23

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?

  • 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 Jun 22 '16 at 9:41
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
  • 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 Sep 3 '15 at 13:09
  • I corrected my answer. – user922 Sep 3 '15 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 Sep 3 '15 at 13:26
  • Glad I helped. :D – user922 Sep 3 '15 at 13:49
  • 1
    This should be a biult-in option. – Gocht Oct 22 '15 at 17:13
7

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 restart systemd-logind
  • 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 Jun 22 '16 at 9:34
  • also, this setting seems to supersede the dconf option of the definitive answer. – user170 Jun 22 '16 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 Jul 6 '17 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

  • 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. – Sonia Hamilton Jan 4 '18 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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