I want to use emacsclient to open files from Thunar in Linux Mint 17 xfce. I have tried right-click+"open with other application"+"emacsclient -c", but this does nothing.

I have also tried writing a custom emacsclient.desktop launcher. Emacs daemon is running and works when emacsclient is invoked from the terminal. Also, using just "emacs" as the preferred program works. Can this be done in Thunar?

1 Answer 1


Thunar implements Freedesktop's desktop entry specification, so a .desktop entry is the answer you are looking for. Try saving this to $XDG_DATA_HOME/applications/emacs.desktop or $HOME/.local/share/applications/emacs.desktop if you don't have that set.

[Desktop Entry]
GenericName=Text Editor
Comment=Edit text
Exec=emacsclient -c -a "" %F

This will take precedence over any emacs.desktop in /usr/share/applications. You may need to logout and and login again before it works, but now when you select Emacs from "open with" it will either attach to the running daemon, or start one and attach if it was not already running.

  • If this works, fine, but I don't see why this would work and not what the OP tried first. Commented Dec 28, 2015 at 19:30
  • 1
    Thanks for the answer, I use it like Exec=emacsclient -c -a 'emacs -Q' %F. It launches Emacs, not as a server, in case it's not already running. It's very fast due to -Q. I don't prefer the silent server start (-a ""), since I have (unless (server-running-p) (server-start)) in my .emacs.
    – legends2k
    Commented Nov 12, 2019 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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