Skip to content

gtk: Session Search#10155

Merged
mitchellh merged 6 commits intoghostty-org:mainfrom
Nevon:gtk-session-search
Jan 20, 2026
Merged

gtk: Session Search#10155
mitchellh merged 6 commits intoghostty-org:mainfrom
Nevon:gtk-session-search

Conversation

@Nevon
Copy link
Copy Markdown
Contributor

@Nevon Nevon commented Jan 3, 2026

Gtk implementation of #9945. Fixes #9948.

This adds session search to the command palette on Gtk, allowing you to jump to any surface by title or working directory. The main difference to the Mac OS implementation is that tabs do not have colors by which to search. I also have not implemented the flashing behavior when a split is focused.

The same, or as close as I could make it, behavior that was introduced for command sorting is also implemented for Gtk. Granted, as I haven't tested this new feature on Mac OS, my understanding of the behavior of it is based on the code and the screencast from the PR.

Screencast.From.2026-01-03.18-41-43.mp4

One thing I noticed during development, which I left unsolved as I also didn't see it solved in the Mac OS implementation (though I haven't tested it), is that if you are zoomed into a split, then focusing a different split doesn't do anything. There's a configuration option that I forgot the name of, related to zoom behavior during navigation, that I would expect to be respected, but I wasn't able to get it to work, so I left it for a later iteration.

The majority of the code was generated with Claude Sonnet 4.5. Although I have reviewed and iterated on the code thoroughly, I am not experienced with Zig and I would not be surprised if there are issues that I did not notice, and would appreciate them being pointed out (and ideally explained if it's not obvious to a non-Zig developer).

Gtk implementation of ghostty-org#9945. Fixes ghostty-org#9948.

This adds session search to the command palette on Gtk, allowing you to
jump to any surface by title or working directory. The main difference
to the Mac OS implementation is that tabs do not have colors by which to
search.
@Nevon Nevon requested a review from a team as a code owner January 3, 2026 17:55
Copy link
Copy Markdown
Member

@jcollie jcollie left a comment

Choose a reason for hiding this comment

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

An interesting start, but there's lots of changes needed before approval. The big issue is storing full references to surfaces in the command palette, but fixing that requires a larger discussion about surface IDs. The other issues can be fixed with a deeper understanding of the available APIs. I'll probably think of more changes as time passes and I'm sure that others will have suggestions as well.

Comment thread src/apprt/gtk/class/command_palette.zig Outdated
Comment thread src/apprt/gtk/class/command_palette.zig
Comment thread src/apprt/gtk/class/command_palette.zig
Comment thread src/apprt/gtk/class/command_palette.zig Outdated
Comment thread src/apprt/gtk/class/command_palette.zig Outdated
Comment thread src/apprt/gtk/class/command_palette.zig Outdated
Comment thread src/apprt/gtk/class/split_tree.zig Outdated
Comment thread src/apprt/gtk/class/application.zig Outdated
Comment thread src/apprt/gtk/class/command_palette.zig Outdated
Comment thread src/apprt/gtk/class/command_palette.zig Outdated
Nevon added 2 commits January 3, 2026 22:07
Removes redundant implementations that is already present in the core
application to work with surfaces.
@Nevon
Copy link
Copy Markdown
Contributor Author

Nevon commented Jan 3, 2026

Thank you so much for the thoughtful review, @jcollie! I really appreciate it.

@jcollie jcollie mentioned this pull request Jan 18, 2026
Copy link
Copy Markdown
Member

@jcollie jcollie left a comment

Choose a reason for hiding this comment

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

A few stylistic changes, then I'll be satisfied. Would be good to get some feedback from other GTK maintainers. Valgrind seemed to be happy, although it looks as there's more GTK suppressions needed. WeakRef seems the best way to handle surfaces at this time. I verified that closing a surface out from under the command palette results in no ill effects.

Comment thread src/apprt/gtk/class/command_palette.zig
Comment thread src/apprt/gtk/class/command_palette.zig Outdated
Comment thread src/apprt/gtk/class/command_palette.zig Outdated
Comment thread src/apprt/gtk/class/command_palette.zig Outdated
Comment thread src/apprt/gtk/class/command_palette.zig Outdated
Comment thread src/apprt/gtk/class/command_palette.zig
@jcollie jcollie added gtk Issues exclusive to GTK which are not OS-specific os/linux labels Jan 18, 2026
@jcollie jcollie added this to the 1.3.0 milestone Jan 18, 2026
Nevon added 2 commits January 20, 2026 17:05
Using a pointer for this is a bit icky. Once Ghostty adds unique ids to
surfaces, we can sort by that id instead. This can potentially also be
used to navigate to the surface instead of having the command palette
reference the surfaces directly.
Copy link
Copy Markdown
Member

@jcollie jcollie left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

Thanks. There are some simple stylistic things to improve here but I think overall I'm fine with this and we can clean it up later. Thank you for implementing it in the simple way first, and we can optimize later. :)

@mitchellh mitchellh merged commit 7d9de9a into ghostty-org:main Jan 20, 2026
54 checks passed
@Nevon Nevon deleted the gtk-session-search branch January 20, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gtk Issues exclusive to GTK which are not OS-specific os/linux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GTK: Implement "jump to terminal" feature

3 participants