macOS: prevent focus loss in hidden titlebar + non-native fullscreen
When using hidden titlebar with non-native fullscreen, the window would lose focus after entering the first command. This occurred because: 1. Shell commands update the window title 2. Title changes trigger reapplyHiddenStyle() 3. reapplyHiddenStyle() re-adds .titled to the style mask 4. Style mask changes during fullscreen confuse AppKit, causing focus loss Fixed by adding a guard to skip titlebar restyling while fullscreen is active, using terminalController.fullscreenStyle.isFullscreen for proper detection of both native and non-native fullscreen modes. https://ampcode.com/threads/T-c4ef59cc-1232-4fa5-8f09-c65724ee84d3pull/8508/head
parent
084ff2de67
commit
c8243ffd99
|
|
@ -31,9 +31,16 @@ class HiddenTitlebarTerminalWindow: TerminalWindow {
|
||||||
.closable,
|
.closable,
|
||||||
.miniaturizable,
|
.miniaturizable,
|
||||||
]
|
]
|
||||||
|
|
||||||
/// Apply the hidden titlebar style.
|
/// Apply the hidden titlebar style.
|
||||||
private func reapplyHiddenStyle() {
|
private func reapplyHiddenStyle() {
|
||||||
|
// If our window is fullscreen then we don't reapply the hidden style because
|
||||||
|
// it can result in messing up non-native fullscreen. See:
|
||||||
|
// https://github.com/ghostty-org/ghostty/issues/8415
|
||||||
|
if terminalController?.fullscreenStyle?.isFullscreen ?? false {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Apply our style mask while preserving the .fullScreen option
|
// Apply our style mask while preserving the .fullScreen option
|
||||||
if styleMask.contains(.fullScreen) {
|
if styleMask.contains(.fullScreen) {
|
||||||
styleMask = Self.hiddenStyleMask.union([.fullScreen])
|
styleMask = Self.hiddenStyleMask.union([.fullScreen])
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue