feat(desktop): overhaul multi-monitor docking UX
Some checks failed
Check / eval (push) Has been cancelled
Some checks failed
Check / eval (push) Has been cancelled
This commit is contained in:
@@ -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
|
||||
'';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user