Files
dotfiles/hypr/.config/hypr/monitor-events.sh
Bertrand Benjamin 818df22812 hypr: package séparé avec --no-folding pour compatibilité source= hyprland
Hyprland ne suit pas les symlinks de répertoires dans les directives source=.
Package hypr/ distinct du package hyprland/, stowé avec --no-folding pour
créer des symlinks fichier par fichier dans ~/.config/hypr/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 06:47:34 +02:00

30 lines
795 B
Bash
Executable File

#!/usr/bin/env bash
# Écoute les événements Hyprland IPC et reconfigure les moniteurs à chaud
MANAGER=~/.config/hypr/monitor-manager.sh
SOCKET="/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock"
# Attendre que Hyprland soit prêt
until [[ -S "$SOCKET" ]]; do sleep 0.2; done
sleep 1
# Configuration initiale
"$MANAGER"
# Debounce : annule et replanifie si plusieurs événements arrivent d'un coup (dock, etc.)
PENDING_PID=""
configure_debounced() {
[[ -n "$PENDING_PID" ]] && kill "$PENDING_PID" 2>/dev/null
(sleep 0.8; "$MANAGER") &
PENDING_PID=$!
}
# Écouter la socket IPC
socat -u "UNIX-CONNECT:$SOCKET" STDOUT | while IFS= read -r line; do
case "${line%%>>*}" in
monitoradded|monitorremoved)
configure_debounced
;;
esac
done