feat(desktop): open a link menu on plain click of a terminal URL

Merged
KI
11d ago
+252-2

Summary

  • A plain click on a URL in a terminal pane now opens a link menu at the pointer: the URL, the in-app and external open actions with their modifier shortcuts, and Copy link. Before, it opened nothing and only showed a hint.
  • Settings → Links: the URL Click row now reads "Show link menu" instead of "Do nothing".

Recording, screenshots and the Orca teardown: https://app.superset.sh/page/orca-s-terminal-link-click-menu-and-how-to-port-it-2fb9dj

Why / Context

A user who also uses Orca asked for this: links printed by CLI agents (Claude Code, Codex) look clickable but a plain click does nothing, because the default urlLinks.plain is null. Orca opens a small popover on plain click (Orca Browser / System Browser / copy). This PR ports that behavior using our own DropdownMenu styling.

How It Works

  • In TerminalPane's onUrlClick, when the plain tier has no action, it calls showLinkMenu(url, clientX, clientY) instead of showHint. Unbound modifier clicks still show the hint.
  • TerminalPane/components/LinkActionMenu is a controlled DropdownMenu on a zero-size fixed trigger at the click point. Rows: "Open in split pane", "Open in new tab", "Open in external browser". When the right pane area is on, "Open in right pane" and "Open in external browser" instead, since runUrlLinkAction sends every in-app open there. Then "Copy link". Each row calls the existing runUrlLinkAction.
  • Shortcut labels are read from the user's urlLinks map, so they stay correct after a rebind.
  • No stored setting changes: users who bound plain click to an action keep it, and ⌘/⇧ clicks still open directly. GitHub PR URLs keep their direct open into the PR pane.

Manual QA Checklist

Dev app on this branch, driven over CDP with real mouse input:

  • Plain click on a URL printed by printf in a terminal: the menu opens at the pointer
  • Plain click on a URL printed by Claude Code in an agent terminal: the menu opens
  • "Open in right pane" opens the page in the right pane browser
  • "Copy link" shows "Link copied", and the clipboard holds the URL
  • Esc closes the menu, and focus returns to the terminal (xterm-helper-textarea)
  • A click outside closes the menu
  • ⌘-click opens directly, with no menu
  • No console.error while opening and closing the menu
  • Settings → Links shows "Show link menu" for the URL Click row
  • Not verified on screen: the three-row variant without the right pane area (the test profile has it on)

Testing

  • bun run typecheck (desktop)
  • bun run lint
  • bun run check:i18n: one new message, "Show link menu", translated into all 16 locales
  • No unit tests added

Known Limitations

  • The built-in chat pane (chat-v3) is unchanged. A plain click there already opens the link in a pane, and I could not reach that pane in the test profile to verify a change.
  • File and folder links in the terminal keep their current behavior.
  • The Settings label says "Show link menu" for every URL surface, but only the terminal shows the menu. Chat and page panes already open on plain click.

Summary by cubic

Plain clicks on URLs in terminal panes now open a link menu at the pointer, instead of only showing a hint. Links printed by CLI agents like Claude Code or Codex looked clickable but did nothing on click; the menu gives users open and copy actions.

  • The menu shows the URL, the in-app and external open actions with their modifier shortcuts, and Copy link; open actions reuse the existing runUrlLinkAction.
  • Only the unbound plain tier triggers the menu, so users who bound plain click to an action keep it, and modifier clicks still open directly.
  • Settings → Links now labels the URL Click row "Show link menu" instead of "Do nothing".

File and folder links, GitHub PR URLs, and the built-in chat pane keep their current click behavior.

Summary by CodeRabbit

  • New Features
    • Clicking a URL in a terminal can show a menu with available actions, such as opening it in a pane or copying it. The menu displays the URL and configured keyboard shortcuts, and provides feedback when copying succeeds or fails.
    • The plain-tier URL setting now offers “Show link menu” as an option.
  • Localization
    • Added translations for the new setting across supported languages.