Skip to content

gtk: add +new-tab action - #11762

Merged
jcollie merged 1 commit into
ghostty-org:mainfrom
jcollie:gtk-action-new-tab
Aug 9, 2026
Merged

jcollie merged 1 commit into
ghostty-org:mainfrom
jcollie:gtk-action-new-tab

Conversation

@jcollie

@jcollie jcollie commented Mar 23, 2026

Copy link
Copy Markdown
Member

This PR adds a +new-tab CLI action, useful for automation on GTK. This mainly re-uses machinery added for the +new-window, but adds in a unique surface ID for identifying surfaces for IPC purposes (and eliminates use of raw pointers for callbacks from notifications).

@jcollie
jcollie requested review from a team as code owners March 23, 2026 03:38
@jcollie jcollie added this to the 1.4.0 milestone Mar 23, 2026
@jcollie jcollie added gtk Issues exclusive to GTK which are not OS-specific cli `ghostty` command-line interface labels Mar 23, 2026
@tristan957

Copy link
Copy Markdown
Member

I think I would like to see the core ID portions pulled to their own PR. We have previously talked about adding a surface ID. In a dedicated PR, we could bikeshed the id format. I know Mitchell had a format in mind.

@jcollie

jcollie commented Mar 29, 2026 •

Copy link
Copy Markdown
Member Author

I think I would like to see the core ID portions pulled to their own PR. We have previously talked about adding a surface ID. In a dedicated PR, we could bikeshed the id format. I know Mitchell had a format in mind.

The format really doesn't matter for this, as long as I can treat it as an "opaque" u64 that's not zero. Any further meaning to the bits makes no difference to the current use cases (+new-tab, notifications) or even some future uses that I have in mind.

@jcollie
jcollie force-pushed the gtk-action-new-tab branch from 6f4799f to ca70623 Compare March 31, 2026 17:46
@jcollie
jcollie force-pushed the gtk-action-new-tab branch 2 times, most recently from be251d7 to 36341eb Compare April 7, 2026 14:55
@tryingET

tryingET commented Apr 17, 2026 •

Copy link
Copy Markdown

I tested this locally on Linux/GTK by cherry-picking it onto current main for an automation workflow (ghostty +new-tab -e ... to start a forked Pi session in a new tab).

Useful testing notes:

  • cherry-picks cleanly onto current main
  • I did not need any source changes on top of the PR
  • when testing side-by-side with distro Ghostty, I had to run the patched build with a separate class and --gtk-single-instance=true, otherwise D-Bus calls were handled by the system Ghostty instance instead
  • after that, new-tab was exposed correctly and the remaining failures were in my wrapper/tooling, not in Ghostty

One thing worth double-checking in the PR:

if (Action.newTab(...)) {
    log.warn("new-tab: unable to create tab", .{});
}

This may be inverted, unless Action.newTab(...) intentionally returns true on failure. From the name/signature I would normally expect true to mean success, in which case I would expect the warning to be under if (!Action.newTab(...)). I mention it because I was still seeing this warning in runs where the tab-launch path was otherwise progressing.

I did not validate the surface-id path end-to-end because GHOSTTY_SURFACE_ID was not present in the client environment I was launching from.

Overall: this was very useful in practice, and +new-tab is exactly the CLI surface I was missing.

@jcollie
jcollie force-pushed the gtk-action-new-tab branch from 36341eb to da2ead3 Compare April 17, 2026 19:27
@jcollie
jcollie force-pushed the gtk-action-new-tab branch 2 times, most recently from 41314e9 to 0b4b2f7 Compare May 18, 2026 03:00
@103sbavert

Copy link
Copy Markdown

This is such a useful feature to me. Could a maintainer please take their time to review this MR and merge it if approved? Thanks for all the work!

@gitzone83

Copy link
Copy Markdown

This is such a useful feature to me. Could a maintainer please take their time to review this MR and merge it if approved? Thanks for all the work!

Ditto for me, I switched to Ghostty because it is more modern and also more functional comparing to other solutions. I also wanted to add option to automatically save / restore tabs on startup, which requires me to be able to create tabs to begin with.

@103sbavert

Copy link
Copy Markdown

I hope a maintainer is able to look into this soon.

@103sbavert

Copy link
Copy Markdown

Did this just get approved?

@00-kat

00-kat commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

By the macOS team; someone from the GTK and terminal side need to approve it too. (IIRC GitHub doesn't show teams to everyone so I'm not sure if you can see this too.)

@jcollie
jcollie force-pushed the gtk-action-new-tab branch from fe970ad to 034506f Compare August 8, 2026 15:34

@pluiedev pluiedev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do this

@jcollie
jcollie merged commit 9d8fbd1 into ghostty-org:main Aug 9, 2026
100 checks passed
@jcollie
jcollie deleted the gtk-action-new-tab branch August 9, 2026 16:31
@lightningRalf

Copy link
Copy Markdown

Yes! Congratz! 5 months in the making!

@103sbavert

Copy link
Copy Markdown

HELLLLLLLLYEAH!

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

Labels

cli `ghostty` command-line interface gtk Issues exclusive to GTK which are not OS-specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants