feat(desktop): overhaul multi-monitor docking UX
Some checks failed
Check / eval (push) Has been cancelled

This commit is contained in:
Bernardo Magri
2026-07-08 22:29:44 +01:00
parent 05c7c7b54f
commit 8a5714f330
4 changed files with 50 additions and 31 deletions

View File

@@ -197,17 +197,35 @@ ${lib.concatStringsSep "\n" (lib.mapAttrsToList
case "$v" in true|True) return 0 ;; *) return 1 ;; esac
}
outputs() { hyprctl monitors all -j 2>/dev/null | jq -r '.[].name' | sort; }
prev=$(outputs)
while :; do
sleep 3
check_monitors() {
cur=$(outputs)
[ "$cur" = "$prev" ] && continue
prev=$cur
[ -n "$cur" ] || continue
auto_on || continue
target=$(nomarchy-display-profile match $cur) || continue
[ "$target" = "$(nomarchy-display-profile active)" ] && continue
nomarchy-display-profile apply "$target"
[ "$cur" = "$1" ] && return
[ -n "$cur" ] || return
auto_on || return
target=$(nomarchy-display-profile match $cur) || target="base"
if [ "$target" = "base" ]; then
[ "$(nomarchy-display-profile active)" = "none" ] && return
nomarchy-display-profile base
else
[ "$target" = "$(nomarchy-display-profile active)" ] && return
nomarchy-display-profile apply "$target"
fi
echo "$cur"
}
prev=$(outputs)
# Listen to Hyprland's IPC socket for instant hotplug reaction
${pkgs.socat}/bin/socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do
case "$line" in
monitoradded*|monitorremoved*)
res=$(check_monitors "$prev")
[ -n "$res" ] && prev="$res"
;;
esac
done
'';