Last active
December 24, 2025 16:03
-
-
Save xentec/74df30bdb38e290eef317d72019496c7 to your computer and use it in GitHub Desktop.
Screen locking script for swaylock.
This file contains hidden or 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 wlr-randr, grim, imagemagick, jq and parallel. | |
| set SCREENS (wlr-randr --json | jq -r .[].name) | |
| for scr in $SCREENS | |
| set -l img /tmp/lock-$scr.jpg | |
| set -a IMGS $img | |
| set -a PARAMS "-i $scr:$img" | |
| end | |
| #echo "Params: $PARAMS" | |
| #echo "Images: $IMGS" | |
| parallel "grim -o {1} -t ppm -s 0.3 - | magick - -filter Gaussian -define filter:sigma=3.5 -resize 200% {2}" \ | |
| ::: $SCREENS :::+ $IMGS | |
| echo "Locking..." | |
| swaylock \ | |
| --daemonize \ | |
| --indicator-caps-lock \ | |
| --show-failed-attempts \ | |
| --scaling fill --color 000000 \ | |
| (echo $PARAMS | string split " ") | |
| rm -- $IMGS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment