Inhibit suspend from GtkApplication
In a radio player application, I want to prevent the system from suspending while a radio is playing.
For that I use gtk_application_inhibit. It works well on GNOME, but on XFCE I get this GTK warning:
(goodvibes:12772): Gtk-WARNING **: 10:23:57.000: Calling org.xfce.Session.Manager.Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such method “Inhibit”
Interestingly, there was an issue opened in GTK in order to support the XFCE session manager, a long time ago, and support was merged back in June 2016:
- https://bugzilla.gnome.org/show_bug.cgi?id=693203
- https://gitlab.gnome.org/GNOME/gtk/-/commit/3c7cd7ac23408195dc99642f4c0ef41f466541f9
After this commit, gtk_application_inhibit ()
attempts to call the D-Bus method org.xfce.SessionManager /org/xfce/SessionManager org.xfce.Session.Manager.Inhibit()
. However this method does not exist!
So I was wondering if it's a known issue, or am I missing something?
If there's no method org.xfce.Session.Manager.Inhibit
, then what is the right way for an application to inhibit suspend on XFCE?
Is it through the D-Bus service org.freedesktop.PowerManagement /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.Inhibit()
? Or org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Inhibit()
on the system bus? Or something else?
Thanks!