From 87b13086c33c7410aed414d8a0923dcdde0c7b9a Mon Sep 17 00:00:00 2001 From: Vaxry Date: Tue, 22 Oct 2024 12:23:08 +0100 Subject: [PATCH] e --- src/core/Hypridle.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/Hypridle.cpp b/src/core/Hypridle.cpp index e06287c..e6c01e0 100644 --- a/src/core/Hypridle.cpp +++ b/src/core/Hypridle.cpp @@ -487,16 +487,19 @@ void CHypridle::setupDBUS() { static auto const IGNORE_DBUS_INHIBIT = **(Hyprlang::INT* const*)g_pConfigManager->getValuePtr("general:ignore_dbus_inhibit"); static auto const IGNORE_SYSTEMD_INHIBIT = **(Hyprlang::INT* const*)g_pConfigManager->getValuePtr("general:ignore_systemd_inhibit"); - auto proxy = sdbus::createProxy(sdbus::ServiceName{"org.freedesktop.login1"}, sdbus::ObjectPath{"/org/freedesktop/login1"}); + auto systemConnection = sdbus::createSystemBusConnection(); + auto proxy = sdbus::createProxy(*systemConnection, sdbus::ServiceName{"org.freedesktop.login1"}, sdbus::ObjectPath{"/org/freedesktop/login1"}); sdbus::ObjectPath path; try { - proxy->callMethod("GetSession").onInterface("org.freedesktop.login1.Manager").storeResultsTo(path); + proxy->callMethod("GetSession").onInterface("org.freedesktop.login1.Manager").withArguments(std::string{"auto"}).storeResultsTo(path); m_sDBUSState.connection->addMatch("type='signal',path='" + path + "',interface='org.freedesktop.login1.Session'", ::handleDbusLogin); m_sDBUSState.connection->addMatch("type='signal',path='/org/freedesktop/login1',interface='org.freedesktop.login1.Manager'", ::handleDbusSleep); } catch (std::exception& e) { Debug::log(WARN, "Couldn't connect to logind service ({})", e.what()); } + systemConnection.reset(); + Debug::log(LOG, "Using dbus path {}", path.c_str()); if (!IGNORE_SYSTEMD_INHIBIT) {