231 Commits

Author SHA1 Message Date
Mitchell Hashimoto
d7256c71c4
ci: flatpak 2025-04-22 10:56:10 -07:00
trag1c
f0ade53fd2 ci: add a script and workflow for requesting i18n review 2025-04-10 16:40:28 -07:00
Jeffrey C. Ollie
27978ef4d0
version bump for development 2025-03-26 23:29:15 -05: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
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
Jeffrey C. Ollie
5cd8ebdafd
update zon2nix
Upstream is now mostly pure Zig and the build.zig.zon.* files are
generated directly by zon2nix. The JSON file is no longer used as an
intermediate file but is retained for downstream packager usage.
2025-03-16 01:09:52 -05:00
Mitchell Hashimoto
221f905a1c
pkg/glfw
Closes #6702

This removes our mach-glfw dependency and replaces it with an in-tree
pkg/glfw that includes both the source for compiling glfw as well as the
Zig bindings. This matches the pattern from our other packages.

This is based on the upstream mach-glfw work and therefore includes the
original license and copyright information.

The reasoning is stated in the issue but to summarize for the commit:

  - mach-glfw is no longer maintained, so we have to take ownership
  - mach-glfw depended on some large blobs of header files to enable
    cross-compilation but this isn't something we actually care about,
    so we can (and do) drop the blobs
  - mach-glfw blobs were hosted on mach hosts. given mach-glfw is
    unmaintained, we can't rely on this hosting
  - mach-glfw relied on a "glfw" package which was owned by another
    person to be Zig 0.14 compatible, but we no longer need to rely on
    this
  - mach-glfw builds were outdated based on latest Zig practices
2025-03-13 20:52:33 -07:00
Mitchell Hashimoto
b123b14686
update zig2nix 2025-03-12 15:56:24 -07:00
Mitchell Hashimoto
3abbe6d3ba
nix: must not inject xcrun into PATH on macOS 2025-03-11 14:49:01 -07:00
Leah Amelia Chen
2f65f01fc8
gtk: add localization support, take 3 (#6004)
This is my third (!) attempt at implementing localization support. By
leveraging GTK builder to do most of the `gettext` calls, I can avoid
the whole mess about missing symbols on non-glibc platforms.

Added some documentation too for contributors and translators, just for
good measure.

Supersedes #5214, resolves the GTK half of #2357
2025-03-05 20:12:52 +01:00
Leah Amelia Chen
9360afd29f
gtk: add localization support, take 3
This is my third (!) attempt at implementing localization support.
By leveraging GTK builder to do most of the `gettext` calls, I
can avoid the whole mess about missing symbols on non-glibc platforms.

Added some documentation too for contributors and translators,
just for good measure.
2025-03-03 10:19:58 +01:00
Leah Amelia Chen
a85651fe4f
gtk: implement quick terminal
Using `gtk4-layer-shell` still seems like the path of least resistance,
and to my delight it pretty much Just Works. Hurrah!

This implementation could do with some further polish (e.g. animations,
which can be implemented via libadwaita's animations API, and global
shortcuts), but as a MVP it works well enough.

It even supports tabs!

Fixes #4624.
2025-02-28 18:04:42 +01:00
Jeffrey C. Ollie
2ef042978d
nix: include libxml2 in nativeBuildInputs for xmllint 2025-02-23 15:17:18 -06:00
Mitchell Hashimoto
03d1240999
nix: use snapcraft only on Linux 2025-02-15 07:07:23 -08:00
Ken VanDine
0c3b873dde Merge remote-tracking branch 'origin/add_snap_package' into add_snap_package 2025-02-15 07:06:40 -08:00
Mitchell Hashimoto
c7635201ab
Add snap to nix, add arm64 builders 2025-02-15 07:06:40 -08:00
Mitchell Hashimoto
4e8e2d9796
nix: snapcraft should only be installed on Linux 2025-02-14 14:52:36 -08:00
Mitchell Hashimoto
f1f23e1c7d
Add snap to nix, add arm64 builders 2025-02-14 14:52:08 -08:00
Tim Culverhouse
9cb297202b cli: add +boo command
Add a `+boo` command to show the animation from the website. The data
for the frames is compressed during the build process. This build step
was added to the SharedDeps object because it is used in both
libghostty and in binaries.

The compression is done as follows:
- All files are concatenated together using \x01 as a combining byte
- The files are compressed to a cached build file
- A zig file is written to stdout which `@embedFile`s the compressed
  file and exposes it to the importer
- A new anonymous module "framedata" is added in the SharedDeps object

Any file can import framedata and access the compressed bytes via
`framedata.compressed`. In the `boo` command, we decompress the file and
split it into frames for use in the animation.

The overall addition to the binary size is 348k.
2025-02-14 14:46:18 -08:00
Mitchell Hashimoto
8231ebb770
build: mirror most of our direct dependencies
This adds a new script `update-mirror.sh` which generates the proper
blob format for R2 (or any blob storage) to mirror all of our
dependencies.

It doesn't automate updating build.zig.zon but on an ongoing basis this
should be easy to do manually, and we can strive to automate it in the
future.

I omitted iTerm2 color themes because we auto-update that via CI and
updating all of the machinery to send it to our mirror and so on is a
pain. Additionally, this doesn't mirror transitive dependencies because
Zig doesn't have a way to fetch those from a mirror instead (unless you
pre-generate a full cache like packagers but that's not practical for
day to day development).

It's hugely beneficial just to get most of our dependencies mirrored.
2025-02-14 10:06:15 -08:00
Jeffrey C. Ollie
f32ad5216b build: generate a build.zig.zon.txt file for easy zig fetch scripting
This fixes a regression in 1.1.1/1.1.2 where our PACKAGING docs mention
using `fetch-zig-cache.sh` but it was removed. This commit adds it back,
generating its contents from the build.zig.zon file (via zon2nix which
we use for our Nix packaging).

For packagers, there are no dependency changes: you still need Zig and
POSIX sh. For release time, Ghostty has a new dependency on `jq` but
otherwise the release process is the same. The check-zig-cache.sh script
is updated to generate the new build.zig.zon.txt file.
2025-02-14 09:23:51 -08:00
Mitchell Hashimoto
cdd287c88b
Add back fetch-zig-cache.sh for packaging
See the comment on more details, which also covers when and how we can
remove this.
2025-02-14 07:23:26 -08:00
Mitchell Hashimoto
52a5069dec
up versions for development
Some checks are pending
Nix / Required Checks: Nix (push) Blocked by required conditions
Nix / check-zig-cache-hash (push) Waiting to run
Test / Required Checks: Test (push) Blocked by required conditions
Test / build-linux-libghostty (push) Blocked by required conditions
Test / build (namespace-profile-ghostty-md, aarch64-linux) (push) Blocked by required conditions
Test / build (namespace-profile-ghostty-md, x86-windows-gnu) (push) Blocked by required conditions
Test / build (namespace-profile-ghostty-md, x86_64-linux) (push) Blocked by required conditions
Test / build (namespace-profile-ghostty-md, x86_64-windows-gnu) (push) Blocked by required conditions
Test / build-bench (push) Blocked by required conditions
Test / build-nix (namespace-profile-ghostty-md) (push) Blocked by required conditions
Test / build-nix (namespace-profile-ghostty-md-arm64) (push) Blocked by required conditions
Test / build-macos (push) Blocked by required conditions
Test / build-macos-matrix (push) Blocked by required conditions
Test / build-windows (push) Blocked by required conditions
Test / test (push) Waiting to run
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (false, false, false) (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (false, false, true) (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (false, true, false) (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (false, true, true) (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (true, false, false) (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (true, false, true) (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (true, true, false) (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (true, true, true) (push) Blocked by required conditions
Test / Build -Dsentry=${{ matrix.sentry }} (false) (push) Blocked by required conditions
Test / Build -Dsentry=${{ matrix.sentry }} (true) (push) Blocked by required conditions
Test / test-macos (push) Blocked by required conditions
Test / prettier (push) Waiting to run
Test / alejandra (push) Waiting to run
Test / typos (push) Waiting to run
Test / Test pkg/${{ matrix.pkg }} (wuffs) (push) Blocked by required conditions
2025-02-13 15:31:14 -08:00
Mitchell Hashimoto
710ea1c8d9
up all the metadata to 1.1.2 2025-02-13 13:02:06 -08:00
Jeffrey C. Ollie
f63242f7fb
gtk: add support for using GTK Builder UI files and Blueprints
Adds buildtime and comptime checks to make sure that Blueprints/UI files
are availble and correctly formed. Will also compile Blueprints to UI
files so that they are available to GTK code.
2025-02-12 15:05:42 -06:00
Jeffrey C. Ollie
3a8c934b19 nix: use zig2nix to manage nix cache/deps
This brings the internal package more in line with how the nixpkgs
package is built. It also handles recursive dependencies better than the
current system.
2025-02-11 08:25:34 -08:00
Leah Amelia Chen
843c714088
gtk: introduce Zig bindings for GTK/GObject
`zig-gobject` is a set of GObject bindings that allow us to write
GTK-facing code in Zig instead of getting hands dirty with C.
It's been tested and refined in real-life applications and several
GTK contributors agree that it is a marked improvement over using
the C API directly, such as allowing method call syntax and avoiding
many manual `@ptrCast`s.

This commit doesn't actually contain any changes to our preexisting
GTK code — the migration process is intended to begin in chunks,
firstly in self-contained components (e.g. the header bar, overlays,
etc.), and then full-scale migration can begin when we remove non-Adwaita
GTK builds for 1.2. (After all, why port code that you'll remove later
either way?)
2025-02-10 18:34:08 +01:00
mitchellh
5100f4ff7d deps: Update iTerm2 color schemes 2025-02-02 00:10:42 +00:00
Mitchell Hashimoto
c5508e7d19
update version for development
Some checks failed
Test / test (push) Has been cancelled
Test / prettier (push) Has been cancelled
Test / alejandra (push) Has been cancelled
Test / typos (push) Has been cancelled
Nix / Required Checks: Nix (push) Has been cancelled
Test / Required Checks: Test (push) Has been cancelled
Test / build (namespace-profile-ghostty-md, aarch64-linux) (push) Has been cancelled
Test / build (namespace-profile-ghostty-md, x86-windows-gnu) (push) Has been cancelled
Test / build (namespace-profile-ghostty-md, x86_64-linux) (push) Has been cancelled
Test / build (namespace-profile-ghostty-md, x86_64-windows-gnu) (push) Has been cancelled
Test / build-bench (push) Has been cancelled
Test / build-linux-libghostty (push) Has been cancelled
Test / build-nix (namespace-profile-ghostty-md) (push) Has been cancelled
Test / build-nix (namespace-profile-ghostty-md-arm64) (push) Has been cancelled
Test / build-macos (push) Has been cancelled
Test / build-macos-matrix (push) Has been cancelled
Test / build-windows (push) Has been cancelled
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (false, false, false) (push) Has been cancelled
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (false, false, true) (push) Has been cancelled
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (false, true, false) (push) Has been cancelled
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (false, true, true) (push) Has been cancelled
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (true, false, false) (push) Has been cancelled
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (true, false, true) (push) Has been cancelled
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (true, true, false) (push) Has been cancelled
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (true, true, true) (push) Has been cancelled
Test / Build -Dsentry=${{ matrix.sentry }} (false) (push) Has been cancelled
Test / Build -Dsentry=${{ matrix.sentry }} (true) (push) Has been cancelled
Test / test-macos (push) Has been cancelled
Test / Test pkg/${{ matrix.pkg }} (wuffs) (push) Has been cancelled
Update iTerm2 colorschemes / update-iterm2-schemes (push) Has been cancelled
2025-01-30 14:23:24 -08:00
Jeffrey C. Ollie
6dd9bf0038
nix: fix Ghostty homepage in package 2025-01-30 11:04:44 -06:00
Mitchell Hashimoto
adf4066b69
nix: use --system build flag instead of relying on $ZIG_GLOBAL_CACHE_DIR (#5434)
Some checks are pending
Nix / Required Checks: Nix (push) Blocked by required conditions
Nix / check-zig-cache-hash (push) Waiting to run
Test / build-windows (push) Blocked by required conditions
Test / test (push) Waiting to run
Test / build-macos-matrix (push) Blocked by required conditions
Test / Required Checks: Test (push) Blocked by required conditions
Test / build (namespace-profile-ghostty-md, aarch64-linux) (push) Blocked by required conditions
Test / build (namespace-profile-ghostty-md, x86-windows-gnu) (push) Blocked by required conditions
Test / build (namespace-profile-ghostty-md, x86_64-linux) (push) Blocked by required conditions
Test / build (namespace-profile-ghostty-md, x86_64-windows-gnu) (push) Blocked by required conditions
Test / build-bench (push) Blocked by required conditions
Test / build-linux-libghostty (push) Blocked by required conditions
Test / build-nix (namespace-profile-ghostty-md) (push) Blocked by required conditions
Test / build-nix (namespace-profile-ghostty-md-arm64) (push) Blocked by required conditions
Test / build-macos (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (false, false, false) (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (false, false, true) (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (false, true, false) (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (false, true, true) (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (true, false, false) (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (true, false, true) (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (true, true, false) (push) Blocked by required conditions
Test / GTK adwaita=${{ matrix.adwaita }} x11=${{ matrix.x11 }} wayland=${{ matrix.wayland }} (true, true, true) (push) Blocked by required conditions
Test / Build -Dsentry=${{ matrix.sentry }} (false) (push) Blocked by required conditions
Test / Build -Dsentry=${{ matrix.sentry }} (true) (push) Blocked by required conditions
Test / test-macos (push) Blocked by required conditions
Test / prettier (push) Waiting to run
Test / alejandra (push) Waiting to run
Test / typos (push) Waiting to run
Test / Test pkg/${{ matrix.pkg }} (wuffs) (push) Blocked by required conditions
Fixes #5431
2025-01-30 08:48:31 -08:00
Jeffrey C. Ollie
40973417d0
nix: use --system build flag instead of relying on $ZIG_GLOBAL_CACHE_DIR
Fixes #5431
2025-01-30 10:16:45 -06:00
Mitchell Hashimoto
a62b26cd2f
next version will be 1.1.0 2025-01-30 07:18:43 -08:00
Mitchell Hashimoto
9ab2e563bb
Update libxev to fix zombie processes on macOS
Fixes #4554

xev.Process.wait is documented as being equivalent to calling `waitpid`,
i.e. including reaping the process. On Linux, it does this automatically
by using pidfd and the `waitid` syscall. On macOS, it wasn't doing this.

This commit updates libxev to include a fix that explicitly calls
`waitpid` for kqueue.
2025-01-24 12:07:01 -08:00
Mitchell Hashimoto
0d6a1d3fdb
Prevent fd leaks to the running shell or command
Multiple fixes to prevent file descriptor leaks:

- libxev eventfd now uses CLOEXEC
- linux: cgroup clone now uses CLOEXEC for the cgroup fd
- termio pipe uses pipe2 with CLOEXEC
- pty master always sets CLOEXEC because the child doesn't need it
- termio exec now closes pty slave fd after fork

There still appear to be some fd leaks happening. They seem related to
GTK, they aren't things we're accessig directly. I still want to
investigate them but this at least cleans up the major sources of fd
leakage.
2025-01-23 22:12:58 -08:00
Mitchell Hashimoto
78a2a815f3
nix: vms for testing ghostty (#4608)
Adds a Nix VM configuration to run Gnome/Wayland. The primary purpose
will be testing Ghostty in a "clean" environment. I'm going to continue
to experiment with running this in CI to see if we can do some basic
testing of GTK since it's difficult to unit test that code.

To use, run `nix run .#wayland-gnome` in the Ghostty source directory. I
have no idea if this works on macOS. There's probably a lot of extra
stuff that can be trimmed to slim it down.

Whatever directory you run this from will be mounted at `/tmp/shared` in
the VM. The `ghostty` user runs as uid/gid 1000/1000 so that may affect
your ability to read/write that directory if your host system user runs
as a different uid/gid.

If this is something that we'd like to keep, we should add VM
definitions for KDE Plasma and maybe one tiling window manager.


https://github.com/user-attachments/assets/57190913-f338-4383-93aa-90c9e351543d
2025-01-23 16:03:29 -08:00
mitchellh
3f367857fc deps: Update iTerm2 color schemes 2025-01-19 00:58:22 +00:00
Jeffrey C. Ollie
3159a7bec7
nix: add x11 xfce vm 2025-01-15 20:37:31 -06:00
Jeffrey C. Ollie
423133bc3c
nix: document how to create custom vms 2025-01-15 11:56:19 -06:00
Jeffrey C. Ollie
1ac56a7ac2
nix vm: +fish +zsh -zig 2025-01-15 10:25:03 -06:00
Jeffrey C. Ollie
321119e001
nix vm: more reusability 2025-01-15 10:25:03 -06:00
Jeffrey C. Ollie
e1e2f94681
nix vm: try and make vm creation more re-usable 2025-01-15 10:25:03 -06:00
Jeffrey C. Ollie
268fc1a040
nix vm: simplify vm definition 2025-01-15 10:25:03 -06:00
Jeffrey C. Ollie
450c019b4e
nix vm: add plasma and cinnamon vms 2025-01-15 10:25:03 -06:00
Jeffrey C. Ollie
6be0902c09
nix vm: add documentation, add Gnome/X11 VM 2025-01-15 10:25:02 -06:00
Jeffrey C. Ollie
dddc2a50a8
nix vm: more slimming 2025-01-15 10:25:02 -06:00
Jeffrey C. Ollie
4bfb1f616c
nix: disable geary 2025-01-15 10:25:02 -06:00
Jeffrey C. Ollie
4ff7f6df06
nix: fix dark mode setting 2025-01-15 10:25:02 -06:00
Jeffrey C. Ollie
0b456d14a4
nix: vms for testing ghostty 2025-01-15 10:24:58 -06:00
mitchellh
50e33a6665 deps: Update iTerm2 color schemes 2025-01-12 01:01:09 +00:00