From d7c1181a5736bc5c6b2585fb0df9065510efcd7c Mon Sep 17 00:00:00 2001 From: Yaroslav Sidlovsky Date: Wed, 5 May 2021 14:32:32 +0300 Subject: [PATCH] GetSessionByPID DBUS call always fails on newer systemd versions GetSessionByPID returns this error: ``` Error org.freedesktop.login1.NoSessionForPID: PID 2469 does not belong to any known session ``` So instead we will get session by calling GetSession("auto"). Tested on Fedora, should also work on openSUSE & KDE Neon. BUG: 433408 --- daemon/powerdevilpolicyagent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/powerdevilpolicyagent.cpp b/daemon/powerdevilpolicyagent.cpp index 653d1eef..d3993d78 100644 --- a/daemon/powerdevilpolicyagent.cpp +++ b/daemon/powerdevilpolicyagent.cpp @@ -236,7 +236,7 @@ void PolicyAgent::onSessionHandlerRegistered(const QString & serviceName) return; } - QDBusPendingReply session = m_managerIface.data()->asyncCall(QLatin1String("GetSessionByPID"), (quint32) QCoreApplication::applicationPid()); + QDBusPendingReply session = m_managerIface.data()->asyncCall(QLatin1String("GetSession"), QLatin1String("auto")); session.waitForFinished(); if (!session.isValid()) { -- GitLab