tart run: do not remove "Edit" menu as its not present anymore (#946)

This commit is contained in:
Nikolay Edigaryev 2024-11-18 09:55:55 +01:00 committed by GitHub
parent b4de3bee83
commit b1e88e1e51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 13 deletions

View File

@ -631,7 +631,7 @@ struct MainApp: App {
static var suspendable: Bool = false
static var capturesSystemKeys: Bool = false
@NSApplicationDelegateAdaptor private var appDelegate: MinimalMenuAppDelegate
@NSApplicationDelegateAdaptor private var appDelegate: AppDelegate
var body: some Scene {
WindowGroup(vm!.name) {
@ -687,18 +687,7 @@ struct MainApp: App {
}
}
// The only way to fully remove Edit menu item.
class MinimalMenuAppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
let indexOfEditMenu = 2
func applicationDidFinishLaunching(_ : Notification) {
NSApplication.shared.mainMenu?.removeItem(at: indexOfEditMenu)
let nsApp = NSApplication.shared
nsApp.setActivationPolicy(.regular)
nsApp.activate(ignoringOtherApps: true)
}
class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
if (kill(getpid(), MainApp.suspendable ? SIGUSR1 : SIGINT) == 0) {
return .terminateLater