Privacy issue when waking up suspended machine

Solution 1:

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.

Solution 2:

It turns out the key is that it is a screensaver "problem", nothing to do with power management, suspend or resume!

So, go to Screensaver preferences, then the advanced tab. In the bottom-right is "Fading and Colormaps". Uncheck "Fade to Black when Blanking".

(I also have Grab Desktop Images unchecked, though I personally use the "Blank Screen Only" screensaver, so that is academic.)

This solution works equally well with lid-closing or using pm-suspend or using the suspend button from the power management menu; and equally well with opening the lid, or pressing the power button to resume. In a couple of my tests I did see the screen flash on briefly after a resume, when using power button to suspend and resume; one of those times it effectively crashed xfce, perhaps as I was testing too quickly. However using the lid-closing/lid-opening technique it has been always behaved correctly (so far).