Tested on Arch Linux, Manjaro Linux.
Prerequisites to replicate:
Be on a laptop with a lid switch. Ensure lightdm and light-locker are installed, working and the light-locker daemon is running, thus activating xfce4-power-manager's light-locker integration (i.e. the 'Security' tab in xfce4-power-manager's settings window).
In the xfce4-power-manager settings, ensure "Lock screen when system is going for sleep" in the Security tab is enabled (which can activate this logind-handle-lid-switch "feature" dependant on other factors described below).
In the General tab set the "Laptop Lid" action for "On battery" to "Suspend" and the action for "Plugged in" to anything other than Suspend (eg. "Switch off display").
While the laptop is plugged in, close the lid. It should not suspend because we set the action for plugged in to be something other than suspend, but it DOES suspend.
i.e. If *either* "On battery" or "Plugged in" is set to suspend, the action taken for both power states is always suspend, even if one of them is set to something else.
The cause is clear in the xfce4-power-manager code. In xfpm-settings.c there is a comment stating the following:
"logind-handle-lid-switch = true when: lock_on_suspend == true and (lid_switch_on_ac == suspend or lid_switch_on_battery == suspend)"
...and the following line of code does this.
At the time of this bug report it is at line 812 of xfpm-settings.c
Since i don't understand why handling off to logind is occurring at all (despite asking why multiple times on the xfce4-dev mailing list), my suggestion is to stop handing off to logind, especially since until very recently (i'm fairly sure it's since the systemd 222 update) systemd/logind wouldn't even suspend my netbook properly anyway, but xfce4-power-manager (when not handing off to logind) did suspend the system just fine. Another user confirmed the same behaviour on different brand of hardware too.
At the least, i'd think it should be changed to be AND rather than OR in regards to:
"(lid_switch_on_ac == suspend or lid_switch_on_battery == suspend)"
I'm bit by this too. I'm not using light-locker, only lightdm. The problem occurs regardless of the "Lock screen when system is going for sleep" setting.
Also confirmed on Xubuntu 14.04+ https://bugs.launchpad.net/ubuntu/+source/xfce4-power-manager/+bug/1471979.
Excuse me, Xubuntu 15.04+.
Yes, similar confirmed on Arch also.
Besides, I can't get be lock the session, if i choose this for lid switch actions. Only i can use "switch off display", "suspend" and "hibernate" options but doesn't work "lock screen". At least there is a strange behavior.
My package is xfce4-power-manager-devel 1.5.2 from AUR
Thank so much! :D
(In reply to Javier Fernández from comment #4)
> Yes, similar confirmed on Arch also.
> Besides, I can't get be lock the session, if i choose this for lid switch
> actions. Only i can use "switch off display", "suspend" and "hibernate"
> options but doesn't work "lock screen". At least there is a strange behavior.
> My package is xfce4-power-manager-devel 1.5.2 from AUR
> Thank so much! :D
Indeed, i think light-locker should be better integrated into xfce4-power-manager, there are many features implied to locking screen that xfce4-power-manager doesn't control appropriately. But again thank for ur work ;)
Bug is present on Xubuntu 18.04(xfce4-power-manager 1.6.1)
*** This bug has been marked as a duplicate of bug 15300 ***