Commit Graph

13482 Commits (072077d19d75eeffec22a47a03a648cf5a4cf1d5)

Author SHA1 Message Date
Mitchell Hashimoto 072077d19d
gtk/opengl: print an error when OpenGL version is too old (#9586)
#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)

-----------------------

I looked for why I couldn't get a context at all mostly to see what
OpenGL 4.3 functions were required to see if there'd be easy fallbacks,
but it also took me a good 15 minutes this morning to understand that
there was nothing wrong with my gtk/mesa versions and it's just my
hardware being old, so I think it'd good to take in itself even if the
displaying itself is a bit meh.

Happy to try to display it in the error page if you think it's important
and I can figure out how (haven't looked much yet)
2025-12-16 13:34:14 -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
Mitchell Hashimoto 7d8bff27a0
ai: add /review-branch command (#9934)
This is a subcommand I've been using for some time. It takes an optional
issue/PR number as context and produces a prompt to review a branch for
how well it addresses the issue along with any isolated issues it spots.

Example:
https://ampcode.com/threads/T-019b2877-475f-758d-ae88-93c722561576
2025-12-16 13:27:14 -08:00
Mitchell Hashimoto a25a5360f3
ai: add /review-branch command
This is a subcommand I've been using for some time. It takes an optional
issue/PR number as context and produces a prompt to review a branch for
how well it addresses the issue along with any isolated issues it spots.

Example: https://ampcode.com/threads/T-019b2877-475f-758d-ae88-93c722561576
2025-12-16 13:23:39 -08:00
Mitchell Hashimoto ab3a3805aa
Fix macOS log command for Ghostty (#9933)
Corrected the command for viewing Ghostty logs on macOS.
2025-12-16 13:17:29 -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 4827c7f53a
macOS: add `toggle_background_opacity` keybind action (#9117)
Related Issue: #5047 
Discussion: #4664 

### Investigation
The behavior of iTerm mentioned on the Discussion thread was as follows:

- `cmd + u` can be used to toggle "Use Transparency"
- The "Use Transparency" toggle operates on a per-surface basis
- The "Use Transparency" state persists even after reloading the config

### Summary
Based on the investigation and discussions in the preceding pull
requests, this implements the `toggle_background_opacity` keybind action
for macOS with the following specifications:

- Switches background opacity on a per-surface basis
- The background opacity state persists even after reloading the config
- Background opacity switching functionality is also available in Quick
Terminal
- Does nothing if `background-opacity` is set to 1 or higher
- Does nothing if in fullscreen mode

### Verification
This functionality has been tested across following scenarios,
confirming correct action behavior for:

- Split Window
  - Each split window maintains synchronized background opacity states
- Tab Group
  - Background opacity states do not synchronize between tabs
- Quick Terminal
- Background opacity states remain synchronized even when windows are
closed
- Command Palette

### AI Disclosure
This pull request was made with assistance from Claude Code.
I reviewed all AI-generated code and wrote the final output manually.


https://github.com/user-attachments/assets/e46ff8f0-42f2-442f-97dd-d5f5c33b10f1
2025-12-16 13:11:51 -08:00
Mitchell Hashimoto 95f4093e96
macos: make syncAppearance a virtual method on BaseTerminalController 2025-12-16 12:59:56 -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 8d49c698e4 refactor(macos): do nothing if in fullscreen 2025-12-16 11:32:10 -08:00
himura467 ded3dd4cbc refactor(macos): do nothing if `background-opacity >= 1` 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
Mitchell Hashimoto a1ffac3c58
introduce split-preserve-zoom config to maintain zoomed splits during navigation (#9089)
Closes #8458.

- Adds the split-preserve-zoom config option with a navigation flag.
- GTK and macOS runtimes now respect the flag so zoomed splits stay
zoomed when using split navigation. I've tested this on macOS (video
below), but have not tested on GTK.

This PR was written primarily with Codex CLI, using the
[gh-issue](https://github.com/ghostty-org/ghostty/blob/main/.agents/commands/gh-issue)
command.

Here is a short video of the debug build:


https://github.com/user-attachments/assets/3abea255-98e1-4a4f-9196-7c1b2663b9d2
2025-12-16 11:21:56 -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
Mitchell Hashimoto db4e8d76d8
macOS: save&restore quick terminal state (#9588)
Implements #8399. 

I didn't save `position` in this pr, since I don't see its necessity. 

Changing `quick-terminal-position` requires a relaunch; saving and
restoring this would have to deal with conflicts. I also don't see why a
user would change this frequently.

> [!NOTE]
> Used GPT to proofread my comments
2025-12-16 09:06:47 -08:00
Lukas d680404fae macOS: save&restore quick terminal state 2025-12-16 08:51:58 -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 011cf0e067
ci: optimizations (#9926)
This adds a couple optimizations to our CI:

1. macOS matrix gone, only test that freetype builds in addition to
Coretext.
2. Move Flatpak out to a triggered build on main similar to snaps. This
was our longest build and avoiding it in PRs is a win since it rarely
fails.
2025-12-16 07:10:06 -08:00
Mitchell Hashimoto 064c5684f7
ci: color scheme GHA uploads to mirror (#9925)
This changes our GHA that updates our color schemes to also upload it to
our dependency mirror at the same time. This prevents issues where the
upstream disappears, which we've had many times.
2025-12-16 07:02:21 -08:00
Mitchell Hashimoto ef0fec473a
ci: move flatpak out to a triggered build similar to snap 2025-12-16 07:00:02 -08:00
Mitchell Hashimoto 1a8eb52e99
ci: disable many macOS builds we don't use
This disables a bunch of configurations that we don't need to actually 
test for. The main one we want to keep building is Freetype because we
sometimes use this to compare behaviors, but Coretext is the default.

This is one of the primary drivers of CI CPU time.
2025-12-16 06:56:42 -08:00
Mitchell Hashimoto 3f504f33e5
ci: color scheme GHA uploads to mirror
This changes our GHA that updates our color schemes to also upload it
to our dependency mirror at the same time. This prevents issues where
the upstream disappears, which we've had many times.
2025-12-16 06:47:29 -08:00
Mitchell Hashimoto cb45410dcc
Update iTerm2 colorschemes (#9900)
Upstream release:
https://github.com/mbadolato/iTerm2-Color-Schemes/releases/tag/release-20251201-150531-bfb3ee1
2025-12-16 06:40:19 -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 0a0068002a
Revert "macos: populate the sparkle:channel element" (#9918)
Reverts ghostty-org/ghostty#9906

cc @jparise
2025-12-15 12:28:53 -08:00
Mitchell Hashimoto 78e539d684
Revert "macos: populate the sparkle:channel element" 2025-12-15 12:28:40 -08: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
Mitchell Hashimoto 14539bc185
logging: document GHOSTTY_LOG and make it more flexible (#8815) 2025-12-15 11:58:42 -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 6d2beed1b0
feat: add liquid glass background effect support (#8801)
## Description

This PR implements the basic functionality for "Liquid Glass" style
background support (#8155). I used OpenCode (Claude 4) in some capacity
to write this as I'm not super familiar with AppKit / SwiftUI. A good
chunk of this I still needed to write by hand since Claude doesn't
understand the Glass APIs, but I'm not 100% if the implementation here
makes the best decisions since the practices in Ghostty config and
separation of the AppKit code and SwiftUI seemed inconsistent to me.

Some of the combinations of options obviously create entirely unreadable
terminals, but I've found that regular glass and transparent with
opacity to be fairly readable. We *don't* enable this feature by default
since it would of course break existing users setups.

## Open Questions

- [x] How to determine the correct cornerRadius? For now this is
eyeballed, I can't see any macOS public API or clearly documented
constants.
- [x] Should boolean options be exposed for reasonable defaults?
- [x] Should the option need to be namespaced to macos-\*?

## Screenshots

0% Opacity, Regular
<img width="917" height="683" alt="image"
src="https://github.com/user-attachments/assets/ccb96ba7-5df2-4284-8526-e07bbb62e3e5"
/>
50% Opacity, Transparent
<img width="880" height="680" alt="image"
src="https://github.com/user-attachments/assets/5bdf12f9-3209-4aa9-8a4f-9a6eb4f95894"
/>
0% Opacity, Transparent
<img width="860" height="681" alt="image"
src="https://github.com/user-attachments/assets/1b33d400-4d8b-479a-94d7-47b844743e52"
/>
2025-12-15 11:10:03 -08:00
Mitchell Hashimoto 4e10f27be4
config: macos blur settings enable blur on non-Mac 2025-12-15 11:00:53 -08:00
Mitchell Hashimoto 8482e0777d
macos: remove glass view on syncAppearance with blur 2025-12-15 10:58:35 -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
Justy Null 42493de098 fix: make titlebar transparent when using glass background style 2025-12-15 10:12:36 -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 0f98e3b905
nix: replace deprecated system with stdenv.hostPlatform.system (#9916)
Reported by Mr. Hashimoto in discord. 

These changes removedthe following warning:
`evaluation warning: 'system' has been renamed to/replaced by
'stdenv.hostPlatform.system'`
2025-12-15 10:07:20 -08:00
Uzair Aftab 07578d5e3f nix: replace deprecated system with stdenv.hostPlatform.system 2025-12-15 18:59:34 +01:00