1305 Commits

Author SHA1 Message Date
Mitchell Hashimoto
cac32fc60d apprt/gtk-ng: hook up adw < 1.5 support 2025-07-17 09:55:59 -07:00
Mitchell Hashimoto
039e248ec9 typos 2025-07-17 09:55:59 -07:00
Mitchell Hashimoto
31c5af74c5 apprt/gtk-ng: handle config reloading 2025-07-17 09:55:58 -07:00
Mitchell Hashimoto
0da47903f4 apprt/gtk-ng: hook up all the refs to show the dialog 2025-07-17 09:55:58 -07:00
Mitchell Hashimoto
b253e2efe2 apprt/gtk-ng: proper memory management for config errors dialog 2025-07-17 09:55:58 -07:00
Mitchell Hashimoto
b1aab1e7bf apprt/gtk-ng: remove Ghostty-prefix from Zig-side classes 2025-07-17 09:55:58 -07:00
Mitchell Hashimoto
531d4a480e apprt/gtk-ng: hook up all the bindings for the config errors dialog 2025-07-17 09:55:30 -07:00
Mitchell Hashimoto
c3ba6e252e apprt/gtk-ng: use the GhosttyConfig class to wrap our config 2025-07-17 09:55:30 -07:00
Mitchell Hashimoto
897649a3af apprt/gtk-ng: GhosttyConfigErrors 2025-07-17 09:55:29 -07:00
Mitchell Hashimoto
e76a151b42 apprt/gtk-ng: GhosttyConfig 2025-07-17 09:55:29 -07:00
Tristan Partin
2695361274 apprt/gtk-ng: assert that GTK is uninitialized in setGtkEnv
Signed-off-by: Tristan Partin <tristan@partin.io>
2025-07-16 22:38:37 -06:00
Mitchell Hashimoto
426fa8d8f9 apprt/gtk-ng: move our app initialization all into the App class 2025-07-16 12:20:13 -07:00
Mitchell Hashimoto
3257203b6c apprt/gtk-ng: start basic window 2025-07-16 09:40:34 -07:00
Mitchell Hashimoto
bb96388902 apprt/gtk-ng: cgroup base setup 2025-07-16 09:40:34 -07:00
Mitchell Hashimoto
ce06eb5f64 apprt/gtk-ng: application startup to initialize styles 2025-07-16 09:40:34 -07:00
Mitchell Hashimoto
ecb77fb8bc apprt/gtk-ng: gresource creation, resource registration in Application 2025-07-16 09:40:34 -07:00
Mitchell Hashimoto
9c6cf61cd4 apprt/gtk-ng: GhosttyApplication and boilerplate to run 2025-07-16 09:40:34 -07:00
Mitchell Hashimoto
2f9660c02c apprt/gtk-ng: boilerplate 2025-07-16 09:40:34 -07:00
Jeffrey C. Ollie
dd3853abeb cli/gtk: move IPC/sendIPC to App/performIpc 2025-07-14 14:48:12 -05:00
Jeffrey C. Ollie
f5eb413c31 cli/gtk: clean ups and better error handling in GTK new-window IPC 2025-07-14 14:48:12 -05:00
Jeffrey C. Ollie
7d05f4c0c5 cli/gtk: don't set GHOSTTY_CLASS 2025-07-14 14:48:12 -05:00
Jeffrey C. Ollie
361d03b578 cli/gtk: remove --release and --debug flags, use optional for arguments 2025-07-14 14:48:12 -05:00
Jeffrey C. Ollie
81358c8dca cli/gtk: replace @hasDecl for performAction-style API
Instead of using @hasDecl, use a performAction-stype API. The C
interface for interfacing with macOS (or any other apprt where Ghostty
is embedded) is unfinished.
2025-07-14 14:48:11 -05:00
Jeffrey C. Ollie
72e47cf8bc cli/gtk: move actual IPC code tp apprt 2025-07-14 14:48:11 -05:00
Jeffrey C. Ollie
824185f23e cli/gtk: add -e to +new-window
This adds the `-e` flag to the `+new-window` CLI action. This allows a
command to be passed from the CLI to the running instance of Ghostty.
Nothing is done with that command besides logging its presence.
2025-07-14 14:48:11 -05:00
Jeffrey C. Ollie
340d190bf0 cli/gtk: clarify +new-window documentation and improve instance discovery
- Add a `GHOSTTY_CLASS` environment variables to any command executed by
  Ghostty to make discovering the correct application ID easier.

- Add a flag to force the relelase application ID.

- Ensure that CLI flags to `+new-window` are mutually exclusive.

- Fix documentation about D-Bus activation requirements.
2025-07-14 14:48:11 -05:00
Jeffrey C. Ollie
1abc3ba1da gtk: change child exited verbiage to be clearer and code cleanup 2025-07-11 22:56:22 -05:00
Jeffrey C. Ollie
9ee25e8a69 gtk: use close button in show_child_exited banner 2025-07-11 22:56:22 -05:00
Jeffrey C. Ollie
8cea111329 gtk: add some comments for show_child_exited 2025-07-11 22:56:21 -05:00
Jeffrey C. Ollie
49243db4b3 gtk: GtkBox not needed for show_child_exited 2025-07-11 22:56:21 -05:00
Jeffrey C. Ollie
7fd900647e show_child_exited: remove emojis 2025-07-11 22:56:21 -05:00
Jeffrey C. Ollie
f24ec13963 remove unused css class from gtk child exited widget 2025-07-11 22:56:21 -05:00
Jeffrey C. Ollie
bf0659f07b use checkmark for icon if child exits normally 2025-07-11 22:56:21 -05:00
Jeffrey C. Ollie
3d89a68fff fix error set for function return signature 2025-07-11 22:56:21 -05:00
Jeffrey C. Ollie
28c7083876 gtk show_child_edit: use different text for normal/abnormal exit
Without this, the only indication would be the difference between a red
or a green background which would be problematic for users with limited
vision or color blindness.
2025-07-11 22:56:21 -05:00
Jeffrey C. Ollie
5219bc51e5 show child exited: return a boolean if native GUI is shown
If a native GUI is shown by the runtime when a child exits, use the
returned boolean to determine if text should be show in the terminal to
avoid duplicating information.
2025-07-11 22:56:21 -05:00
Jeffrey C. Ollie
103772ee8f show child exited: make GTK banner transparent 2025-07-11 22:56:21 -05:00
Jeffrey C. Ollie
033d8c3099 core/gtk: add apprt action to show native GUI warning when child exits
Addresses #7649 for the core and GTK. macOS support will need to be
added later.

This adds an apprt action to show a native GUI warning of some kind when
the child process of a terminal exits.

Also adds a basic GTK implementation of this. In GTK it overlays an
Adwaita banner at the bottom of the window (similar to the banner that
shows up in at the top of windows in debug builds).
2025-07-11 22:56:20 -05:00
Jeffrey C. Ollie
248acbea5b gtk: remove NOTIFY_SOCKET from the inherited environment variables 2025-07-09 13:11:02 -05:00
Jeffrey C. Ollie
c9d0bbefc2 linux: switch systemd user service to type=notify-reload
This allows `systemctl` to send SIGUSR2 to Ghostty to trigger a reload,
which is more convenient than scripting `ps` and `kill` to find the
Ghostty main PID.
2025-07-09 13:11:01 -05:00
Mitchell Hashimoto
86dbfb98d7 Run GTK unit tests in CI, fix broken tests
We only ran `apprt=none` tests in CI, which misses a huge surface area
of unit tests. Thankfully only a couple were broken. This fixes that.
2025-07-09 10:56:30 -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
cbcb0b795c Fallback to cross-platform minimal open when apprt is not available 2025-07-06 15:15:48 -07:00
Jeffrey C. Ollie
70a2a0afd5 better ABI check for apprt.Action.CValue 2025-07-06 15:02:48 -07:00
Jeffrey C. Ollie
9583ea1b7a core/gtk: open urls using an apprt action instead of doing it directly
Partial implementation of #5256

This implements the core changes necessary to open urls using an apprt
action rather than doing it directly from the core.

Implements the open_url action in the GTK and GLFW apprts.

Note that this should not be merged until a macOS-savvy developer can add
an implementation of the open_url action for the macOS apprt.
2025-07-06 15:02:48 -07:00
Jeffrey C. Ollie
b752ade112 gtk: don't allow focusing on tab overview or menu buttons
This prevents GTK from focusing on those buttons, which would prevent
focus from returning to the terminal after those buttons had been used.
2025-07-06 01:05:17 -05:00
Mitchell Hashimoto
984d123fe4 macos: support configuration via CLI arguments
This makes it so `zig build run` can take arguments such as
`--config-default-files=false` or any other configuration. Previously,
it only accepted commands such as `+version`.

Incidentally, this also makes it so that the app in general can now take
configuration arguments via the CLI if it is launched as a new instance
via `open`. For example:

    open -n Ghostty.app --args --config-default-files=false

This previously didn't work. This is kind of cool.

To make this work, the libghostty C API was modified so that
initialization requires the CLI args, and there is a new C API to try to
execute an action if it was set.
2025-07-05 21:31:23 -07:00
Mitchell Hashimoto
fb9c52ecf4 Nuke GLFW from Orbit
This deletes the GLFW apprt from the Ghostty codebase.

The GLFW apprt was the original apprt used by Ghostty (well, before
Ghostty even had the concept of an "apprt" -- it was all just a single
application then). It let me iterate on the core terminal features,
rendering, etc. without bothering about the UI. It was a good way to get
started. But it has long since outlived its usefulness.

We've had a stable GTK apprt for Linux (and Windows via WSL) and a
native macOS app via libghostty for awhile now. The GLFW apprt only
remained within the tree for a few reasons:

  1. Primarily, it provided a faster feedback loop on macOS because
     building the macOS app historically required us to hop out of the
     zig build system and into Xcode, which is slow and cumbersome.

  2. It was a convenient way to narrow whether a bug was in the
     core Ghostty codebase or in the apprt itself. If a bug was in both
     the glfw and macOS app then it was likely in the core.

  3. It provided us a way on macOS to test OpenGL.

All of these reasons are no longer valid. Respectively:

  1. Our Zig build scripts now execute the `xcodebuild` CLI directly and
     can open the resulting app, stream logs, etc. This is the same
     experience we have on Linux. (Xcode has always been a dependency of
     building on macOS in general, so this is not cumbersome.)

  2. We have a healthy group of maintainers, many of which have access
     to both macOS and Linux, so we can quickly narrow down bugs
     regardless of the apprt.

  3. Our OpenGL renderer hasn't been compatible with macOS for some time
     now, so this is no longer a useful feature.

At this point, the GLFW apprt is just a burden. It adds complexity
across the board, and some people try to run Ghostty with it in the real
world and get confused when it doesn't work (it's always been lacking in
features and buggy compared to the other apprts).

So, it's time to say goodbye. Its bittersweet because it is a big part
of Ghostty's history, but we've grown up now and it's time to move on.
Thank you, goodbye.

(NOTE: If you are a user of the GLFW apprt, then please fork the project
prior to this commit or start a new project based on it. We've warned
against using it for a very, very long time now.)
2025-07-04 14:12:18 -07:00
Mitchell Hashimoto
2fa4fc8902 reload configuration on SIGUSR2
This is done at the apprt-level for a couple reasons.

  (1) For libghostty, we don't have a way to know what the embedding
      application is doing, so its risky to create signal handlers that
      might overwrite the application's signal handlers.

  (2) It's extremely messy to deal with signals and multi-threading.
      Apprts have framework access that handles this for us.

For GTK, we use g_unix_signal_add.

For macOS, we use `DispatchSource.makeSignalSource`. This is an awkward
API but made for this purpose.
2025-07-01 15:51:58 -07:00
Mitchell Hashimoto
81cef6e63b various cleanups around scroll timers 2025-06-30 09:40:49 -07:00