mate-desktop / mate-screensaver

MATE screen saver and locker
https://mate-desktop.org
GNU General Public License v2.0
48 stars 40 forks source link

Desktop is visible briefly before lockscreen on resume #231

Open dairefagan opened 4 years ago

dairefagan commented 4 years ago

Expected behaviour

Whether I suspend from the power menu, a systemctl suspend, or by closing the lid of my Dell XPS 13 9360, when I resume the first thing I will see is the lockscreen.

Actual behaviour

If I resume from suspending by closing the lid, the lockscreen is the only thing I see but if I resume from systemctl suspend or by selecting suspend from the power menu, my desktop is visible briefly fo 1 or 2 seconds before the lockscreen.

Steps to reproduce the behaviour

After a fresh distro install yesterday I was *not seeing a lockscreen on resume until I input today:

dconf reset -f /org/gnome/desktop/screensaver/
dconf reset -f /org/mate/screensaver/
dconf reset -f /org/mate/powermanager/

Suspend with systemctl suspend or from the power menu, wait a few seconds and then resume.

*As reported the lockscreen now displays so I am not reporting the issue with it not doing so.

MATE general version

1.24.0

Package version

mate-power-manager 1.24.1 mate-screensaver 1.24.0-1

Linux Distribution

Ubuntu MATE 20.04.1 minimal

https://github.com/mate-desktop/mate-screensaver/issues/145 https://github.com/mate-desktop/mate-screensaver/pull/202

lukefromdc commented 3 years ago

This sort of issue just seems to keep coming back, and as has been stated in the other issues the fact that we draw a window over all other windows (but X has no way to privilige that window and does not "understand" screensavers) makes it difficult to get this to work absolutely, 100% of the time. Moving the screensaver to another VT might be the only truly reliable fix so long as we are on X11.

Langlais115 commented 3 years ago

This issue is know since a very long time now. I don't know why it's still not fixed as this is clearly a security issue. Anyway, there are 2 workarounds for this issue:

1 Workaround

Changing the screensaver to blank screen may solve the issue.

2 Workaround:

From the issue 145 opened in 2017

I've found that configuring my system to delay a few seconds before suspending (via systemd) seems to workaround this issue, giving mate-screensaver time to lock the screen before it goes into suspend:

create the file /usr/lib/systemd/system-sleep/sleep.sh

with the contents:

#!/bin/sh
case $1 in
  pre)
    /bin/sleep 2
  ;;
esac

and make the file executable (chmod 755 sleep.sh)

Now, when I close my laptop lid and re-open it, the lock screen appears without showing the contents of my desktop first

oliverdelancey commented 3 years ago

Is there any progress on this? I'm running Fedora 34 (X11 because Nvidia) on a Thinkpad P17 where the screen is visible ~4 secs before the lock screen appears. This happens both when suspending via the lid and when suspending in software. I'd be willing to manually modify system files if there is a proven solution.

Note that the above sleep fix doesn't work, at least for me.

jesse-osiecki commented 2 years ago

we might be able to hook into systemd pre-sleep to run a mate-screensaver-command -l as well. I'm having this problem, so I'll try that and report back

lukefromdc commented 2 years ago

Changing the screensaver to blank means less code to run, so no surprise if the screensaver window renders faster and thus prevents the desktop from showing. This will be sensitive to the speed of a particular machine however