Files
komorebi/nix/linux/tests/vm/suites/workspace-rules/test.py
T
LGUG2Z f01853ceca refactor(repo): move the KDE and macOS nix files under nix/ (pure move)
komorebi-for-kde/nix/ -> nix/linux/
komorebi-for-mac/nix/ -> nix/macos/

The nix expressions of the platforms (modules, option files, VM test suites, kwin effects,
the darwin module) sit next to the existing nix/workspace-src.nix. Renames only (252
files); the flakes that import them are replaced by one root flake later in this stack, so
nix does not evaluate at this revision.
2026-11-05 15:03:27 -08:00

41 lines
1.9 KiB
Python

# Workspace rules in a real KWin: a rule sends the windows of an application to a workspace, which
# is a virtual desktop, so that a window that opens on the desktop in front leaves the workspace in
# front and is hidden, on the parking desktop, until its workspace is shown. The shared scenarios
# (`komorebi_vm.core.scenarios.rules` and `startup_rules`, which run on Windows too) check where the
# daemon puts the window, that an initial rule sends it once and a permanent rule sends it again,
# and the rules of a `komorebi.json` for a window that was open before the daemon. What only a real
# KWin can tell is in `komorebi_vm.platforms.kde.extras.workspace_rules`: that the window is on the
# desktop of its workspace and out of sight on the parking desktop while another desktop shows,
# also for a rule by the name of a workspace. That a rule is applied at the next event is a check
# of the shared `rules`.
# `komorebi/tests/workspace_rules.rs` checks the same against the fake.
from komorebi_vm import Checks, Kde
from komorebi_vm.core.scenarios import rules, startup_rules
from komorebi_vm.core.suite import platform_only, run_suite, shared
from komorebi_vm.kde_platform import KdePlatform
from komorebi_vm.platforms.kde.extras import workspace_rules as kde_rules
start_all()
machine.wait_for_unit("multi-user.target")
machine.wait_for_unit("user@1000.service")
checks = Checks()
kde = Kde.headless(machine, "main", size=(1920, 1080), scale=SCALE)
platform = KdePlatform(kde, (1920, 1080))
platform.start_komorebi()
args = (platform, checks, [])
run_suite(
checks,
platform_only("kde", kde_rules.desktops, *args),
platform_only("kde", kde_rules.named_rule, *args),
platform_only("kde", kde_rules.cleared, *args),
shared(rules.run, platform, checks),
shared(startup_rules.run, platform, checks),
)
kde.stop_komorebi()
checks.check("a clean stop", not kde.komorebi_running())
kde.stop()
checks.finish()