10774 Commits

Author SHA1 Message Date
Jon Parise
b629f3337a bash: remove dependency on $GHOSTTY_RESOURCES_DIR
We were depending on $GHOSTTY_RESOURCES_DIR for two reasons:

1. To locate our script-adjacent bash-preexec.sh script
2. To restrict our script's execution to environments in which
   $GHOSTTY_RESOURCES_DIR is available (i.e. Ghostty-only shells)

For (1), we can instead determine our directory using $BASH_SOURCE[0].
This is slightly differently than our previous behavior, where we'd
always load bash-preexec.sh from the $GHOSTTY_RESOURCES_DIR hierarchy,
even if ghostty.bash from source from somewhere else on the file system
... but we never relied on that behavior, even in development.

For (2), there's no harm in source'ing this script outside of Ghostty,
and if that does become a concern, we can restore this condition or use
something more targeted based on those specific cases.

Historically, I believe (2) was in place to enable (1), so addressing
(1) removes the need for (2).

And lastly, none of the other shell integration scripts depend on
$GHOSTTY_RESOURCES_DIR.
2025-06-16 19:54:27 -04:00
Mitchell Hashimoto
d0f116da35 macOS: Basic Read-Only Accessibility Integration (#7601)
This integrates with macOS accessibility APIs to expose Ghostty terminal
structure and content.

This is a very, very bare implementation and the terminal contents
currently reported are the _full screen and scrollback_ which is way too
much for realistic human accessibility use. The target use case for this
PR is to enable automated tooling (namely, AI screen readers). However,
this is all groundwork we'll need to iterate and improve the
accessibility work anyways.

To make this work, I also replatformed some of our hacky C APIs onto a
more robust `ghostty_surface_read_text` API that can now read arbitrary
ranges of the screen into C strings for consumers to use. This will be
useful in more places going forward (hint hint).

## Before

Accessibility tooling can't read anything, Ghostty has no attributes, no
contents, just shows up as a square.

![CleanShot 2025-06-15 at 14 06
55@2x](https://github.com/user-attachments/assets/55eba1b4-6fd4-4d78-9434-5d672f374c67)

## After

A lot of metadata, including the screen contents as text.

![CleanShot 2025-06-15 at 14 07
25@2x](https://github.com/user-attachments/assets/e14cb7df-e4e2-4cc4-a214-004a8459f353)

Also, split hierarchies are navigable:



https://github.com/user-attachments/assets/a7b2ffb7-dbeb-41b2-8705-9c3200812c4d
2025-06-15 15:10:27 -07:00
Mitchell Hashimoto
a2b4a2c0e4 macos: complete more ax APIs for terminal accessibility 2025-06-15 14:00:39 -07:00
Mitchell Hashimoto
e69c756c89 macos: auto-expire cached screen contents 2025-06-15 13:55:06 -07:00
Mitchell Hashimoto
839d89f2dc macos: simple cache of screen contents for ax 2025-06-15 13:46:40 -07:00
Mitchell Hashimoto
e1ee180172 apprt/embedded: API to read text can get top left/bottom right coords 2025-06-15 13:06:38 -07:00
Mitchell Hashimoto
c5f921bb06 apprt/embedded: improve text reading APIs (selection, random points) 2025-06-15 07:59:19 -07:00
Mitchell Hashimoto
b46673e631 macos: Tahoe menu item icons, missed the "Ghostty" menu entirely (#7599)
This is a follow up to #7594, I missed an entire menu.
2025-06-15 07:57:11 -07:00
Mitchell Hashimoto
be437f5b64 macos: bare minimum terminal ax 2025-06-15 07:56:05 -07:00
Mitchell Hashimoto
c90eb2e952 macos: AX for debug warning 2025-06-15 07:56:05 -07:00
Mitchell Hashimoto
4237dad240 macOS: simple SplitView AX
Proper labels, action to move the divider
2025-06-15 07:56:05 -07:00
Mitchell Hashimoto
57c79fa357 macos: Tahoe menu item icons, missed the "Ghostty" menu entirely
This is a follow up to #7594, I missed an entire menu.
2025-06-15 07:48:20 -07:00
Mitchell Hashimoto
db28ab4340 macos 15 regression: transparent style shouldn't draw border (#7597)
This fixes a regression from our Tahoe window styling changes on
earlier, stable versions of macOS. We need to set
"titlebarAppearsTransparent" to true in order to hide the bottom border.
2025-06-15 06:57:05 -07:00
Mitchell Hashimoto
7cc7f6cb06 macos 15 regression: transparent style shouldn't draw border
This fixes a regression from our Tahoe window styling changes on
earlier, stable versions of macOS. We need to set 
"titlebarAppearsTransparent" to true in order to hide the bottom
border.
2025-06-15 06:51:11 -07:00
Mitchell Hashimoto
9e45da17d0 macos: menu item symbols for Tahoe (#7594)
This is recommended for macOS Tahoe and all standard menu items now have
associated images. This makes our app look more polished and native for
macOS Tahoe.

On earlier versions of macOS (macOS 15 and earlier), we _do not_ set the
menu item image. Cocoa has supported menu item images for a long time
but it isn't idiomatic to show them in earlier versions, so we only do
this for later macOS versions.

For icon choice, I tried to copy other native macOS apps as much as
possible, mostly from Xcode. It looks like a lot of apps aren't updated
yet. I'm absolutely open to suggestions for better icons but I think
these are a good starting point.

One menu change is I moved "reset font size" above "increase font size"
which better matches other apps (e.g. Terminal.app).


https://github.com/user-attachments/assets/50a68326-221f-454f-9a9c-078878010a63
2025-06-14 19:50:58 -07:00
Mitchell Hashimoto
202020cd7d macos: menu item symbols for Tahoe
This is recommended for macOS Tahoe and all standard menu items now have
associated images. This makes our app look more polished and native for
macOS Tahoe.

For icon choice, I tried to copy other native macOS apps as much as
possible, mostly from Xcode. It looks like a lot of apps aren't updated
yet. I'm absolutely open to suggestions for better icons but I think
these are a good starting point.

One menu change is I moved "reset font size" above "increase font size"
which better matches other apps (e.g. Terminal.app).
2025-06-14 19:44:24 -07:00
Mitchell Hashimoto
bfb1daffbe macos: set toolbar title isBordered to avoid glass view (#7593)
This was recommended by the WWDC25 session on AppKit updates. My hack
was not the right approach.
2025-06-14 15:04:49 -07:00
Mitchell Hashimoto
c4a978b07a macos: set toolbar title isBordered to avoid glass view
This was recommended by the WWDC25 session on AppKit updates. My hack
was not the right approach.
2025-06-14 13:50:02 -07:00
Kristófer R
2f33eee166 fix comptime if statement 2025-06-14 16:26:03 -04:00
Mitchell Hashimoto
22776adc28 ci: update macOS builders to Sequoia (15) and Xcode 16.4 (#7592)
We have been building on macOS 14 and Xcode 16.0 for a longggg time now.
This gets us to a version that will be running Xcode 26 eventually so we
can ultimately build for Tahoe on a stable OS.

This should change nothing in the interim.
2025-06-14 12:48:31 -07:00
Mitchell Hashimoto
5b9f4acbc8 ci: update macOS builders to Sequoia (15) and Xcode 16.4
We have been building on macOS 14 and Xcode 16.0 for a longggg time now.
This gets us to a version that will be running Xcode 26 eventually so
we can ultimately build for Tahoe on a stable OS.

This should change nothing in the interim.
2025-06-14 12:32:48 -07:00
Mitchell Hashimoto
f26dec559a macOS: Tahoe Titlebar Styling Fixes (#7588)
Fixes #7568 
Fixes #7563 

This PR incorporates all the fixes necessary to make all of our
`macos-titlebar-style` values work on macOS Tahoe.

All titlebar styles are significantly more efficient on macOS Tahoe. I
was able to refactor a lot of our complicated logic out of `update`
ticks (which are called on _every event loop tick_) to being eventful,
so the CPU required to render any titlebar style on Tahoe is
dramatically lowered. This fix _might_ be able to be back ported but I
tried my best to not modify Sequoia and earlier codebases to keep them
stable.

The major change here is `macos-titlebar-style = tabs`, which takes on a
whole new look with Tahoe. The ultimate goal of this setting is that the
_native tab bar_ goes into the titlebar, and we've respected that here.
For more background, see #7563 on why we can't easily mimic the Sequoia
style. I think longer term, for people who don't want capsule-tabs in
their titlebar, we'll need a custom tab bar.

## Future Improvements

There are obviously future improvements that can be made. I think for
example the readability in some cases of the `tabs` styling is pretty
bad. But I wonder if Apple themselves will do something about this with
the tab bar, so I'm going to hold out on caring too much.

The main goal of this PR was to make sure Ghostty was usable when
recompiled with the v26 SDKs.

## Screenshots

> [!NOTE]
>
> Ignore the weird background color glitches in the titlebar. That's a
screenshot artifact (bug probably in macOS) and not actually visible
when running.

### `macos-titlebar-style = tabs`

![CleanShot 2025-06-13 at 12 40
43@2x](https://github.com/user-attachments/assets/8728631e-fd0b-47f3-b195-099a7e0e5b72)
![CleanShot 2025-06-13 at 12 40
34@2x](https://github.com/user-attachments/assets/4c280666-4aba-4ae1-9730-cac96e2c88ed)

### `macos-titlebar-style = transparent`

![CleanShot 2025-06-13 at 12 43
53@2x](https://github.com/user-attachments/assets/1743b109-d4bf-4f37-9d73-2e0a0ba21789)
![CleanShot 2025-06-13 at 12 43
45@2x](https://github.com/user-attachments/assets/8cd884b8-5d13-458d-a204-a0ff81698be4)

### `macos-titlebar-style = native`

![CleanShot 2025-06-13 at 12 45
21@2x](https://github.com/user-attachments/assets/781300dc-2229-4d73-80d5-f75105ba0e38)
![CleanShot 2025-06-13 at 12 45
15@2x](https://github.com/user-attachments/assets/ac71b117-ef5a-46bd-8d13-a95a4cb8f5a3)

## TODO

- [x] A really weird bug where if I resize vertically to create
scrollback then create a new tab my font size is... tiny?
- [x] Verify no major regressions on Sequoia
- [x] Sequoia regression: non-native fullscreen with titlebar tabs
doesn't work
- [x] Sequoia regression: reset split zoom button doesn't restore for
tabs titlebar going to zero tabs
- [x] Sequoia regression: transparent isn't working
- [x] Check macOS 26 gates on Solarium instead of version?
- [ ] Merge all windows doesn't create titlebar tabs on Tahoe
2025-06-14 07:02:12 -07:00
Mitchell Hashimoto
928603c23e macos: use a runtime liquid glass check for our Tahoe styling 2025-06-13 20:20:56 -07:00
Mitchell Hashimoto
1b6142b271 macos: don't restore tab bar with non-native fs 2025-06-13 15:02:06 -07:00
Mitchell Hashimoto
ac4b0dcac0 macos: fix transparent tabs on sequoia 2025-06-13 14:57:54 -07:00
Mitchell Hashimoto
1388c277d5 macos: sequoia should use same tab bar identifier as TerminalWindow 2025-06-13 14:43:04 -07:00
Mitchell Hashimoto
8cfc904c0c macos: fix up some sequoia regressions 2025-06-13 14:39:12 -07:00
Mitchell Hashimoto
a7df90ee55 macos: remove split zoom accessory when tabs appear 2025-06-13 13:36:42 -07:00
Mitchell Hashimoto
f7f0514b9f macos: move old toolbar into ventura file 2025-06-13 13:14:16 -07:00
Mitchell Hashimoto
59812c3b02 macos: remove TODO 2025-06-13 12:27:44 -07:00
Mitchell Hashimoto
b1b74d3421 comments 2025-06-13 12:25:21 -07:00
Mitchell Hashimoto
00d41239da macOS: prep the tab bar when system appearance changes 2025-06-13 12:22:29 -07:00
Jeffrey C. Ollie
c1d04a6175 gtk: document effect of changing the class on launching Ghostty 2025-06-13 10:22:17 -05:00
Jeffrey C. Ollie
e5c737a423 linux: use launched-from for new window action 2025-06-13 10:22:16 -05:00
Jeffrey C. Ollie
57392dfcb5 linux: use explicit launched-from config in service files 2025-06-13 10:22:16 -05:00
Jeffrey C. Ollie
649cca61eb gtk: use exhaustive switch for initial-window 2025-06-13 10:22:16 -05:00
Jeffrey C. Ollie
8824d11e1c linux: add dbus and systemd activation services 2025-06-13 10:22:12 -05:00
Mitchell Hashimoto
17ad77b5b0 macos: fix background color of terminal window to match surface 2025-06-12 21:36:00 -07:00
Mitchell Hashimoto
9d9c451b0a macos: titlebar tabs handle hidden traffic buttons 2025-06-12 20:03:21 -07:00
Mitchell Hashimoto
d84c30ce71 macos: titlebar tabs should be transparent 2025-06-12 18:10:37 -07:00
Mitchell Hashimoto
5f99670247 macos: tahoe titlebar tabs taking shape 2025-06-12 17:52:15 -07:00
Mitchell Hashimoto
6ae8bd737a macos: hide the reset zoom titlebar accessory when tab bar is shown 2025-06-12 15:13:23 -07:00
Mitchell Hashimoto
5c8f1948ce macos: remove the duplicated reset zoom accessory view from legacy 2025-06-12 14:42:09 -07:00
Mitchell Hashimoto
de40e7ce02 macos: non-native fullscreen should restore toolbars 2025-06-12 14:36:33 -07:00
Mitchell Hashimoto
658ec2eb6f macos: add reset zoom to all window titles 2025-06-12 14:33:53 -07:00
Mitchell Hashimoto
70029bf82a macos: tahoe terminal tabs shows title 2025-06-12 13:39:19 -07:00
Mitchell Hashimoto
5877913ab8 macoS: Split out terminal tabs for ventura vs tahoe 2025-06-12 12:06:30 -07:00
Mitchell Hashimoto
fd785f98bb macos: titlebar tabs uses legacy window for now 2025-06-12 11:39:10 -07:00
Mitchell Hashimoto
ccfd33022f macos: only titlebar tabs uses legacy styling now 2025-06-11 15:18:02 -07:00
Mitchell Hashimoto
e5cb33e911 typos 2025-06-11 15:18:02 -07:00