mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-18 13:30:29 +00:00
macOS: order out alert sheets to avoid Stage Manager focus loss (#8348)
On macOS, when using stage manager, ghostty loses focus when a running process is terminated. This aims to fix #8336 which has reappeared since the previously fixed #5108. Opened a new pr following the closure of the previous #8343
This commit is contained in:
@@ -290,8 +290,12 @@ class BaseTerminalController: NSWindowController,
|
||||
alert.addButton(withTitle: "Cancel")
|
||||
alert.alertStyle = .warning
|
||||
alert.beginSheetModal(for: window) { response in
|
||||
let alertWindow = alert.window
|
||||
self.alert = nil
|
||||
if response == .alertFirstButtonReturn {
|
||||
// This is important so that we avoid losing focus when Stage
|
||||
// Manager is used (#8336)
|
||||
alertWindow.orderOut(nil)
|
||||
completion()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -747,6 +747,9 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr
|
||||
alert.alertStyle = .warning
|
||||
alert.beginSheetModal(for: alertWindow, completionHandler: { response in
|
||||
if (response == .alertFirstButtonReturn) {
|
||||
// This is important so that we avoid losing focus when Stage
|
||||
// Manager is used (#8336)
|
||||
alert.window.orderOut(nil)
|
||||
closeAllWindowsImmediately()
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user