dotfiles/dot_config/i3/executable_locker.sh

40 lines
1.1 KiB
Bash

#!/bin/bash
# scrot -za 0,0,1024,600 /tmp/lock.png;
# convert /tmp/lock.png -blur 2x2 /tmp/lock.png
# i3lock -nec 131313;
export DISPLAY=:0
export XDG_SEAT=seat0
export LOGNAME=$(whoami)
export XDG_SESSION_TYPE=tty
export XAUTHORITY=$HOME/.lyxauth
export MOTD_SHOWN=pam
export XDG_SESSION_CLASS=user
export XDG_VTNR=2
export XDG_SESSION_ID=$(cat /proc/self/sessionid)
export XDG_RUNTIME_DIR=/run/user/$(id -u)
scrot -oF /tmp/screen.png
magick /tmp/screen.png -scale 5% -scale 2000% -statistic Median 4 \
-font "unscii-16-full" -pointsize 48 \
-draw "gravity Center fill #131313 text -4,260 'Locked'" \
-draw "gravity Center fill #131313 text 4,260 'Locked'" \
-draw "gravity Center fill #131313 text -4,252 'Locked'" \
-draw "gravity Center fill #131313 text 4,252 'Locked'" \
-draw "gravity Center fill #efefef text 0,256 'Locked'" \
/tmp/lock.png;
rm /tmp/screen.png
if [ "x$1" = "x" ]; then
i3lock -befni /tmp/lock.png
else
i3lock -befi /tmp/lock.png
sleep 0.5;
i3-msg mode default;
case "$1" in
hibernate) systemctl hibernate ;;
suspend) systemctl suspend ;;
esac;
fi
# rm /tmp/lock.png;