Same action is forced for lid-close on AC and lid-close on battery

Bug #1722286 reported by Kim Nguyễn
This bug affects 11 people
Affects Status Importance Assigned to Milestone
GNOME Settings Daemon
gnome-settings-daemon (Ubuntu)

Bug Description

Note: I'm flagging this as a bug in gnome-settings-daemon, but the program itself is not buggy. It's rather the usage of this program instead of unity-settings-daemon in ubuntu 17.10 that causes a system regression.

Up to and including Ubuntu 17.04, unity-settings-daemon was used to managed suspend policy in the default graphic session (Unity). Unity-settings-daemon is a fork of (an old version of) gnome-settings-daemon.
Now that gnome-shell is the default environment, session management is handled by gnome-settings-daemon. In particular, the action to perform when the lid is closed is handled by the gsd-power plugin of gnome-settings-daemon (as it was by unity-settings-daemon).

With unity-settings-daemon, two dconf keys where honored (lid-close-ac-action and lid-close-battery-action, under org/gnome/settings-daemon/power ) to specify what action are performed when the user closes the laptop lid, depending on whether the laptop is plugged or on battery.

In Ubuntu 17.10, gnome-settings-daemon ignore those settings (unless their value is 'ignore') and delegate actions to systemd-logind. The latter has no knowledge on whether the laptop is plugged or not and apply the same action regardless.

This is a regression in a useful (and I believe popular) functionality. It is common to want the laptop to suspend when unplugged but expecting it to remain running when plugged (I believe this is the default on MacOS and windows and both system can be configured to distinguish between on-AC and on-Battery).

The functionality can be restored with a bit of sweat with either hooks for acpid (or maybe a session script using the gnome framework to detect events and apply the correct policy, acpid-scripts run as root), but this is clearly not something the average user should have to tinker with.

At the *very least* release note should advertise this regression (as a new feature ?) but ideally provide a compatibility layer to restore this functionality.

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: gnome-settings-daemon 3.26.1-0ubuntu1
ProcVersionSignature: Ubuntu 4.13.0-11.12-generic 4.13.1
Uname: Linux 4.13.0-11-generic x86_64
ApportVersion: 2.20.7-0ubuntu2
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Mon Oct 9 16:15:54 2017
InstallationDate: Installed on 2015-06-03 (859 days ago)
InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Release amd64 (20150422)
SourcePackage: gnome-settings-daemon
UpgradeStatus: Upgraded to artful on 2017-03-16 (207 days ago)

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in gnome-settings-daemon (Ubuntu):
status: New → Confirmed
Revision history for this message
Kim Nguyễn (kim.nguyen) wrote :

I'm attaching a proof of concept python script that restores the behaviour (in case it's useful to others).

The script should be launched as:
systemd-inhibit --who=me --why=because --mode=block --what=handle-lid-switch /path/to/

from the session startup (gnome-session-properties)

This is public domain and only lightly tested. It relies on existing gnome/systemd commands to perform the underlying action

Changed in gnome-settings-daemon:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
Josh Hill (ingenium) wrote :

Can you modify this script so that it works when an external monitor is connected or the laptop is docked? gsd overrides logind, and prevents the computer from suspending in these cases.

Revision history for this message
PabloAB (pabloab777) wrote :

It seems there is no issue filed upstream. The closest thing I'd found is:
Nothing about lid-close-ac-action and lid-close-battery-action.
I'm not sure if an upstream bug issue should be filed.

I read [this][1] and [this][2] on but only locks when lid-close.


To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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