Move scripts that require gui to gui/

This commit is contained in:
ItsDrike 2022-08-13 13:44:00 +02:00
parent 2ef59a7720
commit 7e111fd566
No known key found for this signature in database
GPG key ID: B014E761034AF742
11 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,44 @@
#!/bin/sh
if [ "$1" = "start" ]; then
MODE="start"
elif [ "$1" = "stop" ]; then
MODE="stop"
elif [ "$1" = "toggle" ]; then
if pidof -s xss-lock > /dev/null 2>&1; then
MODE="stop"
else
MODE="start"
fi
elif [ "$1" = "lock" ]; then
MODE="lock"
else
echo "Invalid command usage, use: lockscreen [start/stop/toggle/lock]"
exit 1
fi
if [ "$MODE" = "start" ]; then
echo "Starting xss-lock"
# Set X11 lockscreen delays (DPMS)
xset s on
xset s 600 10 # Dim screen after 10 minutes, lock 10s later
# XSS lock with xsecurelock
xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock &
elif [ "$MODE" = "stop" ]; then
echo "Stopping xss-lock"
# Remove X11 lockscreen delays (DPMS)
xset s off
# Stop XSS lock
killall xss-lock
elif [ "$MODE" = "lock" ]; then
# Send a DPMS trigger if xss-lock is running to inform it
# about the lockstate, if it's not running, run xsecurelock directly
if pidof -s xss-lock > /dev/null 2>&1; then
echo "Locking screen - using DPMS (xss-lock active)"
xset s activate
else
echo "Locking screen - running xsecurelock directly (xss-lock isn't running)"
xsecurelock
fi
fi