mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-30 04:04:09 +01:00
feat(nix): unknown_monitor, a window sent to no monitor must stay managed
The scenario sends the focused window to monitor 7 with send-to-monitor and move-to-monitor, which no display has, and checks that the daemon still manages every window. A port may refuse or ignore the command, but a window that was managed has to stay so: one that is not is left on the screen with nothing tiling it. It found a bug in both ports. kfw managed one window fewer than the OS had afterwards (seen by hand on a Windows guest), and kfde failed it in core-e2e on a real KWin: move_container_to_monitor takes the focused container out of its workspace before it looks the monitor up, so the error for a monitor that is not there comes after the container is gone. It is not fixed, so the scenario is not in core-e2e, which would fail; BEHAVIOUR.md has the finding. Its unit tests run it against a fake that loses the window and one that ignores the command.
This commit is contained in:
1 parent
b22ae83e6a
commit
32b08d1b77
4 files changed
+57
-1
No files matched your search
+15
-1
@@ -35,7 +35,8 @@ runs, and goes stale when the code changes.
|
||||
| `workspaces` | `send-to-workspace` and `focus-workspace` put windows away and bring them back | pass | pass |
|
||||
| `closing` | a closed window leaves the state, and the others take its room | pass | pass |
|
||||
| `resize` | dragging the edge two tiles share moves it by what the pointer moved | pass | **fails**, cause found |
|
||||
| `commands` | every layout, and about 216 commands, leave the daemon healthy | pass, none skipped | not run |
|
||||
| `commands` | every layout, and about 216 commands, leave the daemon healthy | pass, none skipped | not run, see below |
|
||||
| `commands.unknown_monitor` | a window sent to a monitor that does not exist stays managed | **fails** | **fails** |
|
||||
| `rules` | initial, permanent and ignore rules by title | see below | not run |
|
||||
| `hotplug` | an unplugged display takes its windows to the other, a plugged one is a monitor | pass | not run |
|
||||
|
||||
@@ -45,6 +46,19 @@ and the cause is not known.
|
||||
|
||||
## What they have found
|
||||
|
||||
**A window sent to a monitor that does not exist is lost, on both ports.** After
|
||||
`komorebic send-to-monitor 7` (or `move-to-monitor 7`) on a desktop with one monitor, the daemon
|
||||
stops managing the focused window and leaves it on the screen with nothing tiling it. On kfw this
|
||||
was seen on a Windows guest: three windows managed and present, then two managed and three
|
||||
present, with the command exiting 0 and printing nothing. On kfde `core-e2e` failed the scenario's
|
||||
check on a real KWin, and the windows after it. kfde's code shows how:
|
||||
`WindowManager::move_container_to_monitor` takes the focused container out of its workspace with
|
||||
`remove_focused_container()` and only then looks the monitor up, with an error for one that is not
|
||||
there, so the container is gone when the error is returned. This is not fixed, on either port. The
|
||||
scenario is `commands.unknown_monitor`, which a suite can call; it is not in `core-e2e` while it
|
||||
would fail there. The sweep of `commands` is not affected on kfde, which has two outputs, and on
|
||||
kfw the sweep now plugs in a second display first.
|
||||
|
||||
**`resize` on kfw.** Dragging the edge between two tiles by 30, 60 and 120 pixels moved it by 27,
|
||||
53 and 96 on kfw's master, and by 27, 51 and 106 on its animation branch (`0c9acdf4`), where kfde
|
||||
moves it by exactly the pointer's distance. The pointer is not the cause: the same drag of the
|
||||
|
||||
@@ -353,3 +353,20 @@ def prints(platform: Platform, checks: Checks) -> None:
|
||||
checks.skip(f"komorebic {line}", "the port has no such command")
|
||||
continue
|
||||
checks.check(f"komorebic {line}", status == 0)
|
||||
|
||||
|
||||
def unknown_monitor(platform: Platform, checks: Checks, clients: list[Client]) -> None:
|
||||
"""Sends the focused window to a monitor that does not exist, and checks that no window is lost.
|
||||
|
||||
A port may refuse the command or ignore it, but a window that was managed has to stay managed:
|
||||
a daemon that stops managing it leaves it on the screen with nothing tiling it. The platform
|
||||
has fewer than seven displays.
|
||||
"""
|
||||
managed = platform.state().managed()
|
||||
for command in ("send-to-monitor", "move-to-monitor"):
|
||||
platform.komorebic_status(command, "7")
|
||||
platform.wait_for(lambda: unhealthy(platform, clients) is None, timeout=5)
|
||||
checks.check(
|
||||
f"after {command} 7, which no display has, the daemon still manages every window",
|
||||
platform.state().managed() == managed and unhealthy(platform, clients) is None,
|
||||
)
|
||||
@@ -241,6 +241,8 @@ class FakePlatform:
|
||||
self.spaces[int(number)].append([window])
|
||||
case ("change-layout", _):
|
||||
pass
|
||||
case ("send-to-monitor", _):
|
||||
pass
|
||||
case ("move-to-monitor", number):
|
||||
if int(number) < self.display_count:
|
||||
self.display_of[self.containers[self.focus][0]] = int(number)
|
||||
|
||||
@@ -212,3 +212,26 @@ def test_the_sweep_plugs_in_a_second_display_when_there_is_only_one() -> None:
|
||||
commands.sweep(platform, checks, clients, config="unused", commands=("focus right",))
|
||||
assert platform.display_count == 2
|
||||
assert checks.failed == 0, checks.failures
|
||||
|
||||
|
||||
def test_a_daemon_that_loses_a_window_sent_to_no_monitor_fails() -> None:
|
||||
class Loses(FakePlatform):
|
||||
def komorebic_status(self, *args: str) -> tuple[int, str]:
|
||||
if args[:1] == ("send-to-monitor",):
|
||||
self.containers[self.focus].clear()
|
||||
return 0, ""
|
||||
return super().komorebic_status(*args)
|
||||
|
||||
platform = Loses()
|
||||
checks = Checks()
|
||||
clients = opened(platform, checks)
|
||||
commands.unknown_monitor(platform, checks, clients)
|
||||
assert any("send-to-monitor 7" in f for f in checks.failures)
|
||||
|
||||
|
||||
def test_a_daemon_that_ignores_a_monitor_that_does_not_exist_passes() -> None:
|
||||
platform = FakePlatform()
|
||||
checks = Checks()
|
||||
clients = opened(platform, checks)
|
||||
commands.unknown_monitor(platform, checks, clients)
|
||||
assert checks.failed == 0, checks.failures
|
||||
Reference in new issue
Block a user