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?