StartupNotify for domUs

I would like to listen/capture/use the StartupNotify to know when an application is opened and ready to use.

The StartupNotfiy is a Desktop Entry key and more information about it can be found under Desktop Entry Specs.

StartupNotify works fine on dom0 the below code is an example:

GTK APP

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

window = Gtk.Window()

from time import sleep
sleep(20)

window.show_all()

Gtk.main()

The Gtk App Desktop Entry
Move the desktop entry to /usr/share/applications

[Desktop Entry]
Type=Application
Exec=python3 /path/to/the/previous/python/code
Terminal=false
Name=Test-StartupNotify
StartupNotify=true

Now, add an application launcher to your xfce4-panel or to your desktop and select Test-StartupNotify application. If the application is started using the launcher it will show a spinning cursor until the application is started after 20 seconds. Is there a way to do the same thing with applications starting from different VMs/domUs???

The desktop files for domUs are here, in dom0:

$HOME/.local/share/applications/

I don’t think it matters where to store the desktop application file.

What I am trying to do is to know when the application is started and ready to use. I am trying to use the StartupNotify to indicate the application startup. However, in QubesOS this is not the case and it is not straight forward.

It does matter if you are looking for them, and you are.

You can do that, by adding the StartupNotify=true to the corresponding desktop file.
For domUs apps, these files are located at $HOME/.local/share/applications/.

And in those files, you got example to do what you want. (launch an app from domUs).

If you want to know when an app is started, in a script.
From the link you posted (section: Recognized desktop entry keys - Table 2. Standard Keys)

StartupNotify If true, it is KNOWN that the application will send a “remove” message when started with the DESKTOP_STARTUP_ID environment variable set.

Not sure if that’s the better way for a script.

I tried using both paths

  1. /usr/share/applications
  2. ~/.local/share/application

The StartupNotify worked as expected when I click on application from another vm. However, the spinning cursor keeps spinning after the application is started and ready to use. I timed the duration and it appeared to be fixed value around 20 sec after the application is ready and running.

So, it seems to me that the StartupNotify works on click but doesn’t know when to stop.