Re: Inhibitions and suspend in powerdevil and plasma-workspace
Nate Graham <[email protected]> Tue, 16 Sep 2025 15:08:58 -0600
| Newsgroups | gmane.comp.kde.devel.core |
|---|---|
| Message-ID | <[email protected]> |
In terms of the design intention here, inhibitions are only supposed to only prevent automatic suspend. If there are types of app-initiated inhibition that block manual suspend, that's the result of a bug that needs fixing. Nate On 9/12/25 21:34, SignKirigami wrote: > Hello everyone, I find it confusing that some inhibitions will prevent system > from auto suspend, but not manually clicking suspend button, so I try to read > source code of powerdevil and plasma-workspace. > > As far as I can see, in plasma-workspace there is canSuspend function which > will check systemd-inhibit from dbus, and return yes when login1 returns yes > or challenge(some applications requests inhibition will lead to this). Suspend > button uses this, but because canSuspend treats yes and challenge as the same, > there is no difference whether systemd inhibition exists, that's why suspend > button will ignore systemd inhibition. > > In powerdevil, what canSuspend returns is used in function > loadAllInactiveActions, which will create a new profile with canSuspend and > give it to suspendsession action, let it determine auto suspend or not. There > is another mechanism which really works called policyagent. It syncs with > systemd inhibitions and has its own inhibitions related to settings and old > program(like ktorrent). When suspendsesstion handles timeout, it checks > policyagent to determine whether to suspend or not. > > Now I wonder if these really work as expected? Do we need to check systemd > inhibition and give a warnning before do actual suspend work when inhibition > exists?