#!/bin/sh # Lock the screen # the daemon process creates the pixelated image every minute in the background # so that i3lock doesn't have to wait for the image to be generated when run case "$ON_OS" in mac*) pmset displaysleepnow exit 0 ;; linux*) if [ -n "$SWAYSOCK" ]; then swaylock -f -e -c 1d2021 --inside-color 000000b3 -s fill -i "$(find ~/Files/wallpapers | shuf -n1)" elif [ "$1" = "-b" ]; then # daemon while true; do scrot --silent --overwrite "${HOME}/.cache/desktop.png" magick -scale 2% -scale 5000% "${HOME}/.cache/desktop.png" "${HOME}/.cache/pixel.png" sleep 120 done else i3lock -ni "${HOME}/.cache/pixel.png" fi ;; *) echo "Dont know how to lock screen..." >&2 ;; esac