wire the broker to the compositor, containers and pointer
The four slices existed and nothing called them. Now the broker builds a
spatial container per session, reads back what the compositor actually did,
and aims the cursor into one container under a broker-wide lease.
Record schema 3 (registry.py): `container` {output, workspace, mode,
created_by, state}, `pointer` {bookmark, last_released_at, released_by} and
the compositor's `signature`. A v2 record is migrated on load, not refused —
its application is still running. Every field that could not be verified is
null; `container: null` means "no container", never "probably something".
Containers (new container_host.py, manager.py, launcher.py): `start`
allocates a slot from `WorkspaceAllocator`, runs `container_plan()`'s argv,
launches the app with the container stamp in its environment, then reads the
workspace, output and window back out of `clients -j`. Teardown removes the
output, releases the slot and reports survivors rather than claiming success
— and runs for an unprompted exit and for `gc` too, so no container is ever
left unattended. Broker start-up reconciles: adopt `hh-*` outputs a live
session claims, remove the rest, `contains_output()` being the only filter.
No IPC means `container: degraded` and lifecycle verbs unchanged.
The plans' argv are dispatched over the compositor's request socket rather
than by executing `hyprctl`, which is what hyprctl does with the same words;
the reply is checked, so a refused command is not recorded as a container.
Pointer (new driver.py, manager.py): a client for the driver's private
socket, and `pointer.acquire|move|button|click|release|state` on top of
`PointerLease`. The broker owns the lease, the driver executes. The bookmark
is marked on every move and before release and stored in the record, so it
survives a restart. On expiry `pressed()` is read before `expire()` and
`release_all` goes to the driver, because the lease cannot lift a button
itself; a sweep runs unprompted so the TTL is a promise.
containers.py to v2: `quarantine_plan()` -> `quarantine_argv()`, with the
before-any-per-session-rule ordering stated where the caller could get it
wrong. protocol.py: 9 NO_LEASE, 10 COMPOSITOR, the verb table, and the
`request_id` cache moved out of the server so the CLI agrees with it.
Tests: real AF_UNIX everywhere — a stateful fake compositor and the shipped
pointer driver behind a recording sink. No mocked sockets, no compositor, no
VM. 551 -> 693.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mUq7QvQ9EZb2Wi35xj4cs
This commit is contained in:
1 parent
20b2aee109
commit
129430bffd
20 files changed
+4805
-89
No files matched your search
+27
-27
@@ -173,44 +173,44 @@ def container_plan(
|
||||
)
|
||||
|
||||
|
||||
def quarantine_plan(quarantine_workspace: str) -> ContainerPlan | None:
|
||||
def quarantine_argv(quarantine_workspace: str) -> list[list[str]] | None:
|
||||
"""The backstop rule: a window that matched no container goes here.
|
||||
|
||||
Without it, a window with an unexpected class — a dialog spawned by a
|
||||
helper process, a toolkit that rewrites its class — lands on whatever
|
||||
workspace is in front, which is the leak containers exist to prevent. The
|
||||
rule matches every class and is therefore emitted *before* the per-session
|
||||
rules, which are anchored and more specific.
|
||||
workspace is in front, which is the leak containers exist to prevent.
|
||||
|
||||
``quarantine_workspace`` is a workspace *name* (``special:quarantine``), not
|
||||
a slot out of the allocator's band, so the returned plan carries no output
|
||||
and no mode: it is a rule, not a container. An empty or blank name means
|
||||
the operator turned the backstop off, and the answer is ``None`` rather than
|
||||
a plan with an empty command list — a caller that gets a plan should always
|
||||
have something to run.
|
||||
**Install it before any per-session rule.** Hyprland evaluates window
|
||||
rules in the order the keywords were issued and this one matches every
|
||||
class, so a quarantine rule issued *after* a session's anchored rule
|
||||
overrides it and every window in the system ends up in the special
|
||||
workspace — containers included. The ordering cannot be enforced from
|
||||
here, because this module never runs anything; the broker installs it once
|
||||
at start-up, before the first ``container_plan`` is executed, and
|
||||
:mod:`hhstreamd.container_host` says so at the call site.
|
||||
|
||||
``quarantine_workspace`` is a workspace *name* (``special:quarantine``),
|
||||
not a slot out of the allocator's band — which is why this returns bare
|
||||
argv and not a :class:`ContainerPlan` (CONTRACT-sessions.md v2 §3.2): a
|
||||
quarantine rule has no output, no numbered workspace and no mode, and
|
||||
``container_plan`` refuses the zero size one would have to invent. An
|
||||
empty or blank name is how "disabled" is spelled, and the answer is
|
||||
``None`` rather than an empty list — a caller that gets commands should
|
||||
always have something to run.
|
||||
"""
|
||||
|
||||
target = quarantine_workspace.strip()
|
||||
if not target:
|
||||
return None
|
||||
_checked_rule_value(target, "quarantine_workspace")
|
||||
return ContainerPlan(
|
||||
output="",
|
||||
workspace=0,
|
||||
mode=(0, 0),
|
||||
create=[
|
||||
[
|
||||
"hyprctl",
|
||||
"keyword",
|
||||
"windowrule",
|
||||
f"match:initial_class .*, workspace {target}",
|
||||
]
|
||||
],
|
||||
# A keyword rule cannot be unset one at a time, and this one is not
|
||||
# per-session anyway: it is installed once at start-up and goes away
|
||||
# with the compositor.
|
||||
teardown=[],
|
||||
)
|
||||
return [
|
||||
[
|
||||
"hyprctl",
|
||||
"keyword",
|
||||
"windowrule",
|
||||
f"match:initial_class .*, workspace {target}",
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
class WorkspaceAllocator:
|
||||
|
||||
Reference in new issue
Block a user