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
This commit is contained in:
ubuntu1804 2025-11-10 11:09:07 +08:00
parent ac16f7d054
commit eaa40929bd
1 changed files with 4 additions and 4 deletions

View File

@ -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",