Skip to content

feat(terminal): publish session focus-URL env vars on spawn - #80

Merged
jwp2987 merged 1 commit into
mainfrom
feat/session-focus-env
Aug 5, 2026
Merged

feat(terminal): publish session focus-URL env vars on spawn#80
jwp2987 merged 1 commit into
mainfrom
feat/session-focus-env

Conversation

@jwp2987

@jwp2987 jwp2987 commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Part of #2 / the #11 feature-parity ledger ("deep-link focus-URL env plumbing").

What

The app already handles the consumer side of the <scheme>://session/<uuid-hex> deeplink (crate::uri's UriHost::SessionPaneGroup::find_terminal_pane_by_session_uuid), but nothing published that URL into the terminal's environment — so a process inside a session couldn't deep-link back to its own pane (e.g. to focus it when a long-running command finishes).

How

  • New app/src/terminal/focus_env.rs: WARP_FOCUS_URL + WARP_TERMINAL_SESSION_UUID, session_focus_url, add_session_focus_env_vars (ported from Warp).
  • Called from PaneGroup::create_session — the single session-creation choke point. create_session now takes session_uuid: &[u8]; each of the 5 callers threads the same UUID it builds the pane with, so the published deeplink resolves back to that pane.
  • initial_single_terminal_pane minted its UUID after create_session; moved it above the call so the env var and the pane share one UUID.
  • Env-var names keep the WARP_ prefix the fork uses for its other shell-integration vars; the URL uses the fork's own ChannelState::url_scheme.

Ports Warp's focus_env_tests.rs. App builds clean; the ported test passes.

🤖 Generated with Claude Code

Ports Warp's session focus-URL producer. The app already handles the consumer
side of the `<scheme>://session/<uuid-hex>` deeplink (crate::uri's
`UriHost::Session` → `PaneGroup::find_terminal_pane_by_session_uuid`), but
nothing published that URL into the terminal's environment — so a process
inside a session had no way to deep-link back to its own pane (e.g. to focus
it when a long-running command finishes).

Add `app/src/terminal/focus_env.rs` (`WARP_FOCUS_URL` + `WARP_TERMINAL_SESSION_UUID`,
`session_focus_url`, `add_session_focus_env_vars`) and call it from
`PaneGroup::create_session` — the single session-creation choke point. Each of
the five callers now threads the same UUID it builds the pane with, so the
published deeplink resolves back to that pane. `initial_single_terminal_pane`
minted its UUID after `create_session`; moved it above the call so the env var
and the pane share one UUID. Env-var names keep the `WARP_` prefix the fork
uses for its other shell-integration vars; the URL uses the fork's own
`ChannelState::url_scheme`.

Ports Warp's `focus_env_tests.rs`. app builds clean; the ported test passes.
Part of #2 / the #11 feature-parity ledger (deep-link focus-URL env plumbing).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012gDYSHa4oDvQbfungWwG1h
@jwp2987
jwp2987 merged commit b7c4516 into main Aug 5, 2026
1 check failed
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