Commit Graph
122 Commits
Author SHA1 Message Date
Timon de Groot 37d297c03c gtk/portal: General improvements
- Token is formatted without allocation
- Reusable function for formatToken
- Tests in portal.zig are actuall included now
2026-03-22 21:09:38 +01:00
Jeffrey C. Ollie 1342eb5944 gtk: revamp cgroup/transient scope handling
This changes the way Ghostty assigns itself and subprocesses to
cgroups and how resource controls are applied.

* Ghostty itself no longer modifies it's own cgroup or moves itself
to a transient scope. To modify the main Ghostty process' resource
controls ensure that you're launching Ghostty with a systemd unit and
use the standard systemd methods for overriding and applying changes
to systemd units.

* If configured (on by default), the process used to run your command
will be moved to a transient systemd scope after it is forked from
Ghostty but before the user's command is executed. Resource controls
will be applied to the transient scope at this time. Changes to
the `linux-cgroup*` configuration entries will not alter existing
commands. If changes are made to the `linux-cgroup*` configuration
entries commands will need to be relaunched. Resource limits can also
be modified after launch outside of Ghostty using systemd tooling. The
transient scope name can be shown by running `systemctl --user whoami`
in a shell running inside Ghostty.

Fixes #2084.
Related to #6669
2026-02-17 12:54:26 -06:00
Mitchell Hashimoto a1ee2f0764 apprt/gtk: store key sequences/tables in surface state 2025-12-23 09:26:53 -08:00
Mitchell Hashimoto dbfc3eb679 Remove unused imports 2025-11-27 13:37:53 -08:00
Leorize cf0557a093 gtk: restore flatpak-aware resource directory support
This was not ported to gtk-ng before old runtime was removed, breaking
shell integration on Flatpak.
2025-09-21 02:11:41 -05:00
Leah Amelia Chen 93debc439c gtk: the Future is Now 2025-09-05 10:10:52 +02:00
Leah Amelia Chen ac52af27d3 gtk: nuke the legacy apprt from orbit
We don't really have any large outstanding regressions on -ng to warrant
keeping this alive anymore. ¡Adiós!
2025-09-05 00:21:41 +02:00
Leorize 1688f2576c core, gtk: implement host resources dir for Flatpak
Introduces host resources directory as a new concept: A directory
containing application resources that can only be accessed from the host
operating system. This is significant for sandboxed application runtimes
like Flatpak where shells spawned on the host should have access to
application resources to enable integrations.

Alongside this, apprt is now allowed to override the resources lookup
logic.
2025-06-24 07:35:28 -04:00
Mitchell Hashimoto a60f9eb9e6 apprt/gtk: empty inspector window 2023-10-24 15:27:13 -07:00
Mitchell Hashimoto dcf615022e apprt/gtk: key file for logic related to keys 2023-09-18 14:27:05 -07:00
Mitchell Hashimoto d5036e78f4 apprt/gtk: refactor into separate files 2023-09-16 08:28:49 -07:00
Mitchell Hashimoto 120588fb62 apprt/gtk: show warning when running debug version 2023-09-15 15:57:51 -07:00
Tim Culverhouse de5c416341 gtk: handle all close-requests
When compiling in any Release mode, the default gtk close-request
handler does not properly fire. We only rely on the default handler if
we aren't confirming the close. Replace the default handler with our own
in all cases (and just destroy the window if we don't need
confirmation).

Fixes #458
2023-09-15 04:31:50 -05:00
Mitchell Hashimoto 54f58d9cd2 apprt/gtk: implement hide cursor 2023-09-14 19:45:20 -07:00
Mitchell Hashimoto 62ae59cd97 apprt/gtk: apply GDK scale factor to mouse coordinates
Fixes #452
2023-09-14 12:26:36 -07:00
Mitchell Hashimoto 01cb1ad90e apprt/gtk: cursor state should be on surface 2023-09-14 11:22:54 -07:00
Thorsten Ball d96d60445a Fix compilation issues with GTK cursor support 2023-09-14 20:19:53 +02:00
Mitchell Hashimoto cb2931cb27 rename cursor shape to mouse shape for OSC 22 2023-09-14 11:12:17 -07:00
Mitchell Hashimoto 674575e598 apprt/gtk: support set cursor shape 2023-09-14 10:55:05 -07:00
Mitchell Hashimoto 678bd0de0c core: surface should not use app mailbox
The surface runs on the same thread as the app so if we use the app
mailbox then we risk filling the queue before it can drain. The surface
should use the app directly.

This commit just changes all the calls to use the app directly. We may
also want to coalesce certain changes to avoid too much CPU but I defer
that to a future change.
2023-09-13 08:34:09 -07:00
Mitchell Hashimoto fc90a4a052 apprt/gtk: do not ask for confirm window close if all surfaces idle 2023-09-11 15:53:20 -07:00
Mitchell Hashimoto 868b66ce74 apprt/gtk: integrate app needsConfirmQuit 2023-09-11 15:47:37 -07:00
Mitchell Hashimoto 9be46fa80a apprt/gtk: log configuration errors 2023-09-11 09:18:03 -07:00
Thorsten Ball cac5b00d94 gtk: add gtk-single-instance setting to allow disabling of it
This is based on our conversation on Discord and adds a setting for GTK
that allows disabling the GTK single-instance mode.

If this is off, it's possible to start multiple applications from the
same release binary.

Tested like this:

```
$ zig build -Dapp-runtime=gtk -Doptimize=ReleaseFast && ./zig-out/bin/ghostty --gtk-single-instance=false

[... starts new application ...]
```

and

```
$ zig build -Dapp-runtime=gtk -Doptimize=ReleaseFast && ./zig-out/bin/ghostty --gtk-single-instance=true
info: ghostty version=0.1.0-main+42a22893
info: runtime=apprt.Runtime.gtk
info: font_backend=font.main.Backend.fontconfig_freetype
info: dependency harfbuzz=8.0.0
info: dependency fontconfig=21400
info: renderer=renderer.OpenGL
info: libxev backend=main.Backend.io_uring
info(os): LANG is not valid according to libc, will use en_US.UTF-8
info: reading configuration file path=/home/mrnugget/.config/ghostty/config
info(config): default shell source=env value=/usr/bin/zsh

(process:49045): GLib-GIO-WARNING **: 13:55:56.116: Your application did not unregister from D-Bus before destruction. Consider using g_application_run().

[exits]
```
2023-09-05 13:59:07 +02:00
Thorsten Ball a1a48eb3f0 gtk: allow hiding window decoration in configuration
This is part of #319 by fixing it for GTK and introducing the
configuration option.

This adds `window-decoration = false` as a possible configuration
option. If set to `false`, then no window decorations are used.
2023-09-03 21:27:21 +02:00
Will Pragnell 86122624e0 macos: add visible-menu non-native-fullscreen option 2023-09-01 21:45:45 -07:00
Seth Rider c56d07c36f use Gtk.Notebook::switch-page callback for setting window title 2023-08-28 07:26:30 -07:00
Seth Rider fc774cf21a Set gtk window title on change and tab swap (by key command) 2023-08-26 21:25:54 +01:00
Mitchell Hashimoto fe0e1f5ee8 input: key must provide unshifted codepoint 2023-08-17 09:40:32 -07:00
Mitchell Hashimoto 33bef28850 rename key2callback to keycallback 2023-08-16 13:40:57 -07:00
Mitchell Hashimoto 4e8f5d3997 remove charCallback/keyCallback 2023-08-16 13:39:44 -07:00
Mitchell Hashimoto 896d0e8fcf apprt/gtk: only use key2callback 2023-08-16 13:02:31 -07:00
Mitchell Hashimoto 83ba2b9825 apprt/gtk: clean up keyval_unicode usage 2023-08-16 12:51:00 -07:00
Mitchell Hashimoto 1a918bc64b apprt/gtk: call new key2callback using the all-in-one key event 2023-08-16 12:48:48 -07:00
Mitchell Hashimoto e74a173704 apprt/gtk: translate keyval if there is no utf8
This is the same fix as #287 but for GTK.
2023-08-16 12:47:51 -07:00
Mitchell Hashimoto 49a9d626ec apprt/gtk: convert keyval to unicode if input method doesn't process
See comment for details.
2023-08-13 16:27:46 -07:00
Mitchell Hashimoto 5e2fa50d0b macos-option-as-alt config, handle alt-prefix for charCallback 2023-08-13 14:55:31 -07:00
Mitchell Hashimoto 81995fc078 apprt/gtk: inherit font size on new windows and tabs 2023-08-13 12:15:42 -07:00
Mitchell Hashimoto 619d2ade3e only initialize font discovery mechanism once, cache on App
Fontconfig in particular appears unsafe to initialize multiple times.

Font discovery is a singleton object in an application and only ever
accessed from the main thread so we can work around this by only
initializing and caching the font discovery mechanism exactly once on
the app singleton.
2023-08-13 08:01:33 -07:00
Mitchell Hashimoto 55778a049b apprt/gtk, opengl: render preedit 2023-08-11 12:37:27 -07:00
Mitchell Hashimoto ce4eb2112c core: get rid of ignore_char, apprt must handle this now 2023-08-11 12:02:01 -07:00
Mitchell Hashimoto 38477ed547 apprt/gtk: use manual translation, handle dead key states 2023-08-11 12:02:01 -07:00
Mitchell Hashimoto 4fe739cae0 core: note when keyCallback processed the input 2023-08-11 12:02:00 -07:00
Mitchell Hashimoto f012b908b7 apprt/gtk: use glfw for reading primary clipboard (see comment) 2023-08-09 14:17:03 -07:00
Mitchell Hashimoto 347c60d9bd selection copies to the selection clipboard 2023-08-09 14:00:48 -07:00
Mitchell Hashimoto f3996ff0f8 apprt: primary clipboard awareness (selection clipboard) 2023-08-09 13:41:22 -07:00
moderation b33b2bb6a4 gtk: apply background opacity
Signed-off-by: moderation <michael@sooper.org>
2023-08-09 12:03:05 -07:00
Thorsten Ball 147d5b0f3e gtk: fix arrow-up stealing focus
This fixes #253 -- with essentially a single line! Just took me a while
to find out where to add this line.

Turns out we already solved this problem for `<Tab>` so now we do the
same thing for `<Up>`: we tell the `GtkApplication` we handled the event
so it doesn't propagate any further.
2023-08-09 20:11:03 +02:00
Mitchell Hashimoto e93a6eb2e4 apprt/gtk: set icon name 2023-08-08 09:44:11 -07:00
Mitchell Hashimoto 6b45d931c3 plumb through the resources dir to termio 2023-08-08 09:29:38 -07:00