fix(docking): make workspace and lid transitions atomic
All checks were successful
Check / eval (push) Successful in 3m19s

Restore the old flake's external-only workspace handoff, protect closed-lid cable removal with a verified low-level logind inhibitor, and use monitor-added as the settled audio reprobe boundary.

Verified: V2 — nix flake check --no-build; docking-ux, option-docs, and template-sot checks; KVM tools/monitor-fallback.nix lifecycle test.

V3 pending: closed-lid BenQ round 4 in agent/HARDWARE-QUEUE.md.
This commit is contained in:
2026-07-13 13:56:54 +01:00
parent cffe432912
commit 2a34c7398b
12 changed files with 654 additions and 292 deletions

View File

@@ -789,7 +789,6 @@
.home-manager.users.${username};
gen = hm.home.activationPackage;
hyprconf = hm.xdg.configFile."hypr/hyprland.conf".source;
audio = toString hm.systemd.user.services.nomarchy-dock-audio.Service.ExecStart;
in
assert hm.programs.rofi.extraConfig.monitor == -1;
pkgs.runCommand "nomarchy-docking-ux"
@@ -799,11 +798,15 @@
menu=$(find ${gen}/home-path/bin -name nomarchy-menu | head -1)
keyboard=$(find ${gen}/home-path/bin -name nomarchy-keyboard-layout | head -1)
watcher=$(find ${gen}/home-path/bin -name nomarchy-display-profile-watch | head -1)
test -n "$menu" -a -n "$keyboard" -a -n "$watcher"
transition=$(find ${gen}/home-path/bin -name nomarchy-display-transition | head -1)
audio=$(find ${gen}/home-path/bin -name nomarchy-dock-audio | head -1)
test -n "$menu" -a -n "$keyboard" -a -n "$watcher" \
-a -n "$transition" -a -n "$audio"
bash -n "$menu"
bash -n "$keyboard"
bash -n "$watcher"
bash -n ${audio}
bash -n "$transition"
bash -n "$audio"
"$keyboard" layouts > layouts.txt
test "$(wc -l < layouts.txt)" -gt 50
grep -qx us layouts.txt
@@ -814,12 +817,31 @@
grep -q 'nomarchy-display-profile-watch' ${hyprconf}
grep -q -- '--quiet wallpaper' "$watcher"
grep -q 'Dock mode' "$menu"
grep -q 'moveworkspacetomonitor' "$menu"
grep -q 'nomarchy-display-transition dock' "$menu"
grep -q -- '--what=handle-lid-switch' "$watcher"
grep -q 'systemd-inhibit' "$watcher"
grep -q 'systemd-inhibit --list --json=short' "$watcher"
grep -q 'lid-inhibitor=stale-cleaned' "$watcher"
grep -q 'setsid.*systemd-inhibit' "$watcher"
grep -q 'nomarchy-dock-lid-inhibitor' "$watcher"
! grep -q 'exec -a nomarchy-dock-lid-inhibitor' "$watcher"
grep -Fq 'kill -TERM -"$pid"' "$watcher"
grep -q 'done < <(' "$watcher"
grep -q '"$TRANSITION" undock' "$watcher"
grep -q 'nomarchy-dock-audio reprobe monitoradded' "$watcher"
grep -q 'hyprctl --batch' "$transition"
grep -q 'keyword monitor.*disable' "$transition"
grep -q 'result=no-lid-inhibitor' "$transition"
grep -q 'transition=undock.*action=enable\|keyword monitor.*preferred' "$transition"
grep -q 'nomarchy-keyboard-layout' "$menu"
! grep -q 'Laptop screen off' "$menu"
grep -q "'change':card" ${audio}
grep -q 'availability' ${audio}
echo "docking-ux: focused menu + safe display + keyboard/audio watchers present"
grep -q 'action=reprobe-start' "$audio"
grep -q 'restart.*pipewire\|pipewire.service' "$audio"
grep -q 'set-default-sink' "$audio"
grep -q 'subscription-closed' "$audio"
grep -q 'result=no-available-dock-sink' "$audio"
! grep -q 'power_save' "$audio"
echo "docking-ux: atomic display, lid inhibitor, and monitor-triggered audio reprobe present"
touch $out
'';