Skip to content

Export apps to the menu by desktop-file id, not display name - #220

Open
kacperpaczos wants to merge 1 commit into
Dvlv:masterfrom
kacperpaczos:feat/export-apps-by-id
Open

Export apps to the menu by desktop-file id, not display name#220
kacperpaczos wants to merge 1 commit into
Dvlv:masterfrom
kacperpaczos:feat/export-apps-by-id

Conversation

@kacperpaczos

Copy link
Copy Markdown
Contributor

Add To Menu handed the application's display name to distrobox-export --app. But --app matches against the desktop file, and a display name can be blank, shared between apps, or match several files — so one click could export the wrong app, or more than one. Meanwhile the host copy is detected and removed by desktop-file id ({box}-{id}.desktop), so export was keyed on something different from detection and removal.

This identifies the app by its desktop-file id in all three places: it builds the exact in-box path (/usr/share/applications/{id}.desktop) and passes that to --app for both export and --delete. So a single click exports exactly one app, and export, the "already on the menu" detection, and Remove From Menu all agree on which app they mean.

The path builder is a small pure function with a unit test.


Note for the maintainer: this is the reliable-add/remove half of a larger request I had (also wanting a custom, per-app menu label like App:box, and having that follow a box rename). I left those out on purpose — distrobox-export --export-label already tags exports with (on <box>), and distrobox has no in-place container rename to hang label-propagation off, so those parts want a design conversation first rather than shipping half-formed.

Add To Menu passed the application's display name to distrobox-export --app.
--app matches against the desktop file, so a display name that is blank,
shared between apps, or matches several files could export the wrong app or
more than one. The host side is detected and removed by desktop-file id
({box}-{id}.desktop), so export was keyed on something else entirely.

Identify the app by its desktop-file id everywhere: build the exact in-box
path (/usr/share/applications/{id}.desktop) and hand that to --app for both
export and delete, so one click exports exactly one app and it lines up with
detection and removal. The path builder is a small pure function with a test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant