Skip to content

feat(multi-pc): rulers on the remote's screens - #817

Merged
mgth merged 7 commits into
v6from
feat/mpc-remote-rulers
Nov 24, 2026
Merged

mgth merged 7 commits into
v6from
feat/mpc-remote-rulers

Conversation

@mgth

@mgth mgth commented Nov 24, 2026

Copy link
Copy Markdown
Owner

In multi-PC mode, "Rulers on screens" (Location mode) now draws the rulers on the remote's screens too. Each ruler sits at its own place and its physical size, as on the master's screens. Until now only the master's own screens got them.

How it works

  • The master computes them (lbm-app/src/remote_rulers.rs). For each remote on the map, it takes the layout with every other machine's sources off their desktop and runs the same lbm_overlay::scene::from_layout it uses for its own screens. The millimetres come from the master: where the zero falls, the measured panel's length, each screen's physical size. The pixels, the scale and the output name come from what the remote reported in Displays. A set is sent only when it changes (a drag sends one per redraw, a still layout sends none).
  • Agent API: PeerOverlay { MachineId, Bands } (capability PeerOverlay). The frontend that asked owns the rulers: when its connection ends, the agent takes them down on every remote. OverlayError on the remote's entry in Peers says why a remote does not show them. The window shows that message under the toggle.
  • Wire: Control::Overlay { Revision, Bands } (master → remote, empty takes them down) and Control::OverlayFailed { Revision, Error } (remote → master). They are sent only to a remote whose Hello lists RemoteOverlay. An older remote is sent nothing, and the master's user is told it cannot show rulers. A higher revision wins. A failure of an earlier revision is not shown.
  • The remote checks, then draws (lbm-agent/src/peers/overlay.rs). Every band must be a ruler on one of its attached screens as they are now (same output, same pixel rectangle, same scale). Otherwise the whole set is refused, so a master working from an older report cannot draw across the wrong place. They are drawn by the new lbm_overlay::Standalone, and they are passive (new Band::passive): the pointer and the keyboard go through them. Rulers are still dragged on the master's own screens.
    • Windows: layered windows owned by a hidden window, on a thread that waits on its message queue only.
    • Linux: the existing helper process (the agent now dispatches --screen-overlay-host, as lbm-app does). The helper has a two-second lease, so the thread renews it every 500 ms, only while rulers are shown.
  • Never orphaned: the rulers go on an empty set (rulers off, Escape, another mode, the remote leaving the map). They also go when the master's frontend goes, when the link ends, when the mode is turned off on either side, and when the remote's screens change (checked again; the master sends a new set from the new Displays). A display change seen by the surfaces themselves takes them down too. The thread and the surfaces exist only while something is shown. Nothing runs while the mode is off.

Tools

  • examples/peer_drive gains rulers N (computed from the remote's Displays by the master's own scene code) and norulers. It prints OverlayFailed while it sleeps.
  • New examples/peer_remote runs the agent's multi-PC manager alone, with real rulers and no hook. It holds no instance lock, so it can run beside a user's running agent on another port.

Tests

  • lbm-net: wire round-trip of Overlay/OverlayFailed; empty Bands may be left out.
  • lbm-agent unit: what the remote accepts (screens as they are; a moved, unplugged, detached or rescaled screen; non-ruler content; out-of-screen rect; unreadable band; more than 64 bands).
  • lbm-agent/tests/peers.rs, with a recording painter instead of real surfaces:
    • drawn, updated, an older revision ignored, a wrong screen refused with OverlayFailed, taken down when the link drops;
    • taken down when the remote's screens change, when the surfaces fail, and when the mode is turned off;
    • a machine that is not this one's master is not obeyed;
    • only the latest revision's failure is shown to the master.
  • lbm-agent/tests/api.rs: PeerOverlay is passed on unread and taken down when the frontend's connection ends; a remote without the capability is sent nothing and OverlayError says so.
  • lbm-app: the remote's bands come in its own pixels and measure the selected panel; a remote off its desktop gets none; only changes are sent; turning off empties every remote; an agent without the capability is never asked; errors are shown.
  • cargo clippy --workspace --all-targets clean; lbm-hook and lbm-agent (all targets, examples included) clean for x86_64-pc-windows-gnu.

Tried on real hardware

  • Windows remote, vm124 (4K at 1.5 + 1080p). peer_drive on the Linux machine played the master; peer_remote (MSVC release) was the remote, next to the maintainer's installed agent, which kept running untouched. Results:
    • rulers drawn at their place on both screens;
    • the measured zone follows the panel chosen (rulers 0 then rulers 1), and the update worked;
    • taken down on norulers and when the master was killed (kill -9);
    • the pointer goes through them: WindowFromPoint on a ruler returns the desktop beneath.
  • Linux remote surfaces: Standalone drew, updated and renewed its lease inside a nested headless KWin (kwin_wayland --virtual, layer-shell), and the helper process was gone afterwards. This was not tried on a real desktop.

Never run on real hardware

  • The whole chain from lbm-app on a real master (the window's computation and its PeerOverlay requests). It is covered by tests only; only the peer_drive → remote path ran.
  • A Linux remote on a real desktop (Wayland or X11).
  • The window's error line for a remote's refusal (never seen on screen).

Known limits

  • Rulers on the remote cannot be dragged.
  • "Rulers on screens" stays disabled when the selected screen is the remote's, as before.

docs/multi-pc.md gains "Rulers on a remote's screens". docs/multi-pc-etat.md is updated (delivered, tried, never tried, work in progress).

🤖 Generated with Claude Code

mgth and others added 3 commits November 24, 2026 15:41
The master's editor computes each remote screen's rulers from its layout,
in millimetres and in that remote's own pixels, and sends them through its
agent (PeerOverlay -> Control::Overlay, capability RemoteOverlay). The
remote checks every band against its screens as they are now and draws
them, passive, with lbm_overlay::Standalone on surfaces that exist only
while shown. They go with the link, the master's frontend, the mode, or a
display change; a failure comes back as OverlayFailed / OverlayError.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… node alone

peer_drive gains 'rulers N' (computed from the remote's Displays by the
master's own scene code) and 'norulers', and prints OverlayFailed while
it sleeps. peer_remote runs the agent's multi-PC manager with real
overlays and no hook, beside a user's running agent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A remote's OverlayFailed for a revision the master has since replaced is
old news and no longer shows. lbm-app shows no computed error when the
agent cannot send rulers at all. Docs: 'Rulers on a remote's screens' in
multi-pc.md, and the state of the work (delivered, tried on vm124 and in
a nested KWin, never tried) in multi-pc-etat.md. Drops a trial example
committed by mistake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@mgth mgth left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Les trois tests d’intégration ciblés sur les règles distantes passent. Un test avec deux connexions à l’API reproduit un effacement par l’ancien éditeur.

Comment thread rust/crates/lbm-agent/src/runtime.rs Resolved
mgth and others added 2 commits November 24, 2026 16:05
Review: window A turning its rulers off sent an empty Overlay to a remote
whose rulers window B, still open, had replaced since; B keeps its scene
cached and would not resend it. Each remote now records the client that
wrote its rulers last; only that client's empty request or departure
takes them down. Test with two API connections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…/mpc-remote-rulers

# Conflicts:
#	docs/multi-pc-etat.md

@mgth mgth left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contrôle après intégration de v6 sur 75b7192c. Les trois tests d’API sur les règles passent. Quand B remplace les règles de A, leur affichage survit à la demande d’effacement et à la déconnexion de A. B peut toujours les retirer. La résolution du conflit documentaire conserve les deux fonctionnalités.

mgth added a commit that referenced this pull request Nov 24, 2026
Review of #819: #816, #817 and #818 are still open, so "none" was wrong.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mgth added 2 commits November 24, 2026 16:55
…/mpc-remote-rulers

# Conflicts:
#	docs/multi-pc-etat.md
…/mpc-remote-rulers

# Conflicts:
#	rust/crates/lbm-agent/examples/peer_drive.rs
#	rust/crates/lbm-agent/src/peers/actor.rs
#	rust/crates/lbm-agent/src/peers/mod.rs
#	rust/crates/lbm-agent/tests/peers.rs
#	rust/crates/lbm-net/src/wire.rs

@mgth mgth left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recontrôlé après l’intégration de v6 et de #818 sur 40385b04. Les trois tests d’API sur les règles distantes passent, dont le remplacement des règles de A par B puis la déconnexion de A. Le gestionnaire conserve aussi le traitement des blocages Windows. La CI est verte.

@mgth
mgth merged commit 9d66615 into v6 Nov 24, 2026
3 checks passed
@mgth
mgth deleted the feat/mpc-remote-rulers branch November 24, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant