Update swaylock-cool

- Faster blur
- Avoid double-locking on sleep
This commit is contained in:
2021-10-27 20:06:52 +02:00
parent b036544c76
commit a726a701e6
3 changed files with 13 additions and 16 deletions

View File

@ -1,8 +1,12 @@
#!/bin/sh
BLUR_FACTOR=64;
# check if swaylock is running
if ps -e | grep " swaylock$"; then
echo "swaylock is already running!"
exit 1
fi
OPTIONAL_CMDS=("convert" "python3" "grim")
OPTIONAL_CMDS=("convert" "python3" "grim", "lockscreen-blur")
for CMD in $OPTIONAL_CMDS; do
if ! command -v "$CMD" &> /dev/null
@ -19,17 +23,13 @@ BASE_IMAGE_DIR="$(mktemp -d)"
INDEX=1
image_path() {
echo "$BASE_IMAGE_DIR/$1.jpg"
echo "$BASE_IMAGE_DIR/$1.png"
}
UPSCALE="$(python3 -c "print(100*$BLUR_FACTOR, end='')")%"
DOWNSCALE="$(python3 -c "print(100/$BLUR_FACTOR, end='')")%"
grim "$(image_path 1)"
convert -scale $DOWNSCALE -scale $UPSCALE "$(image_path 1)" "$(image_path 2)"
convert -composite -gravity center "$(image_path 2)" ~/.config/sway/ferris-stamp.png "$(image_path 3)"
lockscreen-blur -i "$(image_path 1)" -o "$(image_path 2)" -b 40 --stamp ~/.config/sway/ferris-stamp.png
swaylock --config ~/.config/sway/swaylock.config --image "$(image_path 3)"
swaylock --config ~/.config/sway/swaylock.config --image "$(image_path 2)" $@
rm -r "$BASE_IMAGE_DIR"