https://bugs.kde.org/show_bug.cgi?id=485623

            Bug ID: 485623
           Summary: Powerdevil does not respect lid-switch inhibitor
                    created with systemd-inhibit
    Classification: Plasma
           Product: Powerdevil
           Version: master
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: plasma-b...@kde.org
          Reporter: o...@geek.co.il
                CC: m...@ratijas.tk, natalie_clar...@yahoo.de
  Target Milestone: ---

SUMMARY
PowerDevil does not respect a user's request to prevent a laptop from going to
sleep due to a lid switch action, using the `systemd-inhibit` command with the
`--what=handle-lid-switch` option

This issue was originally reported as a Bug #457859 comment #2 and was moved to
a new ticket at the request of developers.

STEPS TO REPRODUCE
1. Under _Energy Saving_ make sure the "When laptop lid closed" [sic] option
for the current power state is set to "sleep".
2. Open a terminal and run `systemd-inhibit --what=handle-lid-switch --who=test
--why=coz sleep infinity`
3. Close the laptop lid

OBSERVED RESULT
The laptop goes to sleep

EXPECTED RESULT
The laptop will not go to sleep

SOFTWARE/OS VERSIONS
Operating System: KDE neon Testing Edition
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.0
Kernel Version: 6.5.0-27-generic (64-bit)
Graphics Platform: Wayland
Processors: 20 × 12th Gen Intel® Core™ i7-12700H
Memory: 31.0 GiB of RAM
Graphics Processor: Mesa Intel® Graphics

ADDITIONAL INFORMATION
The default systemd behavior can be achieved by stopping PowerDevil (for
example using `systemctl --user stop plasma-powerdevil.service`), after which
closing the lid without inhibition causes the laptop to sleep while with the
above inhibition command the laptop will not sleep on lid close.

When using `sudo` to run `systemd-inhibit`, PowerDevil will still attempt to
put the laptop to sleep but it will first request authorization using a
policykit dialog, and as the laptop lid is closed this authorization request
will go unanswered and the laptop will not sleep, but its not really a good
workaround due to requiring authorization to start and having an unexpected
authorization dialog when opening the lid.

Natalie Clarius in Bug #457859 comment #13 has opined that the behavior
reported in this ticket is probably the desired behavior in order to prevent
users from making mistakes - to which I will answer that having APIs to let
users do things is all about letting users make their own mistakes, see `rm -rf
/` - it is a legit operation a user is allowed to issue.

Furthermore, I will contend the `systemd-inhibit --what=handle-lid-switch` is a
real API with good use cases that is implemented and supported by various
systems and environments and PowerDevil should not disable it.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to