nixos/home/scripts/lockhelper.sh
Torjus Håkestad ffe91246bd
Some checks failed
pre-commit / pre-commit (push) Failing after 16s
Fix lockhelper
2024-06-12 13:51:37 +02:00

19 lines
384 B
Bash

#!/usr/bin/env bash
set -eo pipefail
mkdir -p /tmp/lockscreen || true
monitors=$(hyprctl monitors -j | jq -r '.[] | select( .name | contains ("DP")) | .name')
while IFS= read -r m; do
grim -o "$m" "/tmp/lockscreen/$m.png" || true
done <<< "$monitors"
# Only lock if not already running
if [ -z "$(pgrep hyprlock)" ]
then
exec hyprlock
else
echo "Already locked"
fi