Repository navigation
terminal: add visibility reports with GTK suspension tracking - #13494
Merged
Merged
Conversation
tristan957
reviewed
Jul 28, 2026
Member
|
Not as part of this PR, but "someone" should really add documentation regarding all of the modes that we support to the Ghostty website. |
GTK exposes the Wayland xdg_toplevel suspended state when the compositor knows a window is not visible. Ghostty previously only used widget map state, so it could continue rendering a mapped surface on an inactive workspace or behind other windows. Combine the mapped and suspended states for surface occlusion and update all displayed surfaces whenever the toplevel suspension state changes. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019fa965-aa5f-7099-85b4-a9679d2c8bd3
rockorager
force-pushed
the
visibility-reports
branch
from
July 28, 2026 15:49
aaf2bc3 to
5f6a5a4
Compare
tristan957
approved these changes
Jul 28, 2026
tristan957
left a comment
Member
There was a problem hiding this comment.
I am approving the GTK part! I think the motivation for this mode makes a ton of sense. Getting others to buy in is a different story.
Member
Author
I've got feedback from Kovid, dnkl, and rapha (rio) that are supportive of this mode. In my view of the terminal world, that's a pretty healthy agreement :) |
Applications cannot infer whether an unfocused terminal remains visible, so focus reports are insufficient for avoiding expensive rendering while a view is hidden. Implement private mode 2033 and the visibility query/report sequences. Track conservative per-surface visibility, report every effective change while enabled, and always answer explicit queries and mode enables. Keep view visibility across terminal resets because it is owned by the host, not terminal state. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019fa965-aa5f-7099-85b4-a9679d2c8bd3
rockorager
force-pushed
the
visibility-reports
branch
from
July 28, 2026 16:04
5f6a5a4 to
6c8c079
Compare
jcollie
approved these changes
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Applications cannot reliably determine whether an unfocused terminal is still
visible, so focus reports alone are insufficient for avoiding unnecessary
rendering.
This adds terminal visibility reporting by:
CSI ? 998 nvisibility queries andCSI ? 999 ; Ps nresponsesOn GTK 4.12 and newer, surface visibility now combines widget mapping with the
toplevel
suspendedstate. This allows Ghostty to recognize windows hidden onanother workspace or otherwise known by the compositor to be non-visible.
Older GTK versions retain the existing conservative behavior.
Testing
Added coverage for:
AI disclosure
Amp assisted with the implementation, tests, commit messages, and this pull
request description. I reviewed the resulting changes and understand how they
interact with the terminal, termio, surface, and GTK visibility paths.
Implements: #13451
Reference: https://rockorager.dev/misc/visibility-reports/