Merge pull request #980 from mitchellh/macos-open

macos: do not open an initial window if opening from URL
This commit is contained in:
Mitchell Hashimoto
2023-12-01 19:28:44 -08:00
committed by GitHub
2 changed files with 7 additions and 4 deletions

View File

@ -78,9 +78,12 @@ class AppDelegate: NSObject, ObservableObject, NSApplicationDelegate, UNUserNoti
"ApplePressAndHoldEnabled": false,
])
// Let's launch our first window.
// TODO: we should detect if we restored windows and if so not launch a new window.
terminalManager.newWindow()
// Let's launch our first window. We only do this if we have no other windows. It
// is possible to have other windows if we're opening a URL since `application(_:openFile:)`
// is called before this.
if (terminalManager.windows.count == 0) {
terminalManager.newWindow()
}
// Initial config loading
configDidReload(ghostty)

View File

@ -17,7 +17,7 @@ class TerminalManager {
var focusedSurface: Ghostty.SurfaceView? { mainWindow?.controller.focusedSurface }
/// The set of windows we currently have.
private var windows: [Window] = []
var windows: [Window] = []
// 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