Commit Graph

13724 Commits

Author SHA1 Message Date
Jacob Sandlund
7aec7effea Add test for Tai Tham letter position.y difference 2026-01-05 10:12:05 -05:00
Jacob Sandlund
41f63384f5 Turn off debugging 2026-01-05 09:59:37 -05:00
Jacob Sandlund
f31d2b99ae Merge remote-tracking branch 'upstream/main' into coretext-position-y 2026-01-05 09:58:10 -05:00
Jacob Sandlund
d38558aee1 Show current cp with ▸ in list of cps 2026-01-05 09:34:17 -05:00
Jacob Sandlund
1d4a5d91e0 More debugging for position.y differences 2026-01-04 21:24:45 -05:00
Mitchell Hashimoto
1c2db85aa4 fix: Mac window becomes unmovable after pane rearrangement (#10133)
On main, after rearranging panes, the window becomes permanently
immovable. Grab handles temporarily set `window.isMovable = false` on
hover to prevent window dragging from interfering with pane drags
(fixing [#10110](https://github.com/ghostty-org/ghostty/issues/10110)),
but the restoration logic failed when views were destroyed during pane
rearrangement (which happens each time a pane is rearranged).

The previous approach managed `window.isMovable` state across the view
lifecycle:

1. `mouseEntered` → saved and disabled `window.isMovable`
2. View removed during rearrangement → `mouseExited` never fired
3. `deinit` ran with `self.window` already nil → restoration failed
4. Window stuck with `isMovable = false`

Instead of managing window state, prevent the mouseDown event from
reaching the window's drag handler by overriding mouse event handling in
the grab handle view.

Per [Apple's Event Handling
Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/HandlingMouseEvents/HandlingMouseEvents.html):

> Custom NSView objects should not invoke super in their implementations
of NSResponder mouse-event-handling methods such as mouseDown:,
mouseDragged: and mouseUp: unless it is known that the inherited
implementation provides some needed functionality.

This eliminates all state management while solving both the original
issue (#10110) and the new bug.

AI disclosure: claude code found and wrote the fix. I tested it manually
to see that it works. I pressed claude quite hard here to come up with
the best fix, and looked at documentation to understand what the fix was
doing. It seems like this is a better approach overall to preventing the
main window from being dragged when grabbing the Surface Drag handle.
2026-01-01 16:21:15 -08:00
Martin Emde
c384cd050e Fix Mac window becomes unmovable after pane rearrangement
After rearranging panes, the window becomes permanently unmovable.
Grab handles temporarily set `window.isMovable = false` on hover to prevent
window dragging from interfering with pane dragging.

Override `viewWillMove(toWindow:)` to catch when the view is being removed from
the window. This lifecycle method is called before the window reference
becomes nil, allowing us to restore `window.isMovable`.
2026-01-01 15:56:25 -08:00
Mitchell Hashimoto
9a21e56311 Add iTimeFocus shader uniform to track time since focus (#10130)
When using split panes with custom shaders, unfocused panes receive
frame re-draws when mod keys are held or when the mouse hovers over a
link. This behavior is desirable in general, but shaders have no way to
detect when the frames they are drawing are "real" or a momentary glitch
frame.

Fixes #8456 indirectly, by allowing the shader to be updated to handle
this situation.

This PR adds two new shadertoy uniforms:

```glsl
float iTimeFocus
```

- Timestamp of when the surface last gained focus (set to current iTime,
similar to iTimeCursorChange timestamp)
- Allows calculating time since focus: iTime - iTimeFocus
- Resets on each focus gain, enabling "focus trigger" animations
- Uses the same focus state signal that changes unfocused-split-fill
config option

```glsl
float iFocus
```

- Current focus state: 1.0 when focused, 0.0 when unfocused
- Simple boolean check: if (iFocus == 1.0)
- This indicates that the frame being rendered is a defocused frame (for
example, upon leaving the surface, or when a mod key is held or an OSC8
link is hovered), allowing shaders to apply consistently instead of
flashing.

## Example

This does nothing, but it does show the two costumes and how you might
use them

```glsl
  void mainImage(out vec4 fragColor, in vec2 fragCoord) {
      if (iFocus == 1.0) {
          // Focused: animate based on time since focus
          float timeSinceFocus = iTime - iTimeFocus;
          // Resume normal animation
      } else {
          // Unfocused: dim or hide effects
      }
  }
```

Here's the included example shader being applied to this test build:


https://github.com/user-attachments/assets/4932e12f-6a1c-42dd-81f3-19da9a551c95

And here's a [more exciting
shader](https://github.com/martinemde/dotfiles/blob/main/home/dot_config/ghostty/focus_vignette.glsl)
that locates your cursor upon switching to a surface, renders a
fade/zoom in of the cursor on focus, and applies a shadow vignette to
the defocused surfaces.


https://github.com/user-attachments/assets/32b98956-59f0-4e4b-9c2f-ab79b147205f

AI disclosure: I used claude code to generate everything is this PR, but
I reviewed it, understand what it is doing, tested it manually, and
believe it is correct. I also tested by directly creating shadertoys
that use the new costumes (shown above) and have uploaded the examples
here showing that it works.
2026-01-01 13:14:30 -08:00
Martin Emde
ec2612f9ce Add iTimeFocus shader uniform to track time since focus 2026-01-01 13:11:54 -08:00
Mitchell Hashimoto
bde9578adc macOS: flash menu bar when using keyboard shortcuts (#10122)
When you press a keyboard shortcut that has a menu equivalent, the menu
bar should flash briefly. This is standard macOS behavior.

This change calls `performKeyEquivalent` on the main menu before
checking Ghostty bindings, so shortcuts with menu items get handled by
the menu system first.

This works for most shortcuts - Cmd+V, Cmd+N, Cmd+T, etc. all flash now.

Won't flash for `performable: true` (like Cmd+C copy) -- excluded from
menu: https://github.com/ghostty-org/ghostty/discussions/2811

The change skips menu handling when in a key sequence or key table, so
those still work correctly.
2026-01-01 12:47:47 -08:00
Ivan Buiko
c89627fe75 macOS: Add menu shortcut handling in macOS key event processing
Allow menu bar to flash for shortcuts and handle key equivalents before
checking for Ghostty key bindings
2026-01-01 12:47:16 -08:00
Mitchell Hashimoto
b3fbf11b0c macOS: temporarily disable window.isMovable to fix #10110 (#10125)
Fixes #10110
2026-01-01 12:45:08 -08:00
Jon Parise
2c6c6e1b69 macos: simplify .keyDown guard condition (#10127)
This condition is more naturally expressed as a `guard`.
2026-01-01 11:52:58 -05:00
Jon Parise
12024ed831 macos: simplify .keyDown guard condition
This condition is more naturally expressed as a `guard`.
2026-01-01 10:17:48 -05:00
Lukas
1249f3b88c macOS: temporarily disable window.isMovable to fix #10110 2026-01-01 14:37:08 +01:00
Lukas
74fc48682a macOS: remove unused file 2026-01-01 14:31:11 +01:00
Mitchell Hashimoto
3a89c8ac54 Update Imgui from 1.90.6 to 1.92.5, use Dear Bindings instead of cimgui (#10118)
This updates our Imgui version from 1.90.6 to 1.92.5 which is almost 18
months of changes. In the process, we've also migrated from cimgui to
Dear Bindings, the official way to do C bindings.

This PR doesn't contain any functionality changes, only the dependency
change and API changes necessary to achieve the same behavior.
2025-12-31 13:53:36 -08:00
Mitchell Hashimoto
c694517432 update gitattributes, removed file 2025-12-31 13:42:00 -08:00
Mitchell Hashimoto
8449c3efb8 update all deps 2025-12-31 13:39:19 -08:00
Mitchell Hashimoto
82e585ad9a remove pkg/cimgui 2025-12-31 13:38:40 -08:00
Mitchell Hashimoto
f2bc722a58 pkg/dcimgui: fix wchar size mismatch 2025-12-31 13:36:40 -08:00
Mitchell Hashimoto
965ffb1750 pkg/dcimgui: add freetype 2025-12-31 13:20:27 -08:00
Mitchell Hashimoto
f1ba5297b8 build: fix imgui on GTK 2025-12-31 13:20:03 -08:00
Mitchell Hashimoto
896361f426 Fix up API calls for initialization 2025-12-31 13:01:28 -08:00
Mitchell Hashimoto
978400b0b0 replace cimgui with dcimgui 2025-12-31 10:42:10 -08:00
Mitchell Hashimoto
3bd898603a pkg/dcimgui: DearBindings-based Imgui support 2025-12-31 10:11:43 -08:00
Mitchell Hashimoto
d3666d6ef9 macOS: Dragging last split out of tab should close tab, not window (#10113)
This makes it so that dragging a split over a tab in our app will focus
that tab. Presently, it's very hard if not impossible to get the drag to
focus the tab. This just does it manually.

This also fixes a bug where the last split drop out of a tab will close
the entire window, this affects main currently too.

This is still a draft because I'm chasing down one issue still where the
dropped surface fails to render properly and its unclear why yet.
2025-12-31 06:16:55 -08:00
Mitchell Hashimoto
18abcaa797 macos: remove tab hover event, seems native handles it 2025-12-31 06:15:04 -08:00
Mitchell Hashimoto
d4ba0fa27e macos: last surface should close tab immediately not window 2025-12-30 15:07:28 -08:00
Mitchell Hashimoto
3e399a3d35 macos: detect surface tab bar hovers and focus them 2025-12-30 15:07:27 -08:00
Jacob Sandlund
0a648cddf8 shaping: Use position.y directly for CoreText 2025-12-30 17:36:45 -05:00
Mitchell Hashimoto
f32d54bedb macos: make surface grab handle visible in light mode (#10111) 2025-12-30 13:14:49 -08:00
Mitchell Hashimoto
faa89ba280 macos: Ghostty.Command must copy string values (#10112)
We were previously storing the C struct which contained pointers into
ephemeral memory that could cause segfaults later on. I think this was a
tip regression, because in 1.2 despite doing this, we always referenced
static memory so it was fine. With tip, we now accept custom command
palette entries so it's dynamically allocated.
2025-12-30 13:13:41 -08:00
Mitchell Hashimoto
c34bb5976a macos: Ghostty.Command must copy string values
We were previously storing the C struct which contained pointers into
ephemeral memory that could cause segfaults later on.
2025-12-30 13:09:20 -08:00
Mitchell Hashimoto
43c7277a60 macos: make surface grab handle visible in light mode 2025-12-30 13:06:55 -08:00
Mitchell Hashimoto
6a1a4eee28 Update Vim filetype detection patterns (#10101)
Fixes #10094
2025-12-30 08:11:14 -08:00
Mitchell Hashimoto
b7e1852fb9 Refactor nautilus extension (#10106)
Following #10082 I took the opportunity to clean up the code in the
nautilus extension a little. Specifically, this pull request

- turns methods that weren't using `self` into functions,
- inlines a helper method that was trivial after #10082,
- extracts duplicate code in both menu item callbacks into a new helper
function, and
- removes the compatibility hack for the Nautilus 3.0 API, i.e. GNOME 42
and older.

I'm not that sure about the last point, as it's not clear to me what the
support baseline is here: GNOME 43 (the first version to support the
Nautilus 4.0 API) was released in Sep 2022, i.e. is almost as old as
Ghostty itself. The previous Debian stable release already included
GNOME 43, but Ubuntu 22.04 (the LTS before the current 24.04 LTS) still
includes GNOME 42. Does Ghostty support a system that old? If so, I'll
drop the corresponding commit from this PR.
2025-12-30 07:30:22 -08:00
Mitchell Hashimoto
b52a145bf6 macos: keep glass titlebar inset in sync when tab bar appears (#10105)
Discussion: https://github.com/ghostty-org/ghostty/discussions/10104

Summary:
When background blur uses macOS glass styles, the titlebar becomes fully
transparent after opening a new tab. This updates the glass effect
view’s top inset during layout so
the glass layer continues to cover the titlebar area.

Root Cause:
The glass effect view’s top constraint is computed once using the theme
frame’s safe-area top inset. On macOS 26, opening a new tab changes the
titlebar height/safe-area,
but the constraint is never refreshed. That leaves an uncovered strip at
the top, which appears fully transparent.

Fix:
Track the glass view’s top constraint and update its constant on layout.
This keeps the glass layer aligned with the current safe-area inset
while avoiding unnecessary
reconfiguration.

Tests:
- Manual: `zig build run`, open a new tab with `background-opacity < 1`
and `background-blur = macos-glass-regular` and confirm titlebar is no
longer fully transparent.
- Note: automated tests not added; UI behavior is hard to exercise in
existing test suite.

Window position question:
Opening a new tab seems to reset the window position / trigger a
maximize-like behavior on my system. Is this intended (feature) or a
bug? I did not change this behavior in this PR.

AI Assistance:
This change was implemented with AI assistance (Codex) and reviewed by
me.
2025-12-30 07:21:32 -08:00
Sebastian Wiesner
ab4b54e2a4 Drop GNOME 42 compatibility
GNOME 43 is from 2022-09, i.e. almost as old as Ghostty, so  not longer
worth supporting here.
2025-12-30 13:30:18 +01:00
Sebastian Wiesner
5c35a4710d Rename class
It's a menu provider not a single action.
2025-12-30 13:30:18 +01:00
Sebastian Wiesner
dee093db57 Extract duplicated code into single helper
Extract duplicated code from the two different menu item hooks into a
single helper function, and then inline _make_item, as it's only used
once now.
2025-12-30 13:30:18 +01:00
Sebastian Wiesner
09d6a1ee2e Lift functions out of class
Neither of these used self.
2025-12-30 13:30:18 +01:00
Sebastian Wiesner
f1bed9dd6a Inline trivial method 2025-12-30 13:30:18 +01:00
John Xu
53c510ac40 macos: keep glass titlebar inset in sync on layout 2025-12-30 16:32:12 +08:00
qingyunha
5c4af69765 Update Vim filetype detection patterns
Fixes #10094
2025-12-30 08:47:18 +08:00
Jeffrey C. Ollie
1fa6641a6a Remove systemd integration from nautilus extension (#10082)
As far as I understand ghostty already integrates with systemd nowadays,
and manages its own scopes/cgroups for the application and all tabs. As
such, explicitly moving launching ghostty into a separate systemd scope
from nautilus no longer seems necessary. In any case the scope created
by the nautilus extension quickly goes away, suggesting that Ghostty
moves its processes out of this scope, and the process tree looks just
the same when spawning ghostty directly.
2025-12-29 16:57:58 -06:00
Sebastian Wiesner
622d49206a Remove unused imports 2025-12-29 22:36:27 +01:00
Sebastian Wiesner
d09bac64ae Remove systemd integration from nautilus extension
As far as I understand ghostty integrates with systemd already nowadays,
and manages its own scopes/cgroups for tabs.  As such, explicitly moving
launching ghostty into a separate systemd scope from nautilus no longer
seems necessary.
2025-12-29 22:36:27 +01:00
Mitchell Hashimoto
b9ad1f05ef input: add end_key_sequence binding action (#10098)
End the currently active key sequence, if any, and flush the keys up to
this point to the terminal, excluding the key that triggered this
action.

For example: `ctrl+w>escape=end_key_sequence` would encode `ctrl+w` to
the terminal and exit the key sequence. Or, more fancy,
`ctrl+w>catch_all=end_key_sequence` would exit the sequence without
encoding whatever key was invalid!

Normally, an invalid sequence will reset the key sequence and flush all
data including the invalid key. This action allows you to flush only the
prior keys, which is useful when you want to bind something like a
control key (`ctrl+w`) but not send additional inputs.
2025-12-29 12:12:16 -08:00
Mitchell Hashimoto
61df50d70b input: add end_key_sequence binding action
End the currently active key sequence, if any, and flush the
keys up to this point to the terminal, excluding the key that
triggered this action.

For example: `ctrl+w>escape=end_key_sequence` would encode
`ctrl+w` to the terminal and exit the key sequence.

Normally, an invalid sequence will reset the key sequence and
flush all data including the invalid key. This action allows
you to flush only the prior keys, which is useful when you want
to bind something like a control key (`ctrl+w`) but not send
additional inputs.
2025-12-29 12:07:54 -08:00