Commit Graph

1787 Commits

Author SHA1 Message Date
benodiwal
e197b95c32 feat: scroll-to-bottom on output via renderer pin tracking
Co-Authored-By: Sachin <sachinbeniwal0101@gmail.com>
2026-02-19 13:53:27 -08:00
Jeffrey C. Ollie
9f2d66c9c9 toggle command palette works on gtk 2026-02-18 22:30:52 -06:00
Jeffrey C. Ollie
cb7e6d5d6d gtk: remove delegate setting from transient scope 2026-02-17 12:54:29 -06:00
Jeffrey C. Ollie
1342eb5944 gtk: revamp cgroup/transient scope handling
This changes the way Ghostty assigns itself and subprocesses to
cgroups and how resource controls are applied.

* Ghostty itself no longer modifies it's own cgroup or moves itself
to a transient scope. To modify the main Ghostty process' resource
controls ensure that you're launching Ghostty with a systemd unit and
use the standard systemd methods for overriding and applying changes
to systemd units.

* If configured (on by default), the process used to run your command
will be moved to a transient systemd scope after it is forked from
Ghostty but before the user's command is executed. Resource controls
will be applied to the transient scope at this time. Changes to
the `linux-cgroup*` configuration entries will not alter existing
commands. If changes are made to the `linux-cgroup*` configuration
entries commands will need to be relaunched. Resource limits can also
be modified after launch outside of Ghostty using systemd tooling. The
transient scope name can be shown by running `systemctl --user whoami`
in a shell running inside Ghostty.

Fixes #2084.
Related to #6669
2026-02-17 12:54:26 -06:00
David Matos
c067f2b911 Merge branch 'main' into gtk-prompt-tab-title 2026-02-16 23:06:04 +01:00
Mitchell Hashimoto
99e342717b fix: copy_title_to_clipboard respects user-overridden title (#10694)
## Summary
- Fixes #10345 — `copy_title_to_clipboard` now copies the user-set
custom title instead of the raw terminal title
- Adds a new `copy_title` apprt action as [suggested by
@mitchellh](https://github.com/ghostty-org/ghostty/issues/10345#issuecomment-2601002974)
- Each platform (GTK + macOS) resolves the effective title (user
override → terminal title fallback) before copying to clipboard

## Changes
- **`src/apprt/action.zig`** — New `copy_title` void action
- **`include/ghostty.h`** — C ABI enum entry
- **`src/Surface.zig`** — Binding handler now dispatches apprt action
instead of inline logic
- **`src/apprt/gtk/class/surface.zig`** — `getEffectiveTitle()` helper
(returns `title_override orelse title`)
- **`src/apprt/gtk/class/application.zig`** — GTK action handler
- **`macos/.../Ghostty.App.swift`** — macOS handler using
`surfaceView.title` + `NSPasteboard`

*Note*: This PR was *AI* assisted.
2026-02-16 11:10:17 -08:00
Leah Amelia Chen
61e347a2c2 core/gtk: add language config entry to override GUI localization (#10428)
Fixes #10276

<img width="853" height="637" alt="Screenshot From 2026-01-23 16-45-11"
src="https://github.com/user-attachments/assets/aff9d2f8-eb3e-411e-bd3d-ebd32e5c7973"
/>
2026-02-15 00:24:30 +08:00
Priyanshu
d2841220a8 move copyTitleToClipboard logic into Surface 2026-02-13 21:30:13 +05:30
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
David Matos
fae304105b fix typo and add ellipsis for title 2026-01-25 11:15:56 +01:00
David Matos
ed8027a976 Add context menu tab 2026-01-25 01:28:36 +01:00
Jeffrey C. Ollie
50d9e03424 core/gtk: add language config entry to override GUI localization
Fixes #10276
2026-01-23 17:22:59 -06: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