I’m trying to listen to a signal on the system bus using Gio’s dbus but it seems like I can only add callbacks to session bus signals. Callbacks on system signals are never called.
There’s no error or messages of any kind. It just… doesn’t run.
Am I missing something? Is there any extra requirements to listen to system signals?
system_bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None) system_bus.signal_subscribe('org.freedesktop.login1', 'org.freedesktop.login1.Manager', 'PrepareForSleep', '/org/freedesktop/login1', None, Gio.DBusSignalFlags.NONE, on_prepare_for_sleep, None)
def on_prepare_for_sleep(connection, sender_name, object_path, interface_name, signal_name, parameters, *user_data): """Handle dbus prepare for sleep signal.""" print('Called')