If I lock the screen, hibernate by closing the laptop lid, open the laptop lid and press the power button, the screen will just show a black surface and I can start typing the password immediately. If I don't lock the screen before hibernating, wait about 30s, open the laptop lid and press the power button, the screen will show the desktop and then fade to black as if xscreensaver had been activated after exiting hibernation. Only after the fadeout can I deactivate the screensaver. How can I make sure xscreensaver is always properly activated when hibernating, so that I won't have to wait for the fadeout?

  • I don't use xscreensaver anymore, but I remember its manual has a part called "restart xscreensaver when someone logs in", which suggests doing xscreensaver-command -exit; xscreensaver & on login. Maybe you could do that on wake-up to reset its state? – Anko Jul 16 '14 at 11:45
  • 1
    That sounds like a timing attack waiting to happen. – l0b0 Jul 16 '14 at 13:54
  • This one of those little perks that bug me more than they should. – arielnmz Jul 27 '14 at 2:35

I recently solved this problem myself on Arch Linux. I used the program xss-lock from the AUR found here.

I was trying to set up a service to lock the screen on sleep but for some reason I couldn't get it to work. I ended up using xss-lock and it worked very easily.

  1. Install xss-lock from the AUR.
  2. Add one of the commands below to your .xprofile or appropriate startup script for your WM/DM.

My .xprofile:

xss-lock -- /usr/bin/slock &

For xscreensaver:

xss-lock -- /usr/bin/xscreensaver-command -lock &
| improve this answer | |

I solved this problem for myself by switching to a dedicated screen locker instead of xscreensaver.

I use xtrlock on Debian, but it seems to be unavailable on Arch. Here's a blog post describing some of the alternatives on Arch.

| improve this answer | |

Almost fixed using xautolock with slock and a simple screen locking service. The service currently only works on the system level, but hopefully someone will be able to help with that.

Edit: Even though the service clearly says Before=sleep.target I still sometimes see the desktop flicker when resuming.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.