Skip to content

Add export and unexport commands for desktop and CLI integration #1682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

silverhadch
Copy link

@silverhadch silverhadch commented Jul 12, 2025

This PR introduces two new subcommands: export and unexport.

  • toolbox export allows exporting GUI apps (.desktop files via --app) or CLI binaries (--bin) from a container to the host.
  • toolbox unexport allows removing those exported apps/binaries. It also supports --all to remove all exports for a container.

Also adds an additional runCommand Function that captures stdout of the run Command needed by the export.go.
Additionally some small refactor.

Examples:
toolbox export --app gimp --container Arch
→ Exports gimp to ~/.local/share/applications/gimp-Arch.desktop

toolbox export --bin nvim --container Arch
→ Exports nvim to ~/.local/bin/nvim

toolbox unexport --app gimp --container Arch
→ Removes the exported .desktop file

toolbox unexport --all --container Arch
→ Removes all exported items for container Arch

Fixes #1018

@silverhadch silverhadch force-pushed the kde-kontainer branch 2 times, most recently from 1c0c994 to 4486a70 Compare July 13, 2025 10:19
@silverhadch silverhadch marked this pull request as ready for review July 13, 2025 10:21
@silverhadch silverhadch marked this pull request as draft July 14, 2025 20:29
@silverhadch
Copy link
Author

TODO: Use runCommand rather then calling toolbox binary from toolbox thats ugly.

@silverhadch silverhadch marked this pull request as ready for review July 17, 2025 09:23
@silverhadch
Copy link
Author

@debarshiray
Rebased it and removed Merge Commits. Check this out.

@silverhadch
Copy link
Author

@debarshiray
This too. This feature downstream in KDE Kontainer is 400 lines of Code which can be borthersome now that we want to refactor, polish and rewrite in Kirigami. It would be nice to have our PRs merged soon since its slowing us down.

Copy link
Member

@debarshiray debarshiray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this, @silverhadch !

I have historically avoided adding this feature to Toolbx and stopped at adding the run command because I was apprehensive of muddying our Flatpak story - that Flatpak is for shipping graphical desktop applications, and Toolbx is for software development and troubleshooting the host OS.

A few days ago, I spoke to @alexlarsson about this again, because we had a similar discussion when the run command was added. He gave his blessing, so we are free to go, as far as I am concerned. :)

I am leaving for a two week vacation tomorrow, which meant that I had a ton of miscellaneous things to wrap up before leaving, and kept failing to get to this pull request. My apologies for that.

However, I didn't want to leave you hanging for another two weeks. So, while I didn't get the chance to try out and test your PR, I wanted to say that we will move it forward once I am back, and then into a release.

Copy link

@silverhadch
Copy link
Author

Gofmt is screaming at my Code. But i am also on vacation so screw you!

Copy link

@silverhadch
Copy link
Author

@silverhadch silverhadch marked this pull request as draft August 16, 2025 19:37
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
We forgot to create the .local/bin directory in $HOME when calling exportBinary unlike exportApplication, where we make sure we create .local/share/applications.

Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
Signed-off-by: Hadi Chokr <[email protected]>
… subcommand and use a custom runCommand to supress stdout to the host Console.

Signed-off-by: Hadi Chokr <[email protected]>
Copy link

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.

Automatically add .desktop files in toolbox to the host
2 participants