mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-04-22 09:28:37 +03:00

Fixes #1052 This implements a `close_all_windows` binding in the core and implements it for macOS specifically. This will ask for close confirmation if any surface in any of the windows requires confirmation. This is bound by default to option+shift+command+w to match Safari. The binding is generall option+command+w but users may expect this to also mean "Close All Other Tabs" which is the changed behavior if any tabs are present in a standard macOS application. So I chose to follow Safari instead. This doesn't implement this feature for GTK, that's left as an exercise for a contributor.
41 lines
918 B
Swift
41 lines
918 B
Swift
import Foundation
|
|
import Cocoa
|
|
import SwiftUI
|
|
|
|
class AboutController: NSWindowController, NSWindowDelegate {
|
|
static let shared: AboutController = AboutController()
|
|
|
|
override var windowNibName: NSNib.Name? { "About" }
|
|
|
|
override func windowDidLoad() {
|
|
guard let window = window else { return }
|
|
window.center()
|
|
window.contentView = NSHostingView(rootView: AboutView())
|
|
}
|
|
|
|
// MARK: - Functions
|
|
|
|
func show() {
|
|
window?.makeKeyAndOrderFront(nil)
|
|
}
|
|
|
|
func hide() {
|
|
window?.close()
|
|
}
|
|
|
|
//MARK: - First Responder
|
|
|
|
@IBAction func close(_ sender: Any) {
|
|
self.window?.performClose(sender)
|
|
}
|
|
|
|
@IBAction func closeWindow(_ sender: Any) {
|
|
self.window?.performClose(sender)
|
|
}
|
|
|
|
// This is called when "escape" is pressed.
|
|
@objc func cancel(_ sender: Any?) {
|
|
close()
|
|
}
|
|
}
|