Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #
- # → https://faq.i3wm.org/question/239/how-do-i-suspendlockscreen-and-logout.1.html
- #
- lock() {
- # see https://stackoverflow.com/a/331294
- img="$TMPDIR/i3lock-$$.png"
- img_tmp="$TMPDIR/i3lock-tmp-$$.png"
- scrot $img_tmp
- convert -scale 10% -scale 1000% $img_tmp $img
- i3lock -n -i $img
- rm -f $img $img_tmp
- }
- 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
Advertisement
Add Comment
Please, Sign In to add comment