diff --git a/Xcodes/Backend/AppState.swift b/Xcodes/Backend/AppState.swift index 46a5d633..47c89dc3 100644 --- a/Xcodes/Backend/AppState.swift +++ b/Xcodes/Backend/AppState.swift @@ -104,6 +104,12 @@ class AppState: ObservableObject { } } + @Published var terminateAfterLastWindowClosed = false { + didSet { + Current.defaults.set(terminateAfterLastWindowClosed, forKey: "terminateAfterLastWindowClosed") + } + } + // MARK: - Runtimes @Published var downloadableRuntimes: [DownloadableRuntime] = [] @@ -173,6 +179,7 @@ class AppState: ObservableObject { onSelectActionType = SelectedActionType(rawValue: Current.defaults.string(forKey: "onSelectActionType") ?? "none") ?? .none installPath = Current.defaults.string(forKey: "installPath") ?? Path.defaultInstallDirectory.string showOpenInRosettaOption = Current.defaults.bool(forKey: "showOpenInRosettaOption") ?? false + terminateAfterLastWindowClosed = Current.defaults.bool(forKey: "terminateAfterLastWindowClosed") ?? false } // MARK: Timer diff --git a/Xcodes/Frontend/Preferences/GeneralPreferencePane.swift b/Xcodes/Frontend/Preferences/GeneralPreferencePane.swift index 0e714e42..b15f5c6d 100644 --- a/Xcodes/Frontend/Preferences/GeneralPreferencePane.swift +++ b/Xcodes/Frontend/Preferences/GeneralPreferencePane.swift @@ -20,6 +20,12 @@ struct GeneralPreferencePane: View { NotificationsView().environmentObject(appState) } .groupBoxStyle(PreferencesGroupBoxStyle()) + Divider() + + GroupBox(label: Text("Misc")) { + Toggle("TerminateAfterLastWindowClosed", isOn: $appState.terminateAfterLastWindowClosed) + } + .groupBoxStyle(PreferencesGroupBoxStyle()) } } } diff --git a/Xcodes/Resources/Localizable.xcstrings b/Xcodes/Resources/Localizable.xcstrings index 6d61d71d..f1132cdd 100644 --- a/Xcodes/Resources/Localizable.xcstrings +++ b/Xcodes/Resources/Localizable.xcstrings @@ -8029,7 +8029,7 @@ "el" : { "stringUnit" : { "state" : "translated", - "value" : "Εισάγετε τον %2$d-ψήφιο κωδικού που εστάλη στο %2$@:" + "value" : "Εισάγετε τον %1$d-ψήφιο κωδικού που εστάλη στο %2$@:" } }, "en" : { @@ -14829,6 +14829,130 @@ } } }, + "Misc" : { + "localizations" : { + "ar" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "ca" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "de" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "el" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "es" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "fi" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "hi" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "it" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "ja" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "ko" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "nl" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "pl" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "pt-BR" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "ru" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "tr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "uk" : { + "stringUnit" : { + "state" : "translated", + "value" : "Misc" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "杂项" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "雜項" + } + } + } + }, "Moving" : { "extractionState" : "manual", "localizations" : { @@ -20721,6 +20845,130 @@ } } }, + "TerminateAfterLastWindowClosed" : { + "localizations" : { + "ar" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "ca" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "de" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "el" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "es" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "fi" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "hi" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "it" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "ja" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "ko" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "nl" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "pl" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "pt-BR" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "ru" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "tr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "uk" : { + "stringUnit" : { + "state" : "translated", + "value" : "Terminate App after last window is closed" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "在最后一个窗口关闭后终止App" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "在最後一個窗口關閉後終止 App" + } + } + } + }, "TrashingArchive" : { "extractionState" : "manual", "localizations" : { diff --git a/Xcodes/XcodesApp.swift b/Xcodes/XcodesApp.swift index 74b3aef6..a7835dd6 100644 --- a/Xcodes/XcodesApp.swift +++ b/Xcodes/XcodesApp.swift @@ -11,7 +11,7 @@ struct XcodesApp: App { @StateObject private var updater = ObservableUpdater() var body: some Scene { - WindowGroup("Xcodes") { + Window("Xcodes", id: "main") { MainWindow() .environmentObject(appState) .environmentObject(updater) @@ -166,6 +166,10 @@ class AppDelegate: NSObject, NSApplicationDelegate { } func applicationDidFinishLaunching(_: Notification) {} + + func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return Current.defaults.bool(forKey: "terminateAfterLastWindowClosed") ?? false + } } func localizeString(_ key: String, comment: String = "") -> String {