From 61afa86aa6053b5fec412c28f4a7c15bf27cb5df Mon Sep 17 00:00:00 2001 From: Bryan Lee <38807139+liby@users.noreply.github.com> Date: Mon, 2 Jun 2025 18:40:37 +0800 Subject: [PATCH] macos: fix dock icon reappearing with `macos-hidden=always` --- macos/Sources/Features/Terminal/TerminalManager.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/macos/Sources/Features/Terminal/TerminalManager.swift b/macos/Sources/Features/Terminal/TerminalManager.swift index 07735cb58..56a902607 100644 --- a/macos/Sources/Features/Terminal/TerminalManager.swift +++ b/macos/Sources/Features/Terminal/TerminalManager.swift @@ -98,6 +98,16 @@ class TerminalManager { // All new_window actions force our app to be active. NSApp.activate(ignoringOtherApps: true) + // Reapply dock visibility setting after activation + DispatchQueue.main.async { + switch self.ghostty.config.macosHidden { + case .never: + NSApp.setActivationPolicy(.regular) + case .always: + NSApp.setActivationPolicy(.accessory) + } + } + // We're dispatching this async because otherwise the lastCascadePoint doesn't // take effect. Our best theory is there is some next-event-loop-tick logic // that Cocoa is doing that we need to be after.