Add files via upload

This commit is contained in:
FURK4NGG
2026-01-18 14:35:27 +03:00
committed by GitHub
parent 8b6bdfb390
commit 4f41492227
2 changed files with 112 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# Kullanım: event-driven.sh <MONITOR_NAME> <POLL_INTERVAL>
MONITOR="$1"
POLL_INTERVAL="${2:-3}" # default 3s
[ -z "$MONITOR" ] && { echo "Monitor arg missing"; exit 1; }
BLACKLAYER_BIN="$HOME/blacklayer"
STATE_DIR="$HOME/.blacklayer_state"
STATE_FILE="$STATE_DIR/$MONITOR"
while true; do
sleep "$POLL_INTERVAL"
JSON="$(hyprctl -j monitors 2>/dev/null)"
echo "$JSON" | jq empty >/dev/null 2>&1 || continue
FOCUSED=$(echo "$JSON" | jq -r ".[] | select(.name==\"$MONITOR\") | .focused")
if [ "$FOCUSED" = "true" ]; then
pkill -f "$BLACKLAYER_BIN $MONITOR" >/dev/null 2>&1
echo "false" > "$STATE_FILE"
exit 0
fi
done