10108 Commits

Author SHA1 Message Date
Jon Parise
cd6b850758 shell-integration: minor documentation updates 2025-03-22 15:57:55 -04:00
Jon Parise
0caba3e19f shell-integration: comptime buffer capacity 2025-03-22 15:56:05 -04:00
Jon Parise
36ff70eb7f shell-integration: use elvish's native list type
Instead of looking for individual substrings in $GHOSTTY_SHELL_FEATURES,
`str:split` it into a list of feature names and use `has-value` to
detect their presence.
2025-03-22 12:26:56 -04:00
Jon Parise
77dc5c9dd2 shell-integration: use fish's native list type
Instead of looking for individual substrings in $GHOSTTY_SHELL_FEATURES,
`string split` it into a list of feature names and use `contains` to
detect their presence.
2025-03-22 12:11:51 -04:00
Jon Parise
314d52ac3a shell-integration: switch to $GHOSTTY_SHELL_FEATURES
This change consolidates all three opt-out shell integration environment
variables into a single opt-in $GHOSTTY_SHELL_FEATURES variable. Its
value is a comma-delimited list of the enabled shell feature names (e.g.
"cursor,title").

$GHOSTTY_SHELL_FEATURES is set at runtime and automatically added to the
shell environment. Its value is based on the shell-integration-features
configuration option.

$GHOSTTY_SHELL_FEATURES is only set when at least one shell feature is
enabled. It won't be set when 'shell-integration-features = false'.

$GHOSTTY_SHELL_FEATURES lists only the enabled shell feature names. We
could have alternatively gone in the opposite direction and listed the
disabled features, letting the scripts assume each feature is on by
default like we did before, but I think this explicit approach is a
little safer and easier to reason about / debug.

It also doesn't support the "no-" negation prefix used by the config
system (e.g. "cursor,no-title"). This simplifies the implementation
requirements of our (multiple) shell integration scripts, and because
$GHOSTTY_SHELL_FEATURES is derived from shell-integration-features,
the user-facing configuration interface retains that expressiveness.

$GHOSTTY_SHELL_FEATURES is intended to primarily be an internal concern:
an interface between the runtime and our shell integration scripts. It
could be used by people with particular use cases who want to manually
source those scripts, but that isn't the intended audience.

... and because the previous $GHOSTTY_SHELL_INTEGRATION_NO_* variables
were also meant to be an internal concern, this change does not include
backwards compatibility support for those names.

One last advantage of a using a single $GHOSTTY_SHELL_FEATURES variable
is that it can be easily forwarded to e.g. ssh sessions or other shell
environments.
2025-03-22 10:16:59 -04:00
Leah Amelia Chen
747c43ffa0 gtk: clean up C remnants and @ptrCasts (#6862) 2025-03-21 21:35:11 +01:00
Leah Amelia Chen
f659e70938 gtk: clean up C remnants and @ptrCasts
Some `@ptrCast`s are unavoidable in the codebase but I've gotten rid of
every one that's unnecessary.
2025-03-21 20:15:59 +01:00
Mitchell Hashimoto
4a51643043 Mention macOS' open in the CLI help messages (#6848)
> 3. If you want to live dangerously, open a pull request and hope for
the best.

Sure, why not!

---

This is a *super common* ask in both the GitHub Discussions and on
Discord; I thus decided to add a small(ish) note to the help output
directing users to try the open command. I did not include a note to
check the man page, as the text was already getting a bit long, but I
can change that if requested. Strings open for bike-shedding, of course.

Of course, feel free to close this if this is not a desirable change for
the project; I would appreciate a note about that though, rather than a
random unexpected close without any reason, as that would prevent any
future PRs about this from others.

As I do not use macOS, I was unable to test the appearance of the string
I edited in `main_ghostty.zig`.

On a slightly related note: are there any plans to translate the CLI's
strings? I assume they're in the same boat as the configuration parsing
errors which were [discussed in #maintainers] on [the Ghostty Discord].

[discussed in #maintainers]:
https://discord.com/channels/1005603569187160125/1337443701403815999/1352390511553417327
[the Ghostty Discord]: https://discord.org/ghostty
2025-03-21 07:21:27 -07:00
Kat
9a9bc43a9b Mention macOS' open in the CLI help messages. 2025-03-21 19:16:30 +11:00
Mitchell Hashimoto
1980f9aed4 font/freetype: disable SVG glyphs, simplify color check (#6824)
We don't currently support rendering SVG glyphs so they should be
ignored when loading. Additionally, the check for whether a glyph is
colored has been simplified by just checking the pixel mode of the
rendered bitmap.

This commit also fixes a bug caused by calling the color check inside of
`renderGlyph`, which caused the bitmap to be freed creating a chance for
memory corruption and garbled glyphs. This bug was introduced by 40c1140
(#6602) and discussed in #6781.
2025-03-20 11:47:02 -07:00
Mitchell Hashimoto
141b697f9d apprt/embedded: utf8 encoding buffer lifetime must extend beyond call (#6834)
Fixes #6821

UTF8 translation using KeymapDarwin requires a buffer and the buffer was
stack allocated in the coreKeyEvent call and returned from the function.
We need the buffer to live longer than this.

Long term, we're removing KeymapDarwin (there is a whole TODO comment in
there about how to do it), but this fixes a real problem today.
2025-03-19 21:47:13 -07:00
Mitchell Hashimoto
f31f8bb782 apprt/embedded: utf8 encoding buffer lifetime must extend beyond call
Fixes #6821

UTF8 translation using KeymapDarwin requires a buffer and the buffer was
stack allocated in the coreKeyEvent call and returned from the function.
We need the buffer to live longer than this.

Long term, we're removing KeymapDarwin (there is a whole TODO comment in
there about how to do it), but this fixes a real problem today.
2025-03-19 21:36:39 -07:00
Qwerasd
f0080529c4 fix(font/shape): don't require emoji presentation for grapheme parts
Also update shaper test that fails because the run iterator can't apply
that logic since `testWriteString` doesn't do proper grpaheme clustering
so the parts are actually split across multiple cells.

Several other tests are technically incorrect for the same reason but
still pass, so I've decided not to fix them here.
2025-03-19 15:09:53 -06:00
Mitchell Hashimoto
88ff566e06 ci: simplify debian 12 check (#6825)
Debian 12 CI check now relies entirely on a source tarball.
2025-03-19 13:18:41 -07:00
Mitchell Hashimoto
75045d92b4 Tweak Norwegian Bokmål translation (#6812)
This tweak is minor and fixes some grammatical errors.

I did not change `kopier` to `kopiér`, even though that is a common way
to write the word. The language council of Norway suggest writing the
word as it is written here, without the accent, but it does read weird
and allows for misunderstanding. If this was my project I would have
added the accent. Let me know if you want the accent added.

What do you think regarding the accents @Uzaaft ?
2025-03-19 13:18:05 -07:00
Mitchell Hashimoto
41130ce25f fix: inconsistent behavior from legacy and kitty Key encoding (#5728)
this fix addresses issue occurring in nvim/vim where Backspace deletes
previous letter while in preedit state.

related to #1638

> same issue reproducible
> However, that only fixed for legacy encoding.

Unanswered Discussion
https://github.com/ghostty-org/ghostty/discussions/5312<div
type='discussions-op-text'> can be closed afterwards

tested on macos sequioa IME '2-set Korean', 'Japanese Romaji'
2025-03-19 13:03:32 -07:00
Christoffer Tønnessen
9b3bd146c6 Tweak Norwegian Bokmål translation
This tweak is minor and fixes some grammatical errors.

I did not change `kopier` to `kopiér`, even though that is a common way
to write the word. The language council of Norway suggest writing the
word as it is written here, without the accent, but it does read weird
and allows for misunderstanding. If this was my project I would have
added the accent. Let me know if you want the accent added.
2025-03-19 20:46:00 +01:00
Jeffrey C. Ollie
a7a57011f0 ci: simplify debian 12 check 2025-03-19 14:44:31 -05:00
Serim Son
d61e53d6d6 Kitty key encoding should not encode backspace if UTF-8 text is present
This applies the same logic from #1659 to Kitty encoding.
2025-03-19 12:43:42 -07:00
Mitchell Hashimoto
9c064216a2 build: distribute gresource c/h with source tarball (#6822)
Closes #6760 
Supersedes #6762

This introduces the concept of a "dist resource" (specifically a
`GhosttyDist.Resource` type). This is a resource that may be present in
dist tarballs but not in the source tree. If the resource is present and
we're not in a Git checkout, then we use it directly instead of
generating it. This is a generic concept we can apply to any
preprocessing we want to do that we don't want users/packagers to do.

This is used for the first time in this commit for the gresource c/h
files, which depend on a variety of external tools (blueprint-compiler,
glib-compile-resources, etc.) that we do not want to require downstream
users/packagers to have and we also do not want to worry about them
having the right versions.

This also adds a check for `distcheck` to ensure our distribution
contains all the expected files.

Note @jcollie that there may be elements of 6762 you'll want to bring
back after this.
2025-03-19 12:10:08 -07:00
Mitchell Hashimoto
7b8c2232d3 build: distribute gresource c/h with source tarball
This introduces the concept of a "dist resource" (specifically a
`GhosttyDist.Resource` type). This is a resource that may be present in
dist tarballs but not in the source tree. If the resource is present and
we're not in a Git checkout, then we use it directly instead of
generating it.

This is used for the first time in this commit for the gresource c/h
files, which depend on a variety of external tools (blueprint-compiler,
glib-compile-resources, etc.) that we do not want to require downstream
users/packagers to have and we also do not want to worry about them
having the right versions.

This also adds a check for `distcheck` to ensure our distribution
contains all the expected files.
2025-03-19 11:52:03 -07:00
Qwerasd
6f84a5d682 font/freetype: disable SVG glyphs, simplify color check
We don't currently support rendering SVG glyphs so they should be
ignored when loading. Additionally, the check for whether a glyph is
colored has been simplified by just checking the pixel mode of the
rendered bitmap.

This commit also fixes a bug caused by calling the color check inside of
`renderGlyph`, which caused the bitmap to be freed creating a chance for
memory corruption and garbled glyphs.
2025-03-19 12:43:18 -06:00
Mitchell Hashimoto
bd315c8394 os: Add extra sentinel for GHOSTTY_RESOURCES_DIR (#6814)
Discover resourcesdir with `terminfo/g/ghostty`
as well as existing `terminfo/x/xterm-ghostty`.
This allows either terminfo file to be installed,
notably ncurses only provides a `terminfo/g/ghostty`.

It was brought up that the `ncurses-term` package on Fedora 42 at
<https://packages.fedoraproject.org/pkgs/ncurses/ncurses-term/fedora-42.html>
now provides a `/g/ghostty` terminfo entry which conflicts with
installing the similarly named file from ghostty's build process.
However a build with `zig build -Demit-terminfo=false` won't work as the
`x/xterm-ghostty` terminfo entry is used as a sentinel to discover the
`GHOSTTY_RESOURCES_DIR` used as a reference path for finding locale and
theme files.

```
src/Surface.zig|546 col 43| .resources_dir = global_state.resources_dir,
src/cli/list_themes.zig|112 col 22| if (global_state.resources_dir == null)
src/global.zig|38 col 5| resources_dir: ?[]const u8,
src/global.zig|173 col 14| self.resources_dir = try internal_os.resourcesDir(self.alloc);
src/global.zig|174 col 27| errdefer if (self.resources_dir) |dir| self.alloc.free(dir);
src/global.zig|177 col 18| if (self.resources_dir) |v| internal_os.i18n.init(v) catch |err| {
src/global.zig|185 col 18| if (self.resources_dir) |dir| self.alloc.free(dir);
```

We also have some comments that intend to change how the terminfo
database is discovered.

https://github.com/ghostty-org/ghostty/blob/main/src/termio/Exec.zig#L776C1-L781C60
2025-03-19 09:04:17 -07:00
Mitchell Hashimoto
403b3617f7 update translations 2025-03-19 08:54:30 -07:00
Mitchell Hashimoto
39d4cc3702 update CODEOWNERS 2025-03-19 08:52:39 -07:00
Danylo Zalizchuk
55c221c572 Merge branch 'main' into main 2025-03-19 08:52:14 -07:00
Danylo Zalizchuk
15efb913bf fix: removed words capitalization in the Ukrainian translations 2025-03-19 08:51:53 -07:00
Danylo Zalizchuk
f412237106 fix: update "Reloaded the configuration" translation 2025-03-19 08:51:53 -07:00
Danylo Zalizchuk
cb7180ef77 fix: reorder locales to ensure they follow ASCII ordering 2025-03-19 08:51:53 -07:00
Danylo Zalizchuk
e93be23f68 feat: add Ukrainian translations and locale support 2025-03-19 08:51:11 -07:00
Mitchell Hashimoto
bfec219510 Regenerate translations to fix CI (#6820)
I don't see any actual changes here, just reordering. It's using the Nix
environment so I'm not sure why this happened but it seemed to stem from
the Norwegian work originally. Fixing it back.
2025-03-19 08:39:00 -07:00
Mitchell Hashimoto
e56002e149 Regenerate translations.
I don't see any actual changes here, just reordering. It's using the Nix
environment so I'm not sure why this happened but it seemed to stem from
the Norwegian work originally. Fixing it back.
2025-03-19 08:35:39 -07:00
Leah Amelia Chen
907e62aa29 Fix typo: Alejanda → Alejandra in README.md (#6817) 2025-03-19 14:03:38 +01:00
CKay9
dc21ea9998 Fix typo: Alejanda → Alejandra in README.md 2025-03-19 13:38:38 +01:00
azhn
c5b1961c6b os: Add extra sentinel for GHOSTTY_RESOURCES_DIR
Discover resourcesdir with `terminfo/g/ghostty`
as well as existing `terminfo/x/xterm-ghostty`.
This allows either terminfo file to be installed,
notably ncurses only provides a `terminfo/g/ghostty`.
2025-03-19 20:49:02 +11:00
Mitchell Hashimoto
bd7c5cc95f Add Norwegian Bokmål Translations (#6731)
Pull request to add Norwegian Bokmål translations.
Asking assistance from @Uzaaft for review and help.
2025-03-18 16:04:41 -07:00
hanna
02bfa946d5 i18n: add norwegian bokmal translations 2025-03-18 15:44:46 -07:00
Mitchell Hashimoto
f7999444eb ci: zig fmt check (#6802)
This adds a CI test to ensure that all Zig files are properly formatted.
This avoids unrelated diff noise in future PRs.

This also runs `zig fmt` once to clean up all formatting issues for
future PRs.

I also introduced a new `xsm` (extra small) runner profile to use less
resources for our tiny tasks.
2025-03-18 14:39:34 -07:00
Jeffrey C. Ollie
07ec421cd3 CI: Add checks for blueprint compiler / Nix refactors (#6801)
1. Refactored Nix devshell/package to make it easier to keep
LD_LIBRARY_PATH & buildInputs in sync (plus make it easier to re-use in
other Nix environment).
2. Added a CI job to ensure that Blueprints are formatted correctly and
that they will compile using `blueprint-compiler` 0.16.0.
3. Reformatted all Blueprints with `blueprint-compiler format`.
2025-03-18 16:37:34 -05:00
Jeffrey C. Ollie
648e0a06ab CI: Add checks for blueprint compiler / Nix refactors
1. Refactored Nix devshell/package to make it easier to keep
   LD_LIBRARY_PATH & buildInputs in sync (plus make it easier to re-use
   in other Nix environment).
2. Added a CI job to ensure that Blueprints are formatted correctly and
   that they will compile using `blueprint-compiler` 0.16.0.
3. Reformatted all Blueprints with `blueprint-compiler format`.
2025-03-18 16:12:49 -05:00
Mitchell Hashimoto
4d0bf303c6 ci: zig fmt check
This adds a CI test to ensure that all Zig files are properly formatted.
This avoids unrelated diff noise in future PRs.
2025-03-18 13:58:49 -07:00
Mitchell Hashimoto
c0f5f913c9 zig build dist and distcheck for source tarballs (#6800)
This moves the source tarball creation process into the Zig build system
and follows the autotools-standard naming conventions of `dist` and
`distcheck`.

This doesn't change any of our build process otherwise. This is the
foundation for #6760 along with other source tarball tasks I have
planned (i.e. gobject bindings too).

The `dist` target creates a source tarball in the `PREFIX/dist`
directory. The tarball is named `ghostty-VERSION.tar.gz` as expected by
standard source tarball conventions.

The `distcheck` target does the same as `dist`, but also takes the
resulting tarball, extracts it, and runs tests on the extracted source
to verify the source tarball works as expected. Distcheck currently only
runs `zig build test` but in the future we can add additional checks to
run.

This commit also updates CI:

  1. Tagged releases now use the new `zig build distcheck` command.
  2. Tip releases now use the new `zig build dist` command.
3. A new test build tests that source tarball generation works on every
commit.
2025-03-18 13:21:24 -07:00
Mitchell Hashimoto
bab8c28c8b zig build dist and distcheck for source tarballs
This moves the source tarball creation process into the Zig build system
and follows the autotools-standard naming conventions of `dist` and
`distcheck`.

The `dist` target creates a source tarball in the `PREFIX/dist`
directory. The tarball is named `ghostty-VERSION.tar.gz` as expected by
standard source tarball conventions.

The `distcheck` target does the same as `dist`, but also takes the
resulting tarball, extracts it, and runs tests on the extracted source
to verify the source tarball works as expected.

This commit also updates CI:

  1. Tagged releases now use the new `zig build distcheck` command.
  2. Tip releases now use the new `zig build dist` command.
  3. A new test build tests that source tarball generation works on
     every commit.
2025-03-18 12:41:55 -07:00
Leah Amelia Chen
69590c80a1 gtk: unify gtk/adwaita version checks, use std.SemanticVersion in all cases (#6797) 2025-03-18 20:35:34 +01:00
Jeffrey C. Ollie
5bf10dce12 c804cd3dbb0274f3271736e0b8f279795bdff394 2025-03-18 14:14:50 -05:00
Jeffrey C. Ollie
0f2f0ab69f Update Adwaita version check for Box unref (#6796)
As of Adwaita 1.5.0, the GTK Box is not being properly unref'd when the
parent window is closed. Update the conditional to account for this.

Also add a couple of missing unref()s in errdefers.

This fixes an issue where Ghostty would not properly quit after closing
the last surface.
https://github.com/ghostty-org/ghostty/discussions/3807 is related
(though I'm not sure it's the exact same problem).
2025-03-18 10:42:00 -05:00
Gregory Anders
946c0c370f Update Adwaita version check for Box unref
As of Adwaita 1.5.0, the GTK Box is not being properly unref'd when the
parent window is closed. Update the conditional to account for this.

Also add a couple of missing unref()s in errdefers.
2025-03-18 10:24:42 -05:00
Jeffrey C. Ollie
ee78a3d345 gtk: remove c.zig (#6792)
It has been done.
2025-03-18 09:59:23 -05:00
Leah Amelia Chen
72017ea4d8 translations(zh_CN): update 2025-03-18 12:35:41 +01:00
Leah Amelia Chen
8c0ccfc5b3 translations: update 2025-03-18 12:35:41 +01:00