9103 Commits

Author SHA1 Message Date
Jeffrey C. Ollie
06a57842af gtk: add config option to control GSK_RENDERER env var 2025-01-10 15:21:24 -06:00
Jeffrey C. Ollie
13e96c7ec8 gtk: add config option to disable GTK OpenGL debug logging 2025-01-10 15:21:21 -06:00
Mitchell Hashimoto
c4ece2a141 GTK: refactor headerbar into separate Adwaita & GTK structs (#4850)
There's one behavioral change here. Before this patch, if
`gtk-titlebar=false` we _never_ created a headerbar. This explicitly
contradicted the comments in the source, and the documentation for
`gtk-titlebar` imply that if a window starts out without a titlebar it
can be brought back later with the `toggle_window_decorations` keybind
action.

After this patch, a headerbar is always created, but if
`gtk-titlebar=false` or `window-decoration=false` it's immediately
hidden.

I'm not sure how this interacts with the current SSD/CSD detection that
seems to happen when running Ghostty on non-Gnome DEs so it'll be
important to get #4724 merged (plus any follow ups) to enable more
explicit control of SSD/CSD.
2025-01-10 13:14:39 -08:00
Mitchell Hashimoto
96b3db0b8c docs: update copy-on-select documentation (#4909)
As per discussion in
https://github.com/ghostty-org/ghostty/discussions/4898, this updates
the docs for `copy-on-select` to correct the middle-click paste behavior
change as per https://github.com/ghostty-org/ghostty/pull/4733. I also
opted to remove the multiple "if supported by OS/ for supported systems"
statements since it's supported everywhere now, AFAIK.
2025-01-10 13:13:12 -08:00
Mitchell Hashimoto
e475560af0 vim: update configuration to include theme files (#4893)
Extends vim validation and file type detection to theme files

cc @gpanders @beaumccartney (as you were involved on the previous vim
PR)
2025-01-10 13:12:25 -08:00
Mitchell Hashimoto
61a6e670eb ci: add required checks jobs (#4916)
This is a hack to make it easier for our GitHub branching rules to
require a single check to pass before merging. This lets us describe the
required checks in code rather than via the GH UI.
2025-01-10 13:12:00 -08:00
Mitchell Hashimoto
2fb0d99f00 ci: add required checks jobs
This is a hack to make it easier for our GitHub branching rules to
require a single check to pass before merging. This lets us describe the
required checks in code rather than via the GH UI.
2025-01-10 12:57:41 -08:00
Mitchell Hashimoto
8b8c7ecf1d gtk: unify Wayland and X11 platforms, implement background blur for KDE X11 (#4723)
Part of #4626. Please let me know if the architecture looks alright —
I'm fairly convinced that I'm being unorthodox here.
2025-01-10 12:21:03 -08:00
Mitchell Hashimoto
d26c114b5d apprt/gtk: make sure noop winproto never initializes 2025-01-10 12:10:59 -08:00
Jeffrey C. Ollie
010f4d167d GTK: refactor headerbar into separate Adwaita & GTK structs 2025-01-10 13:46:29 -06:00
Mitchell Hashimoto
799f5b8239 Fix wayland-scanner/protocols packaging dependency (#4910)
By updating zig-wayland:
https://codeberg.org/ifreund/zig-wayland/issues/67
2025-01-10 10:10:42 -08:00
Mitchell Hashimoto
6e411d60f2 Fix wayland-scanner/protocols packaging dependency
By updating zig-wayland:
https://codeberg.org/ifreund/zig-wayland/issues/67
2025-01-10 09:57:29 -08:00
Mitchell Hashimoto
2f81c360bd ci: typos 2025-01-10 09:42:41 -08:00
Mitchell Hashimoto
be0370cb0e ci: test gtk-wayland in the GTK matrix 2025-01-10 09:41:14 -08:00
Mitchell Hashimoto
ed81b62ec2 apprt/gtk: winproto
Rename "protocol" to "winproto".
2025-01-10 09:39:34 -08:00
Onno Siemens
19cfd99439 docs: update copy-on-select documentation 2025-01-10 18:11:57 +01:00
Anund
c03828e032 vim: work with theme config files 2025-01-11 02:45:47 +11:00
Leah Amelia Chen
405a897230 gtk(x11): implement background blur for KDE/KWin on X11 2025-01-09 14:57:02 -08:00
Leah Amelia Chen
03fee2ac33 gtk: unify Wayland and X11 platforms 2025-01-09 14:57:02 -08:00
Mitchell Hashimoto
6ef757a8f8 Revert "termio/exec: fix SIGPIPE crash when reader exits early"
This reverts commit 3e24e96af51fe308705a1f1695e3b9045c54482e.
2025-01-09 12:43:41 -08:00
Mitchell Hashimoto
12ce9f2e3b feat(GTK): show menu in context menu if titlebar is disabled (#4864)
This PR addresses https://github.com/ghostty-org/ghostty/issues/4732.

While @tristan957 suggested alternative approaches, this implementation
provides a straightforward way to make the menu accessible when the
window decoration is disabled. It follows patterns seen in other GTK
apps for handling submenus, though not strictly in the context menu
format truth be told.

If there’s a better way to approach this or further refinements needed,
I’m happy to discuss and iterate. This has been a minor issue I’ve
encountered personally, and I’d like to help improve the experience for
others as well.

Small video of how it looks:


https://github.com/user-attachments/assets/59548fef-f11c-421f-b05b-be81eab6ce06
2025-01-09 07:28:42 -08:00
Ismael Arias
b25c593309 feat(GTK): remove comment 2025-01-09 12:52:35 +01:00
Ismael Arias
ae81edfcbf feat(gtk): show menu in context menu if titlebar is disabled 2025-01-09 12:50:49 +01:00
Mitchell Hashimoto
2d7706ec4f macos: Handle ctrl characters in IME input (#4854)
Fixes:
https://github.com/ghostty-org/ghostty/issues/4634#issuecomment-2573469532

This commit fixes two issues:

1. `libghostty` must not override ctrl+key inputs if we are in a preedit
state. This allows thigs like `ctrl+h` to work properly in an IME.

2. On macOS, when an IME commits text, we strip the control modifier
from the key event we send to libghostty. This is a bit of a hack but
this avoids triggering special ctrl+key handling.
2025-01-08 22:07:15 -08:00
Mitchell Hashimoto
1636ac88fc macos: Handle ctrl characters in IME input
Fixes: https://github.com/ghostty-org/ghostty/issues/4634#issuecomment-2573469532

This commit fixes two issues:

1. `libghostty` must not override ctrl+key inputs if we are in a preedit
   state. This allows thigs like `ctrl+h` to work properly in an IME.

2. On macOS, when an IME commits text, we strip the control modifier
   from the key event we send to libghostty. This is a bit of a hack but
   this avoids triggering special ctrl+key handling.
2025-01-08 21:54:34 -08:00
Mitchell Hashimoto
a7c108a11c macos: improve initial size calculation (#4851)
Fixes #4801

Our size calculation before improperly used a screens frame instead of
its visibleFrame. Additionally, we didn't properly account for origin
needing to move in order to fit the window on the screen.

Apparently, setting a frame height to high crashes AppKit. The width
gets clamped by AppKit but the height does not. Fun!
2025-01-08 21:33:01 -08:00
Mitchell Hashimoto
aafe7deae7 macos: improve initial size calculation
Fixes #4801

Our size calculation before improperly used a screens frame instead of
its visibleFrame. Additionally, we didn't properly account for origin
needing to move in order to fit the window on the screen.

Apparently, setting a frame height to high crashes AppKit. The width
gets clamped by AppKit but the height does not. Fun!
2025-01-08 21:20:58 -08:00
Mitchell Hashimoto
1057fd23be build: update zig-wayland to use new LazyPath API (#4849)
This is a more idiomatic way to handle build paths in Zig 0.13 and
later.
2025-01-08 20:08:32 -08:00
Mitchell Hashimoto
622cc3f9c7 build: update zig-wayland to use new LazyPath API
This is a more idiomatic way to handle build paths in Zig 0.13 and
later.
2025-01-08 19:55:57 -08:00
Mitchell Hashimoto
19ffb0b51f Implement a size-limit function for GTK (#4840)
A "size-limit" function has been implemented for GTK which calls
gtk_widget_set_size_request() to set the minimum widget/window size.
Without
this function, it's left to GTK to set the minimum size which is usually
a lot larger than the documented 10x4 cell minimum size. This doesn't
fix the
issue completely as GTK retains the final say in how small a window can
be
but it gets closer.

Resolves: #4836
2025-01-08 18:49:05 -08:00
Mitchell Hashimoto
08a8bddd38 gtk: clean up context menu creation & refresh (#4834) 2025-01-08 18:48:47 -08:00
Mitchell Hashimoto
8c457fc992 fix: update zig version regex in windows build workflow (#4847)
The [Windows build job in the test workflow was
failing](https://github.com/ghostty-org/ghostty/actions/runs/12679651693/job/35339885415)
because it couldn't extract
the Zig version from _build.zig_. This was caused by a recent refactor
that changed
[how the Zig version is
specified](eb40cce45e (diff-f87bb3596894756629bc39d595fb18d479dc4edf168d93a911cadcb060f10fccR6))
in _build.zig_.
2025-01-08 18:48:38 -08:00
Bryan Lee
37256ec6a2 ci: move version output after variable definition 2025-01-09 10:31:41 +08:00
Bryan Lee
bec690532d ci: update zig version regex in windows build 2025-01-09 10:24:00 +08:00
George Joseph
dac13701e3 Implement a size-limit function for GTK
A "size-limit" function has been implemented for GTK which calls
gtk_widget_set_size_request() to set the minimum widget/window size. Without
this function, it's left to GTK to set the minimum size which is usually
a lot larger than the documented 10x4 cell minimum size.  This doesn't fix the
issue completely as GTK retains the final say in how small a window can be
but it gets closer.

Resolves: #4836
2025-01-08 15:50:18 -07:00
Bryan Lee
5bfb3925ba Add fallback timer for empty window title 2025-01-09 06:30:47 +08:00
Bryan Lee
ea7c54d79d Simplify let binding in TerminalView title logic 2025-01-09 06:30:47 +08:00
Bryan Lee
0651586339 Reduce ghost emoji flash in title bar 2025-01-09 06:30:46 +08:00
Jeffrey C. Ollie
c33629aae5 gtk: clean up context menu creation & refresh 2025-01-08 16:01:31 -06:00
Mitchell Hashimoto
eb40cce45e build: requireZig cleanup 2025-01-08 13:49:54 -08:00
Mitchell Hashimoto
e14bc5b64e Add keybind action copy_url_to_clipboard (#4676)
## Description

This PR implements the `copy_url_to_clipboard` keybind action. This
action allows users to copy URLs directly to the clipboard without
needing to select them first.

### Features

- Works with both regex-matched URLs and OSC8 hyperlinks
- Copies only the URL portion, not the surrounding text
- Respects the `clipboard_trim_trailing_spaces` configuration
- Provides clear error feedback
- Follows the same patterns as other clipboard operations


https://github.com/user-attachments/assets/c9c82e3d-dfc5-4171-b367-d6799305d87f

Resolves https://github.com/ghostty-org/ghostty/issues/4633
2025-01-08 13:35:26 -08:00
Mitchell Hashimoto
90d1023783 correct default keybinding cmd+backspace for macOS (#4249)
This produces the following keybind, which I believe was intended.
> keybind = cmd+backspace=text:\x15

Matches the cmd+left and cmd+right which are a few lines up.

#3679 
#3646
2025-01-08 13:32:08 -08:00
Mitchell Hashimoto
d969a6b6b7 linux: add "Open in Ghostty" shortcut for nautilus (#4816) 2025-01-08 13:26:34 -08:00
Bryan Lee
5213edfa6c Add keybind action copy_url_to_clipboard 2025-01-08 13:22:33 -08:00
Mitchell Hashimoto
ef12d90b74 gtk: implement dropping files and strings (#4211)
This allows dropping files and strings onto Ghostty in the GTK apprt. If
you drop files onto Ghostty it will be pasted as a list of shell-escaped
paths separated by newlines. If you drop a string onto Ghostty it will
paste the string. Normal rules for pasting (bracketed pasts, unsafe
pastes) apply.
2025-01-08 13:12:09 -08:00
Mitchell Hashimoto
6f720a0b11 termio/exec: fix 100% CPU usage after wait-after-command process exits (#4171)
read(2) returning 0 means that the other end of the pipe/pty has been
closed (EOF), so there cannot be any more output to read on the pipe,
and
the io reader thread can just exit.

If exec.wait_after_command=false, the read thread's quit pipe is
immediately written to after the child process dies, so all is well.
However, if wait_after_command=true (which is the case when using
Ghostty
to run a .command/.sh file on macOS), the read thread keeps spinning,
causing persistent 100% CPU usage per exited process.

Fix it by exiting the reader thread on EOF.
2025-01-08 13:10:20 -08:00
Danny Lin
3e24e96af5 termio/exec: fix SIGPIPE crash when reader exits early
If the read thread has already exited, it will have closed the read end
of the quit pipe. Unless SIGPIPE is masked with signal(SIGPIPE, SIG_IGN),
or the macOS-specific fcntl(F_SETNOSIGPIPE), writing to the write end of
a broken pipe kills the writer with SIGPIPE instead of returning -EPIPE
as an error. This causes a crash if the read thread exits before
threadExit.

This was already a possible race condition if read() returns
error.NotOpenForReading or error.InputOutput, but it's now much easier to
trigger due to the recent "termio/exec: fix 100% CPU usage after
wait-after-command process exits" fix.

Fix this by closing the quit pipe instead of writing to it.
2025-01-08 13:06:14 -08:00
Mitchell Hashimoto
542c655348 Add close_tab keybinding action for macOS (#4395)
This PR adds support for a dedicated `close_tab` keybinding action,
allowing users to bind specific keys for closing tabs. The
implementation:

- Adds `close_tab` as a new keybinding action
- Preserves all existing confirmation dialogs for running processes
- Works seamlessly with macOS native tab system

### Testing
- [x] Tested with single tabs
- [x] Tested with multiple tabs
- [x] Tested with running processes (confirmation dialog)
- [x] Tested with splits within tabs

<img width="797" alt="image"
src="https://github.com/user-attachments/assets/8e09eea3-1f71-40a3-a835-76de14013a29"
/>


https://github.com/user-attachments/assets/155210f7-20fe-4a96-8800-6969df214871

Partially resolved #4331
2025-01-08 12:17:27 -08:00
Bryan Lee
140ac93884 Add close_tab keybinding action for macOS
Implement `close_tab` keybinding action to close the current tab and all splits within that tab.
2025-01-08 12:04:40 -08:00
Mitchell Hashimoto
e4033ca4df config: close_tab on macOS should be cmd+opt+w to match iTerm2 2025-01-08 11:47:37 -08:00