Testing of laptop-lid-close suspend behavior in Unity (18.04)

Recently Ubuntu removed code for laptop-lid-close-suspend-behavior from gnome-settings-daemon saying it’s buggy and creates problems when you attach a external monitor.
Bug: https://bugs.launchpad.net/ubuntu/+source/gdm3/+bug/1716160
Changelog: https://launchpad.net/ubuntu/+source/gnome-settings-daemon/3.26.1-0ubuntu3

This made unity-settings-daemon failed, so they patched back only gsettings schema part without the code. I am yet to find regressions on Unity because of this on my machines, so I am starting this thread.

On Unity laptop-lid-close-suspend-behavior is configurable. You can do it from Unity control center unlike in Gnome-Shell where you need tweak-tool. It is located at settings -> power-panel.

How-To-Test:

  1. Install unity-session on fresh machine. Log in .
  2. Go to the power panel , set "when lid is closed" == "Do Nothing"
  3. Reboot. Close the laptop lid.

What happens ?

  1. Does it still suspend the laptop or does it simply blank the screen?

  1. Now change it back to “when lid is closed” == “Suspend”`.
  2. Connect a external monitor
  3. Reboot. And login keeping external monitor open.
  4. Colse the laptop lid

What happens ?

  1. Does it suspend the laptop ? (External monitor will go blank)

  1. Install gnome-tweak-tool.
  2. sudo sed -i "s/NoDisplay=true/NoDisplay=false/g" /etc/xdg/autostart/*.desktop
  3. Reboot.

What happens ?

  1. Check autostart applications. Is there something like “ignore-lid-switch-tweak” auto-starting with boot for Unity session?
  2. If it is then repeat laptop-lid-close-suspend-behavior tests.

[If we are going to use our own unity.iso, then tweak-tool won’t be there and we don’t have to deal with it.]

1 Like

It still suspends the laptop.

There is problem. it will not suspend. Ext monitor locks mouse pointer between edge of screen and unity panel. I have to use F7 on lenovo T61.

Then it’s a problem. For me it works according to the power-panel settings.

That was from fresh install from bionic/daily/current.

This is the problem, this shouldn’t be happening.

This is normal behavior. It will not suspend if external monitor is attached even if settings is set to suspend. But mouse pointer lock is another old xorg issue.

This is a systemd thing I believe, but really the laptop should suspend regardless if configured to suspend with the lid down - some interaction with systemd config should happen.

This works:

modify /etc/systemd/logind.conf, with uncommented line

HandleLidSwitch=lock

reboot
verify lock behavior on lid close.

this was broken but it suddenly works again