From eaa40929bdd5c2a63caf06981a88a24de8c43487 Mon Sep 17 00:00:00 2001 From: ubuntu1804 Date: Mon, 10 Nov 2025 11:09:07 +0800 Subject: [PATCH] Use session D-Bus for ukui ScreenSaver connections Replace QDBusConnection::systemBus() with QDBusConnection::sessionBus() when creating the org.ukui.ScreenSaver interface and connecting Lock/Unlock signals so notifications are tied to the user session --- src/screenlockdetector.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/screenlockdetector.cpp b/src/screenlockdetector.cpp index 35cc66b..7fc4473 100644 --- a/src/screenlockdetector.cpp +++ b/src/screenlockdetector.cpp @@ -204,7 +204,7 @@ bool ScreenLockDetector::connectToUkuiManager() "org.ukui.ScreenSaver", sessionPath, "org.ukui.ScreenSaver", - QDBusConnection::systemBus(), + QDBusConnection::sessionBus(), this ); @@ -212,7 +212,7 @@ bool ScreenLockDetector::connectToUkuiManager() qDebug() << "ukui ScreenSaver interface is valid for session:" << sessionPath; // 连接Lock和Unlock信号到特定会话 - bool lockConnected = QDBusConnection::systemBus().connect( + bool lockConnected = QDBusConnection::sessionBus().connect( "org.ukui.ScreenSaver", sessionPath, "org.ukui.ScreenSaver", @@ -221,7 +221,7 @@ bool ScreenLockDetector::connectToUkuiManager() SLOT(onSessionLocked()) ); - bool unlockConnected = QDBusConnection::systemBus().connect( + bool unlockConnected = QDBusConnection::sessionBus().connect( "org.ukui.ScreenSaver", sessionPath, "org.ukui.ScreenSaver", @@ -469,4 +469,4 @@ void ScreenLockDetector::onSessionUnlocked() setLockState(false); } -#endif // Q_OS_LINUX \ No newline at end of file +#endif // Q_OS_LINUX