Skip to content

Instantly share code, notes, and snippets.

@singulared
Created February 12, 2020 15:37
Show Gist options
  • Save singulared/7c6d53c1b84fbb7cf22d07c5c7d3e945 to your computer and use it in GitHub Desktop.
Save singulared/7c6d53c1b84fbb7cf22d07c5c7d3e945 to your computer and use it in GitHub Desktop.
swaylock with image per-output
#!/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
@fuzunspm
Copy link

fuzunspm commented Aug 5, 2020

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment