I've been having this problem with my acer laptop where ubuntu totally ignores the lid power options. I want my laptop to lock (always) when I close the lid and also, to sleep (only when the adapter is not connected).

I've tried the power options in settings and it didn't work. I tried to edit org.gnome.settings-daemon.plugins.power.lid-close-ac-action and org.gnome.settings-daemon.plugins.power.lid-close-battery-action using dconf-editor but those seem to be completely ignored.

The only setting that does work is the Power > Suspend when laptop lid is closed in Gnome Tweaks but that causes the laptop to sleep even if it's connected to power.

How do I get ubuntu to behave according to the power settings? Is there some other way to do this in Ubuntu 18.04?

  • After digging into the Arch linux wiki and the ubuntu systemd sources, it seems that the version of systemd used by ubuntu does not handle "HandleLidSwitchExternalPower" message. This means that neither systemd nor gnome can differentiate between lid events with power connected and disconnected.
    – Trinopoty
    Jul 2, 2018 at 13:29

1 Answer 1


I came up with my own solution for this. Basically, I wrote a C program that monitors the lid and lock or lock and suspend the system based on whether it's connected to power. It also inhibits the systemd-logind lid events to prevent any surprises.

You must log in to answer this question.

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