Let each box set the menu label its exported apps get - #222
Open
kacperpaczos wants to merge 4 commits into
Open
Conversation
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.
distrobox tags exported apps with "(on <box>)" and has no way to rename a
container in place, so this adds a per-box label the user controls instead.
A new "Menu Label" row shows the current label and opens a dialog to change it;
applying stores the alias in GSettings and re-exports the apps already on the
menu so they pick up the new label too. Empty falls back to distrobox's default,
so a box nobody touched behaves exactly as before.
export_app_from_box gains an optional --export-label, the alias is persisted in
a new a{ss} GSettings key, and the (on …) wrapping is a small tested function.
The "(on …)" wrapping lived in its own function with a test, and the row subtitle spelled the shape out a third time by hand; one helper now formats it for export and display alike. Applying the dialog goes back to the box's own tab instead of the first one, Enter in the entry triggers Apply, and the redundant transient/close calls are gone.
The row edits a label, so document-edit-symbolic fits better than the info icon - and Breeze has no dialog-information-symbolic, which made the row fall back to a full-colour icon in an otherwise monochrome list. document-edit-symbolic exists in both Adwaita and Breeze.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
distrobox tags exported apps with
(on <box>)and has no way to rename a container in place, so this adds a per-box label the user controls instead.A new Menu Label row shows the current label and opens a dialog to change it (Enter applies). Applying stores the alias in GSettings, re-exports the apps already on the menu so they pick up the new label too, and refreshes the box's own tab. Leaving it empty falls back to distrobox's own default, so a box nobody touched behaves exactly as before.
export_app_from_boxgains an optional--export-label, the alias is persisted in a newa{ss}GSettings key, and one small helper formats the(on …)label for both the export call and the row subtitle.Verified on a virtual display: setting "Work VM" on a box stores
{'<box>': 'Work VM'}in the key, the row readsExported apps show "(on Work VM)", and the view stays on that box.Note: builds on #220 (export by desktop-file id), which the export path here relies on — merge that first.
Update: the row now uses
document-edit-symbolic(withtag-symbolicand the info icons as fallbacks) instead of the info icon — it edits a label, so an edit glyph fits better, and on Breeze the info name only exists in full colour, which made the row stand out from the monochrome list (same mechanism as #230).