unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#48783: Advertise support for Startup Notification when built with GTK
@ 2021-06-01 18:40 Peter Oliver
  2021-06-04 10:05 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Oliver @ 2021-06-01 18:40 UTC (permalink / raw)
  To: 48783

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

The specification for the Startup Notification Protocol (https://specifications.freedesktop.org/startup-notification-spec/startup-notification-latest.txt) says that we should put “StartupNotify=true” in our .desktop files if we support it.  Although we don’t cater for it directly, GTK gives us it for free from version 2.2 onwards (https://developer.gnome.org/platform-overview/stable/dev-launching-startupnotify.html.en).  Hence, we should advertise support provided that this is a GTK build.

I have attached a patch to do this.

The practical effect of this change is that window managers will arrange for a slow to start Emacs to not steal the keyboard focus of a user who is typing into another application when Emacs pops onto the screen.

I have requested copyright assignment paperwork but am currently waiting to hear back.

-- 
Peter Oliver

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

From c42203835c590fc85746f0db16fd63e955fd914b Mon Sep 17 00:00:00 2001
From: Peter Oliver <git@mavit.org.uk>
Date: Tue, 1 Jun 2021 19:31:39 +0100
Subject: [PATCH] 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.
---
 Makefile.in             | 7 +++++++
 configure.ac            | 6 ++++++
 etc/emacs.desktop       | 1 +
 etc/emacsclient.desktop | 1 +
 4 files changed, 15 insertions(+)

diff --git a/Makefile.in b/Makefile.in
index 65eceb2a0c..341892c622 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -100,6 +100,8 @@ FIND_DELETE =
 
 HAVE_NATIVE_COMP = @HAVE_NATIVE_COMP@
 
+USE_STARTUP_NOTIFICATION = @USE_STARTUP_NOTIFICATION@
+
 # ==================== Where To Install Things ====================
 
 # Location to install Emacs.app under GNUstep / macOS.
@@ -706,11 +708,15 @@ install-man:
 ## Note: emacs22 does not have all the resolutions.
 EMACS_ICON=emacs
 
+ifeq (${USE_STARTUP_NOTIFICATION},no)
+USE_STARTUP_NOTIFICATION_SED_CMD=-e "/^StartupNotify=true$$/d"
+endif
 install-etc:
 	umask 022; ${MKDIR_P} "$(DESTDIR)${desktopdir}"
 	tmp=etc/emacs.tmpdesktop; rm -f $${tmp}; \
 	sed -e "/^Exec=emacs/ s/emacs/${EMACS_NAME}/" \
 	  -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
+	  $(USE_STARTUP_NOTIFICATION_SED_CMD) \
 	  ${srcdir}/etc/emacs.desktop > $${tmp}; \
 	${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/${EMACS_NAME}.desktop"; \
 	rm -f $${tmp}
@@ -718,6 +724,7 @@ install-etc:
 	client_name=`echo emacsclient | sed '$(TRANSFORM)'`${EXEEXT}; \
 	sed -e "/^Exec=emacsclient/ s|emacsclient|${bindir}/$${client_name}|" \
 	  -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \
+	  $(USE_STARTUP_NOTIFICATION_SED_CMD) \
 	  ${srcdir}/etc/emacsclient.desktop > $${tmp}; \
 	${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/$${client_name}.desktop"; \
 	rm -f $${tmp}
diff --git a/configure.ac b/configure.ac
index d99e5395d3..a44a4730ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2892,6 +2892,12 @@ AC_DEFUN
 AC_SUBST(SETTINGS_CFLAGS)
 AC_SUBST(SETTINGS_LIBS)
 
+USE_STARTUP_NOTIFICATION=no
+if test "${HAVE_GTK}" = "yes"; then
+    USE_STARTUP_NOTIFICATION=yes
+fi
+AC_SUBST(USE_STARTUP_NOTIFICATION)
+
 
 dnl SELinux is available for GNU/Linux only.
 HAVE_LIBSELINUX=no
diff --git a/etc/emacs.desktop b/etc/emacs.desktop
index 2e6496e58c..81c53c6121 100644
--- a/etc/emacs.desktop
+++ b/etc/emacs.desktop
@@ -8,5 +8,6 @@ Icon=emacs
 Type=Application
 Terminal=false
 Categories=Development;TextEditor;
+StartupNotify=true
 StartupWMClass=Emacs
 Keywords=Text;Editor;
diff --git a/etc/emacsclient.desktop b/etc/emacsclient.desktop
index 3feb83c729..2c1edb4b66 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;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#48783: Advertise support for Startup Notification when built with GTK
  2021-06-01 18:40 bug#48783: Advertise support for Startup Notification when built with GTK Peter Oliver
@ 2021-06-04 10:05 ` Lars Ingebrigtsen
  2021-06-22 10:50   ` Peter Oliver
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-04 10:05 UTC (permalink / raw)
  To: Peter Oliver; +Cc: 48783

Peter Oliver <p.d.oliver@mavit.org.uk> writes:

> I have attached a patch to do this.
>
> The practical effect of this change is that window managers will
> arrange for a slow to start Emacs to not steal the keyboard focus of a
> user who is typing into another application when Emacs pops onto the
> screen.

Sounds like a good idea to me.

> I have requested copyright assignment paperwork but am currently
> waiting to hear back.

Great; we'll be told when the assignment is complete, but in case we
miss it, can you remind us after it's complete so that we can apply this
patch?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#48783: Advertise support for Startup Notification when built with GTK
  2021-06-04 10:05 ` Lars Ingebrigtsen
@ 2021-06-22 10:50   ` Peter Oliver
  2021-06-22 13:17     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Oliver @ 2021-06-22 10:50 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 48783

On Fri, 4 Jun 2021, Lars Ingebrigtsen wrote:

> Peter Oliver <p.d.oliver@mavit.org.uk> writes:
>
>> I have requested copyright assignment paperwork but am currently
>> waiting to hear back.
>
> Great; we'll be told when the assignment is complete, but in case we
> miss it, can you remind us after it's complete so that we can apply this
> patch?

The paperwork is now complete.  Thanks.

-- 
Peter Oliver





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#48783: Advertise support for Startup Notification when built with GTK
  2021-06-22 10:50   ` Peter Oliver
@ 2021-06-22 13:17     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-22 13:17 UTC (permalink / raw)
  To: Peter Oliver; +Cc: 48783

Peter Oliver <p.d.oliver@mavit.org.uk> writes:

> The paperwork is now complete.  Thanks.

Great; I've now pushed your patch to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-22 13:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01 18:40 bug#48783: Advertise support for Startup Notification when built with GTK Peter Oliver
2021-06-04 10:05 ` Lars Ingebrigtsen
2021-06-22 10:50   ` Peter Oliver
2021-06-22 13:17     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).