Here's what I did. I have Ubuntu, but I'm pretty sure that
Gnome also uses
/usr/share/applications/
.
Here's my /usr/local/share/applications/emacsclient.desktop
:
[Desktop Entry]
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=/usr/local/bin/emacsclient %F
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupWMClass=Emacs
Here's my /usr/local/share/applications/emacs.desktop
(just for completeness):
[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;
StartupWMClass=Emacs
The command to update these shortcuts without rebooting is:
sudo update-desktop-database
Now you should have an Emacsclient
entry in your file managers "open with" dialog.
Make the associations and the files will open in emacs with a click of a mouse.
Just make sure to have in your ~/.emacs
:
(require 'server)
(or (server-running-p) (server-start))