Rework lockhelper for gunter
All checks were successful
Run nix flake check / flake-check (push) Successful in 2m47s
Periodic flake update / flake-update (push) Successful in 2m10s

This commit is contained in:
2025-06-10 19:21:22 +02:00
parent 75064a7228
commit 8d419de159
4 changed files with 75 additions and 40 deletions

View File

@@ -3,11 +3,14 @@ set -eo pipefail
mkdir -p /tmp/lockscreen || true
monitors=$(hyprctl monitors -j | jq -r '.[] | select( .name | contains ("DP")) | .name')
monitor_lines=$(hyprctl monitors -j | jq -r '.[] | select (.name | contains ("DP")) | [.name, .description]| @tsv')
while IFS= read -r m; do
grim -o "$m" "/tmp/lockscreen/$m.png" || true
done <<< "$monitors"
name=$(echo "$m" | awk -F $'\t' '{print $1}')
sum=$(echo "$m" | awk -F $'\t' '{printf $2}' | sha256sum | awk '{print substr($1,1,8)}')
grim -o "$name" "/tmp/lockscreen/$sum.png" || true
done <<< "$monitor_lines"
# Only lock if not already running
if [ -z "$(pgrep hyprlock)" ]