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?
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: