How to create a desktop shortcut for an application installed inside a Toolbx container
I provide a simple desktop file that creates a shortcut to the app installed in the container.
I have been making use of tools like Toolbx and Distrobox a lot more for creating varying development environments, or just to download and install a package from the internet. The problem occurs when I want to integrate the development tools from the Toolbx into the editor I'm working with.
Both Toolbx and Distrobox are great tools. I've written in the past about how to use Distrobox for different development environments within the same host OS. I've even written about using the integrating the VSCode Flatpak with a Toolbx container. I've been working with Toolbx more these days simply because it comes preinstalled with Fedora and I wanted to leave the base OS unaltered.
Another goal I had with the switch back to Toolbx, is not use VSCode. I wanted to use VSCodium instead. And VSCodium doesn't have access to the same extensions to connect VSCode to the Toolbx container as I mentioned before. So I tried the next best thing, I installed VSCodium directly into the container. This is a great solution for having an well integrated editor. All the linting and code completion features work perfectly. If a tool is required for an extension then it's a simple dnf install
away. For example, a RedHat YAML extension requiring Java to be installed, I simply installed JDK within the Toolbx and the extension simply worked.
The only thing that Toolbx didn't have, that Distrobox did, is a simple command to create an icon on the desktop for any application installed in the container. For now Toolbx doesn't have a simple command like Distrobox to export
apps. But you can do it manually. The following .desktop
file creates a desktop shortcut for VSCodium that runs in the container.
[Desktop Entry]
Name=VSCodium
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=toolbox run codium
Icon=vscodium
Type=Application
StartupWMClass=VSCodium
Categories=Utility;Development;IDE;
MimeType=text/plain;inode/directory;
Keywords=vscode;
After this file is saved in the ~/.local/share/applications
folder, an icon should show up in whatever application menu you have. I use Gnome so the icon shows up in my app drawer. This method should work for any other GUI application that is installed in the container.
Thanks for visiting. Happy hacking :)