50 lines
1.3 KiB
Bash
Executable File
50 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
lock() {
|
|
killall -SIGHUP gpg-agent
|
|
pactl set-sink-mute @DEFAULT_SINK@ true
|
|
|
|
# needs i3lock-color
|
|
i3lock --ignore-empty-password --clock --indicator --show-failed-attempts \
|
|
--color=222222 --verifcolor=eeeeeeee --wrongcolor=eeeeeeee \
|
|
--timecolor=eeeeeeee --datecolor=cccccccc \
|
|
--ringcolor=333333ff --line-uses-ring --insidecolor=00000000 \
|
|
--insidewrongcolor=00000000 --insidevercolor=00000000 \
|
|
--datestr="%Y-%m-%d $(hostname)" \
|
|
--pass-media-keys $@
|
|
}
|
|
|
|
case "$1" in
|
|
lock)
|
|
trap "xset dpms 0 0 0" HUP INT TERM
|
|
# set dpms time to argument, or 0 if none given
|
|
xset +dpms dpms ${2-0} ${2-0} ${2-0}
|
|
lock ${2+"--nofork"}
|
|
xset dpms 0 0 0
|
|
;;
|
|
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
|