Repository navigation
Let a socket focus request target one client (workspace.focus / tab.focus for the caller), not every attached client #5878
digitalmud
started this conversation in
Ideas
Replies: 1 comment
|
+1 from a real use case. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Since 0.9.0 each attached client keeps its own workspace and tab, which is great. But every focus request on the socket API (
workspace.focus,tab.focus,agent.focus,pane.move --focus) is applied to all attached clients. Anything that navigates through the API — a palette plugin, a mobile remote such as Moshi's sidebar, a task-runner "jump to this tab" link — therefore drags every attached screen to the same tab, even though the person only meant the one they are holding.Request: a way to scope a focus request to one client. Two shapes that would work:
workspace.focus/tab.focusaccept an optionalclient: "caller", resolved from the pane the CLI runs in (a plugin action or a key-bound command already runs inside a pane that belongs to a specific client's view), orclient_idparameter, paired with exposing attached clients insession.snapshot(the ask in Expose per-client identity (pid/tty + currently-viewed pane) in the snapshot/socket API #4900).Either keeps today's broadcast as the default, so existing scripts keep working.
What I measured (0.9.5, macOS, one server, three attached clients)
workspace.focused/tab.focusedevents and greppedapi.request.startinherdr-server.logfor the same seconds.prefix+],prefix+w) on one client never moved another: three sidebar clicks on one client at 23:45:34–45Z, no public request logged, the other two clients stayed put. A fresh 42×19 client started asherdr --session defaultbehaved the same.api.request.start request_id="moshi-hook" method="workspace.focus"thentab.focus— a mobile sidebar tap — moved the Mac client and a fresh observer client alike. A plugin palette that ends inherdr workspace focus+herdr tab focus(request_id="cli:workspace:focus") does the same.handle_api_request_with_shutdown_checkcallsfocus_all_shell_clients_on_default_target()whenever a public focus succeeds, while the client-shell endpoint path (apply_shell_navigation_request) updates only the calling client'sClientShellLocation. The deferred client-scoped navigation exists today only forworktree_created/worktree_openedresponses.Why it matters
The 0.9.1 change (#4153) was right for "a script moved my pane, follow it". It is the wrong default for the growing class of navigation UIs built on the API — palettes, mobile remotes, "open the agent that needs me" buttons — which are exactly the tools multi-client users reach for. Related: #5508 (clients collapsing onto one workspace after reconnect), #5805 (someone asking for the opposite, a sync option — a per-request scope would serve both).
Happy to test a preview.
All reactions