5

In Ubuntu versions before Gnome Shell, I could set what I wanted to happen when I close the laptop lid depending on whether the laptop is connected to power or not.

Now the default is standby which I can disable in Gnome Tweak Tool. My preferred setting is to only go to standby when on battery and stay on when connected to AC.

Using systemd I only know of options to completely enable or disable lid-actions alltogether. How did Unity solve this in Ubuntu 17.04?

2
  • Simply doing this will not work, will it?
    – pomsky
    Feb 23, 2018 at 17:09
  • @pomsky: nope, those settings are now ignored.
    – mniess
    Feb 26, 2018 at 12:15

1 Answer 1

5
+100

This appears to be bug in the gnome-settings-daemon.

A workaround has been proposed by Kim Nguyễn in the form of a python script, custom_suspend.py. He/she says:

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

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

5
  • Hey. I'm not looking to ignore the lidswitch, I want it to only put the laptop in standby, when it's running on battery.
    – mniess
    Dec 7, 2017 at 13:39
  • Sorry, misread the question. It appears to be a bug bugs.launchpad.net/ubuntu/+source/gnome-settings-daemon/+bug/… There is a workaround proposed in the comments.
    – SteveSong
    Dec 7, 2017 at 13:52
  • Great find! I'll accept your answer if you update it with the workaround from the bugfix.
    – mniess
    Dec 7, 2017 at 14:00
  • Thanks.. I think you can savely remove the original answer. It's already available somewhere else and your revised answer does answer the question!
    – mniess
    Dec 7, 2017 at 19:43
  • I added a comment to the launchpad issue. It seems there is no upstream issue filed. Feb 24, 2019 at 16:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .