Ubuntu – Use desktop icon for running application

iconslauncherunity

I have used the answers given here How to create a desktop shortcut in Unity? to set a custom application shortcut for spacemacs. While the shortcut works for launching the application, on running, the Emacs icon pops up and is used for selecting the program etc. This is unlike ordinary applications such as Evince where the running icon and launch icon are the same.

Example_image

Is it possible to get the custom icon to behave in an identical manner as Evince and other ordinary program icons? I am using Ubuntu 15.10.

Contents of spacemacs.desktop file:

[Desktop Entry]
Name=Spacemacs
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/xc++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascaltext/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=emacs %F
Icon=/home/varunubuntu/.emacs.d/core/banners/img/spacemacs.png
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupWMClass=Emacs

EDIT: For clarifying after a few comments: the ideal behaviour for me would be that the Emacs icon should not pop up and the Spacemacs icon (put in by hand) should behave identically as the Evince icon.

Best Answer

The line StartupWMClass=Emacs is incorrect. It should be:

StartupWMClass=emacs24

or

StartupWMClass=Emacs24

You can find out by opening a terminal window, type

xprop WM_CLASS

then click on the window of your application

Related Question