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.
This commit is contained in:
LGUG2Z committed 2026-10-30 12:03:00 -07:00
1 parent 631d8267f3
commit b22ae83e6a
2 files changed
+18 -1

No files matched your search

@@ -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)
@@ -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