refactor(display): extract the shared display-transition + keyboard tools (#150)
All checks were successful
Check / eval (push) Successful in 4m29s
All checks were successful
Check / eval (push) Successful in 4m29s
The full nomarchy-display-transition (dock/undock/enable — logging, the lid-inhibitor gate, restore_keyboards, the failure dump) and the nomarchy-keyboard-layout helper it calls move out of hyprland.nix into leaf files (modules/home/display-transition.nix, keyboard-tool.nix), imported by both hyprland.nix and idle.nix. This kills the lossy ~22-line mini idle.nix carried under the same binary name to dodge a circular import. The hypridle wake path (after_sleep / DPMS on-resume) now runs the real undock — restore_keyboards after a reload and the evidence dump on enable-failure — instead of a bare keyword+reload, and the two copies can no longer drift. Behaviour on the hyprland side is unchanged: the built nomarchy-display-transition and nomarchy-keyboard-layout have byte-identical store paths on HEAD vs this change (verbatim extraction). Verify: all four files parse; home activationPackage + system toplevel build; checks.docking-ux green (bash -n + safety-feature greps on the extracted scripts). The tools/monitor-fallback.nix dock harness is red on main already (the #148 reload-mid-dock assertion — identical failure on clean HEAD; filed BACKLOG #154), so it could not gate this. The idle wake-path behaviour change (full undock, incl. dock-intent clearing) is V3 pending: on-hardware suspend/resume + zero-output rescue queued in HARDWARE-QUEUE. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -21,35 +21,23 @@ let
|
||||
'';
|
||||
|
||||
# Absolute store paths for hypridle (thin PATH). Wake reuses the shared
|
||||
# helper; a mini transition avoids a circular import on hyprland.nix.
|
||||
# helper AND the full display-transition tool (#150): idle.nix used to
|
||||
# carry a lossy mini copy to dodge a circular import on hyprland.nix, but
|
||||
# both live in leaf files now, so the wake path gets the real undock —
|
||||
# logging, the enable-failure dump, and restore_keyboards after a reload.
|
||||
displayWake =
|
||||
let
|
||||
miniTransition = pkgs.writeShellScriptBin "nomarchy-display-transition" ''
|
||||
set -u
|
||||
case "''${1:-}" in
|
||||
undock|enable)
|
||||
internal="''${2:-}"
|
||||
[ -n "$internal" ] || exit 64
|
||||
hyprctl keyword monitor "$internal,preferred,auto,1" >/dev/null 2>&1 || true
|
||||
if ! hyprctl monitors -j 2>/dev/null \
|
||||
| ${pkgs.jq}/bin/jq -e --arg m "$internal" 'any(.[]; .name == $m)' \
|
||||
>/dev/null 2>&1; then
|
||||
hyprctl reload >/dev/null 2>&1 || true
|
||||
sleep 0.5
|
||||
fi
|
||||
hyprctl keyword monitor "$internal,preferred,auto,1" >/dev/null 2>&1 || true
|
||||
hyprctl dispatch dpms on >/dev/null 2>&1 || true
|
||||
hyprctl monitors -j 2>/dev/null \
|
||||
| ${pkgs.jq}/bin/jq -e --arg m "$internal" 'any(.[]; .name == $m)' \
|
||||
>/dev/null 2>&1
|
||||
;;
|
||||
*) exit 64 ;;
|
||||
esac
|
||||
'';
|
||||
keyboardTool = import ./keyboard-tool.nix { inherit pkgs lib config; };
|
||||
displayDumpTool =
|
||||
(import ./display-tools.nix { inherit pkgs; }).displayDumpTool;
|
||||
displayTransition = import ./display-transition.nix {
|
||||
inherit pkgs keyboardTool displayDumpTool;
|
||||
sync = lib.getExe config.nomarchy.package;
|
||||
};
|
||||
in
|
||||
(import ./display-tools.nix {
|
||||
inherit pkgs;
|
||||
displayTransition = miniTransition;
|
||||
inherit displayTransition;
|
||||
}).displayWakeTool;
|
||||
in
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user