mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-26 13:14:35 +00:00
Add lockscreen management script
This commit is contained in:
parent
d4dbe64515
commit
0619e887a3
|
@ -6,18 +6,14 @@
|
||||||
# Set monitor order
|
# Set monitor order
|
||||||
xrandr --output HDMI-1 --auto --output eDP-1 --right-of HDMI-1 --auto &
|
xrandr --output HDMI-1 --auto --output eDP-1 --right-of HDMI-1 --auto &
|
||||||
|
|
||||||
# XSS lock with xsecurelock
|
# Start xsecurelock lockscreen with xss-lock
|
||||||
xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock &
|
~/.local/bin/scripts/lockscreen start &
|
||||||
|
|
||||||
# Set X11 lockscreen delays (DPMS)
|
|
||||||
xset s on &
|
|
||||||
xset s 600 10 & # 10 minutes, 5s for dimmer
|
|
||||||
|
|
||||||
# Set the background with a custom `setbg` script
|
# Set the background with a custom `setbg` script
|
||||||
setbg &
|
setbg &
|
||||||
|
|
||||||
# Use xresources file in ~/.config/x11
|
# Use xresources file in ~/.config/x11
|
||||||
xrdb ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources
|
xrdb ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources &
|
||||||
|
|
||||||
# Start compositor manager to allow transparency
|
# Start compositor manager to allow transparency
|
||||||
picom -b --experimental-backends &
|
picom -b --experimental-backends &
|
||||||
|
@ -44,12 +40,6 @@ numlockx &
|
||||||
# Udiskie for simple mounting and notifications, no automount for security reasons
|
# Udiskie for simple mounting and notifications, no automount for security reasons
|
||||||
udiskie -A -s &
|
udiskie -A -s &
|
||||||
|
|
||||||
# Run emacs daemon
|
|
||||||
#emacs --daemon &
|
|
||||||
|
|
||||||
# Run urxvt daemon
|
|
||||||
#urxvtd -q -o -f &
|
|
||||||
|
|
||||||
# Enable running applications from chroot
|
# Enable running applications from chroot
|
||||||
xhost +local:
|
xhost +local:
|
||||||
|
|
||||||
|
|
|
@ -104,10 +104,6 @@ myKeys =
|
||||||
[ ("M-S-r", spawn "xmonad --recompile; xmonad --restart") -- Recompiles xmonad
|
[ ("M-S-r", spawn "xmonad --recompile; xmonad --restart") -- Recompiles xmonad
|
||||||
, ("M-S-q", io exitSuccess) -- Quits xmonad
|
, ("M-S-q", io exitSuccess) -- Quits xmonad
|
||||||
|
|
||||||
-- Lock screen
|
|
||||||
, ("C-M-l", spawn "xsecurelock") -- XSecureLock lockscreen
|
|
||||||
--, ("C-M-l", spawn "xset s activate") -- Send DPMS trigger for lockscreen
|
|
||||||
|
|
||||||
-- Programs
|
-- Programs
|
||||||
, ("M-b", spawn (myBrowser))
|
, ("M-b", spawn (myBrowser))
|
||||||
, ("M-<Return>", spawn (myTerminal))
|
, ("M-<Return>", spawn (myTerminal))
|
||||||
|
@ -128,7 +124,9 @@ myKeys =
|
||||||
|
|
||||||
-- Script shortcuts
|
-- Script shortcuts
|
||||||
, ("M-S-p", spawn "setbg ~/Pictures/Wallpapers/Active") -- Set random background
|
, ("M-S-p", spawn "setbg ~/Pictures/Wallpapers/Active") -- Set random background
|
||||||
, ("M-S-d", spawn "displayselect")
|
, ("M-S-d", spawn "displayselect") -- Set display configurations
|
||||||
|
, ("M-C-l", spawn "lockscreen lock") -- Lock the screen
|
||||||
|
, ("M-C-S-l", spawn "lockscreen toggle") -- Toggle automatic locking
|
||||||
|
|
||||||
-- Kill windows
|
-- Kill windows
|
||||||
, ("M-w", kill1) -- Kill the currently focused client
|
, ("M-w", kill1) -- Kill the currently focused client
|
||||||
|
|
44
home/.local/bin/scripts/lockscreen
Executable file
44
home/.local/bin/scripts/lockscreen
Executable 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
|
Loading…
Reference in a new issue