Skip to content

No way to add a command from a box to the host terminal, and no way to keep both #235

Description

@kacperpaczos

BoxBuddy can put an application from a box into the host menu ("Add To Menu"), and it lists commands that were exported with distrobox-export --bin, but there is no way to add a command to the host terminal from the GUI - the Exported Binaries section is read-only apart from Remove.

The interesting case is a name that exists in both places. I have claude installed on the host and claude inside a box; whichever way the export goes, one shadows the other, and ~/.local/bin comes first on PATH, so exporting from the box silently takes over the host command. There is no way to say "ask me which one".

What I would like: an Add Command… button in Exported Binaries. If nothing on the host answers to that name, it should just be a plain distrobox-export --bin, unchanged behaviour. If something does, the dialog should offer to replace it with a small chooser that asks at invocation time which one to run - host, or one of the boxes that have it.

Two details that I think matter for it to be usable rather than annoying:

  • The prompt must go to stderr and read from /dev/tty, so it does not eat the program's own stdin.
  • With no terminal at all (a pipe, a script, a .desktop launcher) it must not prompt - it should just run the first target. Otherwise every script calling that command hangs.

There is also a bookkeeping trap worth knowing about, which I only found by reading distrobox-export: distrobox keeps no registry of exports. The state is two comment lines in the generated file - # distrobox_binary and # name: <container>. --list-binaries greps for the first and filters on the second; --delete refuses with "is not exported" when the first is missing. So anything that overwrites an exported wrapper makes distrobox lose sight of the command entirely - no warning, it simply stops being listed.

I have this working and will open a PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions