9156 Commits

Author SHA1 Message Date
Mitchell Hashimoto
9732a92d7a terminal: ConEmu OSC9 parsing is more robust and correct (#4727)
Related to #4485

This commit matches ConEmu's parsing logic[^1] more faithfully. For any
substate that requires a progress, ConEmu parses so long as there is a
number and then just ignores the rest.

For substates that don't require a progress, ConEmu literally ignores
everything after the state.

Tests cover both.

[^1]:
740b09c363/src/ConEmuCD/ConAnsiImpl.cpp (L2264)
2025-01-06 15:56:32 -08:00
Tristan Partin
c71da8338b apprt/gtk: continue cleanup of window-decoration code
Remove all window corner artifacting. Now we also respond to changes
when the window becomes decorated or not.

Signed-off-by: Tristan Partin <tristan@partin.io>
2025-01-06 17:44:05 -06:00
Mitchell Hashimoto
7ae94e145d terminal: ConEmu OSC9 parsing is more robust and correct
Related to #4485

This commit matches ConEmu's parsing logic[^1] more faithfully. For any
substate that requires a progress, ConEmu parses so long as there is a
number and then just ignores the rest.

For substates that don't require a progress, ConEmu literally ignores
everything after the state.

Tests cover both.

[^1]: 740b09c363/src/ConEmuCD/ConAnsiImpl.cpp (L2264)
2025-01-06 15:41:44 -08:00
Mustaque Ahmed
85743aebd5 feat: add support for file paths starts with ../ ./ and /
To implement this I extended the existing regex variable in the `src/config` dir. In a few test cases, extra space is added intentionally to verify we don't include space in the URL as it looks & feels odd.
2025-01-07 01:13:29 +05:30
Jon Parise
15f82858b7 termio: don't leak VTE_VERSION into child processes
This variable is used by gnome-terminal and other VTE-based terminals.
We don't want our child processes to think we're running under VTE.
2025-01-06 14:00:38 -05:00
Mitchell Hashimoto
037de64ea2 config: unbind keybind triggers unbinds both translated and physical (#4705)
Fixes #4703

This changes `unbind` so it always removes all keybinds with the given
trigger pattern regardless of if it is translated or physical.

The previous behavior was technically correct, but this implements the
pattern of least surprise. I can't think of a scenario where you really
want to be exact about what key you're unbinding. And if that scenario
does exist, you can always fix it by rebinding after unbind.
2025-01-06 10:06:21 -08:00
Mitchell Hashimoto
359c390218 config: unbind keybind triggers unbinds both translated and physical
Fixes #4703

This changes `unbind` so it always removes all keybinds with the given
trigger pattern regardless of if it is translated or physical.

The previous behavior was technically correct, but this implements the pattern
of least surprise. I can't think of a scenario where you really want to
be exact about what key you're unbinding. And if that scenario does
exist, you can always fix it by rebinding after unbind.
2025-01-06 09:47:21 -08:00
Mitchell Hashimoto
0929500360 Set the paste button as default in the GTK paste confirmation dialog (#4225)
A simple change to make it so that, in the GTK4 paste confirmation
dialog, the user can just hit enter/space to confirm the paste.

After some playing around, it seems as though GTK4 needs you to set the
focus on a widget after the entire view has been configured, meaning
that we have to create more references to pass the `confirm_button`
GtkWidget up and up. Not 100% certain if this is the best way to do so,
but:

1. Add the `ButtonsView` to the `PrimaryView` struct (as
`PrimaryView.buttons`)
2. Add the `confirm_button` to the `ButtonsView` struct (as
`ButtonsView.confirm_button`)
3. Call `c.gtk_widget_grab_focus` on (the now-accessible)
`view.buttons.confirm_button`

This seems to work as expected, but I'm not sure if:

1. We should also make `cancel_button` available?
2. There's a better way to expose `confirm_button` to `PrimaryView`?
3. I did a good Zig?

I've never written (or read) Zig code before today so I hope this makes
sense. Feedback welcome!
2025-01-06 09:43:18 -08:00
Daniel Fox
d79a02db44 Add destructive/suggested action classes 2025-01-06 09:25:42 -08:00
Daniel Fox
4fb253a300 Expose clipboard cancel button and focus it 2025-01-06 09:06:10 -08:00
Daniel Fox
d3973b8fad Set the paste button in the GTK dialog as default 2025-01-06 09:06:10 -08:00
Jeffrey C. Ollie
6d90a181ce core: improve desktop environment detection 2025-01-06 10:38:07 -06:00
Mitchell Hashimoto
3461204741 iOS: Fix crash on device (#4684)
Currently causes a crash on launch in iOS devices (not Simulators) since
[isHeadless](https://developer.apple.com/documentation/metal/mtldevice/1433377-isheadless),
[isRemovable](https://developer.apple.com/documentation/metal/mtldevice/2889851-isremovable)
and
[isLowPower](https://developer.apple.com/documentation/metal/mtldevice/1433409-islowpower)
are only available on macOS (raises `[AGXG16GDevice isHeadless]:
unrecognized selector sent to instance ... `).

The [preferred
method](https://developer.apple.com/documentation/metal/gpu_devices_and_work_submission/getting_the_default_gpu)
in iOS is to access the single GPU device by attempting to create a
default one.

Fixes #4685.
2025-01-06 07:31:21 -08:00
Mitchell Hashimoto
4838bcbb8f macos: halt NSEvent processing at app scope only if event is handled (#4691)
Fixes #4677
2025-01-06 07:28:04 -08:00
Mitchell Hashimoto
ae0c4d927a macos: halt NSEvent processing at app scope only if event is handled
Fixes #4677
2025-01-06 07:27:44 -08:00
Mitchell Hashimoto
b04cb2585d macos: fix retain cycle preventing window from freeing (#4689) 2025-01-06 07:17:48 -08:00
Jon Parise
237c941395 bash: narrow the scope of GHOSTTY_BASH_ENV
GHOSTTY_BASH_ENV is only set in the '--posix' path. This change is a
code organization improvement and doesn't change the script's behavior.
2025-01-06 10:02:24 -05:00
Mitchell Hashimoto
f0c2d3d75a macos: fix retain cycle preventing window from freeing 2025-01-06 07:02:04 -08:00
Evelyn Harthbrooke
dc4774c147 macOS: fixup Photo Library description to make more sense. 2025-01-06 07:13:53 -07:00
George Joseph
c127daa552 Fix minimum initial window size
Change the calculation of minimum initial window size so it agrees with
the documented 10x4 cells instead of 640x480 px.

Resolves: #4655
2025-01-06 07:13:51 -07:00
Mitchell Hashimoto
d0b06bd55f don't error if gtk4 pkg-config configuration could not be found (#4683)
this prevents issues with people running `zig build --help` without gtk4
development stuff installed

same as #4546
2025-01-06 06:12:36 -08:00
Evelyn Harthbrooke
ae0248b5bc macOS: Add Bluetooth permission description; fixup other descs.
Adds the missing Bluetooth permission description to ghostty's Xcode
project description, and fixes up existing permissions to be clearer.

Closes #3995 and #4512.
2025-01-06 07:10:50 -07:00
Tristan Partin
3698b37588 apprt/gtk: use a subtitle to mark the current working directory
If the title is already the current working directory, hide the
subtitle. Otherwise show the current working directory, like if
a command is running for instance.

Signed-off-by: Tristan Partin <tristan@partin.io>
2025-01-06 08:05:24 -06:00
yonihemi
63a47d0ba5 iOS: Fix crash on device 2025-01-06 22:01:41 +08:00
Jan200101
781159af7d don't error if gtk4 pkg-config configuration could not be found
this prevents issues with people running `zig build --help` without gtk4 installed

same as #4546
2025-01-06 14:53:57 +01:00
Mitchell Hashimoto
6181487bad vim compiler plugin for ghostty filetype (#4645)
Basically integrates `ghostty +validate-config` with vim's compiler
feature. This allows validating the config from vim and navigating to
errors e.g. with the quickfix list.
2025-01-05 18:52:59 -08:00
Mitchell Hashimoto
53468541f7 Use \w instead of $PWD for title bar (#4656)
The `PS1=` variable in the bash integration for the title bar could use
[`\w`](https://www.man7.org/linux/man-pages//man1/bash.1.html#PROMPTING)
rather than `$PWD` to indicate the working directory.

The effect is to replace any leading instance of `$HOME` with a tilde,
so `/Users/patrick/code` becomes `~/code`. It also respects
[`$PROMPT_DIRTRIM`](https://www.man7.org/linux/man-pages//man1/bash.1.html#PARAMETERS),
if any. It looks cleaner to me, especially if there are multiple tabs
open.

Implements #4643 (cc discussion #4601).
2025-01-05 18:51:23 -08:00
Beau McCartney
94bf448eda just reset makeprg and errorformat 2025-01-05 17:08:52 -07:00
Mitchell Hashimoto
2485482aec config: store non-reproducible diagnostics in replay steps (#4652)
Fixes #4509

Our config has a replay system so that we can make changes and reproduce
the configuration as if we were reloading all the files. This is useful
because it lets us "reload" the config under various conditions (system
theme change, etc.) without risking failures due to world state changing
(i.e. config files change or disappear).

The replay system assumed that all diagnostics were reproducible, but
this is not the case. For example, we don't reload `config-file` so we
can't reproduce diagnostics that come from it.

This commit adds a new `diagnostic` replay step that can be used to
store non-reproducible diagnostics and `config-file` is updated to use
it.
2025-01-05 14:14:20 -08:00
Mitchell Hashimoto
f6d85baadb config: store non-reproducible diagnostics in replay steps
Fixes #4509

Our config has a replay system so that we can make changes and reproduce
the configuration as if we were reloading all the files. This is useful
because it lets us "reload" the config under various conditions (system
theme change, etc.) without risking failures due to world state changing
(i.e. config files change or disappear).

The replay system assumed that all diagnostics were reproducible, but
this is not the case. For example, we don't reload `config-file` so we
can't reproduce diagnostics that come from it.

This commit adds a new `diagnostic` replay step that can be used to
store non-reproducible diagnostics and `config-file` is updated to use
it.
2025-01-05 13:59:38 -08:00
Mitchell Hashimoto
c9c5ad43a5 macos: ignore modifier changes while IM is active (#4649)
Fixes #4634
2025-01-05 13:46:11 -08:00
Mitchell Hashimoto
ed221f32fe macos: ignore modifier changes while IM is active
Fixes #4634
2025-01-05 13:30:50 -08:00
Mitchell Hashimoto
143c01edcb feat: parse ConEmu OSC9;1 (#4327)
# Description

This PR implements support for the [ConEmu OSC9;1 escape
sequence](https://conemu.github.io/en/AnsiEscapeCodes.html#OSC_Operating_system_commands).

Based on my understanding of [ConEmu's source
code](740b09c363/src/ConEmuCD/ConAnsiImpl.cpp (L705-L724)):
- The default timeout is set to `100` milliseconds if no value is
specified.
- The timeout value is clamped to a maximum of `10000` milliseconds.

#3125
2025-01-05 13:25:41 -08:00
Damien Mehala
ead241f38c Merge branch 'main' into dmehala/conemu-osc9 2025-01-05 21:58:45 +01:00
Mitchell Hashimoto
e3c94210f2 docs: improve terminal page list documentation (#4648)
This PR enhances clarity and comprehension for the terminal page list
documentation.
2025-01-05 12:53:55 -08:00
Mitchell Hashimoto
f14c0f5a63 gtk(wayland): add support for background blur on KDE Plasma (#4403)
Also establishes a foundation for Wayland support and fixes a minor bug
(GTK windows remaining opaque when `background-opacity` is set to 1 on
startup and later updated to less than 1 with a config reload)

Can't update the Zig cache hash myself since I'm currently in China and
my proxy's broken for some reason :(

See also #4361, part of #4626
2025-01-05 12:53:39 -08:00
Mitchell Hashimoto
62dd468500 font(coretext): add config to adjust strength of font-thicken. (#4531)
This is achieved by rendering to an alpha-only context rather than a
normal single-channel context, and adjusting the brightness at which
CoreText thinks it's drawing the glyph, which affects how it applies
font smoothing (which is what `font-thicken` enables).
2025-01-05 12:53:14 -08:00
Alexandre Antonio Juca
057b196024 docs: improve terminal page list documentation 2025-01-05 21:50:20 +01:00
Mitchell Hashimoto
2fbe680aed config: fix tests 2025-01-05 12:38:24 -08:00
Mitchell Hashimoto
ce77b91bf6 nix fmt 2025-01-05 12:37:56 -08:00
Mitchell Hashimoto
bb83a14d7a config: minor config changes 2025-01-05 12:35:50 -08:00
Mitchell Hashimoto
68624e6c45 parse ConEmu OSC9;3 (#4644)
This PR implements support for the [ConEmu OSC9;3 escape
sequence](https://conemu.github.io/en/AnsiEscapeCodes.html#OSC_Operating_system_commands).

| Sequence | Description |
| - | - |
ESC ] 9 ; 3 ; ”txt“ ST | Change ConEmu Tab to txt. Set empty string to
return original Tab text

#3125
2025-01-05 12:35:43 -08:00
Mitchell Hashimoto
0ae8d9ed42 nix: update hash 2025-01-05 12:30:16 -08:00
Leah Amelia Chen
f2c357a209 config: allow booleans for background-blur-radius 2025-01-05 12:27:11 -08:00
Leah Amelia Chen
cd90821b93 fix(gtk): adjust background CSS class dynamically on config reload
Currently the `background` CSS class is added once on startup and never removed
or re-added. This is problematic as that if Ghostty was started with an opaque
window but then its config was reloaded with a `background-opacity` less than 1,
the window won't actually become translucent, and it would only appear as if the
background colors had become faded (because the window is still styled to be
opaque).
2025-01-05 12:27:11 -08:00
Leah Amelia Chen
9184395cba gtk(wayland): add support for background blur on KDE Plasma 2025-01-05 12:27:11 -08:00
Leah Amelia Chen
31439f311d build: add wayland 2025-01-05 12:27:11 -08:00
Beau McCartney
8d7e57f64b vim compiler plugin for ghostty filetype - validates config
`:make` will call `ghostty +validate-config` and populate the quickfix
list with the errors that can be navigated to (e.g. with `:cnext`)

`:h write-compiler-plugin`, and neovim's built in ftplugin/ and
compiler/ plugins were used as references
2025-01-05 13:06:32 -07:00
Mitchell Hashimoto
f4a9b65f78 gtk: fix copy keybinds (#4635)
- **gtk: send copy_to_clipboard toast from Surface**

    Move the toast we send when copying to the clipboard to the Surface
implementation. Previously, we only called this from the gtk accelerator
callback which we only call when the *last set* keybind is activated.

We also only send a toast if we have copied to the standard clipboard,
    as opposed to the selection clipboard. By default, we have
copy-to-clipboard true for linux, which sets the selection keyboard on
    any select. This becomes *very* noisy.

- **config: rearrange default copy_to_clipboard keybinds**

    Move the newly added *+insert keybinds to before the ctrl+shift+*
    keybinds. This is needed to have the ctrl+shift keybinds be the ones
    that show up in the menu.
2025-01-05 07:56:49 -08:00
Tim Culverhouse
9cf9e0639f config: rearrange default copy_to_clipboard keybinds
Move the newly added *+insert keybinds to before the ctrl+shift+*
keybinds. This is needed to have the ctrl+shift keybinds be the ones
that show up in the menu.
2025-01-05 09:37:47 -06:00