GTK: add action to show the GTK inspector

The default keybinds for showing the GTK inspector (`ctrl+shift+i` and
`ctrl+shift+d`) don't work reliably in Ghostty due to the way Ghostty
handles input. You can show the GTK inspector by setting the environment
variable `GTK_DEBUG` to `interactive` before starting Ghostty but that's
not always convenient.

This adds a keybind action that will show the GTK inspector. Due to
API limitations toggling the GTK inspector using the keybind action is
impractical because GTK does not provide a convenient API to determine
if the GTK inspector is already showing. Thus we limit ourselves to
strictly showing the GTK inspector. To close the GTK inspector the user
must click the close button on the GTK inspector window. If the GTK
inspector window is already visible but is hidden, calling the keybind
action will not bring the GTK inspector window to the front.
This commit is contained in:
Jeffrey C. Ollie
2025-05-29 15:45:51 -05:00
parent b2f3c7f309
commit d3cb6d0d41
8 changed files with 38 additions and 1 deletions

View File

@@ -298,6 +298,12 @@ fn actionCommands(action: Action.Key) []const Command {
.description = "Toggle the inspector.",
}},
.show_gtk_inspector => comptime &.{.{
.action = .show_gtk_inspector,
.title = "Show the GTK Inspector",
.description = "Show the GTK inspector.",
}},
.open_config => comptime &.{.{
.action = .open_config,
.title = "Open Config",