Created
February 12, 2020 15:37
-
-
Save singulared/7c6d53c1b84fbb7cf22d07c5c7d3e945 to your computer and use it in GitHub Desktop.
swaylock with image per-output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Dependencies: | |
# imagemagick | |
# swaylock | |
# grim | |
IMAGE=/tmp/i3lock.png | |
LOCK=~/.config/sway/lock.png | |
LOCKARGS="" | |
# All options are here: http://www.imagemagick.org/Usage/blur/#blur_args | |
#BLURTYPE="0x5" # 7.52s | |
#BLURTYPE="0x2" # 4.39s | |
#BLURTYPE="5x3" # 3.80s | |
BLURTYPE="2x8" # 2.90s | |
#BLURTYPE="2x3" # 2.92s | |
for OUTPUT in `swaymsg -t get_outputs | jq -r '.[].name'` | |
do | |
IMAGE=/tmp/$OUTPUT-lock.png | |
grim -o $OUTPUT $IMAGE | |
convert $IMAGE -blur $BLURTYPE -font Liberation-Sans -pointsize 26 -fill white -gravity center -comment 'Type password to unlock' - | composite -gravity center $LOCK - $IMAGE | |
LOCKARGS="${LOCKARGS} --image ${OUTPUT}:${IMAGE}" | |
IMAGES="${IMAGES} ${IMAGE}" | |
done | |
swaylock --text-color=ffffff00 --inside-color=ffffff1c --ring-color=ffffff3e --line-color=ffffff00 --key-hl-color=00000080 --ring-ver-color=00000000 --inside-ver-color=0000001c --ring-wrong-color=00000055 --inside-wrong-color=0000001c $LOCKARGS | |
rm $IMAGES |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@fuzunspm replace
swaylock -f -c 000000
with full path to this script.Or place this script in one of your $PATH directory such as
/usr/local/bin/
and call as sway-lock.sh.