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.
Automatic sleep and screenlocking is permanently inhibited by the battery applet itself inside of lattedock until I restart lattedock.
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.
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
Sometimes I have to toggle it as many as 8 times it would seem.
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.
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.
Also present in the latest neon user. Checking the option inhibits sleep, however, unchecking it does not restore state.
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.
*** Bug 439451 has been marked as a duplicate of this bug. ***
*** Bug 439315 has been marked as a duplicate of this bug. ***
FWIW, while watching
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')"
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
*** Bug 442064 has been marked as a duplicate of this bug. ***
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.
*** Bug 435895 has been marked as a duplicate of this bug. ***
*** Bug 442243 has been marked as a duplicate of this bug. ***
*** Bug 436068 has been marked as a duplicate of this bug. ***