Suspend on lid close can not be configured individually for battery/AC
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
xfce4-power-manager (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Xfce power-manager allows to configure individual actions for the lid close event for battery and AC mode. However, if one is set to suspend the system suspends always despite it might be configured otherwise for the current state.
I believe this happens because xfpm unconditionally removes the handle-lid-switch inhibitor. Instead xfpm should check the power mode (battery/AC) and only remove the inhibitor if it is actually configured to do so for the current power mode. Of course this check must be repeated on every change of the power mode.
Test case:
On eg. AC mode set the lid close action for battery mode to suspend and for AC mode to eg. lock screen.
systemd-inhibit --list shows that the handle-lid-switch inhibitor is removed.
Closing the lid in AC mode consequently lets logind handle the event, which defaults to suspend.
I get this on all up-to-date xubuntu 16.04 installations.
This also happens on yakkety (well, its same version).
In both cases it requires the 'Lock screen when system is going to sleep' option to be set.