The event is BLANK
.
If you have the Lock Screen After
set to 0
. They (BLANK
& LOCK
) happens almost at the same time.
Therefore when you enter in the if (m/^(BLANK)/)
condition, the screen is already locked.
[user@dom0 ~]$ cat x.pl
#!/usr/bin/perl
my $blanked = 0;
my $locked = 0;
open (IN, "xscreensaver-command -watch |");
while (<IN>) {
if (m/^(BLANK)/) {
if (!$blanked) {
system 'xdotool mousemove 200 200';
system 'xscreensaver-command -activate';
$blanked = 1;
}
} elsif (m/^LOCK/) {
if (!$locked) {
$locked = 1;
}
} elsif (m/^UNBLANK/) {
$blanked = 0;
$locked = 0;
}
}
In this example, the unlock prompt will keep showing up, for the reason mentioned above ( Lock Screen After
is set to 0
).
[user@dom0 ~]$ ./x.pl
xscreensaver-command: ClientMessage ignored while authentication dialog is active
The ClientMessage ignored is: xscreensaver-command -activate
To do somethings before the screen lock, just set the Lock Screen After
to 1 minute
.
[user@dom0 ~]$ ./x.pl
xscreensaver-command: activating.
xscreensaver-command: already active.
the message xscreensaver-command: already active.
happens because we have manually
enable the xscreensaver
and I guess it got the message twice (our command and the ānormalā idle thing).
Itās ok, and the unlock prompt will not be showed.
In fact, the screen will blank, unblank (when the mouse get moved), and then blank again.
And after 1 minute, the screen will be locked.
You can also disable Lock Screen After
and use xscreensaver-command -lock
instead
of -activate
in your script.
(I do not recommend, if the script fail to start, the screen will not be locked).
It is expected behaviour, xscreensaver
detect an user activity (the mouse movement).
Donāt know why the unlock prompt showing up is an issue for you, it will disapear after 30s.
This is not luck, itās how it works.
To do more test, run your script in a terminal (not in the background, to see the output).