Skip to content

[FEATURE]: Add "Copy ID", "Copy Name", and "Copy Link" to TUI session context menu #47746

Open

Description

@otakugard

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

To: OpenCode Maintainers <anomalyco/opencode>
Subject: [RFC/UX] Add Copy ID, Copy Name, and Copy Link to TUI Session Context Menu

Hey team,

In the current TUI, right-clicking a session item in the sidebar opens a minimal context menu with three entries: "New tab", "Rename", and "Close".

When working across multiple sessions, referencing a session outside the TUI is a frequent need:

  1. Grabbing the Session ID (ses_...) to run CLI operations (opencode session <id>), inspect SQLite state, or pass to local automation scripts.
  2. Grabbing the Session Title to include in commit messages, PR descriptions, or dev logs.
  3. Grabbing the Session Link (share URL or web session URL) to send to teammates or view in the browser.

Currently, copying any of these requires either selecting text directly with terminal mouse-mode bypass (which often breaks across lines or captures UI padding) or manually searching storage logs.

Adding direct clipboard actions to the context menu resolves this without introducing new UI surfaces.


UI / Interaction Mockup

Current Context Menu

Right-clicking a session entry in the vertical sidebar:

  refactor authentication
  workspace            ┌──────────┐
                       │ New tab  │
: fix connection timeout│ Rename   │
  workspace            │ Close    │
                       └──────────┘
: add logging middleware
  workspace

+ New session

Proposed Context Menu

Group clipboard actions between navigation and destruction:

  refactor authentication
  workspace            ┌───────────────┐
                       │ New tab       │
: fix connection timeout│ Rename        │
  workspace            │ ───────────── │
                       │ Copy ID       │
: add logging middleware│ Copy Name     │
  workspace            │ Copy Link     │
                       │ ───────────── │
+ New session          │ Close         │
                       └───────────────┘

Interaction Flow

  1. Right-click any session item in the vertical tab list.
  2. Select "Copy ID", "Copy Name", or "Copy Link":
    • Writes the target string to system clipboard via clipboard.write(...) (supporting OSC 52 / host clipboard).
    • Closes the context menu.
    • Shows a brief toast alert at the top corner:
      ┌───────────────────────────────┐
      │ Session ID copied to clipboard│
      └───────────────────────────────┘
      

Implementation Sketch

In packages/tui/src/ (where the session tab context menu items are constructed), sessionID and title are already present in the menu state:

const clipboard = useClipboard()
const toast = useToast()

const menuItems = createMemo(() => {
  const sessionID = state.sessionID
  const title = state.title
  const shareURL = state.shareURL // resolved via sync.session.get(sessionID)?.share?.url

  return [
    ...(tabs.add ? [{ title: "New tab", run: () => tabs.add?.() }] : []),
    ...(sessionID ? [
      ...(tabs.promote && tabs.isPreview?.(sessionID) 
        ? [{ title: "Keep open", run: () => tabs.promote?.(sessionID) }] 
        : []),
      { title: "Rename", run: () => DialogSessionRename.show(dialog, sessionID, title) },
      {
        title: "Copy ID",
        run: async () => {
          await clipboard.write(sessionID)
          toast.show({ message: "Copied session ID", variant: "info" })
        },
      },
      {
        title: "Copy Name",
        run: async () => {
          await clipboard.write(title)
          toast.show({ message: "Copied session title", variant: "info" })
        },
      },
      ...(shareURL ? [{
        title: "Copy Link",
        run: async () => {
          await clipboard.write(shareURL)
          toast.show({ message: "Copied session link", variant: "info" })
        },
      }] : []),
      { title: "Close", run: () => tabs.close(sessionID) },
    ] : []),
  ]
})

Edge Cases & Details

  • Session Link availability: If the session has not been shared publicly yet, "Copy Link" can either copy the local web server URL (http://localhost:<port>/session/<id>) or remain omitted when no link is active.
  • Clipboard integration: The existing TUI clipboard provider already wraps OSC 52 and host clipboard commands, so no additional dependencies are required.

Activity

  1. opencodejr commented on Oct 28, 2026

    @opencodejr

    Thanks for the detailed write-up! You're asking for clipboard actions in the TUI session tab menu: copy the session ID, the session name, and the session link.

    Copying the ID is already covered. A Copy session ID entry was added to the tab menu in #50181 and ships in v2.2.0, so please upgrade if you don't see it yet. It's also in the command palette as "Copy session ID".

    That leaves Copy Name and Copy Link (the share URL, or perhaps a local web URL when the session isn't shared). These can't be added through a plugin today, because plugins can't add items to the tab menu. The maintainers will consider adding them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions