132 Commits

Author SHA1 Message Date
Mitchell Hashimoto
9e73d865fb apprt/gtk: small comments 2024-09-13 20:45:39 -07:00
Jeffrey C. Ollie
5f759a19d1 GTK: Fix clicking on desktop notifications
Currently, clicking on a desktop notification will bring Ghostty
to the foreground, but it won't necessarily bring the right window
to the top and it won't switch tabs or change the focus on splits.

With this patch, clicking on a desktop notification will raise the
correct window, change to the correct tab, and focus on the correct
split that send the original desktop notification.
2024-09-13 13:37:38 -07:00
Paul
ac985937cd apprt/gtk: add theme variant in window-theme
this colours the header bar with the config colour.
2024-09-13 10:06:42 +02:00
Mitchell Hashimoto
4cacea3813 apprt/gtk: inline adwaita checks so comptime disables conditional paths
This fixes building without libadwaita or building with an older version
of libadwaita. This also updates the CI to test this.
2024-09-12 09:34:39 -07:00
Mitchell Hashimoto
2b5d436792 apprt/gtk: log the libadwaita version at startup if we use it 2024-09-11 10:27:35 -07:00
Mitchell Hashimoto
c27f427e02 apprt/gtk: the comptimeEnabled check is redundant 2024-09-11 09:50:37 -07:00
Mitchell Hashimoto
afc95fefe2 apprt/gtk: use adwaita helpers, move out some complicated logic 2024-09-11 09:38:05 -07:00
Mitchell Hashimoto
9409e3072f apprt/gtk: remove usingnamespace 2024-08-16 14:58:04 -07:00
Jeffrey C. Ollie
301826dfff gtk: add resize overlay
This adds a transient overlay that shows the size of the surface
while you are resizing the window or the surfaces.
2024-08-09 22:58:33 -05:00
Paul
c461d58519 gtk: One's complement the opacity of overlay for unfocused splits
The case where the split if fully opaque (`unfocused-split-opacity = 1.0`) should result in the overlay being fully transparent (`opacity: 0.0`).
This would be consistent with how this is implemented in the macos app:

dcc492f19b/macos/Sources/Ghostty/Ghostty.Config.swift (L302)
2024-08-06 09:58:23 +02:00
Mitchell Hashimoto
656c720866 apprt/gtk: can manually expire our quit timer instead of 0 second timer 2024-08-04 19:06:17 -07:00
Jeffrey C. Ollie
4657f30f7f Fix quit-after-last-window-closed=true, quit-after-last-window-closed-delay=null
The case when `quit-after-last-window-closed=true` and
`quit-after-last-window-closed-delay=null` was broken because control
gets stuck inside `g_main_context_iteration` and never returns to our
code. In that case add a 0ms timer that will return control flow from
GLib back to our code so that we can quit.

Fixes #2039
2024-08-04 14:47:58 -05:00
Mitchell Hashimoto
288a1fe549 Merge pull request #2021 from jcollie/background
gtk: allow running in the background
2024-08-03 10:08:45 -07:00
Mitchell Hashimoto
224f2d0491 apprt/gtk: use tagged union for quit timer 2024-08-03 10:05:31 -07:00
Jeffrey C. Ollie
3a4b236e6d re-use code to cancel old timer 2024-08-02 10:24:17 -05:00
Jeffrey C. Ollie
38e9847bd2 fix typo 2024-08-01 19:48:00 -05:00
Mitchell Hashimoto
99b1b6305f reset only 2024-08-01 14:54:39 -07:00
Jeffrey C. Ollie
ec0f90d1b6 Improve quit timers.
Instead of "polling" to see if a quit timer has expired, start a single
timer that expires after the confiugred delay when no more surfaces are
open. That timer can be cancelled if necessary.
2024-08-01 14:49:02 -05:00
Jeffrey C. Ollie
3d6ca14dc6 make quit-after-last-window-closed-delay an optional 2024-08-01 10:51:08 -05:00
Jeffrey C. Ollie
143e503d43 gtk: allow running in the background
This patch fixes #2010 by implementing `quit-after-last-window-closed`
for the GTK apprt. It also adds the ability for the GTK apprt to exit
after a delay once all surfaces have been closed and adds the ability to
start Ghostty without opening an initial window.
2024-08-01 01:25:17 -05:00
Jeffrey C. Ollie
67efe7fe42 Additions to GTK context menu
Add "New Window", "New Tab", and "Reset" to GTK context menu.
2024-07-29 12:08:29 -05:00
karei
6e5bc62726 apprt/gtk: disable copy in context menu while without selection
Left a FIXME where the "Copy" button action is disabled.

Though very hackish this was the best way I found to do this currently.
Disable sensitivity on the button didn't do anything and trying to
remove the button altogether like on macOS, causes the menu to become
really buggy. Either by the context menu turning into a scrollable list
or by it becoming really janky and showing the user pre-update UI.
2024-07-21 11:10:26 +03:00
karei
57db35036e apprt/gtk: implement context menu
Implements context menu for GTK with:
- copy
- paste
- split right
- split down
- terminal inspector
2024-07-21 11:10:21 +03:00
karei
50c562bb47 gtk: fix terminal inspector menu button 2024-07-16 15:17:26 +03:00
Tim Culverhouse
11c2ae1007 gtk: use GtkDrawingArea to dim unfocused split
Refactor the GTK unfocused split code to use a GtkDrawingArea widget to
dim the unfocused split. The GtkDrawingArea is added to the overlay and
a CSS style is used to give it a background color and opacity. This
aligns with the macOS design of drawing on top of the surface. In GTK,
we don't need to actually draw a rectangle because we can apply CSS
directly to the widget.
2024-07-11 08:28:47 -05:00
Tim Culverhouse
f04fe01ac6 gtk: improve readability of runtime css fmt 2024-07-10 14:17:58 -05:00
Tim Culverhouse
d1d3de758c gtk: prevent CSS collision on notebook stack
Add a class to the GtkNotebook which holds our tabs so we can more
precisely set the background color of just this `stack`. A collision was
occurring with the menu widgets, which are also a `stack`.
2024-07-10 13:56:03 -05:00
Tim Culverhouse
6c40cd963d gtk: implement unfocused-split opacity and fill
For a long time, us GTK users have been subject to lesser UX by not
knowing which split was focused. Improve the GTK UX by implementing both
unfocused-split-opacity and unfocused-split-fill. This is implemented by
setting the background-color of the notebook stack, and conditionally
applying a new css class "unfocused-split" to the unfocused split.
2024-07-10 12:56:09 -05:00
Severus
49d10fb661 Fix issue 1667
When GTK 4.14 released, it used ngl by default with GSK_RENDERER. It
leads to destroy VAO state when we closed tab or detach tab. It handles
it incorrectly with opengl's engine.

This is a fix for that issue.
2024-06-28 23:35:55 +07:00
Mitchell Hashimoto
3b41b89c23 apprt/gtk: config to hard fail on cgroup init 2024-06-05 09:47:48 -07:00
Mitchell Hashimoto
ad5d44af10 config: control cgroup isolation 2024-06-05 09:43:57 -07:00
Mitchell Hashimoto
1285b4f243 apprt/gtk: store transient cgroup 2024-06-04 21:10:42 -07:00
Mitchell Hashimoto
409c958b7e apprt/gtk: cgroup initialization 2024-06-04 18:59:44 -07:00
Jeffrey C. Ollie
aa9813bc79 Add split right & split down menu entries for the GTK apprt.
Inspired by #1752
2024-05-11 11:48:11 -05:00
Mitchell Hashimoto
e81f525101 apprt/gtk: set GDK_DEBUG 2024-05-08 21:04:50 -07:00
Mitchell Hashimoto
b6f5970264 minor style changes 2024-03-28 14:45:44 -07:00
Jeffrey C. Ollie
f943a4cf87 GTK: Add compiled-in GTK resources and use them for icons.
Use glib-compile-resources to compile CSS style sheets and icons into
the Ghostty GTK binary. Makes for simpler access to icons and sets
things up for customizing the look of Ghostty with CSS in the future.
The CSS style sheets are blank for now so there will be no visual
changes.
2024-03-27 16:47:26 -05:00
Mitchell Hashimoto
d315223423 apprt/gtk: small stylistic edits 2024-02-02 20:00:10 -08:00
Jeffrey C. Ollie
0938835f87 Implement mode 2031 and DSR 996 for GTK 2024-02-02 21:10:58 -06:00
Mitchell Hashimoto
e5400bad06 config: add window-theme = auto for automatic choosing based on bg color 2024-02-01 20:49:28 -08:00
Gregory Anders
d059c57440 gtk: use modifier state from GTK key event on X11
On X11 gdk_device_get_modifier_state does not correctly return the
modifier state, while the modifier state passed to the key callback
does. On Wayland, the situation is exactly reversed.

Therefore on X11 we use the mods provided by the key callback and on
Wayland we continue to get the modifier state from the device.

`App.modifier_state_from_xkb` is removed since we can lift the
conditional out of the function call (we would need to make a second,
redundant check for the presence of `x11_xkb` otherwise).
2024-01-10 16:26:53 -06:00
Jeffrey C. Ollie
698954031a Add 'Open Config' menu to the GTK runtime and synchronize config-related keybindings across platforms. 2024-01-04 23:30:22 -06:00
Mitchell Hashimoto
732063375a apprt/gtk: stylistic changes 2024-01-01 08:34:19 -08:00
Chris Marchesi
d235554606 apprt/gtk: Move Xkb state to App, remove un-needed fields, style changes 2023-12-31 12:10:25 -08:00
Chris Marchesi
fc4fdbb643 apprt/gtk: ensure modifier state matches current keypress under X11
This fixes an issue in that when running under X11, when a modifier key
is pressed, the modifier state will "lag" behind what should be current.
This is due to how X11 sends modifiers in events, i.e. it sends the
state from right before the key press, and does not include the effects
of the key press itself.

This is corrected by checking the X event queue directly for a pending
XkbStateNotify event (we mask this on modifiers), and setting the
modifiers off of that if we find one. If not, we fall back to the GDK
call.
2023-12-30 22:58:33 -08:00
Mitchell Hashimoto
e43919cb9e apprt/gtk: stylistic changes to adwaita init 2023-12-29 09:10:49 -08:00
Tristan Partin
41aa9ac2ff Use adw_application_new() instead of adw_init()
This will enable further libadwaita improvements in the future, but will
have no effect today.
2023-12-28 21:50:56 -06:00
Mitchell Hashimoto
2c311ab369 apprt/gtk: hook up open config 2023-12-18 08:04:24 -08:00
Mitchell Hashimoto
b021d76edf core: quit-after-last-window-closed works properly with "exit"
Fixes #1085

This moves the logic of exiting when there are no surfaces left fully to
apprt and away from the core.
2023-12-13 16:35:14 -08:00
Chris Marchesi
1832401e0e gtk: make sure WM_CLASS is being set on X11
This ensures that WM_CLASS is being set on X11, looks like this was
missed in #816 (not 100% sure if it always needs to be set in GDK or if
it's a side effect of us not using g_application_run).

This also adds the "x11-instance-name" config attribute to control the
instance name, which defaults to "ghostty" (or "ghostty-debug" on debug
builds).
2023-11-30 20:26:12 -08:00