Skip to content

Let each box set the menu label its exported apps get - #222

Open
kacperpaczos wants to merge 4 commits into
Dvlv:masterfrom
kacperpaczos:feat/menu-label-alias
Open

Let each box set the menu label its exported apps get#222
kacperpaczos wants to merge 4 commits into
Dvlv:masterfrom
kacperpaczos:feat/menu-label-alias

Conversation

@kacperpaczos

@kacperpaczos kacperpaczos commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

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_box gains an optional --export-label, the alias is persisted in a new a{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 reads Exported 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 (with tag-symbolic and 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).

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.
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