LINUX: add system bus support

This commit is contained in:
EinTim23 2024-11-06 19:03:01 +01:00
parent 3d47ab90f1
commit 31afe3372d
1 changed files with 11 additions and 2 deletions

View File

@ -189,9 +189,18 @@ bool backend::init() {
conn = dbus_bus_get(DBUS_BUS_SESSION, &err); conn = dbus_bus_get(DBUS_BUS_SESSION, &err);
if (!conn) { if (!conn) {
if (dbus_error_is_set(&err))
dbus_error_free(&err); dbus_error_free(&err);
//fallback to system bus if user doesn't have a session specific bus
conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
if(!conn) {
if (dbus_error_is_set(&err))
dbus_error_free(&err);
return false; return false;
} }
}
return true; return true;
} }