From 57ec4aadc65389f6df5a173cfbff0a551b3ee25d Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Tue, 22 Jun 2021 15:17:28 +0200 Subject: Advertise support for Startup Notification when built with GTK * etc/emacsclient.desktop, etc/emacsclient.desktop: Specify StartupNotify=true. * configure.ac (USE_STARTUP_NOTIFICATION): New variable, yes iff HAVE_GTK. * Makefile.in (install-etc): Remove StartupNotify=true from etc/*.desktop unless USE_STARTUP_NOTIFICATION (bug#48783). --- etc/emacsclient.desktop | 1 + 1 file changed, 1 insertion(+) (limited to 'etc/emacsclient.desktop') diff --git a/etc/emacsclient.desktop b/etc/emacsclient.desktop index 3feb83c7290..2c1edb4b66a 100644 --- a/etc/emacsclient.desktop +++ b/etc/emacsclient.desktop @@ -8,5 +8,6 @@ Icon=emacs Type=Application Terminal=false Categories=Development;TextEditor; +StartupNotify=true StartupWMClass=Emacsd Keywords=Text;Editor; -- cgit v1.2.3 From f355f32e69b1389f7d51b8a50c0a9c064dc2cb32 Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Wed, 30 Jun 2021 15:01:46 +0200 Subject: Revert more of a partially reverted emacsclient.desktop patch * etc/emacsclient.desktop: Undo setting of StartupWMClass=Emacsd, since this relies on a change to etc/emacs.service which was also undone. See bug#37847 for more explanation (bug#49259). --- etc/emacsclient.desktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'etc/emacsclient.desktop') diff --git a/etc/emacsclient.desktop b/etc/emacsclient.desktop index 2c1edb4b66a..f76fb2f5d93 100644 --- a/etc/emacsclient.desktop +++ b/etc/emacsclient.desktop @@ -9,5 +9,5 @@ Type=Application Terminal=false Categories=Development;TextEditor; StartupNotify=true -StartupWMClass=Emacsd +StartupWMClass=Emacs Keywords=Text;Editor; -- cgit v1.2.3 From cbf220bc31c0a00c45b22c140eda7854d81d991b Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Wed, 30 Jun 2021 15:11:21 +0200 Subject: From .desktop files, reuse a frame or start a new Emacs as required * doc/emacs/misc.texi: (Using Emacs as a Server) Explain emacsclient.desktop. * etc/NEWS: (Emacs Server): Explain emacsclient.desktop. * emacs-mail.desktop, etc/emacsclient.desktop: Automatically try to reuse an existing frame, open a new frame, or start a new Emacs daemon. Add actions for specific behaviours (bug#49195). --- doc/emacs/misc.texi | 7 +++++++ etc/NEWS | 8 ++++++++ etc/emacs-mail.desktop | 16 +++++++++++++--- etc/emacsclient.desktop | 11 ++++++++++- 4 files changed, 38 insertions(+), 4 deletions(-) (limited to 'etc/emacsclient.desktop') diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 027133cc3a3..3c11a39de99 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1757,6 +1757,13 @@ expression @code{(+ 1 2)} on the @samp{foo} server, and returns @code{3}. (If there is no server with that name, an error is signaled.) Currently, this feature is mainly useful for developers. + If your operating system’s desktop environment is +@url{https://www.freedesktop.org/wiki/Specifications/,,freedesktop.org-compatible} +(which is true of most GNU/Linux and other recent Unix-like GUIs), you +may use the @samp{Emacs (Client)} menu entry to connect to an Emacs +server with @command{emacsclient}. The daemon starts if not +already running. + @menu * TCP Emacs server:: Listening to a TCP socket. * Invoking emacsclient:: Connecting to the Emacs server. diff --git a/etc/NEWS b/etc/NEWS index 6345992dfe1..701b9a73a8f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -537,6 +537,14 @@ an edit instead of marking it as "Done" (which the 'C-x #' command does). The 'emacsclient' program exits with an abnormal status as result of this command. ++++ +*** New desktop integration for connecting to the server. +If your operating system’s desktop environment is +freedesktop.org-compatible (which is true of most GNU/Linux and other +recent Unix-like GUIs), you may use the new "Emacs (Client)" desktop +menu entry to open files in an existing Emacs instance rather than +starting a new one. The daemon starts if not already running. + ** Perl mode --- diff --git a/etc/emacs-mail.desktop b/etc/emacs-mail.desktop index 0c5fab1dd12..251afa100cd 100644 --- a/etc/emacs-mail.desktop +++ b/etc/emacs-mail.desktop @@ -1,12 +1,22 @@ [Desktop Entry] Categories=Network;Email; Comment=GNU Emacs is an extensible, customizable text editor - and more -Exec=emacs -f message-mailto %u -# If you prefer to use emacsclient, use this instead -#Exec=emacsclient -e '(message-mailto "%u")' Icon=emacs Name=Emacs (Mail) MimeType=x-scheme-handler/mailto; NoDisplay=false Terminal=false Type=Application + +Exec=emacs -f message-mailto %u +# # If you prefer to use emacsclient, use this instead: +# Exec=sh -c 'emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"%u\")"' +# Actions=new-window;new-instance; + +# [Desktop Action new-window] +# Name=New Window +# Exec=emacsclient --alternate-editor= --create-frame --eval '(message-mailto "%u")' + +# [Desktop Action new-instance] +# Name=New Instance +# Exec=emacs -f message-mailto %u diff --git a/etc/emacsclient.desktop b/etc/emacsclient.desktop index f76fb2f5d93..361051e6119 100644 --- a/etc/emacsclient.desktop +++ b/etc/emacsclient.desktop @@ -3,7 +3,7 @@ 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 +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 @@ -11,3 +11,12 @@ Categories=Development;TextEditor; StartupNotify=true StartupWMClass=Emacs Keywords=Text;Editor; +Actions=new-window;new-instance; + +[Desktop Action new-instance] +Name=New Window +Exec=emacsclient --alternate-editor= --create-frame %F + +[Desktop Action new-instance] +Name=New Instance +Exec=emacs %F -- cgit v1.2.3 From 1a7c8f846eb8cccf1d2439f8b03a171b1b6bd104 Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Thu, 1 Jul 2021 12:46:10 +0200 Subject: Fix copy/paste error in emacsclient.desktop * etc/emacsclient.desktop: new-instance should read new-window. --- etc/emacsclient.desktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'etc/emacsclient.desktop') diff --git a/etc/emacsclient.desktop b/etc/emacsclient.desktop index 361051e6119..cd45463093b 100644 --- a/etc/emacsclient.desktop +++ b/etc/emacsclient.desktop @@ -13,7 +13,7 @@ StartupWMClass=Emacs Keywords=Text;Editor; Actions=new-window;new-instance; -[Desktop Action new-instance] +[Desktop Action new-window] Name=New Window Exec=emacsclient --alternate-editor= --create-frame %F -- cgit v1.2.3 From 0a4b66f82752adeb808851a36eabd0554779b33c Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Wed, 7 Jul 2021 22:04:01 +0100 Subject: Valid quoting in .desktop files * etc/emacsclient.desktop, emacsclient-mail.desktop (Exec): Quote according to the rules in the Freedesktop.org Desktop Entry Specification. --- etc/emacsclient-mail.desktop | 4 ++-- etc/emacsclient.desktop | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'etc/emacsclient.desktop') diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop index 8d51dcdd2fc..f96e8a3c97f 100644 --- a/etc/emacsclient-mail.desktop +++ b/etc/emacsclient-mail.desktop @@ -1,7 +1,7 @@ [Desktop Entry] Categories=Network;Email; Comment=GNU Emacs is an extensible, customizable text editor - and more -Exec=sh -c 'exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"%u\")"' +Exec=sh -c "exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\\\(message-mailto\\\\ \\\\\\"%u\\\\\\"\\\\)" Icon=emacs Name=Emacs (Mail, Client) MimeType=x-scheme-handler/mailto; @@ -12,7 +12,7 @@ Actions=new-window;new-instance; [Desktop Action new-window] Name=New Window -Exec=emacsclient --alternate-editor= --create-frame --eval '(message-mailto "%u")' +Exec=emacsclient --alternate-editor= --create-frame --eval "(message-mailto \\"%u\\")" [Desktop Action new-instance] Name=New Instance diff --git a/etc/emacsclient.desktop b/etc/emacsclient.desktop index cd45463093b..0feec67da50 100644 --- a/etc/emacsclient.desktop +++ b/etc/emacsclient.desktop @@ -3,7 +3,7 @@ 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 +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 -- cgit v1.2.3 From aea7823a7e4a2cd3a1904b3bc2ed4f5fc5c26a69 Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Sat, 10 Jul 2021 12:01:09 +0100 Subject: Hint that emacsclient.desktop should match a search for “emacsclient” MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is necessary to get the Gnome desktop to show “Emacs (Client)” when the user searches for “emacsclient”. * etc/emacsclient.desktop, emacsclient-mail.desktop (Keywords): Add “emacsclient”. --- etc/emacsclient-mail.desktop | 1 + etc/emacsclient.desktop | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'etc/emacsclient.desktop') diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop index f96e8a3c97f..b575a41758a 100644 --- a/etc/emacsclient-mail.desktop +++ b/etc/emacsclient-mail.desktop @@ -8,6 +8,7 @@ MimeType=x-scheme-handler/mailto; NoDisplay=true Terminal=false Type=Application +Keywords=emacsclient; Actions=new-window;new-instance; [Desktop Action new-window] diff --git a/etc/emacsclient.desktop b/etc/emacsclient.desktop index 0feec67da50..4e4870730ec 100644 --- a/etc/emacsclient.desktop +++ b/etc/emacsclient.desktop @@ -10,7 +10,7 @@ Terminal=false Categories=Development;TextEditor; StartupNotify=true StartupWMClass=Emacs -Keywords=Text;Editor; +Keywords=Text;Editor;emacsclient; Actions=new-window;new-instance; [Desktop Action new-window] -- cgit v1.2.3 From 024e6d213cfd6a0f273d485003e1c37e061ef227 Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Sat, 10 Jul 2021 12:01:57 +0100 Subject: Drop redundant keywords in .desktop files. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Freedesktop.org Desktop Entry spec says, “The values [of Keywords]… should not be redundant with the values of Name or GenericName”. * etc/emacs.desktop, etc/emacsclient.desktop (Keywords): Remove keywords that are duplicated from the GenericName field. --- etc/emacs.desktop | 1 - etc/emacsclient.desktop | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'etc/emacsclient.desktop') diff --git a/etc/emacs.desktop b/etc/emacs.desktop index 81c53c6121d..0d7cac14da5 100644 --- a/etc/emacs.desktop +++ b/etc/emacs.desktop @@ -10,4 +10,3 @@ Terminal=false Categories=Development;TextEditor; StartupNotify=true StartupWMClass=Emacs -Keywords=Text;Editor; diff --git a/etc/emacsclient.desktop b/etc/emacsclient.desktop index 4e4870730ec..1ecdecffafd 100644 --- a/etc/emacsclient.desktop +++ b/etc/emacsclient.desktop @@ -10,7 +10,7 @@ Terminal=false Categories=Development;TextEditor; StartupNotify=true StartupWMClass=Emacs -Keywords=Text;Editor;emacsclient; +Keywords=emacsclient; Actions=new-window;new-instance; [Desktop Action new-window] -- cgit v1.2.3