#!/bin/sh # check if swaylock is running if ps -e | grep " swaylock$"; then echo "swaylock is already running!" exit 1 fi OPTIONAL_CMDS=("convert" "python3" "grim", "lockscreen-blur") for CMD in $OPTIONAL_CMDS; do if ! command -v "$CMD" &> /dev/null then echo "$CMD could not be found, falling back to basic mode." swaylock --config ~/.config/sway/swaylock.config --color 302f3b $@ exit 0 fi done BASE_IMAGE_DIR="$(mktemp -d)" INDEX=1 image_path() { echo "$BASE_IMAGE_DIR/$1.png" } grim "$(image_path 1)" 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 2)" $@ rm -r "$BASE_IMAGE_DIR"