Skip to content

Follow herdr focus changes in the web UI (opt-in) #311

Closed

Description

@manolitto

Problem

When a script or the herdr CLI moves herdr's focus (for example herdr tab create --focus followed by herdr tab focus <tab_id>), the native herdr terminal switches to the new
tab. The web UI keeps showing whichever pane was selected before. The new tab appears in the sidebar, but I have to click it myself.

My use case is a small wrapper that opens a new tab in the current workspace and starts an agent in it:

out=$(herdr tab create --workspace "$HERDR_WORKSPACE_ID" --cwd "$PWD" --focus)
herdr pane run "$pane_id" "claude"
herdr tab focus "$tab_id"

When I run it from a pane I'm using through the web UI, I'd expect the web UI to jump to the new tab the same way the terminal client does.

Current behaviour (from reading the source, v0.3.41):

  • server/collector.ts already subscribes to pane.focused, and per the comment there it also fires when a tab or workspace is brought to the front.
  • The onFocus handler in server/index.ts only uses the event for completion state (done → idle via completions.seen). It never tells clients which pane is now focused.
  • The client keeps its own selectedPaneId (src/App.tsx, also stored in localStorage). It changes only on user action, a notification tap, or ?pane= at load time.

Environment: herdr 0.9.3 · herdr-web-ui 0.3.41 · macOS 26 (Darwin 25.5)

Proposal

  • In onFocus, also broadcast something like { type: "pane-focused", pane_id } to connected clients.
  • In the client, when that message arrives and a new "Follow herdr focus" setting is enabled, call selectPane(pane_id) (or selectTarget with the current machine).

I'd keep it opt-in, off by default, or limit it to the client that issued the action if that can be identified. Otherwise a focus change at the desk would also switch the
view on a phone that is open on another pane.

Where

Sidebar and navigation

Workarounds and alternatives

No response

Activity

  1. added
    enhancement
    on Oct 2, 2026
  2. added a commit that references this issue on Oct 20, 2026
    aaff6b1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions