i3/.config/i3/lock.sh

53 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
lock() {
killall -SIGHUP gpg-agent
setxkbmap -option 'ctrl:nocaps' -option "shift:both_capslock"
# needs i3lock-color
i3lock --ignore-empty-password --clock --indicator -f --color=222222 \
--textcolor=eeeeeeee --timecolor=eeeeeeee --datecolor=cccccccc \
--ringcolor=333333ff --line-uses-ring --insidecolor=00000000 \
--insidewrongcolor=00000000 --insidevercolor=00000000 \
--datestr="%Y-%m-%d $(hostname)"
# will work with normal i3lock
#i3lock -ec222222 -i /home/adam/.config/i3/LockScreen.png
}
case "$1" in
lock)
lock
# if given an argument, turn off the screen after that many seconds
if [[ $2 && ${2-x} ]]
then
sleep $2
xset dpms force off
fi
;;
logout)
i3-msg exit
;;
suspend)
lock && systemctl suspend
;;
hibernate)
lock && systemctl hibernate
;;
reboot)
systemctl reboot
;;
shutdown)
systemctl poweroff
;;
pick)
$0 $(echo -e "lock\nlogout\nsuspend\nhibernate\nreboot\nshutdown" | rofi -dmenu -i)
;;
*)
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown|pick}"
exit 2
;;
esac
exit 0