claim windows by pid, and find the compositor after a restart
Two things stood between "containers enabled" and an application actually sitting on its own output, and neither was where I said it was. ipc: discovery refused whenever two instance directories existed, which every compositor restart leaves behind (a log file where a live compositor used to be). After two rebuilds the broker could not reach any compositor at all, so no container could be created and the pointer had nothing to aim at. It now asks each candidate for its version and uses the one that answers, preferring the newest only when two answer, and still refusing when none do. container_host.claim: windows are assigned by the pid the compositor already reports, not by the class stamp the per-session rule matches -- foot, GTK, Qt and the chromium wrapper all ignore that stamp, so the desk was created and left empty while the window sat in special:quarantine. The claim moves the window to its desk's workspace, makes that workspace the one the desk is showing, and reads back: the record says where the window is, never where it was sent. Called from both places a window can appear -- the read-back at start and container.reconcile -- and skipped in the steady state, because a move is a real change on screen and should not be dispatched for its own sake.
This commit is contained in:
1 parent
336474793f
commit
352cfdcb24
6 files changed
+359
-12
No files matched your search
@@ -276,6 +276,47 @@ def test_container_reconcile_reports_the_difference_it_repaired(rig: Rig):
|
||||
assert rig.daemon.session(session_id)["window"] is None
|
||||
|
||||
|
||||
def test_a_window_that_lands_outside_its_desk_is_moved_onto_it(rig: Rig):
|
||||
"""The case the class-matching rule could never handle.
|
||||
|
||||
Every allowlisted application keeps its own class, so the per-session rule
|
||||
matches nothing and the window is swept to the quarantine backstop — a desk
|
||||
created and left empty. The compositor reports each client's pid, so the
|
||||
window can still be claimed: moved onto its own desk's workspace, with that
|
||||
workspace made the visible one, and read back afterwards to say so.
|
||||
"""
|
||||
|
||||
rig.compositor.auto_window = False
|
||||
session_id = start(rig.daemon, "sleeper")
|
||||
# It turns up on the main screen instead — where a quarantined window goes.
|
||||
rig.compositor.add_window(f"hh-{session_id}", 1, "HEADLESS-1", pid=WINDOW_PID)
|
||||
|
||||
rig.daemon.call("container.reconcile", id=session_id)
|
||||
|
||||
record = rig.daemon.session(session_id)
|
||||
desk = record["container"]
|
||||
assert record["workspace"] == desk["workspace"], "the read-back says where it is"
|
||||
assert record["foreground"] is True, "its desk is showing it"
|
||||
assert desk["state"] != "degraded"
|
||||
commands = rig.plan_commands()
|
||||
assert (
|
||||
f"dispatch movetoworkspacesilent {desk['workspace']},"
|
||||
f"address:{record['window']['address']}" in commands
|
||||
), commands
|
||||
assert f"dispatch workspace {desk['workspace']}" in commands, commands
|
||||
|
||||
|
||||
def test_a_window_already_on_its_desk_is_not_moved(rig: Rig):
|
||||
"""The steady state costs nothing: a move is a real change on screen."""
|
||||
|
||||
session_id = start(rig.daemon, "sleeper")
|
||||
|
||||
rig.daemon.call("container.reconcile", id=session_id)
|
||||
|
||||
assert rig.daemon.session(session_id)["workspace"] == 1000
|
||||
assert not [c for c in rig.plan_commands() if c.startswith("dispatch")]
|
||||
|
||||
|
||||
# ===========================================================================
|
||||
# the start-up scan
|
||||
# ===========================================================================
|
||||
|
||||
Reference in new issue
Block a user