From 833e1a532952649137e17e1136e6a0a5fa6f4a7e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 2 Nov 2023 22:12:52 -0700 Subject: [PATCH] macos: only modify style mask, don't overwrite Fixes #784 The issue before was we were removing the fullscreen style which was triggering a Cocoa assertion. --- .../Features/Terminal/TerminalController.swift | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 6a4ae7afb..8ad1509d5 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -28,13 +28,6 @@ class TerminalController: NSWindowController, NSWindowDelegate, TerminalViewDele /// True when an alert is active so we don't overlap multiple. private var alert: NSAlert? = nil - /// The style mask to use for the new window - private var styleMask: NSWindow.StyleMask { - var mask: NSWindow.StyleMask = [.resizable, .closable, .miniaturizable] - if (ghostty.windowDecorations) { mask.insert(.titled) } - return mask - } - init(_ ghostty: Ghostty.AppState, withBaseConfig base: Ghostty.SurfaceConfiguration? = nil) { self.ghostty = ghostty super.init(window: nil) @@ -76,7 +69,9 @@ class TerminalController: NSWindowController, NSWindowDelegate, TerminalViewDele override func windowDidLoad() { guard let window = window else { return } - window.styleMask = self.styleMask + + // If window decorations are disabled, remove our title + if (!ghostty.windowDecorations) { window.styleMask.remove(.titled) } // Terminals typically operate in sRGB color space and macOS defaults // to "native" which is typically P3. There is a lot more resources