I often use Emacs with Linux Manjaro and Gnome. I need straightforward access to Emacs from desktop. Therefore, I have pinned the Emacs icon to dash so I can launch Emacs by clicking the Emacs icon.
However, the Emacs icon does not activate (has no dot below) while an activated Emacsclient icon pops up in the dash.
I don't like this. How to make Emacs run from a single icon just like any desktop application?
Emacs does run:
alba@mac2011-manjaro% ps -u alba|tail -5
19713 ? 00:00:00 python3
19754 ? 00:00:00 obexd
20336 ? 00:00:01 emacs
20377 pts/1 00:00:00 ps
20378 pts/1 00:00:00 tail
Emacsclient does not run:
alba@mac2011-manjaro% ps -u alba|grep client
(empty output)
Files corresponding to the desktop icons:
alba@mac2011-manjaro% cat /usr/share/applications/emacs.desktop
[Desktop Entry]
Name=Emacs
GenericName=Text Editor
Comment=Edit text
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=emacs %F
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupNotify=true
StartupWMClass=Emacs
alba@mac2011-manjaro% cat /usr/share/applications/emacsclient.desktop
[Desktop Entry]
Name=Emacs (Client)
GenericName=Text Editor
Comment=Edit text
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=sh -c "if [ -n \\"\\$*\\" ]; then exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" \\"\\$@\\"; else exec emacsclient --alternate-editor= --create-frame; fi" placeholder %F
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupNotify=true
StartupWMClass=Emacs
Keywords=emacsclient;
Actions=new-window;new-instance;
[Desktop Action new-window]
Name=New Window
Exec=/usr/bin/emacsclient --alternate-editor= --create-frame %F
[Desktop Action new-instance]
Name=New Instance
Exec=emacs %F
emacsclient
, but in some Linux flavors it is possible to create a custom desktop launcher file with either a command line, or a path to a script. For example, in Debian or Ubuntu, the file would be created at/usr/share/applications/my_custom_emacs_launcher.desktop
. If there is a command-line that works for you, then perhaps you could create a custom launcher that does what you want. TheExec
portion of the desktop file is what controls the custom command line or path to a script containing whatever is desired. And, of course, you can set the path to the desired icon. – lawlist Mar 03 '23 at 02:52