Commit Graph

7735 Commits

Author SHA1 Message Date
Joshie
cbeb6890c9 Add .ghostty extension to config (#8885)
Resolves #8689

For various reason, ghostty wants to have a unique file extension for
the config files. The name was settled on `config.ghostty`. This will
help with tooling. See #8438 (original discussion) for more details.

This PR introduces the preferred default of `.ghostty` while still
supporting the previous `config` file. If both files exist, a warning
log is sent.

The docs / website will need to be updated to reflect this change. 

> [!NOTE]
> Only tested on macOS 26.0.

---------

Co-authored-by: Mitchell Hashimoto <m@mitchellh.com>
2025-10-12 13:48:06 -07:00
Jeffrey C. Ollie
37b3c27020 synthetic: use std.Io.Writer for more of the interface (#9038) 2025-10-12 13:11:52 -07:00
Alan Wu
5efb915771 Fix fish shell cursor integration in fish vi mode (#9157)
Previously, the fish shell integration interfered with fish's builtin vi
mode cursor switching configurations such as `$fish_cursor_default` and
`$fish_cursor_insert`.

```console
$ ghostty --config-default-files=false -e fish --no-config --init-command 'source "$GHOSTTY_RESOURCES_DIR"/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish; fish_vi_key_bindings'
```

The above command starts fish in vi mode with Ghostty shell
integrations. Manually loading the integration is necessary due to
`--no-config` blocking auto injection.

1. At the prompt, fish is in insert mode, and the cursor is a blinking
beam. However, press escape and then "i" to exit then re-enter insert
mode, and the cursor will be a solid beam due to the
`$fish_cursor_unknown` setting. Without the shell integration, insert
mode always uses a solid beam cursor.

2. A similar problem shows if we start fish with `fish_vi_key_bindings
default`. The cursor ends up as a blinking beam in normal mode only due
to the shell integration interfering. This glitch can also be reset away
by entering then exiting insert mode.

3. Also, `$fish_cursor_external` has no effect when used with shell
integration. After `fish_vi_key_bindings`, set it to `line`, run cat(1),
and shell integration will give you a blinking block, not the asked for
line/beam.

I verified that this patch makes the shell integration stop interfering
in three scenarios above, and it still changes the cursor when not using
fish's vi mode.

Note that `$fish_cursor_*` variables can be set when fish isn't in vi
mode, so they're not great signals for the shell integration hooks.
2025-10-12 10:55:21 -07:00
Daniel Wennberg
65f73f5d20 font: Apply adjust-icon-height to both large and small icons (#9160)
As pointed out in #9156, an unintended consequence of all the work to
get icon sizing right is that `adjust-icon-height` now only applies to
the small icons you get when the next cell is not whitespace. Large
icons are unaffected.

With this PR, `adjust-icon-height` affects the maximum height of every
symbol specifying the `.icon` constraint height, regardless of
constraint width. This includes most Nerd Font icons, but excludes emoji
and other unicode symbols, and also excludes terminal graphics-oriented
Nerd Font symbols such as Powerline symbols.

In the following screenshots, **Baseline** is without
`adjust-icon-height`, while **Before** and **After** are with
`adjust-icon-height = -25%`.

**Baseline**
<img width="711" height="95" alt="Screenshot 2025-10-11 at 23 28 20"
src="https://github.com/user-attachments/assets/7499db4d-75a4-4dbd-b107-8cb5849e31a3"
/>

**Before** (only small icons affected)
<img width="711" height="95" alt="Screenshot 2025-10-11 at 23 20 12"
src="https://github.com/user-attachments/assets/9afd9fbf-ef25-44cc-9d8e-c39a69875163"
/>


**After** (both small and large icons affected, but not emoji)
<img width="711" height="95" alt="Screenshot 2025-10-11 at 23 21 05"
src="https://github.com/user-attachments/assets/90999f59-3b43-4684-9c8e-2c3c1edd6d18"
/>
2025-10-12 07:31:54 -07:00
Daniel Wennberg
2e34f4e0e5 fix(font): Additional scale group tweaks (#9152)
Of course #9142 would require a minor follow-up!

* Scale groups can cut across patch sets, but not across fonts. We had
some scale group mixing between Font Awesome and the weather symbols,
which is removed by this PR.[^cp_table_full]
* There's one case where a scale group includes a glyph that's not part
of any patch sets, just for padding out the group bounding box.
Previously, an unrelated glyph from a different font would be pulled in.
Now we use an appropriate stand-in. (See code comment for details.)
* I noticed overlaps weren't being split between each side of the
bounding box, they were added to both sides, resulting in twice as much
padding as specified.

Screenshots showing the extra vertical padding for progress bar elements
due to the second bullet point:

**Before**
<img width="191" height="42" alt="Screenshot 2025-10-11 at 15 33 54"
src="https://github.com/user-attachments/assets/cf288cce-86d3-46fd-ae86-18e5c274b0e4"
/>

**After**
<img width="191" height="42" alt="Screenshot 2025-10-11 at 15 33 20"
src="https://github.com/user-attachments/assets/7ac799c7-bf50-4e65-a74a-f8a2c42d2441"
/>

[^cp_table_full]: Forming and using the merged `cp_table_full` table
should have been a red flag. Such a table doesn't make sense, it would
be a one-to-many map. You need the names of the original fonts to
disambiguate.
2025-10-11 19:48:08 -07:00
Daniel Wennberg
4af93975ed font(fix): Extract and apply Nerd Font codepoint mapping table (#9142)
Fixes #9076

**Before** 
<img width="128" height="57" alt="Screenshot 2025-10-11 at 00 07 09"
src="https://github.com/user-attachments/assets/a6b416d5-dae1-4cea-a836-00640ceaf39b"
/>

**After**
<img width="128" height="57" alt="Screenshot 2025-10-11 at 00 07 31"
src="https://github.com/user-attachments/assets/7d2df7b1-4767-4e2d-84d2-8301da5c6602"
/>

These screenshots show the chevrons mentioned in
https://github.com/ghostty-org/ghostty/discussions/7820#discussioncomment-14617170,
which should be scaled as a group but were not until this PR.

The added code downloads each individual symbol font file from the Nerd
Fonts github repo (making sure to get the version corresponding to the
vendored `font-patcher.py`) and iterates over all of them to build the
correct and complete codepoint mapping table. The table is saved to
`nerd_font_codepoint_tables.py`, which `nerd_font_codegen.py` will reuse
if possible instead of downloading the font files again.

I'm not going to utter any famous last words or anything, but... after
this, I don't think the number of remaining issues with icon
scaling/alignment is _large._
2025-10-11 13:12:13 -07:00
Brice
c7058143c7 GTK fix quick terminal autohide (#9139)
This is pretty much a direct port of the previous GTK app. still inside
of the `isActive` handler for a window


7e429d73d6/src/apprt/gtk/Window.zig (L822-L837)

Fixes: https://github.com/ghostty-org/ghostty/discussions/9137
2025-10-11 12:52:35 -07:00
Jeffrey C. Ollie
81c982df96 gtk: fix clicking on desktop notifications (#9146)
Clicking on desktop notifications sent by Ghostty _should_ cause the
window that sent the notification to come to the top. However, because
the notification that was sent targeted the wrong surface (apprt surface
vs core surface) and the window did not call `present()` on itself the
window would never be brought to the surface, the correct tab would not
be selected, etc.

Fixes #9145
2025-10-11 12:51:52 -07:00
Jeffrey C. Ollie
c5ad7563f9 gtk: better reporting for CSS parsing problems (#9129)
Log messages will include the problematic CSS, simplifying debugging.
Especially helpful since some of our CSS is generated at runtime so it
could be difficult to examine the CSS "source".

```
info(gtk_ghostty_application): loading gtk-custom-css path=/home/ghostty/dev/ghostty/x.css
warning(gtk_ghostty_application): css parsing failed at <data>:2:3-14: gtk-css-parser-error-quark 4 No property named "border-poop"
* {
  border-poop: 0;

warning(gtk_ghostty_application): css parsing failed at <data>:1:3-3:1: gtk-css-parser-warning-quark 1 Unterminated block at end of document
* {
  border-poop: 0;
```

vs:

```
info(gtk_ghostty_application): loading gtk-custom-css path=/home/ghostty/dev/ghostty/x.css
warning(glib): WARNING: Gtk: Theme parser error: <data>:2:3-14: No property named "border-poop"
warning(glib): WARNING: Gtk: Theme parser warning: <data>:1:3-3:1: Unterminated block at end of document
```
2025-10-10 13:41:58 -07:00
Bruno BELANYI
854c8e6975 Set title as argv[0] for commands specified with -e (#9121)
I want to see #7932 get merged, so applied the latest proposed patch.

Will close if the original PR gets some traction, as I do _not_ know Zig
nor this project.

Co-authored-by: rhodes-b <59537185+rhodes-b@users.noreply.github.com>
2025-10-10 13:41:38 -07:00
Jeffrey C. Ollie
c28104e62f gtk: properly check for amount of time elapsed before notifying about command finish (#9128) 2025-10-10 10:01:06 -07:00
Jeffrey C. Ollie
7767a45779 osc: do inplace decoding of cmdline passed in OSC 133;C (#9127) 2025-10-10 10:00:50 -07:00
Mitchell Hashimoto
cbbcf06e6e terminal: add semi-colon character to word boundary list for easier selection (#9069)
Sorry, I'm living dangerously here and haven't started a discussion.

New ghostty user. When working interactively with SQL clients you're
often writing semi-colons at the end of statements, e.g. `select * from
table;`

It's super annoying when you double-click to select the word `table` it
actually selects `table;` Anecdotally, this behaviour disagrees with
other terminals I've tried (tho not exhaustive).

Disclosure: Claude wrote this code but, ironically, I "assisted it" by
pointing to the file and function after uncovering issue #30 and
relevant PR.
2025-10-10 09:04:22 -07:00
tlj
f0da093bdc apprt/gtk: use configured title as fallback for closureComputedTitle 2025-10-10 08:49:59 -07:00
Ēriks Remess
402c492d94 set minimum required zig version from build.zig.zon in tests and dockerfile 2025-10-09 17:07:58 +03:00
Ēriks Remess
f4b051a84c use app_version from build.zig.zon 2025-10-09 16:02:40 +03:00
Ravi Chandra
e70ae28fa3 terminal: add semi-colon character to word boundary list 2025-10-07 18:16:06 +13:00
Mitchell Hashimoto
bf9f025aec lib-vt: begin paste utilities exports starting with safe paste 2025-10-06 21:09:28 -07:00
Mitchell Hashimoto
725203d494 lib-vt: split header to be more consumable 2025-10-06 20:48:49 -07:00
Jeffrey C. Ollie
3d1977ca43 osc: parse additional OSC 133 options (#9059)
OSC 133;A can have:

- special_key
- click_events

OSC 133;C can have:

- cmdline
- cmdline_url

Notably, they are in use by `fish`. Not sure what other shells currently
use these options.

Note that the options are only parsed. Nothing further is done with them
at this point.
2025-10-06 16:01:34 -05:00
Jeffrey C. Ollie
f72bbb5038 fix custom-shader writergate breakage
Fixes: #9060
2025-10-06 15:03:25 -05:00
Jeffrey C. Ollie
debdf6bf03 osc: parse additional OSC 133 options
OSC 133;A can have:

- special_key
- click_events

OSC 133;C can have:

- cmdline
- cmdline_url

Notably, they are in use by `fish`. Not sure what other shells currently
use these options.

Note that the options are only parsed. Nothing further is done with them
at this point.
2025-10-06 14:52:09 -05:00
Mitchell Hashimoto
e1e5bfc096 apprt/gtk: only close with no windows active if close delay is off
Fixes #9052
2025-10-06 09:17:16 -07:00
Mitchell Hashimoto
e4f0c366ff lib-vt docs: add etags to the pages 2025-10-06 08:48:57 -07:00
Mitchell Hashimoto
9194d6c496 doxygen: integrate examples into documentation 2025-10-06 08:44:47 -07:00
Jeffrey C. Ollie
d2ee80bc49 gtk: use std.Io.Writer to generate runtime CSS 2025-10-06 09:39:50 -05:00
Mitchell Hashimoto
86421c9e09 lib-vt: trying to fix up hosted docs 2025-10-05 20:36:22 -07:00
Mitchell Hashimoto
6ef0be7580 libghostty website: update to use arch for doxygen for latest 2025-10-05 20:26:18 -07:00
Mitchell Hashimoto
f3c1357337 lib-vt: fix dockerfile to include assets for web 2025-10-05 20:18:48 -07:00
Mitchell Hashimoto
ed65401bf8 osc: reorder osc tests and name them consistently (#9042)
No changes in the tests were made, but reordering them and naming them
consistently will makes finding tests easier (there are a LOT).
2025-10-05 19:51:07 -07:00
Jeffrey C. Ollie
d9de5909d9 linux cgroup: also fix controllers()
This fix was found by Claude Code, but I manually reviewed this change
and removed extraneous changes made by the AI tool.

Co-authored-by: moderation <michael@sooper.org>
2025-10-05 21:03:14 -05:00
Jeffrey C. Ollie
a249b3da3a linux cgroup: fix initialization 2025-10-05 20:46:48 -05:00
Jeffrey C. Ollie
f03344b1c6 osc: reorder osc tests and name them consistently 2025-10-05 19:49:21 -05:00
Mitchell Hashimoto
c5ea4a8079 libghostty: use Arch for docs container to get later Doxygen 2025-10-05 15:19:20 -07:00
Mitchell Hashimoto
aeb6647aa6 libghostty docs: use latest Doxygen 2025-10-05 15:04:51 -07:00
Mitchell Hashimoto
48f5e4a16d lib-vt: expose key encoding as a C API (#9040)
Example in `example/c-vt-key-encode`, but here is an abridged version:

```c
#include <assert.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <ghostty/vt.h>

int main() {
  GhosttyKeyEncoder encoder;
  GhosttyResult result = ghostty_key_encoder_new(NULL, &encoder);
  assert(result == GHOSTTY_SUCCESS);

  ghostty_key_encoder_setopt(encoder, GHOSTTY_KEY_ENCODER_OPT_KITTY_FLAGS, &(uint8_t){GHOSTTY_KITTY_KEY_ALL});

  GhosttyKeyEvent event;
  result = ghostty_key_event_new(NULL, &event);
  assert(result == GHOSTTY_SUCCESS);
  ghostty_key_event_set_action(event, GHOSTTY_KEY_ACTION_RELEASE);
  ghostty_key_event_set_key(event, GHOSTTY_KEY_CONTROL_LEFT);
  ghostty_key_event_set_mods(event, GHOSTTY_MODS_CTRL);

  char buf[128];
  size_t written = 0;
  result = ghostty_key_encoder_encode(encoder, event, buf, sizeof(buf), &written);
  assert(result == GHOSTTY_SUCCESS);

  ghostty_key_event_free(event);
  ghostty_key_encoder_free(encoder);
  return 0;
}
```
2025-10-05 14:44:55 -07:00
Mitchell Hashimoto
61fe78c1d3 lib-vt: expose key encoding as a C API 2025-10-05 14:40:20 -07:00
NikoMalik
ff3a6d0650 fix: do not remove libc memmove until performance comparisons have been conducted 2025-10-05 17:35:58 +03:00
NikoMalik
1c0282d658 fix:use builtin memmove 2025-10-05 12:30:51 +03:00
Mitchell Hashimoto
44496df899 input: use std.Io.Writer for key encoder, new API, expose via libghostty
This modernizes `KeyEncoder` to a new `std.Io.Writer`-based API.
Additionally, instead of a single struct, it is now an `encode` function
that takes a series of more focused options. This is more idiomatic Zig
while also making it easier to expose via libghostty-vt.

libghostty-vt also gains access to key encoding APIs.
2025-10-04 20:19:39 -07:00
Mitchell Hashimoto
503a25653f build: framegen can use self-hosted (#9021)
This was a red herring when I was doing the 0.15 port. It works with
self-hosted just fine.
2025-10-04 14:08:42 -07:00
Mitchell Hashimoto
d4dcecb071 Move paste encoding to the input package, test, optimize away one alloc
This moves our paste logic to `src/input` in preparation for exposing
this as part of libghostty-vt. This yields an immediate benefit of
unit tests for paste encoding. 

Additionally, we were able to remove one allocation on every unbracketed
paste path unless the input specifically contains a newline. Unlikely to
be noticable, but nice.

NOTE: This also includes one change in behavior: we no longer encode
`\r\n` and a single `\r`, but as a duplicate `\r\r`. This matches xterm
behavior and I don't think will result in any issues since duplicate
carriage returns should do nothing in well-behaved terminals.
2025-10-04 14:05:32 -07:00
Mitchell Hashimoto
18eee610bc Expand ~ in macos-custom-icon (#9024)
Since #8999, `macos-custom-icon` works when its a fully expanded
absolute path like `/Users/username/dir/icon.icns`, but not when it's
abbreviated as `~/dir/icon.icns`. Users were understandably surprised
and confused by this. This PR adds tilde expansion using `NSString`s
built-in property for this.

Also removed a line from the config docs that seemed erroneous. Given
that the option has a functional default, it seems incorrect to say that
it's required.
2025-10-04 07:18:50 -07:00
Daniel Wennberg
3620132dfc Remove incorrect note from config docs 2025-10-04 00:13:23 -07:00
Daniel Wennberg
6bc60b6c64 Add comprehensive constraint tests 2025-10-03 22:30:52 -07:00
Daniel Wennberg
5360aeb8aa Fix botched cherry-pick from #8990 2025-10-03 22:20:45 -07:00
Mitchell Hashimoto
e07415a2e2 build: framegen can use self-hosted
This was a red herring when I was doing the 0.15 port. It works with
self-hosted just fine.
2025-10-03 14:41:05 -07:00
Daniel Wennberg
78f1bf1807 Handle font_patcher codepoint range overlaps 2025-10-03 13:50:11 -07:00
Daniel Wennberg
44951d9b1c Handle font_patcher codepoint offsets 2025-10-03 13:50:11 -07:00
Daniel Wennberg
d07237fff5 Skip patchsets and codepoints not in SymbolsNF 2025-10-03 13:50:11 -07:00