Skip to content

input: add new_tab_with_command keybind action#12984

Open
jamesarch wants to merge 1 commit into
ghostty-org:mainfrom
jamesarch:feat/new-tab-with-command
Open

input: add new_tab_with_command keybind action#12984
jamesarch wants to merge 1 commit into
ghostty-org:mainfrom
jamesarch:feat/new-tab-with-command

Conversation

@jamesarch

@jamesarch jamesarch commented Jun 11, 2026

Copy link
Copy Markdown

Summary

Adds a new keybind action new_tab_with_command:<command> that opens a new tab running the given command instead of the configured default:

keybind = cmd+ctrl+digit_1=new_tab_with_command:ssh myhost

This gives a lightweight version of iTerm2's "profile that runs a command" workflow: a dedicated shortcut per remote host or tool, each opening in a native tab.

Vouched in #12977. Design discussion for window/split variants: #12985.

Implementation notes

  • The surface configuration plumbing already existed (SurfaceConfiguration.command and the inherited-config notification on macOS); this change only exposes it through a binding action.
  • The apprt action follows the existing OpenUrl pattern for passing a C-ABI string across the boundary.
  • The command is always run in a shell and the surface behaves as if wait-after-command were enabled — both inherited from the existing embedded surface-config behavior, and documented in the action's doc comment.
  • macOS implements the full behavior. GTK currently falls back to a plain new_tab. I don't have a Linux dev setup to wire and test the GTK side properly, so I kept it compiling with a graceful fallback rather than shipping untested code. Happy to do a follow-up if someone can point me at the right spot in the GTK apprt.
  • Added a parse test (parse: new_tab_with_command); zig fmt clean; targeted tests pass locally on macOS.

Open design question

@jcollie asked in the vouch discussion whether there should be similar actions for new windows and splits, and whether that should be one parameterized action or separate actions. I kept this PR minimal: tab only, as a separate action mirroring the existing new_tab naming. Discussion opened in #12985 — happy to rework toward whichever direction maintainers prefer.

AI disclosure

Per AI_POLICY.md: this change was developed with assistance from Claude Code (Anthropic). I directed the design, reviewed and understand every line (the patch is purely additive and follows existing patterns), and built and tested the result locally on macOS, where I run it as my daily driver.

🤖 Generated with Claude Code

@jamesarch jamesarch requested review from a team as code owners June 11, 2026 01:38
@ghostty-bot ghostty-bot Bot added the input Keyboard or mouse input label Jun 11, 2026
@jamesarch

Copy link
Copy Markdown
Author

Design discussion for the window/split question opened in #12985.

@jamesarch jamesarch force-pushed the feat/new-tab-with-command branch from 183b67f to e368af3 Compare June 11, 2026 01:50
Adds a new keybind action that opens a new tab running the given
command instead of the configured default, e.g.:

    keybind = cmd+ctrl+digit_1=new_tab_with_command:ssh myhost

The surface configuration plumbing (command override, inherited
config notification) already existed; this exposes it through a
binding action. macOS implements the full behavior; GTK currently
falls back to a plain new tab.
@jamesarch jamesarch force-pushed the feat/new-tab-with-command branch from e368af3 to ceeca73 Compare June 11, 2026 01:58
@jamesarch jamesarch closed this Jun 11, 2026
@jamesarch jamesarch reopened this Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

input Keyboard or mouse input

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants