From 31afe3372d914c7c56eff6772a55d732f8c1ef17 Mon Sep 17 00:00:00 2001 From: EinTim23 Date: Wed, 6 Nov 2024 19:03:01 +0100 Subject: [PATCH] LINUX: add system bus support --- src/backends/linux.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/backends/linux.cpp b/src/backends/linux.cpp index ae7d369..4737728 100644 --- a/src/backends/linux.cpp +++ b/src/backends/linux.cpp @@ -189,8 +189,17 @@ bool backend::init() { conn = dbus_bus_get(DBUS_BUS_SESSION, &err); if (!conn) { - dbus_error_free(&err); - return false; + if (dbus_error_is_set(&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 true; }