29 lines
622 B
Bash
Executable File
29 lines
622 B
Bash
Executable File
#!/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
|
|
|
|
TMP_IMG="/tmp/lock.png"
|
|
|
|
grim -t ppm - | lockscreen-blur -o "$TMP_IMG" -b 40 --stamp ~/.config/sway/ferris-stamp.png
|
|
|
|
swaylock --config ~/.config/sway/swaylock.config --image "$TMP_IMG" "$@"
|
|
|
|
rm "$TMP_IMG"
|