5886 Commits

Author SHA1 Message Date
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
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
Tim Culverhouse
4d4b785a58 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.
2025-01-05 09:25:47 -06:00
Mitchell Hashimoto
948cbfbf0e gtk: enable window-title-font-family (#4560) 2025-01-04 20:35:44 -08:00
Jeffrey C. Ollie
51c42795fc gtk: enable window-title-font-family 2025-01-04 20:20:52 -08:00
Christian Schneider
da80531c22 Implement configuration option split-divider-color for macOS 2025-01-04 20:18:00 -08:00
Mitchell Hashimoto
0df4012edc gtk: add split-separator-color config (#4593)
Fixes #4326


![image](https://github.com/user-attachments/assets/eaf5280b-be08-4927-9536-19b96d206ad6)
2025-01-04 20:16:51 -08:00
Patrick Reynolds
5fa9e88482 Use \w instead of $PWD for title bar 2025-01-04 19:26:14 -05:00
Jeffrey C. Ollie
f3cb95ac1f gtk: add split-separator-color config
Fixes #4326 for GTK
2025-01-04 16:56:52 -06:00
Mitchell Hashimoto
0306c592a7 Feat: display memory size in Terminal Inspector using bytes and kibibytes (#4549)
This PR ensures that we can view all memory-related information in the
Terminal Inspector in bytes and kibibytes for improved readability at a
glance.

<img width="561" alt="Screenshot 2025-01-03 at 23 32 07"
src="https://github.com/user-attachments/assets/b1075a0e-f8e1-44e8-8386-8462e35e2c46"
/>
2025-01-04 14:55:29 -08:00
Alexandre Antonio Juca
62fae29395 chore: rename file 2025-01-04 23:37:54 +01:00
Mitchell Hashimoto
f5f30605a8 feat: parse ConEmu OSC9;2 (#4447)
This PR implements support for the [ConEmu OSC9;2 escape
sequence](https://conemu.github.io/en/AnsiEscapeCodes.html#OSC_Operating_system_commands).

| Sequence | Description |
| - | - |
ESC ] 9 ; 2 ; ”txt“ ST | Show GUI MessageBox ( txt ) for any purposes.
2025-01-04 14:37:01 -08:00
Mitchell Hashimoto
9f9248fd28 Ensure all search results are visible in theme list (#4473)
## Changes

- Add a threshold to determine when to reset window position

- Reset window position to show all results from the top when result set
is small

- Maintain scroll position for larger result sets to preserve navigation
context


https://github.com/user-attachments/assets/826a2411-9b31-4adb-b1b4-f55b05aa911d

Resolves https://github.com/ghostty-org/ghostty/discussions/4472
2025-01-04 14:34:35 -08:00
Mitchell Hashimoto
305e5b3533 fix typo: CSI header (#4565)
Fixes a typo in the keybindings documentation comments.
Originally opened on the website repo at
https://github.com/ghostty-org/website/pull/259
2025-01-04 14:27:23 -08:00
Mitchell Hashimoto
32c4a9d65e macOS: Input Improvements (#4591)
Sorry for the vague title. This PR addresses multiple issues:

1. Fixes #4540 
2. #4522 is fixed for macOS only
3. Fixes #4590 
4. Fixes an untracked issue where `command+key` events will not send
release events for Kitty keyboard protocol, something I only noticed
while working on this.

There are multiple components to this PR.

## Part 1: `App/Surface.keyEventIsBinding`

This new API (also available in libghostty as
`ghostty_surface_key_is_binding`) returns a boolean true if the given
key event would match a binding trigger if it was the next key event
sent. It does not process the binding now.

This can be used by event handlers that intercept key events to
determine if it should send the event to Ghostty. This helps resolve
#4590 for us but is also part of all resolved issues.

## Part 2: macOS `performKeyEquivalent` changes

macOS calls `performKeyEquivalent` for any key combination that may
trigger a key equivalent. if this returns `true` then it is handled and
macOS ceases processing the event.

We were already using this to intercept things like `Ctrl+/` which
triggers a context menu in macOS Sequoia. But we now expand this to
intercept all events to check for bindings. This lets us fix #4590.

Additionally, it's been changed to special case `cmd+period`. I'm sure
more need to be added.

## Part 3: NSEvent local listener for command keyUp events

macOS simply doesn't send `keyUp` events for key events with command
pressed. The only way to work around this is to register an `NSEvent`
local listener. We now do this. This fixes the untracked issue noted
above.
2025-01-04 14:22:44 -08:00
Mitchell Hashimoto
40bdea7335 macos: handle overridden system bindings with no focused window 2025-01-04 14:07:47 -08:00
Mitchell Hashimoto
1bcfff3b79 macos: manual send keyUp event for command key 2025-01-04 14:02:16 -08:00
Mitchell Hashimoto
3e89c4c2f4 Key events return boolean if handled 2025-01-04 13:36:40 -08:00
Mitchell Hashimoto
4d103ca16d core: add keyEventIsBinding
This API can be used to determine if the next key event, if given as-is,
would result in a key binding being triggered.
2025-01-04 12:45:15 -08:00
Kiril Angov
2dc518d8b0 Improve the documentation for move_tab keybind action 2025-01-04 12:57:38 -05:00
Mitchell Hashimoto
6b30736776 Move app quit to apprt action
This changes quit signaling from a boolean return from core app `tick()`
to an apprt action. This simplifies the API and conceptually makes more
sense to me now.

This wasn't done just for that; this change was also needed so that
macOS can quit cleanly while fixing #4540 since we may no longer trigger
menu items. I wanted to split this out into a separate commit/PR because
it adds complexity making the diff harder to read.
2025-01-04 07:22:28 -08:00
Damien Mehala
d3334ecb06 [3/12] parse ConEmu OSC9;3 2025-01-04 16:19:19 +01:00
Mitchell Hashimoto
e8811ac6fb Move app quit to apprt action
This changes quit signaling from a boolean return from core app `tick()`
to an apprt action. This simplifies the API and conceptually makes more
sense to me now.

This wasn't done just for that; this change was also needed so that
macOS can quit cleanly while fixing #4540 since we may no longer trigger
menu items. I wanted to split this out into a separate commit/PR because
it adds complexity making the diff harder to read.
2025-01-04 07:18:53 -08:00
Alexandre Antonio Juca
0599f73fac chore: use KiB notation for representing memory size 2025-01-04 09:02:25 +01:00
dkmar
69e4428d80 fix typo: CSI header 2025-01-03 23:34:39 -08:00
Alexandre Antonio Juca
f14371e909 Merge branch 'main' of github.com:AlexJuca/ghostty into feature/display-memory-size-in-bytes-and-kb 2025-01-03 23:37:34 +01:00
Alexandre Antonio Juca
78cdc7d0de Merge branch 'main' of https://github.com/AlexJuca/ghostty into feature/display-memory-size-in-bytes-and-kb 2025-01-03 23:34:52 +01:00
Mitchell Hashimoto
fa30a04f2a Docs: update goto_split documentation (#4536)
In #4388, documentation was added for goto_split but in #3427 this
documentation was made outdated but not updated. This makes the
documentation up to date and brings the ordering in line with new_split
2025-01-03 12:54:57 -08:00
Mitchell Hashimoto
2f6e7d6ecd gtk: add class names to the rest of the windows (#4533)
This sets up for theming the other windows in the future.
2025-01-03 12:51:13 -08:00
Caleb Norton
2610f5b4e2 Docs: update goto_split documentation
In #4388, documentation was added for goto_split but in #3427 this
documentation was made outdated but not updated. This makes the
documentation up to date and brings the ordering in line with new_split
2025-01-03 14:32:39 -06:00
Jeffrey C. Ollie
063868b311 gtk: add class names to the rest of the windows 2025-01-03 14:08:00 -06:00
Qwerasd
25a112469c font(coretext): add config to adjust strength of font-thicken.
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-03 14:19:19 -05:00
Mitchell Hashimoto
ab9b14215c input: legacy encoding falls back to mapping of logical key for ctrlseq (#4528)
Fixes #4518

If our UTF8 encoding is not recognized, we fall back to the ASCII
mapping of the logical key for the control sequence. This allows
cyrillic control characters to work.

I also verified that non-cyrllic (US) and alternate layouts (Dvorak)
work as expected still.
2025-01-03 11:09:09 -08:00
Mitchell Hashimoto
1bf8b262ea os: directory functions should prefer cached home if available (#4527)
This fixes tests as well if env vars are set.
2025-01-03 11:01:03 -08:00
Peter Cock
6459e5c8ca Fixing a few typos in the source code comments (#4529) 2025-01-03 11:00:45 -08:00
Mitchell Hashimoto
45d005ce65 input: legacy encoding falls back to mapping of logical key for ctrlseq
Fixes #4518

If our UTF8 encoding is not recognized, we fall back to the ASCII
mapping of the logical key for the control sequence. This allows
cyrillic control characters to work.

I also verified that non-cyrllic (US) and alternate layouts (Dvorak)
work as expected still.
2025-01-03 10:53:54 -08:00
Mitchell Hashimoto
e03c428728 os: directory functions should prefer cached home if available
This fixes tests as well if env vars are set.
2025-01-03 10:39:03 -08:00
Alexandre Antonio Juca
6b4e6d2fa5 feat: Display memory usage and and limit in both bytes and Kb for improved readability 2025-01-03 12:48:52 +01:00
Damien Mehala
8a3aae2caf code review
- Change show_message_box from struct to string.
- Add tests:
  - Blank message
  - Spaces only message
  - No trailing semicolon OSC 9;2
2025-01-03 12:01:50 +01:00
Bryan Lee
9fa404c390 Ensure all search results are visible in theme list
When searching in the theme list (e.g., searching for "Snazzy"), some matching themes might be hidden due to incorrect window position handling.

This fix ensures all matching themes are visible by adjusting the window position logic.
2025-01-03 16:24:53 +08:00
Mitchell Hashimoto
e2f9eb6a6f keybindings: improve sort to include key value 1,2,3,4... (#4399)
Current sort used by `+list-keybinds` doesn't include the value of the
key:
```
ctrl  + shift + v                      paste_from_clipboard
ctrl  + shift + a                      select_all
...
ctrl  + shift + q                      quit
ctrl  + shift + n                      new_window
...
alt   + five                           goto_tab:5
alt   + eight                          goto_tab:8
...
alt   + six                            goto_tab:6
alt   + seven                          goto_tab:7
```
adding the key value improves the sort order

```
ctrl  + shift + a                      select_all
ctrl  + shift + c                      copy_to_clipboard
...
ctrl  + shift + n                      new_window
ctrl  + shift + o                      new_split:right
ctrl  + shift + q                      quit
...
alt   + one                            goto_tab:1
alt   + two                            goto_tab:2
alt   + three                          goto_tab:3
...
alt   + eight                          goto_tab:8
alt   + nine                           last_tab
alt   + f4                             close_window
2025-01-02 19:43:19 -08:00
Mitchell Hashimoto
f2d255d423 Correct typos and update typos.toml (#4456)
I noticed that the version of `typos` in nixpkgs is still at
[1.28.4](https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/ty/typos/package.nix#L12)
(as of [2 weeks
ago](https://github.com/crate-ci/typos/releases/tag/v1.28.4)), while the
latest version is
[1.29.3](https://github.com/crate-ci/typos/releases/tag/v1.29.3). For
tools like this where the dictionary is constantly being updated, we
might want to consider using `uses: crate-ci/typos@master` directly in
our CI workflow instead of the version from nixpkgs.

I understand the current setup using `devShell.nix` helps maintain
consistency between local development and CI environments. However, I
found some typos that can be detected by the new version of typos, but
were missed by the old version of typos on nixpkgs.

<img width="690" alt="image"
src="https://github.com/user-attachments/assets/d9e7f45a-8980-4acd-a093-a1e45521a28d"
/>

## Proposal:

1. Use `crate-ci/typos` action in CI while keeping nixpkgs version for
local development (catching more typos in CI but introducing some
inconsistency)
2025-01-02 19:29:26 -08:00
Mitchell Hashimoto
bec46fc2fc Revert "gtk: equalize on double clicking the split handle (#3557)"
This reverts commit 09470ede55c26e042a3c9805a8175e972b7cc89b, reversing
changes made to 6139cb00cf6a50df2d47989dfb91b97286dd7879.
2025-01-02 19:17:34 -08:00
Mitchell Hashimoto
bc5cbf3e87 kittygfx: Ensure temporary files are named per spec (#4451)
Temporary files used with Kitty graphics must have
"tty-graphics-protocol" somewhere in their full path.


https://sw.kovidgoyal.net/kitty/graphics-protocol/#the-transmission-medium
2025-01-02 19:13:19 -08:00
Bryan Lee
ac524b6c34 Correct typos and update typos.toml 2025-01-03 09:55:21 +08:00
David Leadbeater
4cb2fd4f79 Add negative test for temporary filename and fix other tests 2025-01-03 12:09:49 +11:00
Jeffrey C. Ollie
3c93f00d04 cli: only print out DE when using the GTK apprt 2025-01-02 18:29:33 -06:00