i3-config/scripts/i3lock.bash
2021-08-28 11:44:28 -05:00

35 lines
1.0 KiB
Bash

#!/bin/bash
revert() {
rm /tmp/*screen*.png
xset dpms 0 0 0
}
trap revert HUP INT TERM
if [[ $(command -v xset) ]]; then
xset +dpms dpms 0 0 5
else
echo 'xset command not found' >> "$HOME/.config/i3/logs/xset-log-$(date +'%F-%k-%M-%S').log" 2>&1 # debug
fi
if [[ $(command -v scrot) ]]; then
scrot -d 1 /tmp/locking_screen.png
else
echo 'scrot is not installed' >> "$HOME/.config/i3/logs/scrot-log-$(date +'%F-%k-%M-%S').log" 2>&1 # debug
fi
if [[ $(command -v convert) ]]; then
convert -blur 0x8 /tmp/locking_screen.png /tmp/screen_blur.png
convert -composite /tmp/screen_blur.png "$HOME/.config/i3/images/imagelock.png" -gravity South -geometry -20x1200 /tmp/screen.png
else
echo 'convert command not found' >> "$HOME/.config/i3/logs/convert-log-$(date +'%F-%k-%M-%S').log" 2>&1 # debug
fi
if [[ $(command -v i3lock) ]]; then
i3lock -i /tmp/screen.png
else
echo 'i3lock is not installed' >> "$HOME/.config/i3/logs/i3lock-log-$(date +'%F-%k-%M-%S').log" 2>&1 # debug
fi
revert "$@"