all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Peter Oliver <p.d.oliver@mavit.org.uk>
To: emacs-devel@gnu.org
Subject: Re: GUI X-FreeDesktop integration
Date: Tue, 25 May 2021 22:34:18 +0100 (BST)	[thread overview]
Message-ID: <7f52af92-4fb5-74b4-232a-eabfa315ac0@froglet.home.mavit.org.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

On Sunday 16th May, Robin Tarsiger wrote:

> In fact, the _least_ surprising from
> an XDG/FDO perspective would actually be to _only_ expose
> a "client+autolaunch" desktop entry and just call that the
> point of integration for Emacs.

Agreed.  Attached is a patch which achieves this.

-- 
Peter Oliver

[-- Attachment #2: Type: text/plain, Size: 3708 bytes --]

From 84508dbc948038f9b7c797b3ec012c00379df7ee Mon Sep 17 00:00:00 2001
From: Peter Oliver <git@mavit.org.uk>
Date: Tue, 25 May 2021 22:06:43 +0100
Subject: [PATCH] From a GUI, lauch via emacsclient by default

* etc/emacs-mail.desktop, etc/emacs.desktop: Call emacsclient not
  emacs by default.  Provide plain emacs as an alternative action.
---
 etc/NEWS                |  7 +++++++
 etc/emacs-mail.desktop  | 13 ++++++++++---
 etc/emacs.desktop       | 11 ++++++++++-
 etc/emacsclient.desktop | 12 ------------
 4 files changed, 27 insertions(+), 16 deletions(-)
 delete mode 100644 etc/emacsclient.desktop

diff --git a/etc/NEWS b/etc/NEWS
index 1541b74a3b..0605c8b46c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -108,6 +108,13 @@ avoid security issues when executing untrusted code.  See the manual
 page for 'seccomp' system call, for details about Secure Computing
 filters.
 
+** Launching Emacs from a GUI now defaults to trying emacsclient.
+When launching Emacs via a freedesktop.org-compatible GUI, it is now
+the default to try to use emacsclient to open the file in an existing
+Emacs frame.  Opening a new frame in an existing Emacs or a separate
+instance of Emacs are available as an alternative action (performed,
+for example, by right-clicking on the icon).
+
 \f
 * Changes in Emacs 28.1
 
diff --git a/etc/emacs-mail.desktop b/etc/emacs-mail.desktop
index 0c5fab1dd1..e949b7f1ed 100644
--- a/etc/emacs-mail.desktop
+++ b/etc/emacs-mail.desktop
@@ -1,12 +1,19 @@
 [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")'
+Exec=emacsclient --alternate-editor= --eval '(message-mailto "%u")'
 Icon=emacs
 Name=Emacs (Mail)
 MimeType=x-scheme-handler/mailto;
 NoDisplay=false
 Terminal=false
 Type=Application
+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/emacs.desktop b/etc/emacs.desktop
index 2e6496e58c..d21bba0e10 100644
--- a/etc/emacs.desktop
+++ b/etc/emacs.desktop
@@ -3,10 +3,19 @@ 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
+Exec=emacsclient --alternate-editor= %F
 Icon=emacs
 Type=Application
 Terminal=false
 Categories=Development;TextEditor;
 StartupWMClass=Emacs
 Keywords=Text;Editor;
+Actions=new-window;new-instance;
+
+[Desktop Action new-window]
+Name=New Window
+Exec=emacsclient --alternate-editor= --create-frame %F
+
+[Desktop Action new-instance]
+Name=New Instance
+Exec=emacs %F
diff --git a/etc/emacsclient.desktop b/etc/emacsclient.desktop
deleted file mode 100644
index 3feb83c729..0000000000
--- a/etc/emacsclient.desktop
+++ /dev/null
@@ -1,12 +0,0 @@
-[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=Emacsd
-Keywords=Text;Editor;
-- 
2.31.1


             reply	other threads:[~2021-05-25 21:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25 21:34 Peter Oliver [this message]
2021-05-26  8:49 ` GUI X-FreeDesktop integration Robert Pluim
2021-05-26 12:14 ` Peter Oliver
2021-05-26 12:19 ` Eli Zaretskii
2021-05-28 12:54   ` Peter Oliver
2021-05-28 13:03     ` Eli Zaretskii
2021-05-28 18:49       ` chad
2021-05-28 19:16         ` Eli Zaretskii
2021-05-28 20:05           ` chad
2021-05-29  6:01             ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2021-08-12 12:42 Manuel Uberti
2021-08-12 12:51 ` Eli Zaretskii
2021-08-12 12:58   ` Lars Ingebrigtsen
2021-05-14  3:18 Boruch Baum
2021-05-14  3:46 ` Stefan Monnier
2021-05-16  3:26   ` Boruch Baum
2021-05-14  6:45 ` Eli Zaretskii
2021-05-14  7:20   ` Joost Kremers
2021-05-14  7:41     ` Eli Zaretskii
2021-05-14  7:53       ` Joost Kremers
2021-05-14 11:29         ` Yuri Khan
2021-05-14 13:51         ` Stefan Monnier
2021-05-16  3:33   ` Boruch Baum
2021-05-16  4:25     ` Eli Zaretskii
2021-05-16  4:36       ` Boruch Baum
2021-05-16 10:46         ` Robin Tarsiger
2021-05-16 20:07           ` Matthias Meulien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f52af92-4fb5-74b4-232a-eabfa315ac0@froglet.home.mavit.org.uk \
    --to=p.d.oliver@mavit.org.uk \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.