Commit Graph

7149 Commits

Author SHA1 Message Date
Mitchell Hashimoto
75dd8e46b5 datastruct: fix split tree debug log rounding 2025-08-08 14:22:38 -07:00
Mitchell Hashimoto
ae5dc3a4fb apprt/gtk-ng: split tree new split actions 2025-08-08 14:22:38 -07:00
Mitchell Hashimoto
5bf8f12cf0 apprt/gtk-ng: template callbacks can't return bool, must be c_int
This fixes the tab bar showing the window controls sometimes.
2025-08-08 13:36:08 -07:00
Mitchell Hashimoto
8e073505f7 apprt/gtk-ng: set resize overlay label in the idle callback
This avoids jitter when resizing splits. I didn't see any jitter before
splits but conceptually its possible. The issue is that since we're
updating the overlay DURING A RESIZE, changing the dimensions of any
part of the widget tree causes GTK warnings and a bunch of laggy
updates.

Instead, we copy the label text to a property and update it on the idle
callback along with everything else. This also provides a natural
debounce to the label.
2025-08-08 12:59:54 -07:00
Mitchell Hashimoto
729b8f9c2d apprt/gtk-ng: add proper setters for surface properties (#8184)
This also fixes a bug where we were setting custom cursors on the wrong
gtk widget, this showed up most terribly with `mouse-hide-while-typing`
where the mouse would never reappear.
2025-08-08 12:36:42 -07:00
Mitchell Hashimoto
16e15554da apprt/gtk-ng: add proper setters for surface properties
This also fixes a bug where we were setting custom cursors on the wrong
gtk widget, this showed up most terribly with `mouse-hide-while-typing`
where the mouse would never reappear.
2025-08-08 12:30:22 -07:00
Jeffrey C. Ollie
cae60f7c29 gtk-ng: use single if expression instead of block 2025-08-08 13:36:45 -05:00
Jeffrey C. Ollie
0f67282dfa gtk-ng: add "title bar styles"
This PR adds a "tabs" title bar style similar to the macOS title bar
style. When `gtk-titlebar-style=tabs` the title bar and the tab bar
will be merged together.

The config entry for controlling this is kept separate from macOS as
macOS has more styles defined that don't map to a GTK title bar style
and it's likely that users that use both macOS and GTK would want
different settings for each platform.
2025-08-08 13:32:23 -05:00
Leah Amelia Chen
4d9d133ebc inspector: fix display for fractional pixel sizes (#8179) 2025-08-08 17:12:43 +08:00
Leah Amelia Chen
7663f7d922 inspector: fix display for fractional pixel sizes
#4371 2: Electric Boogaloo

Regression caused by #7953
2025-08-08 14:39:26 +08:00
Jeffrey C. Ollie
b5073b34ee gtk-ng: nuke .nick and .blurb from property definitions 2025-08-07 13:12:56 -05:00
Mitchell Hashimoto
326e55c8f8 apprt/gtk-ng: PR feedback 2025-08-07 08:37:22 -07:00
Mitchell Hashimoto
4a4577cf8a apprt/gtk-ng: address some TODOs 2025-08-07 08:14:02 -07:00
Mitchell Hashimoto
bc731c0ff6 apprt/gtk-ng: hook up Tab signals to surface 2025-08-07 08:14:02 -07:00
Mitchell Hashimoto
3b4c33afe0 apprt/gtk-ng: connect surface signals 2025-08-07 08:14:02 -07:00
Mitchell Hashimoto
a7865d79ea apprt/gtk-ng: render a single artificial split 2025-08-07 08:14:02 -07:00
Mitchell Hashimoto
70b050ebb4 apprt/gtk-ng: setup split tree property 2025-08-07 08:14:02 -07:00
Mitchell Hashimoto
fa08434b28 apprt/gtk-ng: initial GhosttySplitTree widget 2025-08-07 08:14:02 -07:00
Mitchell Hashimoto
ad1cfe8347 remove outdated comment 2025-08-07 08:14:02 -07:00
Mitchell Hashimoto
3e767c166c datastruct: split tree node removal 2025-08-07 08:14:02 -07:00
Mitchell Hashimoto
52e264948d apprt/gtk-ng: ASCII output for SplitTree 2025-08-07 08:14:02 -07:00
Mitchell Hashimoto
5c30ac0e8e apprt/gtk-ng: spatial tree 2025-08-07 08:14:02 -07:00
Mitchell Hashimoto
7811c04f9d apprt/gtk-ng: SplitTree data structure 2025-08-07 08:14:02 -07:00
Leah Amelia Chen
f107b2f910 font/{harfbuzz,coretext}: enable dlig for test shaper
Some of the tests rely on dlig and I'm far too lazy to rewrite those
tests now
2025-08-07 11:54:31 +08:00
Leah Amelia Chen
eb96ff0757 font: disable discretionary ligatures by default
Closes #5372

Discretionary ligatures (denoted by the OpenType feature tag `dlig`) are
sometimes used by programming fonts (e.g. Iosevka) to provide more
"complex" and uncommon ligatures that may be useful in a programming
context. Unfortunately, this has some nasty side effects with certain
Japanese fallback fonts (#5372) due to perhaps a misaligned understanding
of the OpenType spec[^spec].

The spec details that `dlig` ligatures should only be used to contract
sequences of glyphs together into one glyph, and that it should be used
only for "special effect", **at the user's preference** (emphasis mine).
Indeed, it also suggests that:

> UI suggestion: This feature should be off by default.

All of this, combined with the fact that historical, nowadays unused and
even unintelligible Kanji ligatures are explicitly included as examples
of discretionary ligatures, shows that in the Japanese context at least
that the "level of discretion" is significantly higher than what is found
in programming fonts, where it is more understood to be "opinionated and
uncommon", rather than "obsolete and unreadable".

Furthermore, it appears that a lot of common programming fonts don't even
make use of the `dlig` feature —  JetBrains Mono, FiraCode and MonoLisa
lack a `dlig` feature altogether, while Inconsolata seems to only use it
for ligatures that are more commonly found in `liga` or `calt`, such as
the `->` ligature. To a lot of people, then, this change would literally
alter nothing.

Therefore, it's my opinion that we should disable `dlig` by default.
It's arguably not being used correctly in the programming font space
(or at least not in a way that's coherent with other fonts), and it only
provides a marginal benefit while potentially rendering entire sentences
in Japanese (and possibly other languages) unreadable out of the box.

If someone upgrades to tip or 1.2 and then asks "why aren't the ligatures
working anymore", then at least they can always just turn on `dlig` by
themselves.

[^spec]: https://learn.microsoft.com/en-us/typography/opentype/spec/features_ae#tag-dlig
2025-08-07 03:33:24 +08:00
Leah Amelia Chen
1d042f1e71 build: allow disabling i18n (#8158) 2025-08-06 21:09:03 +08:00
Leah Amelia Chen
5fbdb8c459 build: allow disabling i18n
GNU gettext simply is a PITA on certain platforms (i.e. Windows, musl
Linux, etc.) and currently it's not possible to cleanly remove i18n
from the build process, making building Ghostty on the aforementioned
platforms difficult. By providing users with a way to opt-out of the
i18n mechanisms (or opt-in, on platforms where i18n is disabled by
default) we can make sure that people at least have *some* way of
building Ghostty before i18n mechanisms can be integrated neatly.
2025-08-06 14:54:02 +08:00
Jeffrey C. Ollie
35e3ac8b4c gtk-ng: remove use of deprecated use-es GLArea property 2025-08-05 19:56:00 -05:00
Jeffrey C. Ollie
288601e386 gtk-ng: fix OSC 22 not changing mouse shape on -ng 2025-08-05 19:56:00 -05:00
Mitchell Hashimoto
70ec59d566 macOS: properly handle buffer allocation in ZH locale canonicalization (#8137)
Fix a bug introduced by #6885 

`fixZhLocale` returns locale string literal without copying it into the
buffer, causing the `LANGUAGE` environment variable to be set
incorrectly.
```log
$ LANG="" zig build run
...
debug(os_locale): setting LANGUAGE from preferred languages value=�����.UTF-8:�����.UTF-8:en_US.UTF-8:ja_CN.UTF-8
...
```
2025-08-05 09:41:15 -07:00
Mitchell Hashimoto
5c0e15f50f gtk-ng: port the command palette (#8083) 2025-08-05 09:40:37 -07:00
Mitchell Hashimoto
19fde96d30 funny typos 2025-08-05 09:38:08 -07:00
Jeffrey C. Ollie
cf77897388 gtk-ng: port the command palette 2025-08-05 10:33:08 -05:00
Jeffrey C. Ollie
6ae333869e zig: switch all uses of callconv(.C) to callconv(.c) 2025-08-05 10:32:03 -05:00
Aaron Ruan
c1060d56b3 macOS: properly handle buffer in zh locale canonicalization 2025-08-05 22:56:28 +08:00
Mitchell Hashimoto
8c85bae931 apprt/gtk-ng: background-opacity doesn't need to be a window property
We only need properties for things that are bound via the blueprint
files. Otherwise, its kind of just a pain. This fixes a bug where it
wasn't being properly set initially anyways because we didn't trigger
syncAppearance.
2025-08-04 12:41:44 -07:00
Mitchell Hashimoto
55c68d809d apprt/gtk-ng: action accelerators, clean up explicit error sets 2025-08-04 12:35:37 -07:00
Mitchell Hashimoto
ee6d9b3116 apprt/gtk-ng: surface context menu 2025-08-04 11:28:48 -07:00
Mitchell Hashimoto
1d62f37cbb apprt/gtk-ng: global shortcuts (#8142)
Ports global shortcuts. 

This is mostly a direct logic copy. The primary difference is I
converted `GlobalShortcuts` to a `GObject` which has a config and dbus
property and emits a trigger signal. Importantly, it's no longer tied or
dependent on the `gio.Application` in any way. The config and dbus
connection are updated as normal properties.

Verified with Valgrind we're clean. Found one memory leak I ported back
to legacy.
2025-08-04 10:37:57 -07:00
Mitchell Hashimoto
c8fce8850b apprt/gtk-ng: global shortcuts 2025-08-04 10:25:24 -07:00
Mitchell Hashimoto
41e8f1374b gtk-ng: prevent split button from becoming focused (#8136)
Without this, if you create a new tab by clicking on the split button it
will be the focus for any new input. So for example if you create a new
tab and then immediately press the space bar a bunch of new tabs will be
created. Other keypresses will just "disappear". Only by clicking in the
new tab to focus it will keyboard input go to "the right place".
2025-08-04 08:07:52 -07:00
Robbie Vanbrabant
42e4a95b64 fix fish shell syntax for ssh-env shell integration
As discussed here https://github.com/ghostty-org/ghostty/discussions/8021

This fixes invalid fish shell syntax.

As an example, run ghostty like so: `XDG_CONFIG_HOME=/tmp ghostty --shell-integration-features=ssh-env --command="/usr/bin/env fish"`. Setting XDG_CONFIG_HOME to /tmp is just to start from the default config.

Before:

```
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
robbiev@neo ~/s/ghostty (fish-shell-ssh)> ssh git@github.com
env: ‘command’: No such file or directory
robbiev@neo ~/s/ghostty (fish-shell-ssh) [127]>
```

After:

```
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
robbiev@neo ~/s/ghostty (fish-shell-ssh)> ssh git@github.com
PTY allocation request failed on channel 0
Hi robbiev! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
robbiev@neo ~/s/ghostty (fish-shell-ssh) [1]>
```

My understanding of the fix follows.

The script is using `command` to make sure it calls the actual ssh binary and not some intermediate shell function with the same name (`man command` explains).

`env` can be useful for fish compat < 3.1, where [the KEY=value syntax was introduced](https://fishshell.com/docs/current/faq.html#how-do-i-set-or-clear-an-environment-variable). However because `command` is a builtin it doesn't work in this case.

So a simple solution is this, requiring fish >= 3.1

```
TERM="$ssh_term" command ssh $ssh_opts $argv
```

An [alternative](https://serverfault.com/questions/164305/how-can-i-set-environment-variable-for-just-one-command-in-fish-shell) for maximum fish compat could be the following:

```
begin
  set -lx TERM "$ssh_term"
  command ssh $ssh_opts $argv
end
```

According to `man set`, `-l` means local to the block and `-x` means export.

I'm in favour of keeping `command` as it makes the integration more predicable.

The reason I went with the current fix:
- It's easier to understand without knowing fish shell.
- [kat found that fish 3.1 should be widely available](https://github.com/ghostty-org/ghostty/discussions/8021#discussioncomment-13877129).
2025-08-04 11:28:39 +01:00
Jeffrey C. Ollie
83063e5527 gtk-ng: prevent split button from becoming focused 2025-08-03 13:38:49 -05:00
Jon Parise
f4e434fffd bash: upgrade to bash-preexec 0.6.0
https://github.com/rcaloras/bash-preexec/releases/tag/0.6.0

This is a small update for us because we've been using a patched version
of this script in Ghostty for some time, and the 0.6.0 release includes
most of the local changes we made as part of maintaining and improving
our bash shell integration.

- https://github.com/rcaloras/bash-preexec/pull/167
- https://github.com/rcaloras/bash-preexec/pull/170

We continue to maintain one local HISTCONTROL-related modification
(#2478). There are a few upstream conversations related to HISTCONTROL
that might eliminate the need for this local patch, so we may revisit
that in the future.
2025-08-03 09:15:35 -04:00
Mitchell Hashimoto
053e3d307b apprt/gtk-ng: runtime CSS and custom CSS 2025-08-02 20:28:22 -07:00
Mitchell Hashimoto
5078fc5243 apprt/gtk-ng: toggle_window_decorations 2025-08-02 13:34:14 -07:00
Mitchell Hashimoto
91254bb6cc apprt/gtk-ng: address feedback 2025-08-02 12:53:27 -07:00
Mitchell Hashimoto
e1e525ba3d apprt/gtk-ng: winproto callbacks for subprocess env 2025-08-01 21:16:08 -07:00
Mitchell Hashimoto
523799a45f apprt/gtk-ng: winproto resizeEvent 2025-08-01 21:05:42 -07:00
Mitchell Hashimoto
7aa84cd372 apprt/gtk-ng: quick terminal 2025-08-01 20:51:43 -07:00