FYI: A maintainer of pi-greeter informed me that dm-tool is not safe for locking the screen because it switches to the greeter where the password can be bypassed by pressing Ctrl+Alt+F7. The suggestion was to use `swaylock` which is more secure. But since swaylock is not installed in my version of RPi, I took Kenny's advice and upgraded to `raspberrypi 6.12.25+rpt-rpi-v7 #1 SMP Raspbian 1:6.12.25-1+rpt1 (2025-04-30)` which uses swaylock by default for Lock Screen. However, since it takes 3 clicks and more mouse movements to reach the default Lock Screen button, I retained my lockscreen script with some changes:Lock checking can now be done via:I'll update iRest to detect swaylock (though I guess I'm the only one using iRest
)
Code:
#!/bin/bash# Kill existing swayidle processespkill -f swayidle# Run swayidle with timeout 1. Screen blanking will happen after 1 second and then swaylock will lock the screenswayidle -w timeout 1 'wlopm --off \* ; swaylock &' resume 'wlopm --on \* ; pkill -f swayidle' # Set screen blanking to 5 minutes (300 seconds)swayidle -w timeout 300 'wlopm --off \*' resume 'wlopm --on \*' &Code:
#!/bin/bash#PROCESS_PATH="/usr/sbin/pi-greeter"PROCESS_PATH="swaylock"while sleep 2 do if pgrep -f "$PROCESS_PATH" > /dev/null then echo "$PROCESS_PATH is running. Screen is locked" else echo "$PROCESS_PATH is not running. Screen is not locked" fidoneStatistics: Posted by Nav9 — Mon May 26, 2025 7:25 am