1

Running Ubuntu 20.04, I wish to have two clickable launch modes for gnome-terminal in the Favorites bar [i.e. in the "Dock"]. For example, I want both the default launch and a bespoke launch. The default launcher was trivial to add to the Favorites bar, using the well-known mechanisms. For the custom launcher, I created the following .desktop file:

$ cat ~/.local/share/applications/custom-terminal.desktop 
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=CustomTerminal
Comment=Terminal for Specialized Development
Exec=$HOME/.bin/custom-terminal.sh
Icon=/usr/share/icons/gnome/48x48/apps/gnome-terminal.png
Terminal=false

For the bespoke launch, I set an environment variable (FOOBAR) by which my ~/.bashrc file can invoke custom logic:

$ cat $HOME/.bin/custom-terminal.sh
#!/bin/bash
FOOBAR=SomeTriggerValue /usr/bin/gnome-terminal

PROBLEM: I can add the custom launcher to the Favorites bar, but the launched instance is incorrectly associated to the default launcher's icon. i.e. The default launcher's icon [in the Favorites bar] gets the "red dot" for my custom instance of gnome-terminal.

I have tried making copies of the executable [of course, having different paths] to "fool" the desktop into believing that the one app is actually two, but that gimmick failed.

I noticed that if I right-click on the default gnome-terminal icon, then I'm offered a Preferences option. A right-click on the custom gnome-terminal icon does not offer a Preferences option.

QUESTION: How to add 2+ custom launchers for gnome-terminal to the Favorites bar?

1 Answer 1

0

The Ubuntu launcher distinguishes running applications based on the WMClass. You should do two things

  • ensure that the terminal from the custom launcher adopts a different WM_CLASS than the default.
  • declare that custom WM_CLASS in the launcher using a StartupWMClass= directive.

See gnome-terminal --help-gtk for the option on how to set your own WM_CLASS.

3
  • Worked like a charm. Thank you.
    – badfd
    Aug 16, 2021 at 12:25
  • If this answer helped, then please consider "accepting" it, i.e., click the checkmark next to the question. This helps future users.
    – vanadium
    Aug 16, 2021 at 13:28
  • Done. Sorry for the delay. I asked myself, "How to 'accept' this answer?"
    – badfd
    Aug 17, 2021 at 14:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .