gtk: Session Search#10155
Conversation
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.
jcollie
left a comment
There was a problem hiding this comment.
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.
Removes redundant implementations that is already present in the core application to work with surfaces.
|
Thank you so much for the thoughtful review, @jcollie! I really appreciate it. |
jcollie
left a comment
There was a problem hiding this comment.
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.
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.
mitchellh
left a comment
There was a problem hiding this comment.
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. :)
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).