With Ubuntu 16.04, if you create a launcher (desktop file in ~/.local/share/applications
) with a custom icon for a terminal application (so with Terminal=true
) then when you start it, it will spawn a new standard terminal icon, and your custom icon will pulse and disappear within a few seconds.
In 14.04, it just worked as expected. (it would not start a new standard terminal icon).
Any idea what to do to change this behaviour? I have a few terminal apps that I want to launch from unity and the new behaviour is problematic (I lose trace of which is which since they all end up with the standard terminal icon)…
Best Answer
Why it doesn't work like you do
As mentioned in the comment, an application in principle can only be represented by one icon in the launcher at a time. This has always been the case.
What you are referring to is probably that Unity has become "smarter" in determining which of the
.desktop
files is the best representative for the application's window. Therefore, your script, running a terminal window, will be represented by thegnome-terminal
-icon:Therefore, what worked in the past in your setup, simply creating a launcher, starting your script, doesn't fool Unity anymore, and it picks the existing
gnome-terminal
launcher to represent your window.The bad solution
...is to overrule Unity's choice by adding a line to your launcher (for 16.04):
...but then all terminal windows, no matter if they run your script or not, are grouped under this icon.
Furthermore, in general, having multiple
.desktop
files, calling the same application in their main command is bad, unclean practice.EDIT
How to have (a) separate icon(s) for a running script(s)
It takes a bit of trickery and deceit, but it is possible to have a separate icon for multiple scripts, running in different terminal windows.
How it works in practice
somscript.sh
, which you want to run in a terminal window, showing its dedicated icon in the Unity Launcher while it runs.Run the command:
and the script will run inside a newly opened
gnome-terminal
window, showing the icon:someicon.png
An example
I want a script,
/home/jacob/Bureaublad/script.sh
, run, showing in the Unity launcher with icon:/home/jacob/Thema/icon/ubu.png
Running the command:will do that:
Now let's add another one:
The result:
Once the windows are closed, the icon(s) are removed again.
How to setup
The script needs
wmctrl
Create, if it doesn't exist yet, the directory
~/bin
showicon
(no extension) in~/bin
, and make it executableLog out and back in, your setup should work. Test it with the command
to have
script.sh
run in a terminal, showingicon.png
in the Unity launcher.The script
Note
What the icon does:
gnome-terminal
window, running your scriptWhen clicking on it, it raises the window, as usual. The command to do so is automatically added to the temporary launcher:
What it does not:
Explanation
Without going too much into detail:
showicon
, an instance ofshowicon
runs your script in agnome-terminal
window, similar toTerminal=true
.showicon
waits for the newgnome-terminal
window to appear and reads its window id.A temporary launcher is then created, using the window id to create the command to raise the window in its
Exec=
line. The icon you set as argument in the command to runshowicon
is automatically set as icon of this temporary launcher (defined in the lineIcon=
).an example of such an automatically created (temporary) launcher:
Using the very same procedure as in this answer, the temporary launcher is added to the Unity Launcher, in the top position, to represent your running script.
showicon
checks for the window to exist. If not (anymore), the temporary launcher is removed from the Unity launcher and removed from existence at all, and theshowicon
instance is terminated.