Ubuntu – Privacy issue when waking up suspended machine

screensaversuspendxfce

Using Xfce, when I close the notebook lid it suspends, and when I open the lid it wakes up. When it wakes up it shows the screensaver until I press a key or move the mouse then it asks me for my password. All that is working beautifully. The issue is that when I open the lid, for a second or so I can see what is on the desktop, all the open windows, etc. Then it does a fade into the screensaver. The expected behaviour is that I see a blank screen, or the login prompt, immediately.

I've removed the screen saver (set it to be a black screen) but that made no difference.

Is this something that can be configured?

System details: Lenova E540, Mint 16, Xfce 4.10.

(In contrast, my Ubuntu 10.04 notebook did not have this issue: when the case was opened it always showed a blank screen. However I always had to suspend from the power control menu, as closing the case was unreliable as a way to get it to suspend, so maybe that was why??)


More Notes:

(Thanks to Nattgew for finding a related bug report.)

There appears to be a distinct difference between closing the screen, and going to the power manager and choosing suspend.

Close screen: screen visible when opening, then it goes to screensaver, then I have to type password to login. Wifi net connection is preserved.

Explicit suspend: wifi is disconnected. When I resume the screen is visible, it doesn't go to screensaver, it doesn't ask password. It needs to reconnect to wifi.
–> FIXED THIS BIT. launch xfce4-session-settings, go to last tab ("Advanced") and mark "Lock screen before sleep" checkbox. You also have to check the checbox that says the same thing in Power Manager preferences!! (Source.) So, now I've fixed this, both ways of suspending show the screen fading away into the screensaver, then prompt for password. However the explicit suspend is still the only one that disconnects wifi.

(Using pm-suspend from the commandline works just like going to the power manager menu.)

Best Answer

This seems to be present in a lot of distros. This is a workaround I'm using for Cinnamon on Debian, but it should be possible to do something similar with other distro/window manager combinations:

  1. Use dconf-editor to change the button-suspend action at org>cinnamon>settings-daemon>plugins>power to 'nothing' (you could also amend lid-close-ac-action and lid-close-bettery-action as well if you're using a laptop).

  2. Save the following script to a convenient location:

    #!/bin/bash
    cinnamon-screensaver-command -l
    systemctl suspend
    
  3. Use the System Settings app to create a custom keybinding for the sleep key that points to the script.

After this it behaves as it should. You can see the lock screen pop up briefly before it goes to sleep, which is reassuring.

Related Question