Skip to content

feat(app): add Duplicate to the tab right-click menu #42

Closed

Description

@arifintahu

What and why

Right-clicking a tab shows only the move items (Move left / right / to start / to end). Opening a second shell with the same profile in the same folder means clicking the profile menu and then cd-ing back. Add Duplicate to the tab context menu so one click gives a new tab like the current one.

Behavior

  • New item Duplicate in TabMenu.svelte, above the move items, separated by a divider.
  • The new tab gets a fresh PTY session with the same profile and the same working directory as the source tab's main pane (Tab.cwd, kept current by OSC 7).
  • If the source tab is split, the duplicate is split the same way: same direction, second pane with its own profile and cwd. This matches what session restore already does (restoreSession in App.svelte).
  • The duplicate opens right after the source tab and becomes the active tab.
  • A custom (renamed) title is copied; an automatic title is not, so the new tab labels itself from its own folder / program.
  • Shell state is not cloned: no scrollback, no running program, no env changes or shell history from the source session.
  • If spawning fails, show the existing toast (Failed to open tab: ...), like openNewTab.

Implementation notes

  • TabStrip.svelte gets an onDuplicateTab(tabId) prop; App.svelte implements it with openNewTab(profileId, cwd) + splitTab(...), then moves the tab next to the source with moveTab.
  • The menu height clamp in TabMenu.svelte (innerHeight - 140) needs to grow for the extra row.
  • Command palette entry "Duplicate tab" is a possible follow-up, not part of this issue.

Acceptance criteria

  • Right-click a tab, choose Duplicate: a new tab opens next to it, active, running the same profile in the same folder.
  • Duplicating a split tab produces a split tab with both panes' profile and folder.
  • A renamed tab keeps its name in the duplicate.
  • A spawn failure shows a toast and leaves the tab list unchanged.
  • The item works with keyboard (arrow keys, Enter) like the other menu items.
  • Unit test for the pure part (insert position / title carry-over); /ci passes.
  • CHANGELOG.md has a line under [Unreleased].

Non-goals

Cloning scrollback or running processes; a keyboard shortcut; duplicating into a new window.

Activity

  1. added
    enhancement
    good first issue
    on Oct 29, 2026
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

    enhancementgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions