diff --git a/Source/Modules/SessionCtl_Core.swift b/Source/Modules/SessionCtl_Core.swift
index b40ad780..dd843a4f 100644
--- a/Source/Modules/SessionCtl_Core.swift
+++ b/Source/Modules/SessionCtl_Core.swift
@@ -178,8 +178,20 @@ extension SessionCtl {
keyHandler.ensureKeyboardParser()
Self.theShiftKeyDetector.alsoToggleWithLShift = PrefMgr.shared.togglingAlphanumericalModeWithLShift
- if isASCIIMode, !isCapsLocked, PrefMgr.shared.disableShiftTogglingAlphanumericalMode { isASCIIMode = false }
- if isCapsLocked || PrefMgr.shared.disableShiftTogglingAlphanumericalMode { isASCIIMode = isCapsLocked } // 同步 Caps Lock 狀態。
+
+ if #unavailable(macOS 12) {
+ if #available(macOS 10.15, *) {
+ if isASCIIMode, PrefMgr.shared.disableShiftTogglingAlphanumericalMode { isASCIIMode = false }
+ }
+ } else {
+ if isASCIIMode, !isCapsLocked, PrefMgr.shared.disableShiftTogglingAlphanumericalMode {
+ isASCIIMode = false
+ }
+ // 同步 Caps Lock 狀態。
+ else if isCapsLocked || PrefMgr.shared.disableShiftTogglingAlphanumericalMode {
+ isASCIIMode = isCapsLocked
+ }
+ }
/// 必須加上下述條件,否則會在每次切換至輸入法本體的視窗(比如偏好設定視窗)時會卡死。
/// 這是很多 macOS 副廠輸入法的常見失誤之處。
diff --git a/Source/Modules/SessionCtl_HandleEvent.swift b/Source/Modules/SessionCtl_HandleEvent.swift
index e9d6b01b..0c6ddd37 100644
--- a/Source/Modules/SessionCtl_HandleEvent.swift
+++ b/Source/Modules/SessionCtl_HandleEvent.swift
@@ -35,19 +35,21 @@ extension SessionCtl {
return false
}
- // Caps Lock 通知與切換處理。
- if event.type == .flagsChanged, event.keyCode == KeyCode.kCapsLock.rawValue {
- DispatchQueue.main.async {
- let isCapsLockTurnedOn = event.modifierFlags.intersection(.deviceIndependentFlagsMask).contains(.capsLock)
- let status = NSLocalizedString("NotificationSwitchASCII", comment: "")
- if PrefMgr.shared.showNotificationsWhenTogglingCapsLock {
- Notifier.notify(
- message: isCapsLockTurnedOn
- ? "Caps Lock" + NSLocalizedString("Alphanumerical Input Mode", comment: "") + "\n" + status
- : NSLocalizedString("Chinese Input Mode", comment: "") + "\n" + status
- )
+ // Caps Lock 通知與切換處理,要求至少 macOS 12 Monterey。
+ if #available(macOS 12, *) {
+ if event.type == .flagsChanged, event.keyCode == KeyCode.kCapsLock.rawValue {
+ DispatchQueue.main.async {
+ let isCapsLockTurnedOn = event.modifierFlags.intersection(.deviceIndependentFlagsMask).contains(.capsLock)
+ let status = NSLocalizedString("NotificationSwitchASCII", comment: "")
+ if PrefMgr.shared.showNotificationsWhenTogglingCapsLock {
+ Notifier.notify(
+ message: isCapsLockTurnedOn
+ ? "Caps Lock" + NSLocalizedString("Alphanumerical Input Mode", comment: "") + "\n" + status
+ : NSLocalizedString("Chinese Input Mode", comment: "") + "\n" + status
+ )
+ }
+ self.isASCIIMode = isCapsLockTurnedOn
}
- self.isASCIIMode = isCapsLockTurnedOn
}
}
diff --git a/Source/Modules/UIModules/PrefUI/suiPrefPaneExperience.swift b/Source/Modules/UIModules/PrefUI/suiPrefPaneExperience.swift
index 2afb228c..f5ee671b 100644
--- a/Source/Modules/UIModules/PrefUI/suiPrefPaneExperience.swift
+++ b/Source/Modules/UIModules/PrefUI/suiPrefPaneExperience.swift
@@ -64,6 +64,13 @@ struct suiPrefPaneExperience: View {
}
}()
+ var macOSMontereyOrLaterDetected: Bool {
+ if #available(macOS 12, *) {
+ return true
+ }
+ return false
+ }
+
var body: some View {
ScrollView {
VStack {
@@ -203,7 +210,7 @@ struct suiPrefPaneExperience: View {
isOn: $selShowNotificationsWhenTogglingCapsLock.onChange {
PrefMgr.shared.showNotificationsWhenTogglingCapsLock = selShowNotificationsWhenTogglingCapsLock
}
- )
+ ).disabled(!macOSMontereyOrLaterDetected)
}
Preferences.Section(label: { Text(LocalizedStringKey("Misc Settings:")) }) {
Toggle(
diff --git a/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib b/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib
index 0ae9f045..5ee176fe 100644
--- a/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib
+++ b/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib
@@ -41,10 +41,10 @@
-
+
-
+
@@ -267,10 +267,10 @@
-
+
-
+
@@ -320,7 +320,7 @@
-
+
@@ -366,10 +366,10 @@
-
+
-
@@ -471,7 +458,6 @@
-
@@ -482,7 +468,6 @@
-