lock screen automatically after time of idle

Please post all general support questions for LXDE here.
Post Reply
marco556
Posts: 2
Joined: Thu Dec 22, 2022 1:36 pm

lock screen automatically after time of idle

Post by marco556 »

I love LXDE but I don't want to use xscreensaver. A simple script should be enough:

Code: Select all

#!/bin/bash
while [ $(xprintidle) -le 6000 ]
do
	#nothing, just wait
done
/usr/bin/dm-tool lock
But: The problem is, how to restart it automatically, after unlocking?

Can an event be triggered, similar to autostart after login? Or is there a way to find out if the screen is locked or not?
Thanks
marco556
Posts: 2
Joined: Thu Dec 22, 2022 1:36 pm

Re: lock screen automatically after time of idle

Post by marco556 »

push!
nutterbutternut
Posts: 5
Joined: Thu Apr 20, 2023 3:10 am

Re: lock screen automatically after time of idle

Post by nutterbutternut »

Reset to defaults
soccer random
lilycollins34
Posts: 3
Joined: Mon May 15, 2023 4:27 am

Re: lock screen automatically after time of idle

Post by lilycollins34 »

marco556 wrote: Thu Dec 22, 2022 1:49 pm I love LXDE but I don't want to use xscreensaver. A simple script should be enough:

Code: Select all

#!/bin/bash
while [ $(xprintidle) -le 6000 ]
do
	#nothing, just wait
done
/usr/bin/dm-tool [url=https://bitlifeonline.com/]bitlife[/url] lock
But: The problem is, how to restart it automatically, after unlocking?

Can an event be triggered, similar to autostart after login? Or is there a way to find out if the screen is locked or not?
Thanks
To automatically restart the script after unlocking the screen in LXDE, you can make use of the xscreensaver events and create a script that listens for the "Unblank" event.
kleasywe
Posts: 4
Joined: Wed May 17, 2023 1:23 am

Re: lock screen automatically after time of idle

Post by kleasywe »

Code: Select all

#!/bin/bash
while [ $(xprintidle) -le 6000 ]
do
	#nothing, just wait

done
/usr/bin/dm-tool lock
I still can't understand this codedrift boss
Post Reply