Created
October 21, 2021 17:12
-
-
Save xentec/74df30bdb38e290eef317d72019496c7 to your computer and use it in GitHub Desktop.
Screen locking script for swaylock.
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
#!/usr/bin/env fish | |
# You need sway, swaylock, grim, imagemagick, jq and parallel. | |
set SCREEN (swaymsg -t get_outputs | jq -r .[].name) | |
for s in $SCREEN; | |
set -l img /tmp/lock-$s.jpg | |
set -a IMG $img | |
set -a PARAMS "-i $s:$img" | |
end | |
parallel "grim -o {1} -t ppm -s 0.3 - | convert - -filter Gaussian -define filter:sigma=3.5 -resize 200% {2}" \ | |
::: $SCREEN :::+ $IMG | |
swaylock -lF -s fill -c 000000 (echo $PARAMS | string split " ") | |
rm -- $IMG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment