ctlIME // Optimize showPreferences().

This commit is contained in:
ShikiSuen 2022-08-25 19:23:35 +08:00
parent 38a6fa4821
commit a6a4637abb
1 changed files with 3 additions and 7 deletions

View File

@ -188,17 +188,13 @@ extension ctlInputMethod {
if #available(macOS 10.15, *) { if #available(macOS 10.15, *) {
NSApp.setActivationPolicy(.accessory) NSApp.setActivationPolicy(.accessory)
ctlPrefUI.shared.controller.show(preferencePane: Preferences.PaneIdentifier(rawValue: "General")) ctlPrefUI.shared.controller.show(preferencePane: Preferences.PaneIdentifier(rawValue: "General"))
ctlPrefUI.shared.controller.window?.level = .floating ctlPrefUI.shared.controller.window?.level = .statusBar
} else { } else {
showPrefWindowTraditional() showLegacyPreferences()
} }
} }
@objc func showLegacyPreferences(_: Any?) { @objc func showLegacyPreferences(_: Any? = nil) {
showPrefWindowTraditional()
}
private func showPrefWindowTraditional() {
(NSApp.delegate as? AppDelegate)?.showPreferences() (NSApp.delegate as? AppDelegate)?.showPreferences()
NSApp.activate(ignoringOtherApps: true) NSApp.activate(ignoringOtherApps: true)
} }