From 35462331ae03f05dd436c9f287a87abafb87b8b4 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 30 Sep 2024 10:44:09 -0700 Subject: [PATCH] macos: non-native fs sets frame async to account for style changes Fixes #1996 --- macos/Sources/Helpers/Fullscreen.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/macos/Sources/Helpers/Fullscreen.swift b/macos/Sources/Helpers/Fullscreen.swift index ce91adc14..001b5df5e 100644 --- a/macos/Sources/Helpers/Fullscreen.swift +++ b/macos/Sources/Helpers/Fullscreen.swift @@ -160,11 +160,16 @@ class NonNativeFullscreen: FullscreenStyle { // Being untitled let's our content take up the full frame. window.styleMask.remove(.titled) - // Set frame to screen size, accounting for the menu bar if needed - window.setFrame(fullscreenFrame(screen), display: true) - // Focus window window.makeKeyAndOrderFront(nil) + + // Set frame to screen size, accounting for any elements such as the menu bar. + // We do this async so that all the style edits above (title removal, dock + // hide, menu hide, etc.) take effect. This fixes: + // https://github.com/ghostty-org/ghostty/issues/1996 + DispatchQueue.main.async { + self.window.setFrame(self.fullscreenFrame(screen), display: true) + } } func exit() {