Skip to content

Conversation

@PeterDaveHello
Copy link
Contributor

@PeterDaveHello PeterDaveHello commented Sep 16, 2025

Commit 247f167(PR #202) added browser restoration during edit, but assumed X-WebApp-Browser always exists. Legacy desktop files miss that key, so on_edit_button hits IndexError at line 366, the GTK main loop stalls, and CPU usage spikes.

Match by Exec when the name lookup fails, and fall back if nothing fits. Editing now completes and rewrites the desktop file with fresh metadata.

Fix #345

PR summary from GitHub Copilot:

This pull request introduces improvements to how the application determines and matches the browser executable for a web app, making browser selection more robust and accurate. The main changes include new utility functions for parsing and matching executable commands and updates to the browser selection logic in the UI.

Browser Executable Parsing and Matching

  • Added the _strip_leading_env function to remove leading environment variable assignments and env invocations from command-line tokens, ensuring accurate extraction of the actual executable from complex command lines.
  • Introduced _extract_exec_binary, which parses a desktop Exec line to reliably determine the invoked executable, handling cases with shell wrappers and environment settings.
  • Implemented _exec_matches to compare the extracted executable against known browser paths, supporting both absolute and basename matches for flexibility.

Browser Selection Logic Enhancement

  • Updated the browser selection logic in the on_edit_button method to use the new executable extraction and matching functions, improving the accuracy of browser pre-selection when editing a web app, especially for custom or non-standard browser commands.

Dependency Update

  • Imported shlex to support robust command-line parsing required by the new utility functions.

Commit 247f167 added browser restoration during edit but assumed
X-WebApp-Browser always exists. Legacy desktop files miss that key, so
on_edit_button hits IndexError at line 366, the GTK main loop stalls,
and CPU usage spikes.

Match by Exec when the name lookup fails, and fall back if nothing fits.
Editing now completes and rewrites the desktop file with fresh metadata.

Fix linuxmint#345
@PeterDaveHello PeterDaveHello force-pushed the fix-edit-legacy-indexerror-#345 branch from 44854b3 to 71c76ef Compare September 17, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

IndexError on Trying to Edit Entry

1 participant