Subject: Re: [PATCH] Improve client/daemon xdg/systemd experience

From: Carlos Pita <[email-masked]>
Date: Mon, 21 Oct 2019 04:27:17 -0300

I've changed the name of the emacsclient launcher from "Emacs" to
"Emacs (Client)".

Also added the bug number to the commit message.

One last remark: the name emacsclient to run `emacs --daemon` is
admittedly confusing. OTOH, it is natural as the name of the frames
later launched by the daemon (in particular, it's natural as
StartWMClass). If you prefer I can change it, though.
From 2d9e1951b0a30bb7053cd371de37ac22690d7c8c Mon Sep 17 00:00:00 2001
From: memeplex <[email-masked]>
Date: Mon, 21 Oct 2019 03:58:55 -0300
Subject: [PATCH] Improve client/daemon xdg/systemd experience (Bug#37847)

* Makefile.in: Add emacsclient.desktop generation.
* etc/emacsclient.desktop: Add file.
* etc/emacs.service: Run with name emacsclient.
---
 Makefile.in             |  7 +++++++
 etc/emacs.service       |  2 +-
 etc/emacsclient.desktop | 12 ++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 etc/emacsclient.desktop

diff --git a/Makefile.in b/Makefile.in
index aa11e6b0b7..0d50c1636a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -714,6 +714,13 @@ install-etc:
 	  ${srcdir}/etc/emacs.desktop > $${tmp}; \
 	${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/${EMACS_NAME}.desktop"; \
 	rm -f $${tmp}
+	tmp=etc/emacsclient.tmpdesktop; rm -f $${tmp}; \
+	client_name=`echo emacsclient | sed '$(TRANSFORM)'`${EXEEXT}; \
+	sed -e "/^Exec=emacsclient/ s|emacsclient|${bindir}/$${client_name}|" \
+	  -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
+	  ${srcdir}/etc/emacsclient.desktop > $${tmp}; \
+	${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/$${client_name}.desktop"; \
+	rm -f $${tmp}
 	umask 022; ${MKDIR_P} "$(DESTDIR)${appdatadir}"
 	tmp=etc/emacs.tmpappdata; rm -f $${tmp}; \
 	sed -e "s/emacs\.desktop/${EMACS_NAME}.desktop/" \
diff --git a/etc/emacs.service b/etc/emacs.service
index c99c6779f5..8f4a10e076 100644
--- a/etc/emacs.service
+++ b/etc/emacs.service
@@ -8,7 +8,7 @@ Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/
 
 [Service]
 Type=notify
-ExecStart=emacs --fg-daemon
+ExecStart=@emacs emacsclient --fg-daemon
 ExecStop=emacsclient --eval "(kill-emacs)"
 # The location of the SSH auth socket varies by distribution, and some
 # set it from PAM, so don't override by default.
diff --git a/etc/emacsclient.desktop b/etc/emacsclient.desktop
new file mode 100644
index 0000000000..4897267c1f
--- /dev/null
+++ b/etc/emacsclient.desktop
@@ -0,0 +1,12 @@
+[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=emacsclient -c %F
+Icon=emacs
+Type=Application
+Terminal=false
+Categories=Development;TextEditor;
+StartupWMClass=Emacsclient
+Keywords=Text;Editor;
-- 
2.20.1