mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
Add TerminateAfterLastWindowClosed toggle support in Misc
This commit is contained in:
parent
3d5fdd528b
commit
f8970f44d5
4 changed files with 60 additions and 0 deletions
|
|
@ -104,6 +104,12 @@ class AppState: ObservableObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Published var terminateAfterLastWindowClosed = false {
|
||||||
|
didSet {
|
||||||
|
Current.defaults.set(terminateAfterLastWindowClosed, forKey: "terminateAfterLastWindowClosed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Runtimes
|
// MARK: - Runtimes
|
||||||
|
|
||||||
@Published var downloadableRuntimes: [DownloadableRuntime] = []
|
@Published var downloadableRuntimes: [DownloadableRuntime] = []
|
||||||
|
|
@ -173,6 +179,7 @@ class AppState: ObservableObject {
|
||||||
onSelectActionType = SelectedActionType(rawValue: Current.defaults.string(forKey: "onSelectActionType") ?? "none") ?? .none
|
onSelectActionType = SelectedActionType(rawValue: Current.defaults.string(forKey: "onSelectActionType") ?? "none") ?? .none
|
||||||
installPath = Current.defaults.string(forKey: "installPath") ?? Path.defaultInstallDirectory.string
|
installPath = Current.defaults.string(forKey: "installPath") ?? Path.defaultInstallDirectory.string
|
||||||
showOpenInRosettaOption = Current.defaults.bool(forKey: "showOpenInRosettaOption") ?? false
|
showOpenInRosettaOption = Current.defaults.bool(forKey: "showOpenInRosettaOption") ?? false
|
||||||
|
terminateAfterLastWindowClosed = Current.defaults.bool(forKey: "terminateAfterLastWindowClosed") ?? false
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Timer
|
// MARK: Timer
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,11 @@ struct AdvancedPreferencePane: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.groupBoxStyle(PreferencesGroupBoxStyle())
|
.groupBoxStyle(PreferencesGroupBoxStyle())
|
||||||
|
|
||||||
|
GroupBox(label: Text("Misc")) {
|
||||||
|
Toggle("TerminateAfterLastWindowClosed", isOn: $appState.terminateAfterLastWindowClosed)
|
||||||
|
}
|
||||||
|
.groupBoxStyle(PreferencesGroupBoxStyle())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14829,6 +14829,28 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Misc" : {
|
||||||
|
"localizations" : {
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Misc"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "杂项"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "雜項"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Moving" : {
|
"Moving" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|
@ -20721,6 +20743,28 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"TerminateAfterLastWindowClosed" : {
|
||||||
|
"localizations" : {
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Terminate App after last window is closed"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "在最后一个窗口关闭后终止App"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "在最後一個窗口關閉後終止 App"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"TrashingArchive" : {
|
"TrashingArchive" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
func applicationDidFinishLaunching(_: Notification) {}
|
func applicationDidFinishLaunching(_: Notification) {}
|
||||||
|
|
||||||
|
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
||||||
|
return Current.defaults.bool(forKey: "terminateAfterLastWindowClosed") ?? false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func localizeString(_ key: String, comment: String = "") -> String {
|
func localizeString(_ key: String, comment: String = "") -> String {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue