Commit Graph

8218 Commits

Author SHA1 Message Date
Mitchell Hashimoto
44972198ae apprt: add action for key table activation/deactivation 2025-12-20 19:53:12 -08:00
Mitchell Hashimoto
845bcdb498 config: copy key table name into arena 2025-12-20 15:15:30 -08:00
Mitchell Hashimoto
daa613482e keybind = clear and reset should reset tables, too 2025-12-20 14:57:37 -08:00
Mitchell Hashimoto
14bbc4893f implement one-shot key tables 2025-12-20 14:36:39 -08:00
Mitchell Hashimoto
36f891afd8 implement key table lookup in maybeHandleBinding 2025-12-20 14:30:36 -08:00
Mitchell Hashimoto
18ce219d78 input: activate/deactivate key table binding actions 2025-12-20 14:23:02 -08:00
Mitchell Hashimoto
34ae3848b6 core: key tables 2025-12-20 14:04:11 -08:00
Mitchell Hashimoto
8c59143c1a rename some key sequence state so it is clearer what it is 2025-12-20 14:04:03 -08:00
Mitchell Hashimoto
c53b3fffd5 config: keybind table parsing 2025-12-20 13:32:52 -08:00
Mitchell Hashimoto
63422f4d4e add the catch_all binding key
Part of #9963

This adds a new special key `catch_all` that can be used in keybinding
definitions to match any key that is not explicitly bound. For example:
`keybind = catch_all=new_window` (chaos!). 

`catch_all` can be used in combination with modifiers, so if you want to
catch any non-bound key with Ctrl held down, you can do:
`keybind = ctrl+catch_all=new_window`.

`catch_all` can also be used with trigger sequences, so you can do:
`keybind = ctrl+a>catch_all=new_window` to catch any key pressed after
`ctrl+a` that is not explicitly bound and make a new window!

And if you want to remove the catch all binding, it is like any other:
`keybind = catch_all=unbind`.
2025-12-19 15:03:38 -08:00
Mitchell Hashimoto
594195963d Update src/renderer/Metal.zig
Co-authored-by: Jon Parise <jon@indelible.org>
2025-12-19 09:31:10 -08:00
Mitchell Hashimoto
07b47b87fa renderer/metal: clamp texture sizes to the maximum allowed by the device
This prevents a crash in our renderer when it is larger.

I will pair this with apprt changes so that our mac app won't ever allow
a default window larger than the screen but we should be resilient at
the renderer level as well.
2025-12-19 09:24:49 -08:00
Mitchell Hashimoto
5a2f5a6b9e terminal: RenderState linkCells needs to use Page y not Viewport y
Fixes #9957

Our `Page.getRowAndCell` uses a _page-relative_ x/y coordinate system
and we were passing in viewport x/y. This has the possibility to leading
to all sorts of bugs, including the crash found in #9957 but also simply
reading the wrong cell even in single-page scenarios.
2025-12-18 13:54:35 -08:00
Jacob Sandlund
aecdacbe49 Merge remote-tracking branch 'origin/main' into shaping-positions 2025-12-17 10:02:06 -05:00
Jacob Sandlund
139a23a0a2 Pull out debugging into a separate function. 2025-12-17 09:57:32 -05:00
Jacob Sandlund
e28e4facf0 Merge remote-tracking branch 'origin/main' into shaping-positions 2025-12-17 09:18:10 -05:00
Elad Kaplan
67f9bb9e8a Fix link opening by resolving existing relative paths 2025-12-17 15:13:47 +02:00
Mitchell Hashimoto
50cb1bafd7 macOS: change window to new-window for macos-dock-drop-behavior (#9764)
Matches current option references and Swift implementation
2025-12-16 13:35:25 -08:00
Dominique Martinet
f37acdf6a0 gtk/opengl: print an error when OpenGL version is too old
#1123 added a warning when the OpenGL version is too old, but
it is never used because GTK enforces the version set with
gl_area.setRequiredVersion() before prepareContext() is called:
we end up with a generic "failed to make GL context" error:
warning(gtk_ghostty_surface): failed to make GL context current: Unable to create a GL context
warning(gtk_ghostty_surface): this error is almost always due to a library, driver, or GTK issue
warning(gtk_ghostty_surface): this is a common cause of this issue: https://ghostty.org/docs/help/gtk-opengl-context

This patch removes the requirement at the GTK level and lets the ghostty
renderer check, now failing as follow:
info(opengl): loaded OpenGL 4.2
error(opengl): OpenGL version is too old. Ghostty requires OpenGL 4.3
warning(gtk_ghostty_surface): failed to initialize surface err=error.OpenGLOutdated
warning(gtk_ghostty_surface): surface failed to initialize err=error.SurfaceError

(Note that this does not render a ghostty window, unlike the previous
error which rendered the "Unable to acquire an OpenGL context for
rendering." view, so while the error itself is easier to understand it
might be harder to view)
2025-12-16 13:30:37 -08:00
IceCodeNew
ccc2d32aa5 Fix macOS log command for Ghostty
Corrected the command for viewing Ghostty logs on macOS.
2025-12-17 05:16:27 +08:00
Mitchell Hashimoto
f9a1f526c8 update some copy for the background opacity toggle 2025-12-16 11:40:12 -08:00
himura467
ba2cbef1f1 apprt/gtk: list toggle_background_opacity as unimplemented 2025-12-16 11:32:10 -08:00
himura467
4c6d3f8ed2 macos: add toggle_background_opacity keybind action 2025-12-16 11:32:10 -08:00
Mitchell Hashimoto
4883fd938e config: better docs for split-preserve-zoom 2025-12-16 11:27:51 -08:00
lorenries
d364e421a8 introduce split-preserve-zoom config to maintain zoomed splits during navigation 2025-12-16 11:14:09 -08:00
Mitchell Hashimoto
67eb480577 Adding keybind to the +list-themes TUI that would write out a file that contained themes (#8930)
This resolves issue: https://github.com/ghostty-org/ghostty/issues/8903,
so we can press 'w' when in TUI preview save mode to write a auto theme
config
2025-12-16 10:12:06 -08:00
greathongtu
f7d0d72f19 remove auto theme include in config-template 2025-12-17 01:50:53 +08:00
Mitchell Hashimoto
29c0f982c3 Fix cmd-click opening of relative/local paths (#9921)
This PR fixes an issue #9563 where relative file paths were not being
resolved against the terminal’s current working directory before
opening.


#### Verification
Tested with directories containing:
```
/tmp/test/test
❯ du -h .
  0B    ./spaces-end
  0B    ./with dot.
  0B    ./space middle
8.0K    .
```

Parent directory resolution also works as expected:
```
/tmp/test/test
❯ du -h ..
  0B    ../test/spaces-end
  0B    ../test/with dot.
  0B    ../test/space middle
8.0K    ../test
 16K    ..
 ```
 
@mitchellh  
In your original description you mentioned that “Links should work for all situations as they do in iTerm2.”  
I noticed that, for example, when running `ls`, the paths are not clickable, while they are clickable in iTerm2.
If you think this case should also be handled, I can open a separate PR for it once this one is accepted.
2025-12-16 09:07:16 -08:00
greathongtu
e58bbc1d3e Merge branch 'ghostty-org:main' into feat-list-themes-write-config 2025-12-17 00:29:24 +08:00
Mitchell Hashimoto
72747a28af OSC parser microbenchmarking (#9867)
Add options to the Ghostty benchmark tool to test the OSC parser in
isolation.

```
ghostty on  benchmark-osc [?] via  v0.15.2 via   impure (ghostty-env) took 5s
at 22:32:50 → ./zig-out/bin/ghostty-gen +osc --style=parser --p-valid=0.9 | head -c100000000 > osc.txt

ghostty on  benchmark-osc [?] via  v0.15.2 via   impure (ghostty-env)
at 22:32:52 → poop './zig-out/bin/ghostty-bench +osc-parser --data=osc.txt'
Benchmark 1 (12 runs): ./zig-out/bin/ghostty-bench +osc-parser --data=osc.txt
  measurement          mean ± σ            min … max           outliers
  wall_time           421ms ± 4.15ms     415ms …  430ms          0 ( 0%)
  peak_rss           5.89MB ± 74.1KB    5.73MB … 6.03MB          4 (33%)
  cpu_cycles         1.54G  ± 5.82M     1.54G  … 1.56G           2 (17%)
  instructions       4.12G  ± 15.6      4.12G  … 4.12G           1 ( 8%)
  cache_references   13.6M  ±  219K     13.3M  … 14.0M           0 ( 0%)
  cache_misses       72.7K  ± 16.5K     59.2K  …  121K           1 ( 8%)
  branch_misses      3.29M  ± 42.1K     3.23M  … 3.36M           0 ( 0%)
```
2025-12-16 07:27:16 -08:00
Mitchell Hashimoto
8ed7cce203 zsh: removed unused self_dir variable (#9924)
This came from the original Kitty script on which ours is based, but we
don't use it.
2025-12-16 06:38:56 -08:00
Jon Parise
c4cd2ca81d zsh: removed unused self_dir variable
This came from the original Kitty script on which ours is based, but we
don't use it.
2025-12-16 08:27:00 -05:00
Elad Kaplan
24413a9a24 Add a description to the test section comment 2025-12-16 10:17:54 +02:00
Elad Kaplan
32395fd838 Fix cmd-click opening of relative/local paths 2025-12-16 10:09:07 +02:00
Mitchell Hashimoto
051e6543ff Decouple balanced top and left window paddings to avoid diagonal resize jitter (#9518)
I had a bit of the same annoyance as #9064. I agree that with balanced
padding, you should expect horizontal jitter when resizing horizontally,
and vertical jitter when resizing vertically. Diagonal jitter, however,
happened because the top padding was upper bounded by the left padding,
coupling the vertical and horizontal wobbling. This looks kind of janky,
and it's surprising that the balance between top and bottom padding
changes as you vary only the width of the window.

With this PR, the upper bound is instead equal to the maximum left
padding. Since this only depends on the config, not the current window
width, the diagonal wobbling is avoided. Both the top and left padding
still have the same range of motion as before.

An alternative could be to bound by the minimum or median left padding
instead. Open to suggestions.

**Before**


https://github.com/user-attachments/assets/d12c5870-f05d-450f-89fc-c59eab90e199

**After**


https://github.com/user-attachments/assets/35b80bb0-9ea2-41c1-8502-3a8eec51dbc6
2025-12-15 12:11:04 -08:00
Jeffrey C. Ollie
f8c03bb6f6 logging: document GHOSTTY_LOG and make it more flexible 2025-12-15 11:54:36 -08:00
Mitchell Hashimoto
4e10f27be4 config: macos blur settings enable blur on non-Mac 2025-12-15 11:00:53 -08:00
Mitchell Hashimoto
a6ddf03a2e remove the macos-background-style config 2025-12-15 10:54:35 -08:00
Mitchell Hashimoto
bb23071166 config: change macos-background-style to be enums on background-blur 2025-12-15 10:42:21 -08:00
Mitchell Hashimoto
d5c378cd6b minor style tweaks 2025-12-15 10:12:36 -08:00
Justy Null
45aceace72 fix: disable renderer background when macOS effects are enabled 2025-12-15 10:12:11 -08:00
Justy Null
d40af61960 refactor: migrate background glass effect to new macos-background-style config 2025-12-15 10:10:51 -08:00
Justy Null
a02364cbef feat: add liquid glass background effect support 2025-12-15 10:10:51 -08:00
Mitchell Hashimoto
47462ccc95 clean up some blurring code 2025-12-15 09:40:10 -08:00
James Baumgarten
b15f16995c Fix i3 window border disappearing after fullscreen toggle
When toggling a Ghostty window between fullscreen and windowed mode in
the i3 window manager, window borders would disappear and not return.

Root cause was that syncAppearance() was updating X11 properties on
every call during window transitions, even when values hadn't changed.
These redundant property updates interfered with i3's border management.

The fix adds caching to syncBlur() and syncDecorations() to only update
X11 properties when values actually change, eliminating unnecessary
property changes during fullscreen transitions.
2025-12-15 09:33:00 -08:00
Mitchell Hashimoto
195c1561fa refactor(build): simplify dependency detection logic (#9914)
Closes #9894

**Problem**: Since #9850, a local build incorrectly identifies itself as
1.3.0 stable (in lieu of tip w/ commit info).

**Bug**: `@import("root")` in `Config.zig` resolves to the compilation
root (`main.zig`), not `build.zig` where the marker was defined. So
`@hasDecl` always returned false (i.e. all builds treated as
dependencies).

**Solution**: More or less @rockorager's original approach from #9850.

> _Use `@src().file` to get ghostty's source directory and compare it
with `b.build_root`. When they differ, ghostty is a dependency and we
skip git detection._

However, there is a potential edge case where if a downstream project
also has a `src/build/Config.zig` this will fail silently - seems
unlikely, but worth noting.

**Testing**:

```
$ zig build -p $HOME/.local -Doptimize=ReleaseFast
$ ghostty --version
Ghostty 1.3.0-main+a0a915a06

Version
  - version: 1.3.0-main+a0a915a06
  - channel: tip
```

---

> **AI Disclosure**: I used Claude Code to review and identify edge
cases.
2025-12-15 08:46:02 -08:00
kadekillary
a0a915a06f refactor(build): simplify dependency detection logic
- Removes unnecessary marker constant from build.zig that existed
  solely to signal build root status
- Uses filesystem check (@src().file access) instead of compile-time
  declaration lookup to detect when ghostty is a dependency
- Same behavior with less indirection: file resolves from build root
  only when ghostty is the main project
2025-12-15 06:31:54 -06:00
Jon Parise
b0c053cfb7 zsh: document unsupported system-level ZDOTDIR
We rely on temporarily setting ZDOTDIR to our `zsh` resource directory
to implement automatic shell integration. Setting ZDOTDIR in a system
file like /etc/zshenv overrides our ZDOTDIR value, preventing our shell
integration from being loaded.

The only way to prevent /etc/zshenv from being run is via the --no-rcs
flag. (The --no-globalrcs only applies to system-level files _after_
/etc/zshenv is loaded.) Unfortunately, there doesn't appear to be a way
to run a "bootstrap" script (to reimplement the Zsh startup sequence
manually, similar to how our bash integration works) and then enter an
interactive shell session.

https://zsh.sourceforge.io/Doc/Release/Files.html

Given all of the above, document this as an unsupported configuration
for automatic shell integration and point affected users at our manual
shell integration option.
2025-12-14 20:24:41 -05:00
Mitchell Hashimoto
1fdc0c0b9f terminal: CSI S compatiblity improvements
Fixes #9905

This fixes a major compatibility issues with the CSI S sequence:

When our top margin is at the top (row 0) without left/right
margins, we should be creating scrollback. Previously, we were
only deleting.
2025-12-14 14:36:42 -08:00
Mitchell Hashimoto
dfb94cd55d apprt/gtk: clean up gotoWindow 2025-12-13 14:23:53 -08:00