SessionCtl // Use GCD for Caps Lock processing.
This commit is contained in:
parent
030a8cb776
commit
b286f23c69
|
@ -37,6 +37,7 @@ extension SessionCtl {
|
||||||
|
|
||||||
// Caps Lock 通知與切換處理。
|
// Caps Lock 通知與切換處理。
|
||||||
if event.type == .flagsChanged, event.keyCode == KeyCode.kCapsLock.rawValue {
|
if event.type == .flagsChanged, event.keyCode == KeyCode.kCapsLock.rawValue {
|
||||||
|
DispatchQueue.main.async {
|
||||||
let isCapsLockTurnedOn = event.modifierFlags.intersection(.deviceIndependentFlagsMask).contains(.capsLock)
|
let isCapsLockTurnedOn = event.modifierFlags.intersection(.deviceIndependentFlagsMask).contains(.capsLock)
|
||||||
let status = NSLocalizedString("NotificationSwitchASCII", comment: "")
|
let status = NSLocalizedString("NotificationSwitchASCII", comment: "")
|
||||||
if PrefMgr.shared.showNotificationsWhenTogglingCapsLock {
|
if PrefMgr.shared.showNotificationsWhenTogglingCapsLock {
|
||||||
|
@ -46,7 +47,8 @@ extension SessionCtl {
|
||||||
: NSLocalizedString("Chinese Input Mode", comment: "") + "\n" + status
|
: NSLocalizedString("Chinese Input Mode", comment: "") + "\n" + status
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
isASCIIMode = isCapsLockTurnedOn
|
self.isASCIIMode = isCapsLockTurnedOn
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用 Shift 開關半形英數模式,僅對 macOS 10.15 及之後的 macOS 有效。
|
// 用 Shift 開關半形英數模式,僅對 macOS 10.15 及之後的 macOS 有效。
|
||||||
|
|
Loading…
Reference in New Issue