Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Prevent XScreenSaver from flashing unlocked screen
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
yuri69
n00b
n00b


Joined: 17 Apr 2017
Posts: 15
Location: /home/lxuser

PostPosted: Sat Dec 21, 2024 11:22 am    Post subject: Prevent XScreenSaver from flashing unlocked screen Reply with quote

Hi,
I've been using x11-misc/xscreensaver for a while on my laptop. It's fast and seems to be a bit more secure than the rest of common screen lock apps. But there is one thing...

I simply can't configure it well enough to prevent it from showing the unlocked screen for a very brief period (500ms?) before it shows the lock screen itself. This happens after I wake the laptop up from sleep but it doesn't occur every time - it's like 50:50.

The setup is systemd + i3wm with the screensaver being started by auto-running:

Code:
xscreensaver --no-splash


It feels like the system goes to sleep before the saver has a chance to lock itself. Is there anybody else using XScreenSaver on a similar setup?
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22876

PostPosted: Sat Dec 21, 2024 2:05 pm    Post subject: Reply with quote

This is an inherent problem with a screensaver / screenlocker that is not integrated in the rendering path. At the time you enter suspend, you were recently active, so the screen is correctly not blanked. When you resume, your X server is restored and begins rendering to the screen, showing whatever you had open. Soon afterward, but not instantly, the kernel will get around to scheduling xscreensaver, which will notice that the current time says you have been idle for hours, and will react by blanking / locking the screen. As you observed, this may or may not be fast enough to happen before Xorg renders to the monitor. The typical solution to this is that you need to run xscreensaver-command -lock on the suspend path, so that the screen is already blanked and locked before you enter suspend, and is still that way when you resume.
Back to top
View user's profile Send private message
yuri69
n00b
n00b


Joined: 17 Apr 2017
Posts: 15
Location: /home/lxuser

PostPosted: Sun Dec 22, 2024 10:42 am    Post subject: Reply with quote

Hu wrote:
The typical solution to this is that you need to run xscreensaver-command -lock on the suspend path, so that the screen is already blanked and locked before you enter suspend, and is still that way when you resume.

Thanks for the reply.

I thought this was there reason for xscreensaver spawning the xscreensaver-systemd DBus-connected utility. Its description IMO fits here:

Quote:
When the system is about to go to sleep (e.g., the laptop lid has just been closed) it locks the screen just before the system sleeps, by running xscreensaver-command --suspend. When the system wakes up again, it runs xscreensaver-command --deactivate to make the unlock dialog appear immediately. It does this through the org.freedesktop.login1(5) D-Bus interface.


When I run the saver as --verbose it seems to log the pre-suspend action correctly:

Code:
xscreensaver-systemd: 11:33:29: exec: xscreensaver-command --verbose -suspend


Is this unrelated?
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22876

PostPosted: Sun Dec 22, 2024 2:47 pm    Post subject: Reply with quote

Yes, that mechanism is intended to address this issue. It's optional though, and it did not occur to me to check whether you were using it. If you run that command manually, does it consistently blank the screen before the shell prompt returns? I speculate, with no data to support this, that the screen blanking may initiate immediately, but not finish before the system enters suspend.
Back to top
View user's profile Send private message
yuri69
n00b
n00b


Joined: 17 Apr 2017
Posts: 15
Location: /home/lxuser

PostPosted: Sun Dec 22, 2024 3:00 pm    Post subject: Reply with quote

Hu wrote:
I speculate, with no data to support this, that the screen blanking may initiate immediately, but not finish before the system enters suspend.

Indeed, it seems the blanking effect is not immediate and might not finish on time.

Code:
$ time xscreensaver-command --verbose -suspend
xscreensaver-command: suspending


real   0m1.188s
user   0m0.000s
sys   0m0.005s
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum