Signal that the session is about to end

Is there any that signal the session is about to end (the user is being logged out? My extension needs to save its state, but unfortunately the disable function isn’t called in this case for some reason.

See The `disable()` function of the extension.

The Shell.Global::shutdown signal might do what you want, although I’ve never used it myself.

Unfortunately, this signal is not available in Shell versions before 12. I’m guessing this could be solved using DBus, but it seems too complicated for such a simple task.

BTW, how to find out which API version (Shell, Clutter) is available on a given system?

I guess you could check which Mutter directory you have, like /usr/lib64/mutter-13/. I don’t think Clutter or Mutter have version constants for runtime use.

GNOME Shell 45 uses the API number 13 for Clutter, Meta, St and Shell. Each release is a major bump, so GNOME Shell 44 used 12 and GNOME Shell 46 will use 14.

IIRC you can actually check the version with things like imports.gi.Meta.__version__ but I don’t know if this is supposed to be a public API. Maybe would be easier just to check for existence of the signal with GObject.signal_lookup.

1 Like

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