From c40c588aa61e401b85b8121383fb72981aefea50 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Fri, 15 Nov 2024 17:42:01 +0100 Subject: [PATCH] tart run: do not remove "Edit" menu as its not present anymore --- Sources/tart/Commands/Run.swift | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/Sources/tart/Commands/Run.swift b/Sources/tart/Commands/Run.swift index c5747727..ded19f9c 100644 --- a/Sources/tart/Commands/Run.swift +++ b/Sources/tart/Commands/Run.swift @@ -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