11109 Commits

Author SHA1 Message Date
Mitchell Hashimoto
e68c1d2cad config: add available since for SSH shell integration 2025-07-09 09:30:22 -07:00
Mitchell Hashimoto
5a5c9e4387 Add SSH Integration Configuration Option (#7608)
Addresses #4156 and #5892, specifically by implementing @mitchellh's
[request](https://github.com/ghostty-org/ghostty/discussions/5892#discussioncomment-12283628)
for "opt-in shell integration".

## Problem

Ghostty's custom `xterm-ghostty` TERM value breaks terminal
functionality when SSHing to remote systems that lack the corresponding
terminfo entry. This affects enterprise environments, legacy servers,
and ephemeral instances.

## Solution

Adds two independent SSH integration flags within the existing
`shell-integration-features` configuration:

```
shell-integration-features = ssh-env,ssh-terminfo
```

- **`ssh-env`**: TERM compatibility fix (xterm-ghostty → xterm-256color)
+ environment variable propagation (COLORTERM, TERM_PROGRAM,
TERM_PROGRAM_VERSION)
- **`ssh-terminfo`**: Automatic terminfo installation on remote hosts
with caching and utility commands

Flags work independently and harmoniously when combined, allowing users
granular control over SSH integration behavior.

## Implementation

Adds SSH wrapper functions across bash, zsh, fish, and elvish that
handle TERM compatibility, environment propagation, and terminfo
installation. Follows the same pattern as existing shell integration
features - client-side only with graceful fallback behavior.

The flag-based approach allows users to choose exactly the features they
need:
- Environment compatibility only: `ssh-env`
- Terminfo installation only: `ssh-terminfo` 
- Optimal experience: `ssh-env,ssh-terminfo`
- No SSH integration: omit both flags

## Evolution Note

Based on maintainer feedback, this evolved from a progressive
enhancement approach (`ssh-integration = basic | full`) to independent
flags within `shell-integration-features`. See discussion below for the
complete architectural evolution and rationale.
2025-07-09 09:28:40 -07:00
Mitchell Hashimoto
8ab3010bb8 cli: rewrite ssh-cache diskcache and test IO 2025-07-09 09:20:14 -07:00
Mitchell Hashimoto
7cfb026e84 cli: ssh-cache stylistic changes 2025-07-09 06:47:17 -07:00
Mitchell Hashimoto
bcb4e624a4 cli: fix macOS builds 2025-07-09 06:45:29 -07:00
Mitchell Hashimoto
2f4af5eb87 Changed behaviour of bold-color (#7871)
Continuation of discussion in
https://github.com/ghostty-org/ghostty/discussions/3134

This changes the behaviour of the new bold-color option to only affect
the default foreground text when set to a static colour. By using a
static colour, the remaining colours are rendered as bright.
2025-07-09 06:37:21 -07:00
Mitchell Hashimoto
7af3f28e5e core: document which release added config entries (#7859)
For each config entry, add a comment specifying in which release it was
first added. In some cases I note when certain aspects of each config
entry were modified.
2025-07-09 06:34:37 -07:00
Robert Ian Hawdon
94cca0cc17 Updated comment 2025-07-09 11:35:44 +01:00
Robert Ian Hawdon
57fdfe76bb Changed behaviour of bold-color 2025-07-09 11:33:12 +01:00
Leah Amelia Chen
b90deebfb2 build: disable fuzzy matching for msgmerge (#7866) 2025-07-09 15:15:21 +08:00
Jeffrey C. Ollie
13805f7cc5 build: disable fuzzy matching for msgmerge
CI is currently configured to fail if there are any fuzzy matches in
translation files. This change prevents `msgmerge` from creating any
fuzzy matches when translations are updated.
2025-07-08 22:17:20 -05:00
Jeffrey C. Ollie
527dcea266 core: avalability of config entry since 1.0.0 can be assumed 2025-07-08 22:06:27 -05:00
Jeffrey C. Ollie
1a3a03577b core: document which release added config entries
For each config entry, add a comment specifying in which release it was
first added. In some cases I note when certain aspects of each config
entry were modified.
2025-07-08 22:06:27 -05:00
Mitchell Hashimoto
f0549e182e build: update zig build update-translations (#7862)
- The order of the arguments to xgettext influences the output. Since
  directorty walking does not guarantee that files will be listed in
  a deterministic order (especially when run on different systems) the
  translation files would see a lot of churn depending on who updated
  them last.

  In this update the files are sorted so that the arguments to xgettext
  are always in the same order. This should reduce churn in the future.

- Mark all of the files as inputs so that the Zig build system caching
  will work properly.
2025-07-08 16:33:45 -07:00
Jeffrey C. Ollie
68c9ab63b5 i18n: update translations 2025-07-08 15:21:34 -05:00
Jeffrey C. Ollie
b8d5c1cf42 build: update zig build update-translations
- The order of the arguments to xgettext influences the output. Since
  directorty walking does not guarantee that files will be listed in
  a deterministic order (especially when run on different systems) the
  translation files would see a lot of churn depending on who updated
  them last.

  In this update the files are sorted so that the arguments to xgettext
  are always in the same order. This should reduce churn in the future.

- Mark all of the files as inputs so that the Zig build system caching
  will work properly.
2025-07-08 15:21:19 -05:00
Qwerasd
638a31cc8c Hopefully Last Nerd Fonts Tweak (#7861)
With these two changes (see commits for details) our scaling should be
identical to the nerd font patcher in all the ways that matter and even
slightly better in some others.

I'm really hoping this is the last change I have to make to the nerd
font scaling...
2025-07-08 13:28:06 -06:00
Qwerasd
8b8e0bedad font: add scale groups to nerd font constraints
We do this by characterizing the shared bounding boxes in a static copy
of the symbols only nerd font when we're doing the codegen. This allows
us to get results of our scaling that are just as good as in a patched
font, since related glyphs can now be sized and positioned relative to
each other.
2025-07-08 12:00:22 -06:00
Qwerasd
1430660933 font: constrain width of two-cell icon-height icons
This stops things like folder icons from becoming over-wide. The patcher
typically makes these glyphs always 1 cell wide, but since we know how
it will be displayed we have the benefit of being able to make it more
than 1 cell when there's room. This makes our dynamic scaling *better*
than a static patched font :D
2025-07-08 11:56:49 -06:00
Jason Rayne
f6319efaa1 Merge branch 'main' into ssh-integration 2025-07-08 10:46:29 -07:00
Jason Rayne
f95476b181 refactor: apply maintainer feedback to SSH integration scripts across all shells
- Update Bash script (baseline): Simplify cache checking logic, clarify
"xterm-ghostty terminfo" message, remove unnecessary ssh_opts from
terminfo installation, remove extra success message
- Align ZSH/Fish/Elvish with updated Bash: Remove extra success
messages, adopt simplified cache checking, standardize setup messages
- Apply Elvish improvements: Remove unnecessary try/catch blocks, use
idiomatic error handling patterns
- Apply Fish improvements: Replace string pattern matching with
efficient `contains` checks on split features list
2025-07-08 10:45:42 -07:00
Qwerasd
731da5aea5 font/coretext: disable Apple's quantization, do it ourselves (#7854)
Using the "subpixel quantization" option for rendering our glyph was
creating bad edge cases where we'd lose the bottom or left row / column
of pixels in a glyph sometimes. I investigated the exact effect of this
option and it seems like beyond quantizing the position and scale it's
also doing some rudimentary auto-hinting. That said, the auto-hinting
doesn't do that much for us, and the fact that it horizontally snaps
coordinates to thirds of a pixel instead of whole pixels makes things
worse in terms of legibility at small pixel sizes, so ultimately it's
better with our own handling anyway.

I extensively compared the result of Apple's option with our own manual
quantization here and I'm pretty sure this will always match the
apparent whole pixel sizes, and where it differs (other than things like
crossbars) it seems to make glyphs generally more legible not less.

### Comparisons at several pixel sizes
Images have been scaled 8x so you can see the pixels
|Before (main)|After (this PR)|
|-|-|
|![image](https://github.com/user-attachments/assets/405d1fd3-a18c-43d9-bd0a-be4966bc04bd)|![image](https://github.com/user-attachments/assets/becc1459-baa4-4c9f-b68d-0b3fdb3a51ab)|
|![image](https://github.com/user-attachments/assets/00f33fac-bdef-4579-9344-8bd1aee9e0e9)|![image](https://github.com/user-attachments/assets/b88f9cd1-6c0c-4253-a25d-c14143d90089)|
|![image](https://github.com/user-attachments/assets/78ad227c-9b11-4ae1-a9f6-f682eaa0f16d)|![image](https://github.com/user-attachments/assets/50b619df-bef7-4b8b-b041-cc4ca21e850c)|
2025-07-08 10:29:13 -06:00
Qwerasd
a67b8b35f6 font/coretext: disable Apple's quantization, do it ourselves
Using the "subpixel quantization" option for rendering our glyph was
creating bad edge cases where we'd lose the bottom or left row / column
of pixels in a glyph sometimes. I investigated the exact effect of this
option and it seems like beyond quantizing the position and scale it's
also doing some rudimentary auto-hinting. That said, the auto-hinting
doesn't do that much for us, and the fact that it horizontally snaps
coordinates to thirds of a pixel instead of whole pixels makes things
worse in terms of legibility at small pixel sizes, so ultimately it's
better with our own handling anyway.

I extensively compared the result of Apple's option with our own manual
quantization here and I'm pretty sure this will always match the whole
pixel sizes, and where it differs (other than things like crossbars) it
seems to make glyphs generally more legible not less.
2025-07-07 21:26:23 -06:00
Jason Rayne
740c9c6644 Merge branch 'main' into ssh-integration 2025-07-07 11:33:44 -07:00
Jason Rayne
f279937377 refactor: simplify terminfo handling and remove base64 dependency
- Default ssh_term to xterm-256color to eliminate fallback assignments
- Remove base64 and replace infocmp -Q2 with standard -0 -x options for
compatibility
- Use process substitution instead of intermediate ssh_config variable
- Always set TERM explicitly since ssh_term is always defined
2025-07-07 11:33:26 -07:00
Mitchell Hashimoto
26522ab8c2 ci: switch Apple notarization to an new account (#7852)
The Ghostty Apple ID has been frozen. I'm working on figuring out how to
get it back. In the meantime, this switches the notarization to my
personal Apple ID.

I originally created the dedicated Apple ID to limit access since we
were using app passwords. But I've since discovered that we can create
API tokens that have limited access, so I don't think this is a problem
anymore.
2025-07-07 11:21:40 -07:00
Mitchell Hashimoto
9d81a5f5ec ci: switch Apple notarization to an new account
The Ghostty Apple ID has been frozen. I'm working on figuring out how to
get it back. In the meantime, this switches the notarization to my
personal Apple ID.

I originally created the dedicated Apple ID to limit access since we
were using app passwords. But I've since discovered that we can create
API tokens that have limited access, so I don't think this is a problem
anymore.
2025-07-07 11:08:44 -07:00
Jason Rayne
22edfd2c5d Merge branch 'main' into ssh-integration 2025-07-07 10:01:22 -07:00
Jason Rayne
c3b14dff71 refactor: simplify SSH terminfo and environment handling
- Simplify feature detection to use single wildcard check
- Replace ssh_env array with simple ssh_term string variable
- Use TERM environment prefix instead of save/restore pattern
- Remove unnecessary backgrounded subshell for cache operations
2025-07-07 10:00:56 -07:00
Qwerasd
5bc41dc694 Nerd Font Icon Height Constraint (#7850)
Nerd font icons were ***WAY*** too big depending on your font setup,
this is because we were always using the full cell height when the nerd
font patcher instead uses an "icon height" for most things. The patcher
calculates the icon height as two thirds of the font's cap height and
one third of the line height, but I've chosen to instead use 1.2 times
the cap height for more consistent results across fonts-- if the user
wants their icons bigger, they can use the `adjust-icon-height` metric
modifier (and they can also use it to make them smaller if they want
that for some reason).

I also adjusted the attributes to user horizontal cover + vertical fit
for `^` stretch modes (proportional scaling but scale up), which makes
it so that it never exceeds the cell size, since first it covers
horizontally and then scales down to fit vertically if necessary;
previously, if there were a particularly wide glyph that was scaled with
cover/cover it would exceed the available width and overflow in to
neighboring cells which wasn't good.
2025-07-07 10:25:53 -06:00
Jason Rayne
e0035e153d Merge branch 'main' into ssh-integration 2025-07-07 09:07:14 -07:00
Jason Rayne
08db61e27e refactor: simplify SSH environment variable handling
- Remove complex ssh_exported_vars tracking and local environment
modification in favor of trusting Ghostty's local environment
- Replace regex patterns with glob-based feature detection for better
performance
- Fix local variable declaration consistency throughout
- Streamline logic while maintaining all functionality
2025-07-07 09:06:15 -07:00
Qwerasd
bcb6ee6db6 config: add adjust-icon-height option
Metric modifier for the `icon_height` metric.
2025-07-07 10:04:11 -06:00
Qwerasd
c47459b4a2 font: add icon height to nerd font constraints
Icons were often WAY too big before because they were filling the whole
cell in height, which isn't great lol. This commit adds an `icon_height`
metric which is used to constrain glyphs that shouldn't be the size of
the entire cell.
2025-07-07 10:04:11 -06:00
Mitchell Hashimoto
fb271a67ec font/coretext: fix horizontal bearing calculation (#7848)
This was subtly wrong in a way that was most obvious when text switched
from regular to bold, where it would seem to wiggle since the bearings
of each letter would shift by a pixel in either direction. This affected
applications like fzf which uses bold to dynamically highlight the line
you have selected.
2025-07-07 08:59:31 -07:00
Mitchell Hashimoto
4aff16c148 gtk: rebuild gresources.c/h if CSS or icons change (#7849) 2025-07-07 08:59:07 -07:00
Jeffrey C. Ollie
5b1d390379 gtk: rebuild gresources.c/h if CSS or icons change 2025-07-07 10:38:08 -05:00
Qwerasd
23cc50b12c font/Metrics: remove original_cell_width, no longer needed 2025-07-07 09:09:37 -06:00
Qwerasd
e1e2f823ba font/coretext: fix horizontal bearing calculation
This was subtly wrong in a way that was most obvious when text switched
from regular to bold, where it would seem to wiggle since the bearings
of each letter would shift by a pixel in either direction. This affected
applications like fzf which uses bold to dynamically highlight the line
you have selected.
2025-07-07 08:57:20 -06:00
Kat
292d89dbe2 Add Hebrew Translations (#6758)
Pull request to add Hebrew translations, as discussed in the Discord.
2025-07-07 06:28:09 +00:00
Qwerasd
00d1e34957 Fallback Font Size Adjustment (#7840)
This PR changes `font.Collection` to automagically adjust the sizes of
added fonts so that their metrics (specifically their ex height, or
their ideograph character width if they have one) match the primary
font. This is like
[`font-size-adjust`](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size-adjust)
from CSS.

This is a big win for users who use mixed writing systems and rely
heavily on fallback fonts. For example, in #7774 it's pointed out that
CJK characters are not very well harmonized with existing Latin glyphs,
well:
|Before (`main`)|After (this PR)|
|-|-|
|<img width="326" alt="image"
src="https://github.com/user-attachments/assets/c11d372d-ec69-426d-b008-1f56a7430f23"
/>|<img width="326" alt="image"
src="https://github.com/user-attachments/assets/efcb56ea-0572-481a-b632-a0b5cd170fa9"
/>|

This also improves our handling of the horizontal alignment of fallback
glyphs. It's not an ideal solution; it only works for glyphs narrower
than the cell width because it messes with ligatures if we include
glyphs wider than the cell width; and most things would look better if
the center were proportionally remapped based on the ratio from the
glyph advance to the cell width, but that messes with glyphs designed to
align vertically so it can't be done, instead the original advance width
is centered in the cell width.
2025-07-06 23:01:55 -06:00
Qwerasd
08fd1688ff font: add test for size adjustment, fix small bug in resize
Previously produced very wrong values when calling Collection.setSize,
since it was assuming that the provided face had the same point size as
the primary face, which isn't true during resize-- so instead we just
have faces keep track of their set size, this is generally useful.
2025-07-06 22:45:13 -06:00
Qwerasd
d33161ad66 fix(font): include line gap in lineHeight helper 2025-07-06 22:40:43 -06:00
Mitchell Hashimoto
de814d32ef macos: open URLs with NSWorkspace APIs instead of open (#7843)
Fixes #5256

This updates the macOS apprt to implement the `OPEN_URL` apprt action to
use the NSWorkspace APIs instead of the `open` command line utility.

As part of this, we removed the `ghostty_config_open` libghostty API and
instead introduced a new `ghostty_config_open_path` API that returns the
path to open, and then we use the `NSWorkspace` APIs to open it (same
function as the `OPEN_URL` action).
2025-07-06 21:11:45 -07:00
Mitchell Hashimoto
b7ffbf933f macos: open URLs with NSWorkspace APIs instead of open
Fixes #5256

This updates the macOS apprt to implement the `OPEN_URL` apprt action to
use the NSWorkspace APIs instead of the `open` command line utility.

As part of this, we removed the `ghostty_config_open` libghostty API and
instead introduced a new `ghostty_config_open_path` API that returns the
path to open, and then we use the `NSWorkspace` APIs to open it (same
function as the `OPEN_URL` action).
2025-07-06 21:01:01 -07:00
Mitchell Hashimoto
db45fab85e bash: conditionally add cursor shape sequences (#7839)
In #7808, we stopped using PS0 to reset the cursor shape because
restoring PS0 in __ghostty_preexec was causing issues (#7802).

The alternate approach of printing the cursor reset escape sequence
directly from __ghostty_preexec caused a new issue: the input cursor
would persist longer than intended, such as when a suspended vim process
was restored to the foreground.

This change takes a different approach. We now conditionally add the
cursor shape escape sequences to PS0 (and PS1, for consistency) when
they don't already appear. The fixes the cursor shape reset problem.

The main downside to this approach is that PS0 will continue to contain
this escape sequence; it won't be cleared/reset in __ghostty_preexec for
the reasons described in #7808. This feels like an acceptable outcome
because there's no harm in the modified PS0 existing for the life of the
bash session (rather than it being modified and then restored for each
command cycle), and it's consistent with how some other terminals' bash
integration works (e.g. kitty).
2025-07-06 19:46:10 -07:00
Mitchell Hashimoto
fbb1994934 font: fix nerd font patcher ypadding twice what it should be (#7841)
The nerd font patcher uses `ypadding` as a single subtraction from the
cell height, which means that half of it should go to the top padding
and the other half to the bottom, but we were setting it for both the
top and bottom! This was making the heavy brackets way too small lol
(0.4 of the cell height instead of 0.7)

#7834 introduced the *opposite* problem to what it fixed haha. This
fixes it for real!
2025-07-06 19:43:15 -07:00
Qwerasd
327caf903c font: fix nerd font patcher ypadding twice what it should be
The nerd font patcher uses `ypadding` as a single subtraction from the
cell height, which means that half of it should go to the top padding
and the other half to the bottom, this was making the heavy brackets way
too small lol (0.4 of the cell height instead of 0.7)
2025-07-06 17:20:39 -06:00
Qwerasd
db08bf1655 font: adjust fallback font sizes to match primary metrics
This better harmonizes fallback fonts with the primary font by matching
the heights of lowercase letters. This should be a big improvement for
users who use mixed scripts and so rely heavily on fallback fonts.
2025-07-06 16:55:50 -06:00
Jon Parise
65a7c81c94 bash: conditionally add cursor shape sequences
In #7808, we stopped using PS0 to reset the cursor shape because
restoring PS0 in __ghostty_preexec was causing issues (#7802).

The alternate approach of printing the cursor reset escape sequence
directly from __ghostty_preexec caused a new issue: the input cursor
would persist longer than intended, such as when a suspended vim process
was restored to the foreground.

This change takes a different approach. We now conditionally add the
cursor shape escape sequences to PS0 (and PS1, for consistency) when
they don't already appear. The fixes the cursor shape reset problem.

The main downside to this approach is that PS0 will continue to contain
this escape sequence; it won't be cleared/reset in __ghostty_preexec for
the reasons described in #7808. This feels like an acceptable outcome
because there's no harm in the modified PS0 existing for the life of the
bash session (rather than it being modified and then restored for each
command cycle), and it's consistent with how some other terminals' bash
integration works (e.g. kitty).
2025-07-06 18:39:32 -04:00