Commit Graph

12112 Commits

Author SHA1 Message Date
Alan Moyano
a479c9b2af i18n: add missing es_AR translations (#8347)
Part of #8344
2025-08-22 15:59:04 +02:00
Aindriú Mac Giolla Eoin
35102ddb5a Updating Irish translation for Ghostty 1.2 2025-08-22 14:53:56 +01:00
Mitchell Hashimoto
298f11166d macos: move activation to after new window/tab is created (#8338)
This is a follow-up to #8064, moving the activation into the async block
such that it happens after the window is created. As discussed in #8064,
this is necessary to bring only the newly created window to the front,
rather than both the previous main window and the new window.

Also made the same change for the new tab action, which also needs to
activate in case it was triggered from the dock menu or a global
keybind.

Finally, I removed the activations within AppDelegate that are redundant
now that TerminalController itself takes care of activating.
2025-08-21 15:38:40 -07:00
Daniel Wennberg
7d60c7c75b macos: move activation to after new window/tab is created 2025-08-21 15:16:20 -07:00
Mitchell Hashimoto
056ccc9818 macOS: update sparkle (#8337)
There aren't any noteworthy changes here we're just using a very old
version. Additionally, our CI was using... different versions!
2025-08-21 14:56:50 -07:00
Mitchell Hashimoto
3ef6de4ffa macos: in new_window action, activate App (#8064)
> [!NOTE]  
> The change might have been intentional, and so I lack context. I
mention two ways to fix below, this PR implements the first possible
fix.

This change makes sure that the new window is focused and visible.

When commit 33d128bcff removed the
TerminalManager class and moved its functionality into
TerminalController, it accidentally removed app activation for windows
triggered by global keybinds.

How the bug works:

1. Menu actions (like File → New Window) call AppDelegate.newWindow()
which: 2. Calls TerminalController.newWindow() 3. AND explicitly calls
NSApp.activate(ignoringOtherApps: true) in the AppDelegate
4. Global keybind actions trigger ghosttyNewWindow() notification
handler which:
      5. Only calls TerminalController.newWindow()
      6. Does NOT call NSApp.activate(ignoringOtherApps: true)
7. While TerminalController.newWindow() does call
NSApp.activate(ignoringOtherApps: true) internally, this call happens
before the async dispatch that shows the window, so the activation
occurs but the window isn't focused when it's actually shown.
8. In the old TerminalManager.newWindow(), the activation happened
immediately before the async dispatch, ensuring proper timing for window
focus.

To see the bug in action:
- run recent Ghostty `main`
- set up a global keybind for `new_window`
- focus some other window
- trigger keybind
- notice that Ghostty doesn't come to the foreground, but when manually
switching to Ghostty you will see that the new window _was_ created

The fix would be to either move the NSApp.activate() call back into
TerminalController.newWindow(), as it was for TerminalManager, or add
the activation call to the notification handlers in AppDelegate.
2025-08-21 14:09:44 -07:00
Mitchell Hashimoto
1ce56a12fa update sparkle
There aren't any noteworthy changes here we're just using a very old
version. Additionally, our CI was using... different versions!
2025-08-21 14:08:32 -07:00
Aljoscha Krettek
f736ee8865 macos: in new_window action, activate App
This change makes sure that the new window is focused and visible.

When commit 33d128bcff removed the
TerminalManager class and moved its functionality into
TerminalController, it accidentally removed app activation for windows
triggered by global keybinds.

How the bug works:

   1. Menu actions (like File → New Window) call AppDelegate.newWindow()
      which:
      2. Calls TerminalController.newWindow()
      3. AND explicitly calls NSApp.activate(ignoringOtherApps: true) in
         the AppDelegate
   4. Global keybind actions trigger ghosttyNewWindow() notification
      handler which:
      5. Only calls TerminalController.newWindow()
      6. Does NOT call NSApp.activate(ignoringOtherApps: true)
   7. While TerminalController.newWindow() does call
      NSApp.activate(ignoringOtherApps: true) internally, this call
      happens before the async dispatch that shows the window, so the
      activation occurs but the window isn't focused when it's actually
      shown.
   8. In the old TerminalManager.newWindow(), the activation happened
      immediately before the async dispatch, ensuring proper timing for
      window focus.

The fix would be to either move the NSApp.activate() call back into
TerminalController.newWindow(), as it was for TerminalManager, or add
the activation call to the notification handlers in AppDelegate.
2025-08-21 14:03:00 -07:00
Mitchell Hashimoto
40105e1c7e cli: add filtering hotkey to list_themes (#8082)
## Summary

Implements the theme filtering hotkey as requested in #7930. 

## Implementation

- Adds 'f' hotkey to cycle through filtering options: all, dark, and
light.
- Integrates with existing search functionality.
- Preserves CLI `--color` flag behavior for initial state.
- Updates help menu with the new hotkey. 

**NOTE**: I noticed another PR
[#8079](https://github.com/ghostty-org/ghostty/pull/8079) opened. I
started this implementation independently prior and don't want to step
on any toes. Happy to collaborate or defer to maintainers.
2025-08-21 14:01:50 -07:00
Mitchell Hashimoto
c110c0f76d gtk-ng: add a helper to reduce boilerplate in GTK IPC (#8306) 2025-08-21 13:34:53 -07:00
Mitchell Hashimoto
c675896595 ci: add 30 minute timeout to valgrind (#8333)
It usually takes less than a few minutes right now. Something is wrong
if it takes more than that.
2025-08-21 11:46:07 -07:00
Mitchell Hashimoto
53c2f915d8 gtk-ng: allow XKB remaps for non-writing-system keys (#8330)
Compromise solution to #7356

XKB is naughty. It's really really naughty. I don't understand why we
didn't just kill XKB with hammers during the Wayland migration and
change it for something much better. I don't understand why we're
content with what amounts to an OS-level software key remapper that
completely jumbles information about original physical key codes in
order to fake keyboard layouts, and not just let users who really want
to remap keys use some sort of evdev or udev-based mapper program.

In a sane system like macOS, the "c" key is always the "c" key, but it's
understood to produce the Unicode character "ц" when using a Russian
layout. XKB defies sanity, and just pretends that your "c" key is
actually a "ц" key instead, and so when you ask for the keybind "Ctrl+C"
it just shrugs in apathy (#7309). And so, we took matters into our own
hands and interpreted hardware keycodes ourselves.

But then, a *lot* of people have the ingrained muscle memory of swapping
Escape with Caps Lock so that it is easier to hit. We respect that. In a
sane system, they would use a remapper that actually makes the system
think you've hit the Escape key when in reality you've hit the Caps Lock
key, so in all intents and purposes to the OS and any app developer,
these two just have their wires swapped. But not on Linux. Somehow this
and the aforementioned case should be treated by the same key transform
algorithm, which is completely diabolical.

As a result, we have to settle for a compromise that truly satisfies
neither party — by allowing XKB remaps for keys that don't really change
depending on the layout.

The Linux input stack besets all hopes and aspirations.
2025-08-21 11:45:48 -07:00
Mitchell Hashimoto
795c745491 ci: add 30 minute timeout to valgrind
It usually takes less than a few minutes right now. Something is wrong
if it takes more than that.
2025-08-21 11:44:58 -07:00
Leah Amelia Chen
534aa508d6 gtk-ng: allow XKB remaps for non-writing-system keys
Compromise solution to #7356

XKB is naughty. It's really really naughty. I don't understand why we
didn't just kill XKB with hammers during the Wayland migration and change
it for something much better. I don't understand why we're content with
what amounts to an OS-level software key remapper that completely jumbles
information about original physical key codes in order to fake keyboard
layouts, and not just let users who really want to remap keys use some
sort of evdev or udev-based mapper program.

In a sane system like macOS, the "c" key is always the "c" key, but it's
understood to produce the Unicode character "ц" when using a Russian
layout. XKB defies sanity, and just pretends that your "c" key is
actually a "ц" key instead, and so when you ask for the keybind "Ctrl+C"
it just shrugs in apathy (#7309). And so, we took matters into our own
hands and interpreted hardware keycodes ourselves.

But then, a *lot* of people have the ingrained muscle memory of swapping
Escape with Caps Lock so that it is easier to hit. We respect that.
In a sane system, they would use a remapper that actually makes the
system think you've hit the Escape key when in reality you've hit the
Caps Lock key, so in all intents and purposes to the OS and any app
developer, these two just have their wires swapped. But not on Linux.
Somehow this and the aforementioned case should be treated by the same
key transform algorithm, which is completely diabolical.

As a result, we have to settle for a compromise that truly satisfies
neither party — by allowing XKB remaps for keys that don't really change
depending on the layout.

The Linux input stack besets all hopes and aspirations.
2025-08-22 02:02:11 +08:00
Mitchell Hashimoto
d725f2346f macOS: Add macos-dock-drop-folder-behavior (new tab or window) configuration option (#8114)
This PR adds a new configuration option
`macos-dock-drop-folder-behavior` that controls whether folders dropped
onto the Ghostty dock icon open in a new tab (default) or a new window.

## Changes

### Configuration Option Added
- **Option name**: `macos-dock-drop-folder-behavior`
- **Valid values**: 
  - `tab` (default) - Opens folders in a new tab in the main window
  - `window` - Opens folders in a new window
- **Platform**: macOS only

### Files Modified

1. **`src/config/Config.zig`**
- Added `MacOSDockDropFolderBehavior` enum with `tab` and `window`
values
   - Added configuration field with default value of `.tab`
   - Added documentation explaining the option

2. **`macos/Sources/Ghostty/Package.swift`**
   - Added `MacOSDockDropFolderBehavior` enum to match the Zig enum

3. **`macos/Sources/Ghostty/Ghostty.Config.swift`**
- Added `macosDockDropFolderBehavior` computed property to access the
configuration value from Swift

4. **`macos/Sources/App/macOS/AppDelegate.swift`**
- Modified `application(_:openFile:)` method to check the configuration
- When a folder is dropped on the dock icon, it now respects the user's
preference

## Usage

Add to your Ghostty configuration file:
```
macos-dock-drop-folder-behavior = window
```

## Motivation

This feature is useful for users (like me!) who prefer window-based
workflows over tab-based workflows when opening folders via drag and
drop on macOS.
2025-08-21 10:55:04 -07:00
Jeffrey C. Ollie
dcc5aded6e gtk-ng: more complete GTK startup/shutdown in test (#8324) 2025-08-21 12:52:10 -05:00
Mitchell Hashimoto
e01ff4093a macos: have macos-dock-drop-behavior apply to all drops 2025-08-21 10:45:17 -07:00
David Keegan
f9ad061ea8 Add macos-dock-drop-folder-behavior configuration option
This adds a new configuration option that controls whether folders
dropped onto the Ghostty dock icon open in a new tab (default) or
a new window.

The option accepts two values:
- tab: Opens folders in a new tab in the main window (default)
- window: Opens folders in a new window

This is useful for users who prefer window-based workflows over
tab-based workflows when opening folders via drag and drop.
2025-08-21 10:30:26 -07:00
Mitchell Hashimoto
d20376c1ff macOS Custom Icon + Persistence (#8230)
This PR aims to improve custom icons on macOS in the following ways. (I
based this PR on the discussion #3631)

### Currently
- Current Icon customizations are not persistent *(when closing the
application the icon in dock reverts back to official icon)*
- There is no officially supported way to change icon to be something
completely custom.

### After this PR
- Current icon customizations are persistent (closing the application no
longer reverts back to official icon)
- Ghostty config `macos-icon` has a new option `custom` which by default
looks for icon `~/.config/ghostty/Ghostty.icns`. It has an accompanying
new configuration `macos-custom-icon` which allows for a different path
to be specified, it does support more than just `.icns` as well.

Both changes are based on the thread with @sfsam in
https://github.com/ghostty-org/ghostty/discussions/3631#discussioncomment-12180647

Feedback is always welcome, if I have not done something up to par
please let me know and I will do my best to correct it.

NOTE: I did notice some newlines with indents which seems to be against
convention in those files so I removed the whitespace if this is not
preferred I can revert.

---

P.S. Thanks for all the work you put into making an awesome terminal!
2025-08-21 10:13:38 -07:00
ClearAspect
f7994e6412 fix: correct the cursor Y position value exposed to shader uniforms
Fix for discussion #8113

The cursor Y position value exposed to the shader uniforms was
incorrectly calculated. As per the doc in cell_text.v.glsl: In order to
get the top left of the glyph, we compute an offset based on the
bearings. The Y bearing is the distance from the bottom of the cell to
the top of the glyph, so we subtract it from the cell height to get the
y offset.

This calculation was mistakenly left out of the original code.

This will ensure that the custom shaders using
iCurrentCursor/iPreviousCursor get the correct Y coordinate representing
the top-left corner of the cursor rectangle, matching the documented
uniform behavior
2025-08-21 10:08:49 -07:00
Mitchell Hashimoto
f178f4419e macos: fix iOS builds 2025-08-21 10:03:25 -07:00
Nicholas Mata
f1c68f698b Correct Swift formatting inconsistencies 2025-08-21 10:00:15 -07:00
Nicholas Mata
5948bd3f02 Add support for 'custom' on 'macos_icon' to support a completely custom app icon 2025-08-21 10:00:15 -07:00
Nicholas Mata
29419e7aac Make macos icon persistent even when app is closed 2025-08-21 10:00:15 -07:00
Mitchell Hashimoto
66e5081721 ci: add timeout to snap and windows jobs (#8329)
There have been times these runaway taking forever for unknown reasons.
2025-08-21 09:29:44 -07:00
Mitchell Hashimoto
e92fe9d9f8 ci: add timeout to snap and windows jobs
There have been times these runaway taking forever for unknown reasons.
2025-08-21 09:22:14 -07:00
Mitchell Hashimoto
e3e69269e5 Switch macOS builds to Tahoe (Beta 7 currently) (#8328)
This switches our macOS builds to build on Tahoe, rather than on
Sequoia.

The primary motivation is to get builds out using a new Xcode version
(our builds at the time of writing this are _still produced_ with beta
1! ONE!). Every subsequent beta has had bugs that have prevented us from
upgrading, amusingly enough. But the later betas _also_ have a bunch of
fixes I want to get in. I hope this one works...

The reason we have to use Tahoe instead of Sequoia is because on
Sequoia, builds in CI _crash xcodebuild_. This is definitely an Apple
bug but I can't reproduce it locally to create a bug report, so I'm not
sure what to do.
2025-08-21 09:19:53 -07:00
Mitchell Hashimoto
82f7cd2133 ci: switch release builds to tahoe builders 2025-08-21 09:05:34 -07:00
Mitchell Hashimoto
7bb493e6ac ci: switch to Tahoe for builds 2025-08-21 07:36:59 -07:00
Mitchell Hashimoto
073a8b01d2 terminal: explicitly initialize undefined fields at runtime (#8323)
This works around the Zig issue as noted in the comment.

No new Valgrind issues found from this.
2025-08-21 07:34:21 -07:00
Jeffrey C. Ollie
36f7e018ae gtk-ng: more complete GTK startup/shutdown 2025-08-21 09:29:22 -05:00
Mitchell Hashimoto
531924e7e7 terminal: explicitly initialize undefined fields at runtime
This works around the Zig issue as noted in the comment.

No new Valgrind issues found from this.
2025-08-21 07:27:43 -07:00
Mitchell Hashimoto
2ffc61d21e gtk-ng: properly skip Zig test (#8322) 2025-08-21 07:25:30 -07:00
Jeffrey C. Ollie
2d0f930e6a gtk-ng: properly skip Zig test 2025-08-21 09:14:06 -05:00
Mitchell Hashimoto
7a42c82d18 temp: try downloading metal explicitly 2025-08-21 07:06:40 -07:00
Mitchell Hashimoto
d66747407d ci: move to bleedging edge sequoia builds
This will bring in Xcode 26 Beta 4 which I believe fixes all the known
issue we were dealing with keeping us on beta 1.
2025-08-21 07:06:40 -07:00
Mitchell Hashimoto
0e81f8d4e2 flatpak: manually install Zig 0.14.1 (#8311)
The SDK published on Flathub updated to Zig 0.15.1 which broke the
Flathub build in CI. So let's install it ourselves so that we can
control the version.
2025-08-21 07:04:50 -07:00
Mitchell Hashimoto
4cc33b546c Full unit test suite passing Valgrind (#8319)
This contains the various changes necessary to get the full unit test
suite passing Valgrind, and configures CI to run this.

I disabled relatively few (less than 10) tests under Valgrind because
they're way too slow: all `verifyIntegrity` tests, because those run
anyways in debug and check their own memory health, a font test that
fills out font map, and the sprite render test. Everything else runs
as-is.

I found a number of issues, most were in the tests themselves. A couple
in actual code. A funny one was some undefined memory on tabstop resize
if you exceed the default number of tabstops. I don't know any real
world program that ever even did that (memory issue aside), and that
whole file hasn't been touched since 2022, so that was funny.

No memory leaks in actual code, but a number of leaks in tests. All
resolved.

I think we're still missing some reports because of the Zig bug:
https://github.com/ziglang/zig/issues/19148 so I'm gong to audit our
codebase after this and look for cases of that.
2025-08-21 07:04:13 -07:00
Mitchell Hashimoto
793e817d74 ci: run all valgrind tests 2025-08-21 06:58:08 -07:00
Mitchell Hashimoto
96a0b9021c font: disable sprite test in valgrind 2025-08-21 06:57:25 -07:00
Mitchell Hashimoto
fe5eafac0a font: fix fontconfig leaks in unit tests 2025-08-21 06:53:59 -07:00
Jeffrey C. Ollie
6427a21679 flatpack: add back to list of required CI jobs 2025-08-21 00:42:18 -05:00
Qwerasd
d2ac29c919 font/CoreText: fix positioning for padded scaled glyphs (#8310)
When constraints increased or decreased the size significantly, the
fractional position was getting messed up by the scale. This change
separates that out so that it applies correctly.

I noticed this when messing around with constraints, adding this
constraint to every glyph and then running with `font-family=Arial` and
`adjust-cell-width = -35%` (if you want to reproduce this)
```zig
constraint = .{
    .size_horizontal = .stretch,
    .align_horizontal = .center,
    .pad_left = 0.1,
    .pad_right = 0.1,
};
```
The padding was disproportionately affecting thin glyphs that were
stretched a lot. The problem was that the padding was being multiplied
by the scale.

This also made it so the top or right of said thin glyphs often got
clipped off by the edge of the canvas.

Anyway I fixed it.

|Before|After|
|-|-|
|<img width="1824" height="1480" alt="image"
src="https://github.com/user-attachments/assets/32779f9d-a048-4a8c-b5ea-0e8a851d5119"
/>|<img width="1824" height="1480" alt="image"
src="https://github.com/user-attachments/assets/5bf449e5-699e-4bdc-ac96-2b776f9fb7fa"
/>|
2025-08-20 21:55:51 -06:00
Mitchell Hashimoto
a57afd41ac terminal: fix undefined memory access in unit test 2025-08-20 20:54:29 -07:00
Mitchell Hashimoto
566062c0a5 terminal: fix undefined memory in Tabstops code 2025-08-20 20:44:35 -07:00
Mitchell Hashimoto
be51f3e729 terminal: fix uninitialized memory in Cell init 2025-08-20 20:21:26 -07:00
Mitchell Hashimoto
3ce043123b terminal: fix undefined memory access in PageList eraseRows 2025-08-20 19:53:33 -07:00
Mitchell Hashimoto
2cebc225c0 ci: failing pagelist tests
on purpose, so we can verify CI fails
2025-08-20 19:46:37 -07:00
Jeffrey C. Ollie
1f7f678745 flatpak: manually install Zig 0.14.1
The SDK published on Flathub updated to Zig 0.15.1 which broke the
Flathub build in CI. So let's install it ourselves so that we can
control the version.
2025-08-20 19:10:25 -05:00
Qwerasd
610ce94f2d font/CoreText: fix positioning for padded scaled glyphs
When constraints increased or decreased the size significantly, the
fractional position was getting messed up by the scale. This change
separates that out so that it applies correctly.
2025-08-20 15:26:16 -06:00