89luca89 / distrobox

Use any linux distribution inside your terminal. Enable both backward and forward compatibility with software and freedom to use whatever distribution you’re more comfortable with. Mirror available at: https://gitlab.com/89luca89/distrobox
https://distrobox.it/
GNU General Public License v3.0
9.41k stars 384 forks source link

[Suggestion] Automatic profile generation for terminal emulators #1432

Open jahinzee opened 1 month ago

jahinzee commented 1 month ago

Is your feature request related to a problem? Please describe.

Although not related to any specific problem I'm having, I think it would be very convenient for Distrobox to automatically create and manage terminal profiles for each container (e.g. for Konsole, GNOME Terminal, xfce-terminal, etc.), similar to the existing feature with .desktop files.

This feature would allow users to manage sessions inside their terminals more effectively, and would work to integrate better with immutable desktops.

Describe the solution you'd like I propose adding this functionality to the distrobox-generate-entry script, which will create valid profile data for installed compatible terminals, filling out the custom icons and starting commands similarly to .desktop files.

Example behaviour

Say a Distrobox container is created, named ubuntu, using the Ubuntu image. Currently, Distrobox will create a desktop file in ~/.local/share/application/:

[Desktop Entry]
Name=Ubuntu
GenericName=Terminal entering Ubuntu
Comment=Terminal entering Ubuntu
Categories=Distrobox;System;Utility
Exec=/usr/bin/distrobox enter  ubuntu
Icon=/home/jahinzee/.local/share/icons/distrobox/ubuntu.png
Keywords=distrobox;
NoDisplay=false
Terminal=true
TryExec=/usr/bin/distrobox
Type=Application

With this change, if the script detects that, say Konsole is installed on the host, Distrobox would also also create this profile in ~/.local/share/konsole:

[General]
Command=/usr/bin/distrobox enter ubuntu
Icon=/home/jahinzee/.local/share/icons/distrobox/ubuntu.png
Name=ubuntu
Parent=FALLBACK/

Describe alternatives you've considered Instead of adding this behaviour to the existing distrobox-generate-entry script, a separate script that only created terminal profiles could be implemented, but I figured that implementing this behaviour into the existing script would be better (with perhaps options to enable/disable this feature if required), as much of the existing code for desktop files can be reused for profile files.

Additional context I'm more than happy to work on the implementation and submit a PR if this is something that might be worth doing :)

89luca89 commented 2 weeks ago

Hi @jahinzee I have this script to generate it for gnome-terminal: https://gist.github.com/89luca89/0de1c8c70f4370511320a39ca7d2785e

I'm not familiar with other terminals tbh, and I think doing this type of approach risks to become a donkey-carrot problem, always needing to update profile generation :shrug: