Bug 433675 - Power management remains inhibited after checking and then unchecking its checkbox
Summary: Power management remains inhibited after checking and then unchecking its che...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Battery Monitor (show other bugs)
Version: 5.21.2
Platform: Arch Linux Linux
: VHI normal
Target Milestone: 1.0
Assignee: Kai Uwe Broulik
URL:
Keywords: regression
: 435895 436068 439315 439451 442064 442243 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-02-26 19:00 UTC by Dashon
Modified: 2021-09-24 18:46 UTC (History)
13 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.23
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dashon 2021-02-26 19:00:37 UTC
SUMMARY
After a while of desktop use, I usually end up checking and unchecking the allow automatic sleep and screen locking check box in the battery applet for various reasons. Upon doing this a few times say (3 - 4) cycles of turning it on and off. I then get a message saying an application is preventing sleep and screenlocking: the battery applet has enabled system-wide inhibition. At this point my laptop won't sleep regardless as to whether or not the checkbox is checked or not. This is with the default plasma battery applet and not some third party one. I decided to also try putting a secondary battery applet on the desktop itself and attempting to recreate the issue, and then again with a plasma panel. However when the applet is on the plasma desktop or a plasma panel. I can toggle this checkbox as many times as I like without it getting stuck and inhibiting sleep.

STEPS TO REPRODUCE
1. Add battery applet or system tray to a latte panel
2. click on battery applet
3. Toggle on and off the automatic sleep and screenlocking by checking and unchecking the checkbox. 
4. Do this at least 4 times.

OBSERVED RESULT
Automatic sleep and screenlocking is permanently inhibited by the battery applet itself inside of lattedock until I restart lattedock.

EXPECTED RESULT
The battery applet should not be able to inhibit the screen on its own unless unchecked. Otherwise there is no way for the system to automatically sleep.

SOFTWARE/OS VERSIONS
Operating System: EndeavourOS
KDE Plasma Version: 5.21.1
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2
Kernel Version: 5.11.1-arch1-1
OS Type: 64-bit
Graphics Platform: X11
Processors: 4 × Intel® Core™ i7-7500U CPU @ 2.70GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 620
Comment 1 Dashon 2021-02-26 19:11:10 UTC
Sometimes I have to toggle it as many as 8 times it would seem.
Comment 2 Dashon 2021-03-07 22:51:57 UTC
After a bit of testing. I don't think this problem is in latte-dock, but in the battery-applet itself. It does inhibit the screen on a normal plasma panel, but the difference is unlike latte. Plasmashell does not report the battery applet as blocking while latte does report that the battery applet is blocking.
Comment 3 Dashon 2021-03-10 01:31:36 UTC
Moved this to the battery monitor widget since the issue is actually present on the default panel as well. The difference is that latte dock reports the issue while the plasma panel does not.
Comment 4 Kishore 2021-07-26 10:38:20 UTC
Also present in the latest neon user. Checking the option inhibits sleep, however, unchecking it does not restore state.
Comment 5 Dashon 2021-07-26 10:49:08 UTC
Just wanted to add that toggling it once is enough now. Checking the box will inhibit screen sleep and like @Kishore mentioned unchecking the box does not allow the screen to sleep again.
Comment 6 Nate Graham 2021-07-30 15:50:32 UTC
*** Bug 439451 has been marked as a duplicate of this bug. ***
Comment 7 Nate Graham 2021-07-30 15:52:28 UTC
Can confirm.
Comment 8 Nate Graham 2021-07-30 16:44:04 UTC
*** Bug 439315 has been marked as a duplicate of this bug. ***
Comment 9 witchhunter 2021-08-21 12:44:15 UTC
FWIW, while watching

dbus-monitor "sender=org.kde.Solid.PowerManagement.PolicyAgent"

and unchecking the option, it registers inhibit signal after some delay, but checking it afterwards will produce an immediate error: 

error time=1629547820.839541 sender=:1.22 -> destination=:1.28 error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=29403
   string "No such method 'UnInhibit' in interface 'org.freedesktop.PowerManagement.Inhibit' at object path '/org/freedesktop/PowerManagement/Inhibit' (signature 'i')"
Comment 10 Nate Graham 2021-08-23 20:36:18 UTC
Good find!

I can confirm that. However `qdbus org.freedesktop.PowerManagement /org/freedesktop/PowerManagement/Inhibit` shows that the method exists:

method void org.freedesktop.PowerManagement.Inhibit.UnInhibit
Comment 11 Nate Graham 2021-09-07 16:15:55 UTC
*** Bug 442064 has been marked as a duplicate of this bug. ***
Comment 12 Nate Graham 2021-09-07 16:16:48 UTC
Fixed by Peifeng Yu with https://invent.kde.org/plasma/plasma-workspace/-/commit/6379d1ec8d4a1fce141280eead930a6cdd9282d1 in Plasma 5.23!

I will email distros and ask them to backpor tit to 5.22.5, since no further 5.22 bugfix releases are planned.
Comment 13 Nate Graham 2021-09-14 16:34:34 UTC
*** Bug 435895 has been marked as a duplicate of this bug. ***
Comment 14 Michail Vourlakos 2021-09-17 18:14:21 UTC
*** Bug 442243 has been marked as a duplicate of this bug. ***
Comment 15 Nate Graham 2021-09-24 18:46:29 UTC
*** Bug 436068 has been marked as a duplicate of this bug. ***