1

I'm trying to set up a custom "Open in Emacs" .desktop file that uses the emacsclient utility to open a new buffer in an existing Emacs instance, if available, or start a new instance otherwise. In either case, I would like the icon in the dash to be the one for the standard "Emacs (GUI)" desktop launcher. And I would like to keep this launcher pinned in the dash so that I can click it to launch Emacs in the conventional fashion.

I've tried implementing this solution. My current emacsclient.desktop file looks like this:

[Desktop Entry]
Version=1.0
Name=Emacsclient
GenericName=Text Editor
Comment=View and edit files
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=emacsclient --no-wait --alternate-editor "emacs" %F
Icon=emacs
Type=Application
Terminal=false
Categories=Utility;Development;TextEditor;
StartupWMClass=Emacs

It works well for opening things in an existing Emacs instance. However, whenever I launch Emacs, either through the regular app launcher or by calling my custom launcher on a file, GNOME shows the app as being "Emacsclient" rather than Emacs. If I pin the regular Emacs launcher to the app, this results in two separate Emacs icons in the dock, with the Emacsclient one the only one that can be active. I can't even just accept the app being called "Emacsclient" in the dock, because if I try to pin my Emacsclient launcher, clicking it doesn't launch Emacs.

How can I get the Emacsclient functionality without getting duplicate icons in the dock and with the ability to pin Emacs in a sensible fashion?

Your Answer

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

Browse other questions tagged or ask your own question.