Add New Window to Dock menu (#2340)

* Add Dock menu new-window regression test

* Add New Window to Dock menu
This commit is contained in:
Austin Wang 2026-03-30 02:19:17 -07:00 committed by GitHub
parent 27db2eb8dd
commit 29c0f525db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 50 additions and 0 deletions

View file

@ -5511,6 +5511,18 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
mainWindowContexts.values.first(where: { $0.windowId == windowId })?.sidebarState.isVisible
}
func applicationDockMenu(_ sender: NSApplication) -> NSMenu? {
let menu = NSMenu(title: "")
let newWindowItem = NSMenuItem(
title: String(localized: "menu.file.newWindow", defaultValue: "New Window"),
action: #selector(openNewMainWindow(_:)),
keyEquivalent: ""
)
newWindowItem.target = self
menu.addItem(newWindowItem)
return menu
}
@objc func openNewMainWindow(_ sender: Any?) {
_ = createMainWindow()
}