24

In other OSes, in the power settings I am able to configure a laptop's 'Close lid' behaviour. Options are like:

  • Hibernate
  • Sleep
  • Power off
  • Do nothing

I do not see such an option in elementary OS Freya power settings:

enter image description here

In my scenario, I want it to do nothing but it always sleeps instead (I have external devices attached and need to tuck the laptop away).

Any workarounds to lack of GUI options? Or am I missing a GUI option elsewhere?

1
  • the options made in dconf editor may not change if /etc/systemd/logind.conf is edited as explained in the other answer (HandleLidSwitch=suspend or HandleLidSwitch=ignore), but the latter will supersede the former.
    – user170
    Commented Jun 22, 2016 at 9:41

3 Answers 3

16

Here a bug has been filed regarding this issue. There are many workarounds suggested on the page. I suggest you go and give it a read.

TLDR;

(warning: might not work in all cases, if so read the page for other solutions)

Using dconf editor, you can change the lid closing settings:
First install dconf editor using sudo apt-get install dconf-editor

dconf editor -> org -> gnome -> settings daemon -> plugins -> power

-> lid-close-ac-action
-> lid-close-battery-action
7
  • I've updated my question to include a screenshot of what I am seeing in ElementaryOS power settings (no 'When lid is closed' option). Do you see that option in ElementaryOS? If so, are you running Freya?
    – dom_watson
    Commented Sep 3, 2015 at 13:09
  • I corrected my answer.
    – user922
    Commented Sep 3, 2015 at 13:19
  • 1
    Thank you. I'll remember to look there first next time (though I think questions like that useful here due to coming up higher in search results).
    – dom_watson
    Commented Sep 3, 2015 at 13:26
  • Glad I helped. :D
    – user922
    Commented Sep 3, 2015 at 13:49
  • 1
    This should be a biult-in option.
    – Gocht
    Commented Oct 22, 2015 at 17:13
8

The solution given by cheekyngeeky does not work for some laptops.

Alternate solution:

sudo vim /etc/systemd/logind.conf

find line "#HandleLidSwitch=suspend"
Replace line with "HandleLidSwitch=ignore"

finaly, restart service:
sudo systemctl restart systemd-logind
3
  • This answer is correct, answering what the OP asks at the end of the question body but not what the question title was suggesting in its initial form. I will try to edit the title of the question. To get the lid close to suspend: just uncomment that line to look like HandleLidSwitch=suspend.
    – user170
    Commented Jun 22, 2016 at 9:34
  • also, this setting seems to supersede the dconf option of the definitive answer.
    – user170
    Commented Jun 22, 2016 at 9:37
  • I thought this one had the advantage of looking simple, but the instruction to restart the service, at least on debian8, is sudo systemctl restart systemd-logind.service
    – mariotomo
    Commented Jul 6, 2017 at 14:57
2

The command line 'copy-pasta' method for the impatient:

gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action 'nothing'
gsettings set org.gnome.settings-daemon.plugins.power lid-close-battery-action 'nothing'

You can change to one of the following values

possible power settings values

1
  • One of the other answers mentions modifying the systemd config then running "sudo systemctl restart systemd-logind.service" (which worked for me). I wonder how this differs from using gsettings. Commented Jan 4, 2018 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.