Files
sysadmin/i3wm/i3exit.sh
2018-12-10 19:38:19 -02:00

51 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
lock() {
import -window root -colorspace gray /tmp/i3lock.png;
convert /tmp/i3lock.png -blur 0x5 /tmp/i3lock-blur.png;
rm -f /tmp/i3lock.png;
i3lock -i /tmp/i3lock-blur.png -c 00001e -e -f -p win
#bindsym $mod+z exec "$lock"
#bindsym $mod+Shift+z exec "$lock && systemctl suspend"
#i3lock
}
case "$1" in
lock)
lock
;;
logout)
i3-msg exit
;;
suspend)
lock && systemctl suspend
;;
hibernate)
lock && systemctl hibernate
;;
reboot)
systemctl reboot
;;
shutdown)
systemctl poweroff
;;
*)
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
exit 2
esac
exit 0
### USAGE
#set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
#mode "$mode_system" {
# bindsym l exec --no-startup-id i3exit lock, mode "default"
# bindsym e exec --no-startup-id i3exit logout, mode "default"
# bindsym s exec --no-startup-id i3exit suspend, mode "default"
# bindsym h exec --no-startup-id i3exit hibernate, mode "default"
# bindsym r exec --no-startup-id i3exit reboot, mode "default"
# bindsym Shift+s exec --no-startup-id i3exit shutdown, mode "default"
#
# # back to normal: Enter or Escape
# bindsym Return mode "default"
# bindsym Escape mode "default"
#}
#bindsym $mod+z mode "$mode_system"