Laptop lid setting on AC ignored

Bug #1471979 reported by Michael MacEachern
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Xfce4 Power Manager
Confirmed
Medium
xfce4-power-manager (Ubuntu)
Confirmed
Medium
Unassigned
Focal
New
Undecided
Unassigned
Impish
Fix Released
Undecided
Unassigned

Bug Description

In XFCE's power management settings, there are two options for what to do when you close the lid of the laptop. On battery, and for when on AC power.

Problem is, while on AC, it's still using the "on battery" setting, and never actually uses the on AC power setting. For example, my settings are as follows:

On Battery: Suspend
On AC Power: Switch off display

When I close the laptop while plugged into the charger, it still goes to sleep and suspends. If I however change the on battery status to Switch off display, then closing the lid does just that, doesn't suspend, and stays on with the display switched off, despite it being plugged into the power cord.

I have verified that Xfce knows the charger is plugged in as the battery icon shows the lightning bolt when it should.

ProblemType: Bug
DistroRelease: Ubuntu 15.04
Package: xfce4-power-manager 1.4.3-0ubuntu1
ProcVersionSignature: Ubuntu 3.19.0-21.21-generic 3.19.8
Uname: Linux 3.19.0-21-generic x86_64
ApportVersion: 2.17.2-0ubuntu1.1
Architecture: amd64
CurrentDesktop: XFCE
Date: Mon Jul 6 16:57:10 2015
InstallationDate: Installed on 2015-07-05 (1 days ago)
InstallationMedia: Xubuntu 15.04 "Vivid Vervet" - Release amd64 (20150422.1)
SourcePackage: xfce4-power-manager
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Michael MacEachern (maceach-b) wrote :
Revision history for this message
In , Rob McCathie (korrode) wrote :

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).

To replicate:

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.

Cause:
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[1]

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[2]), 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.[3]

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)"

[1] http://git.xfce.org/xfce/xfce4-power-manager/tree/settings/xfpm-settings.c#n812
[2] https://mail.xfce.org/pipermail/xfce4-dev/2015-July/031347.html
[3] https://forum.manjaro.org/index.php?topic=7319.msg210748#msg210748

Revision history for this message
In , Octavio Alvarez (alvarezp) wrote :

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.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in xfce4-power-manager (Ubuntu):
status: New → Confirmed
Revision history for this message
Dekameter (dekameter) wrote :

This bug seems to be an upstream bug, that has a more general cause than just "AC setting ignored".

See Arch: https://bugs.archlinux.org/task/45760
See XFCE upstream: https://bugzilla.xfce.org/show_bug.cgi?id=12088

Revision history for this message
Dekameter (dekameter) wrote :

Specifically I've encountered this bug on Manjaro Linux.

Revision history for this message
In , Dekameter (dekameter) wrote :
Revision history for this message
Michael MacEachern (maceach-b) wrote :

I don't have this issue on Mint though, which is Ubuntu based.

Changed in xfce4-power-manager:
importance: Unknown → Medium
status: Unknown → Confirmed
Changed in xfce4-power-manager (Ubuntu):
importance: Undecided → Medium
Revision history for this message
In , Javi FA (wyre12) wrote :

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

Revision history for this message
In , Javi FA (wyre12) wrote :

(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 ;)

Revision history for this message
Sean Davis (bluesabre) wrote :

Fixed upstream in release 1.7.1.

Changed in xfce4-power-manager (Ubuntu Impish):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.