nixos/home/scripts/lockhelper.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
384 B
Bash
Raw Normal View History

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