Receive startup notification

I’m creating a program that uses DesktopAppInfo.launch_uris_as_managers() to launch a .desktop file. But I want to receive the startup notification to change the mouse cursor from ‘progress’ to ‘default’. I tried by passing a Gio.AppLaunchContext() and connecting the ‘launched’ and ‘launch-failed’ signals, but it seems to not work always: with Thunderbird and Gimp it seems to work, but not with Gedit… (I don’t receive any of the signals).

I’m on Wayland.

What am I doing wrong?

The latter :slight_smile: AFAIK Wayland currently has no equivalent for the X11 based “startup-notification” protocol (startup-notification).

Gimp works because it’s still using Gtk2 (no Wayland support at all). Thunderbird uses Gtk3, but still restricts the Gdk backend to X11.

1 Like

Oh, that explains it… Thanks!

GTK has its own start up notification mechanism when running under Wayland and GNOME Shell; it’s part of the unstable gtk-shell protocol.

Both the compositor and the toolkit need to implement it.

1 Like

Mmm… But I presume that another Gtk program, let’s call it program A, can’t detect the notification from another program B, even when it was that program A the one that launched program B, isn’t it? Or is it possible?

No, it’s not possible. The desktop startup id comes from the compositor (in the X11 and Wayland cases both) and the application notifies the compositor when it has complete loading the first window. The entire start up notification protocol is meant as a communication channel between an application and the desktop; other applications do not not intervene.

In the X11 case, since any client can poke at the events queue and properties of every other client, you can set up a watcher that gets a notification; on Wayland, only a privileged component can do that—notably, the display server/compositor.

1 Like

What I suspected… Thanks!!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.