9172 Commits

Author SHA1 Message Date
Jeffrey C. Ollie
0a26321e9d gtk: add some comments about closing the last tab invaldating self pointer 2025-01-10 19:19:11 -06:00
Jeffrey C. Ollie
16233b16e7 gtk: fix crash due to accessing invalidated pointer to adwaita notebook 2025-01-10 19:12:08 -06:00
Mitchell Hashimoto
da558f2678 fix(gtk): add close confirmation for tabs (#4235)
On the discord this bit of feedback came up from
[here](https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blob;f=misc/terminfo.src;h=ccd4c32099cf740d331eeaa3955f48f177435878;hb=a28a11d84d969cfdc876e158deae7870e8948a24#l8323)
```
8323 # - ghostty has tabs (imitating gnome-terminal); when closing a tab with a
8324 #   running process (e.g., a hung vttest), ghostty does not prompt about the 
8325 #   process to be killed.
```

This PR adds confirmation to the places where tabs are closed directly 

Fixes: https://github.com/ghostty-org/ghostty/issues/4234
2025-01-10 15:45:10 -08:00
Mitchell Hashimoto
00137c4189 apprt/gtk: adw tab view close confirmation 2025-01-10 15:32:32 -08:00
Leigh Oliver
8c1ad59de7 remove unnecessary struct 2025-01-10 15:05:11 -08:00
Leigh Oliver
b7b5b9bbf5 fix(gtk): add close confirmation for tabs 2025-01-10 15:05:11 -08:00
Mitchell Hashimoto
126c0505e2 fix: ensure terminal windows don't part from parent window when toggling visibility (#4789)
As of version 1.0.1 (macOS build) when running the toggle visibility
action a window with tabs is made into multiple windows.

This PR ensures terminal tabs are reconstructed and correctly placed
into its parent window.

# Demo


https://github.com/user-attachments/assets/44f14bca-15a1-4717-ba0a-44f0767feec3


FYI: I will create another PR to ensure the right tab is focused after
the main window is restored.

Solves #4329
2025-01-10 14:52:33 -08:00
Mitchell Hashimoto
200aee9acf macos: rework toggle_visibility to better match iTerm2
Two major changes:

1. Hiding uses `NSApp.hide` which hides all windows, preserves tabs, and
   yields focus to the next app.

2. Unhiding manually tracks and brings forward only the windows we hid.
   Proper focus should be retained.
2025-01-10 14:40:02 -08:00
Alexandre Antonio Juca
61a78efa83 chore: revert on TerminalManager changes 2025-01-10 14:16:47 -08:00
Alexandre Antonio Juca
3a5aecc216 fix: hide windows without calling orderOut API 2025-01-10 14:16:47 -08:00
Alexandre Antonio Juca
4dd9fe5cfd fix: ensure terminal tabs are reconstructed in main window after toggling visibility 2025-01-10 14:16:47 -08:00
Mitchell Hashimoto
d3de3448cc gtk: add config option to disable GTK OpenGL debug logging (#4662)
The only change from default should be that when running a ReleaseFast
binary you won't get OpenGL debugging.
2025-01-10 14:01:13 -08:00
Jeffrey C. Ollie
96e427cd6a gtk: default to opengl debugging only on debug builds 2025-01-10 15:48:20 -06:00
Mitchell Hashimoto
8e52c6d12b Reduce ghost emoji flash in title bar (#4804)
Fixes #4799

This PR attempts to reduce the flash caused by the ghost emoji in the
title bar when opening new windows.

## Changes:

- Initialize `SurfaceView.title` with empty string instead of ghost
emoji

- Simplify title computation logic in `TerminalView`

- Adding a 500ms fallback timer for "👻"

	- Canceling timer if title is set

## Current Status:

While these changes reduce the initial ghost emoji flash, there's still
a brief moment where a folder emoji appears alone in the title bar when
opening a new window. This suggests there might be a race condition or
timing issue with how the title is being set and updated.


https://github.com/user-attachments/assets/3688c9f3-1727-4379-b04d-0bd6ac105728

Would appreciate feedback on the remaining flash issue and suggestions
for further improvements.
2025-01-10 13:46:45 -08:00
Mitchell Hashimoto
b783e12b93 ci: required checks must be named separately (#4919) 2025-01-10 13:45:00 -08:00
Mitchell Hashimoto
f5add68100 ci: required checks must be named separately 2025-01-10 13:31:28 -08:00
Mitchell Hashimoto
4af44c5460 ci: avoid "successful failure" of status check job by inspecting needs (#4918)
Thanks to @ryanec for this tip.
2025-01-10 13:29:50 -08:00
Mitchell Hashimoto
6237377a59 ci: avoid "successful failure" of status check job by inspecting needs
Thanks to @ryanec for this tip.
2025-01-10 13:28:21 -08:00
Jeffrey C. Ollie
cd638588c4 gtk: better method for setting GDK env vars 2025-01-10 15:21:24 -06:00
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