Skip to content

gtk: fix quick terminal breaking when manually toggled off while auto-hide is enabled - #12471

Merged
mitchellh merged 1 commit into
ghostty-org:mainfrom
dkinzler:fix/11679-gtk-quick-terminal
Apr 27, 2026
Merged

mitchellh merged 1 commit into
ghostty-org:mainfrom
dkinzler:fix/11679-gtk-quick-terminal

Conversation

@dkinzler

Copy link
Copy Markdown
Contributor

Fixes quick terminal breaking when auto-hide is enabled and quick terminal is manually toggled off (#11679).

quick-terminal-autohide is implemented by the Window.propIsActive function in apprt/gtk/class/window.zig which calls Window.toggleVisibility when the quick terminal window becomes inactive (loses focus). However Window.propIsActive is also triggered when you manually hide the quick terminal because hiding it causes the window to become inactive. Normally that should just toggle the quick terminal off and immediately back on, but there is also a re-entrancy issue. Manually toggling off the terminal causes the Application.toggleQuickTerminal (in apprt/gtk/class/application.zig) to run which sets off the call chain Window.toggleVisibility -> gtk_widget_set_visible -> ... GTK signal/event handling ... -> Window.propIsActive -> Window.toggleVisibility -> gtk_widget_set_visible.
The nested calls to gtk_widget_set_visible cause the GTK window state to become corrupted. The window is marked visible, but is not actually visible or just shows a placeholder. What exactly happens depends on the compositor and how it handles moving window focus.

Reproduced the bug on KDE and hyprland and verified the fix on both.

Changes

apprt/gtk/class/window.zig: added check to Window.propIsActive to only toggle quick-terminal if it is inactive and visible.

AI Disclosure

Found the bug without AI using "printf debugging" then traced it through GTK with valgrind. Used GPT5.4 in setting up valgrind and researching how signals/events move through GTK internally.

@dkinzler
dkinzler requested a review from a team as a code owner April 26, 2026 09:10
@ghostty-bot ghostty-bot Bot added the gtk Issues exclusive to GTK which are not OS-specific label Apr 26, 2026
@mitchellh mitchellh added this to the 1.3.2 milestone Apr 27, 2026
@mitchellh
mitchellh merged commit 0b56ae2 into ghostty-org:main Apr 27, 2026
91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gtk Issues exclusive to GTK which are not OS-specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants