From b22ae83e6af816b93c7d9729f39f2260934e4176 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Thu, 29 Oct 2026 00:33:27 -0700 Subject: [PATCH] feat(nix): the command sweep plugs in a second display when it needs one The sweep has commands that name the second monitor, send-to-monitor 1 and the ones after it, so it needs two displays. The KDE suite runs with two outputs and never noticed. On Windows, with one display, the first run of the sweep reported that after send-to-monitor 1 kfw managed one window fewer than the OS had, and every command after it was reported unhealthy; whether that is kfw losing a window sent to a monitor that does not exist has not been confirmed by hand. The sweep now plugs in a display first if the platform has one, and a fake with one display shows it does. --- .../vm/lib/komorebi_vm/core/scenarios/commands.py | 9 ++++++++- nix/tests/vm/lib/tests/test_focus_moving.py | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/nix/tests/vm/lib/komorebi_vm/core/scenarios/commands.py b/nix/tests/vm/lib/komorebi_vm/core/scenarios/commands.py index d9a3087f..96e04caa 100644 --- a/nix/tests/vm/lib/komorebi_vm/core/scenarios/commands.py +++ b/nix/tests/vm/lib/komorebi_vm/core/scenarios/commands.py @@ -321,7 +321,14 @@ def sweep( ) -> None: """Runs every command of `commands` (`SWEEP`), and checks that it is understood and leaves the daemon healthy. `config` is the path, on the platform, of a file the daemon can be told to - load.""" + load. + + The sweep has commands that name the second monitor (`send-to-monitor 1`), so it needs two + displays: one is plugged in first if the platform has only one. + """ + if len(platform.displays()) < 2: + platform.add_display() + platform.wait_for(lambda: len(platform.state().monitors) >= 2, timeout=30) for line in commands: words = line.format(config=config).split() status, out = platform.komorebic_status(*words) diff --git a/nix/tests/vm/lib/tests/test_focus_moving.py b/nix/tests/vm/lib/tests/test_focus_moving.py index b6f3fc48..fa58aa83 100644 --- a/nix/tests/vm/lib/tests/test_focus_moving.py +++ b/nix/tests/vm/lib/tests/test_focus_moving.py @@ -202,3 +202,13 @@ def test_a_daemon_that_does_not_see_the_displays_fails_hotplug() -> None: clients = opened(platform, checks) hotplug.run(platform, checks, clients) assert any("a monitor for each display" in f for f in checks.failures) + + +def test_the_sweep_plugs_in_a_second_display_when_there_is_only_one() -> None: + platform = FakePlatform() + platform.display_count = 1 + checks = Checks() + clients = opened(platform, checks) + commands.sweep(platform, checks, clients, config="unused", commands=("focus right",)) + assert platform.display_count == 2 + assert checks.failed == 0, checks.failures