Commit Graph

1773 Commits

Author SHA1 Message Date
Priyanshu
de49b7f27b rename copy_title action to copy_title_to_clipboard 2026-02-13 09:59:02 +05:30
Priyanshu
b4be13ed50 fix: copy_title_to_clipboard now respects user-overridden title
When a user renames a surface via "Change Terminal Title" and then
uses copy_title_to_clipboard, the raw terminal title was copied
instead of the custom name.

This adds a new `copy_title` apprt action so each platform resolves
the effective title (user override or terminal-set) before copying
to clipboard.

Fixes #10345
2026-02-13 01:19:15 +05:30
Jeffrey C. Ollie
dd14ce6752 gtk: add two-finger left/right scroll to switch tab pages
This adds the ability to use two fingers on a touchpad to scroll left
or right on a Ghostty window to change tab pages. Uses the same basic
machinery as scrolling up and down the scrollback buffer. Scrolling
pages does not wrap around at the start or end of the tabs.
2026-02-04 20:23:50 -06:00
Mitchell Hashimoto
63f9d4aaf7 apprt/gtk: move imgui widget to frame timer redraw 2026-02-01 14:30:53 -08:00
Mitchell Hashimoto
32ac82c66f inspector: no longer holds surface pointer 2026-01-31 08:47:15 -08:00
Mitchell Hashimoto
bdfb45bca7 imgui delta time needs to use float math
Our prior math converted to float after int which made our delta time
wrong making hovers and stuff not work.
2026-01-27 09:35:38 -08:00
Mitchell Hashimoto
32f5677a94 macos: slow down inspector trackpad (precision) scrolling 2026-01-27 08:34:35 -08:00
Jeffrey C. Ollie
f0b4e86ab5 gtk: add read-only indicator for surfaces
Fixes: #9889
2026-01-23 12:11:48 -06:00
Mitchell Hashimoto
338c9b15aa splits: make resize_split and toggle_split_zoom non-performable with single pane (#10376)
Refer to discussion #10000 

When a tab contains only a single split, resize_split and
toggle_split_zoom actions now return false (not performed). This allows
keybindings marked with `performable: true` to pass the event through to
the terminal program.

The performable flag causes unperformed actions to be treated as if the
binding didn't exist, so the key event is sent to the terminal instead
of being consumed.

- Add isSplit() helper to SplitTree to detect single-pane vs split state
- Update GTK resizeSplit/toggleSplitZoom to return false when single
pane
- Update macOS resizeSplit/toggleSplitZoom to return Bool and check
isSplit
- Add unit test for isSplit method
2026-01-22 08:23:57 -08:00
Mitchell Hashimoto
492eb40d28 gtk: add GSettings generic module and respect gtk-enable-primary-paste on gtk systems (#10328)
# Add GSettings Support for Primary Paste

Implements support for `org.gnome.desktop.interface
gtk-enable-primary-paste` to allow users to disable middle-click paste.
Also refactors GTK Settings access into a reusable generic module.

## Changes

- **NEW**: `src/apprt/gtk/gsettings.zig` - Generic GTK Settings reader
supporting `bool` and `c_int` types, portal-aware for Flatpak/Snap
- **MODIFIED**: `src/apprt/gtk/class/surface.zig` - Reads primary paste
setting and refactors gtk-xft-dpi to use new module

## Behavior
- Setting `false` → Middle-click paste blocked
- Setting `true` or unavailable → Middle-click paste works (default)
- Uses GTK Settings API which automatically uses XDG Desktop Portal in
sandboxed environments

Note: No unit tests added as this is a thin wrapper around GTK Settings
API that's already tested indirectly through surface.zig. Happy to add
tests if desired, though they would require an active display
environment and skip on most CI systems.
2026-01-20 09:49:48 -08:00
Mitchell Hashimoto
c8ffc0faa5 termio: report color scheme synchronously (#9705)
The reporting of color scheme was handled asynchronously by queuing a
handler in the surface. This could lead to race conditions where the DSR
is reported after subsequent VT sequences.

Fixes #5922
2026-01-20 09:48:43 -08:00
mauroporras
811e3594eb feat: add configurable word boundary characters for text selection
Add new `selection-word-chars` config option to customize which characters
mark word boundaries during text selection operations (double-click, word
selection, etc.). Similar to zsh's WORDCHARS environment variable, but
specifies boundary characters rather than word characters.

Default boundaries: ` \t'"│`|:;,()[]{}<>$`

Users can now customize word selection behavior, such as treating
semicolons as part of words or excluding periods from boundaries:

    selection-word-chars = " \t'\"│`|:,()[]{}<>$"

Changes:
- Add selection-word-chars config field with comprehensive documentation
- Modify selectWord() and selectWordBetween() to accept boundary_chars parameter
- Parse UTF-8 boundary string to u32 codepoints at runtime
- Update all call sites in Surface.zig and embedded.zig
- Update all test cases to pass boundary characters
2026-01-20 09:37:31 -08:00
evertonstz
8c9891b5de Refactor primary paste settings handling and documentation for clarity 2026-01-20 14:32:47 -03:00
evertonstz
bc067fc782 Refactor gtk_enable_primary_paste to remove optional type and simplify condition checks 2026-01-20 14:23:22 -03:00
evertonstz
7b6147aa28 Refactor GValueType and getImpl functions to use type-based switches for improved clarity and maintainability 2026-01-20 14:23:10 -03:00
Mitchell Hashimoto
7d9de9afd9 gtk: Session Search (#10155)
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.

https://github.com/user-attachments/assets/d50d93a8-fe32-4d39-ba41-1f766010a293

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).
2026-01-20 08:51:38 -08:00
Tommy Brunn
0c8b51c7ab gtk: Add todo for replacing jump sort key with surface id
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.
2026-01-20 17:09:15 +01:00
Tommy Brunn
f2b5a9192a gtk: Clean up title sorting 2026-01-20 17:05:14 +01:00
evertonstz
bff21222d4 Refactor gsettings keys to use string literals for GTK settings and update related tests 2026-01-20 12:12:04 -03:00
Steven Lu
1e41d87709 hope to fix 2026-01-20 11:45:01 +07:00
Steven Lu
6db4e437ca splits: make resize_split and toggle_split_zoom non-performable with single pane
When a tab contains only a single split, resize_split and toggle_split_zoom
actions now return false (not performed). This allows keybindings marked with
`performable: true` to pass the event through to the terminal program.

The performable flag causes unperformed actions to be treated as if the
binding didn't exist, so the key event is sent to the terminal instead of
being consumed.

- Add isSplit() helper to SplitTree to detect single-pane vs split state
- Update GTK resizeSplit/toggleSplitZoom to return false when single pane
- Update macOS resizeSplit/toggleSplitZoom to return Bool and check isSplit
- Add unit test for isSplit method
2026-01-19 17:34:34 +07:00
Tobias Kohlbau
836d794b9e termio: report color scheme synchronously
The reporting of color scheme was handled asynchronously by queuing a
handler in the surface. This could lead to race conditions where the
DSR is reported after subsequent VT sequences.

Fixes #5922
2026-01-19 07:49:57 +01:00
evertonstz
1c2c2257d4 Set default value for gtk_enable_primary_paste to true and simplify condition checks 2026-01-16 12:29:31 -03:00
Everton Correia
60da5eb3a6 Apply suggestion from @pluiedev
Co-authored-by: Leah Amelia Chen <github@acc.pluie.me>
2026-01-16 12:25:49 -03:00
evertonstz
c553296d7a Remove unused import of 'builtin' in gsettings.zig 2026-01-15 19:08:37 -03:00
evertonstz
04a7bcd138 Fix middle button paste condition to respect GNOME settings 2026-01-15 18:20:44 -03:00
evertonstz
db7df92a81 Refactor gsettings usage for gtk-xft-dpi and gtk-enable-primary-paste with improved logging 2026-01-15 18:15:31 -03:00
evertonstz
29adcf4b64 Enhance GTK settings handling with well-defined types and utility functions 2026-01-15 17:16:11 -03:00
Everton Correia
7a306e52c2 Update src/apprt/gtk/class/surface.zig
Co-authored-by: Leah Amelia Chen <github@acc.pluie.me>
2026-01-15 11:49:23 -03:00
evertonstz
78a503491e initial commit 2026-01-15 10:53:00 -03:00
rhodes-b
50516ed581 add search selection for GTK 2026-01-10 19:45:05 -06:00
Mitchell Hashimoto
856ef1fc1b input: change the key_is_binding to return some information 2026-01-09 06:51:48 -08:00
Mitchell Hashimoto
caa6b958d7 apprt/embedded: escape the initial input string
Fixes #10214
2026-01-08 14:07:46 -08:00
Leah Amelia Chen
c559a1dbba Allow for default or inherited CWD in new window, tab and split surfaces (redone for GTK-NG) (#9158) 2026-01-07 20:45:06 +08:00
Mitchell Hashimoto
3ba4f17f0d zig fmt 2026-01-06 14:21:42 -08:00
Mitchell Hashimoto
f07d600e43 macos: start_search with needle changes needle 2026-01-06 14:14:22 -08:00
Mitchell Hashimoto
8e28f58b42 rename the selection search binding, unify into start_search action 2026-01-06 14:10:42 -08:00
Aaron Ruan
9b6a3be993 macOS: Selection for Find feature
Adds the `selection_for_search` action, with Cmd+E keybind by default.
This action inputs the currently selected text into the search
field without changing focus, matching standard macOS behavior.
2026-01-06 22:21:55 +08:00
Peter Guy
55285fee28 preserve multi-line formatting 2026-01-05 16:47:04 -08:00
Peter Guy
b119bc6089 consolidated enums 2026-01-05 16:47:04 -08:00
Peter Guy
d660799723 Consolidate the several ghostty_surface_inherited_config
functions back into a single function with a second parameter for the source context.
2026-01-05 16:47:04 -08:00
Peter Guy
0af2a3f693 Enable distinguishing between a new tab in a new window
(which should inherit based on the window setting),
and a new tab in an existing window
(which should inherit base on tab setting)
2026-01-05 16:47:04 -08:00
Peter Guy
82614511ab Use the new GTK Surface::setParent from the tab and split 2026-01-05 16:47:04 -08:00
Peter Guy
05229502bf Add the surface context to the Surface's setParent
In order to set the private context variable so that initiSurface can use it.
2026-01-05 16:47:04 -08:00
Peter Guy
dba0ff5339 Add C API function to handle new surfaces of different types 2026-01-05 16:47:04 -08:00
Peter Guy
02e1a68263 Use config to determine cwd inheritance for windows, tabs, and splits
- Define NewSurfaceContext enum (window, tab, split)
- Add shouldInheritWorkingDirectory helper function
- Thread surface context through newConfig and newSurfaceOptions
- Replace window-inherit-working-directory checks with context-aware logic
- Add context to embedded CAPI and GTK Surface structs
2026-01-05 16:47:04 -08:00
Tommy Brunn
f5d7108c51 gtk: Remove strong reference to surface from command palette 2026-01-04 08:36:40 +01:00
Tommy Brunn
d3aa684139 gtk: Remove window reference from jump commands
Removes redundant implementations that is already present in the core
application to work with surfaces.
2026-01-03 22:34:23 +01:00
Tommy Brunn
8754c53e0e gtk: Get jump command title from Surface title 2026-01-03 22:07:57 +01:00
Tommy Brunn
d7972cb8b7 gtk: Session Search
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.
2026-01-03 18:38:28 +01:00