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.


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]
GenericName=Text Editor
Comment=Edit text
Exec=emacs %F

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.

  • 1
    Please add the content of your .desktop file to your question.
    – Byte Commander
    Jan 27, 2016 at 17:29
  • My bad. I've put it up now. Jan 27, 2016 at 17:33
  • Aha. I think it's the line StartupWMClass=Emacs. Remove it and try starting Spacemacs again. Maybe you need to log out and back in for the changes to take effect, but usually not. It should not run as Emacs in the launcher then any more, does it?
    – Byte Commander
    Jan 27, 2016 at 17:34
  • Yes, on removing that line, there is no active icon in the launcher. However, using Alt-Tab still shows the Emacs icon as earlier. Jan 27, 2016 at 17:37
  • Can you please open the Spacemacs window, then run xprop WM_CLASS in a terminal and click the Spacemacs window and post the terminal output line?
    – Byte Commander
    Jan 27, 2016 at 17:38

2 Answers 2


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




You can find out by opening a terminal window, type

xprop WM_CLASS

then click on the window of your application

  • That doesn't fix the issue; the behaviour is identical to the earlier one. See the comments on the question. The output is WM_CLASS(STRING) = "emacs", "Emacs24". Jan 27, 2016 at 17:42
  • @varun That is quite impossible, did you edit the line? Jan 27, 2016 at 17:43
  • 2
    When in doubt, log out and back in. Also, where is the desktop file located? /usr/share/applications/ or ~/.local/share/applications/? Is one in both locations maybe?
    – Byte Commander
    Jan 27, 2016 at 17:46
  • 2
    Yes, it is working now after logging out and logging in with Emacs24. Many thanks! Jan 27, 2016 at 17:54
  • 1
    @varun always glad it works. Sometimes the Unity launcher can be a bit stubborn. A log out/in can be refreshing then :) Jan 27, 2016 at 17:55

A note for future googlers: To get this working in Gnome 3 I also had to delete the file /usr/share/applications/Emacs24.desktop which used the same WM_CLASS. If I didn't, the one in /usr/share seemed to take precedence over my new desktop file in ~/.local/share/applications/Spacemacs.desktop.

  • 1
    You can suggest an edit to that post.
    – muru
    Mar 9, 2017 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.