summaryrefslogtreecommitdiff
path: root/macos
diff options
context:
space:
mode:
authorMitchell Hashimoto <m@mitchellh.com>2025-09-03 09:54:57 -0700
committerMitchell Hashimoto <m@mitchellh.com>2025-09-03 10:01:28 -0700
commitc8243ffd99e0612e3f2111e8400aa500ec8707ea (patch)
treebb6fb37e28c3d127837c04c4c4b50b46bfdcbb95 /macos
parent084ff2de67ff24989999fbd4db5d8200f85a826a (diff)
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-c65724ee84d3
Diffstat (limited to 'macos')
-rw-r--r--macos/Sources/Features/Terminal/Window Styles/HiddenTitlebarTerminalWindow.swift9
1 files changed, 8 insertions, 1 deletions
diff --git a/macos/Sources/Features/Terminal/Window Styles/HiddenTitlebarTerminalWindow.swift b/macos/Sources/Features/Terminal/Window Styles/HiddenTitlebarTerminalWindow.swift
index 996506f0b..dc7dd7633 100644
--- a/macos/Sources/Features/Terminal/Window Styles/HiddenTitlebarTerminalWindow.swift
+++ b/macos/Sources/Features/Terminal/Window Styles/HiddenTitlebarTerminalWindow.swift
@@ -31,9 +31,16 @@ class HiddenTitlebarTerminalWindow: TerminalWindow {
.closable,
.miniaturizable,
]
-
+
/// Apply the hidden titlebar style.
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
if styleMask.contains(.fullScreen) {
styleMask = Self.hiddenStyleMask.union([.fullScreen])