mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-05-04 23:38:38 +03:00
22 lines
843 B
Swift
22 lines
843 B
Swift
import Cocoa
|
|
|
|
class PrimaryWindowController: NSWindowController {
|
|
// Keep track of the last point that our window was launched at so that new
|
|
// windows "cascade" over each other and don't just launch directly on top
|
|
// of each other.
|
|
static var lastCascadePoint = NSPoint(x: 0, y: 0)
|
|
|
|
// This is used to programmatically control tabs.
|
|
weak var windowManager: PrimaryWindowManager?
|
|
|
|
// This is required for the "+" button to show up in the tab bar to add a
|
|
// new tab.
|
|
override func newWindowForTab(_ sender: Any?) {
|
|
// TODO: specify our window so the tab is created in the proper window
|
|
// guard let window = self.window else { preconditionFailure("Expected window to be loaded") }
|
|
|
|
guard let manager = self.windowManager else { return }
|
|
manager.addNewTab()
|
|
}
|
|
}
|