Emacsclient as desktop application

Dear All,

I am trying using emacs as a daemon by enabling and starting the systemd service emacs.service. Thus launching the emacsclient via XDG desktop application using the following code:

#!/usr/bin/env xdg-open

[Desktop Entry]
Name=Emacs (Client)
GenericName=Text Editor
Comment=Edit text
Exec=/usr/bin/emacsclient -с -a "" %F

However, when I click on the icon "Emacs (Client)" nothing happens. I can start emacsclient from the terminal running 'emacsclient -c -a ""' and it works without issues. I have tried both with and without the xdg-open shebang. Nothing change.

Can you please help me?

Thanks in advance for your time!

I think that is not correct (emacsclient: unrecognized option '-с', EDIT: it is actually an Es (Cyrillic) :rofl:), should be a lower case c. Also, I am not sure the %F argument helps. I have two related desktop files that works (you might not want the -n flag):

  • With new frame: Exec=emacsclient -cna "".
  • Without new frame: Exec=emacsclient -na "".

Check if that works, they should even if the daemon has not started, since they will do that then. Also try the exact command from CLI.

I have tried starting emacs daemon as emacs -Q and the emacsclient desktop works like a charm... So it's a configuration issue. I will try debugging that (although emacs --debug-init didn't give any type of error O.o)

Thank for your help!! :slight_smile:

Are you running that as root or as your user?

If as root, try running as a user service:

sudo systemctl disable --now emacs
systemctl --user enable --now emacs
1 Like

Forum kindly sponsored by