From 048f294b2b88c019ac58834d929ba7d9f4804a22 Mon Sep 17 00:00:00 2001 From: Bart De Vries Date: Tue, 15 Jun 2021 11:27:49 +0200 Subject: [PATCH] Fix inhibit suspend on Gnome The inhibit dbus call to gnome sessionmanager expects flags as input. Currently the flags are set to 4, which will "Inhibit the session being marked as idle". This is insufficient to prevent the device from suspending while playing. We should also add 8 = "Inhibit suspending the session or computer". Hence, the updated flags to 12. This change was tested on phosh/phoc and it properly prevents the system from suspending. The flags = 12 settings is also what gnome music players like Lollypop are using (as checked through the gnome sessionmanager dbus interface). --- src/powermanagementinterface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/powermanagementinterface.cpp b/src/powermanagementinterface.cpp index 877b1581..a0305e36 100644 --- a/src/powermanagementinterface.cpp +++ b/src/powermanagementinterface.cpp @@ -208,10 +208,12 @@ void PowerManagementInterface::uninhibitSleepPlasmaWorkspace() void PowerManagementInterface::inhibitSleepGnomeWorkspace() { #if !defined Q_OS_ANDROID && !defined Q_OS_WIN + // flags are: 4 = "Inhibit suspending the session or computer" + // 8 = "Inhibit the session being marked as idle" auto asyncReply = d->mGnomeInterface->Inhibit(QCoreApplication::applicationName(), uint(0), i18nc("Explanation for sleep inhibit during play of music", "Playing Music"), - uint(8)); + uint(12)); auto replyWatcher = new QDBusPendingCallWatcher(asyncReply, this);