Skip to content

macos: fix quick terminal restoring stale size after display reconnect - #13250

Merged
mitchellh merged 1 commit into
ghostty-org:mainfrom
quinnypig:fix/quick-terminal-stale-frame-on-display-change
Jul 8, 2026
Merged

mitchellh merged 1 commit into
ghostty-org:mainfrom
quinnypig:fix/quick-terminal-stale-frame-on-display-change

Conversation

@quinnypig

Copy link
Copy Markdown
Contributor

"Why is my quick terminal not taking up the entire top of my docked Mac screen after I reconnect?" Boy howdy are you in the right PR.

It turns out that the quick terminal caches its last-closed window frame per display so it can restore the user's size when reopened. The cache entry was considered valid whenever the current screen was the same size or larger than when the frame was saved ("persist when screens grow"). This has led to a pattern that was simply maddening. To wit: that rule breaks across display changes.

When an external display is disconnected and later reconnected at a different resolution (common after traveling with a laptop, do not even get me started on projectors) the same display can come back larger than when the frame was cached. The stale frame is still treated as valid and restored, so the quick terminal no longer fills the screen (it appears at a partial width/height). Because the cache is persisted, restarting Ghostty does not clear it, and the user is slowly driven mad. Welcome to madness; we have snacks.

This PR addresses this by treating a cached frame as valid when the screen geometry matches exactly (both backing scale factor and frame size). On any mismatch we drop the entry and fall back to the configured quick-terminal-size. Manual resizes are still remembered across toggles within a stable display configuration.

Fixes the regression reported in #12348.

AI disclaimer: I used AI for this. Of course I used AI for this, my code is terrible on a good day. Specifically, Claude Code, as well as a custom harness that has the curious tendency to write commit messages containing conspiracy theories about the code because I am history's greatest monster.

Fight me!

The quick terminal caches its last-closed window frame per display so it
can restore the user's size when reopened. The cache entry was considered
valid whenever the current screen was the same size *or larger* than when
the frame was saved ("persist when screens grow"). This has led to a pattern
that was simply maddening. To wit:

That rule breaks across display changes. When an external display is
disconnected and later reconnected at a different resolution (common
after traveling with a laptop) the same display can come back larger
than when the frame was cached. The stale frame is still treated as valid
and restored, so the quick terminal no longer fills the screen (it appears
at a partial width/height). Because the cache is persisted, restarting
Ghostty does not clear it, and the user is slowly driven mad.

Only treat a cached frame as valid when the screen geometry matches
exactly (both backing scale factor and frame size). On any mismatch we
drop the entry and fall back to the configured quick-terminal-size. Manual
resizes are still remembered across toggles within a stable display
configuration.

Fixes the regression reported in ghostty-org#12348.
@quinnypig
quinnypig requested a review from a team as a code owner July 8, 2026 17:26
@ghostty-bot ghostty-bot Bot added the os/macos label Jul 8, 2026
@mitchellh

Copy link
Copy Markdown
Contributor

Thanks Corey. The description sounds right and the code looks good. ❤️

@mitchellh
mitchellh merged commit f815f84 into ghostty-org:main Jul 8, 2026
93 of 94 checks passed
@mitchellh mitchellh added this to the 1.4.0 milestone Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants