diff --git a/macos/Sources/App/macOS/AppDelegate.swift b/macos/Sources/App/macOS/AppDelegate.swift index d54b49642..c00025bf5 100644 --- a/macos/Sources/App/macOS/AppDelegate.swift +++ b/macos/Sources/App/macOS/AppDelegate.swift @@ -957,18 +957,10 @@ class AppDelegate: NSObject, @IBAction func newWindow(_ sender: Any?) { _ = TerminalController.newWindow(ghostty) - - // We also activate our app so that it becomes front. This may be - // necessary for the dock menu. - NSApp.activate(ignoringOtherApps: true) } @IBAction func newTab(_ sender: Any?) { _ = TerminalController.newTab(ghostty) - - // We also activate our app so that it becomes front. This may be - // necessary for the dock menu. - NSApp.activate(ignoringOtherApps: true) } @IBAction func closeAllWindows(_ sender: Any?) { diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 7a11ac3ae..ec56fb934 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -214,10 +214,6 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr } } - // All new_window actions force our app to be active, so that the new - // window is focused and visible. - NSApp.activate(ignoringOtherApps: true) - // 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. @@ -230,6 +226,10 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr } c.showWindow(self) + + // All new_window actions force our app to be active, so that the new + // window is focused and visible. + NSApp.activate(ignoringOtherApps: true) } // Setup our undo @@ -336,6 +336,10 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr controller.showWindow(self) window.makeKeyAndOrderFront(self) + + // We also activate our app so that it becomes front. This may be + // necessary for the dock menu. + NSApp.activate(ignoringOtherApps: true) } // It takes an event loop cycle until the macOS tabGroup state becomes