SessionCtl // Turn off isASCIIMode if CapsLock is turned off.

This commit is contained in:
ShikiSuen 2023-10-15 22:08:35 +08:00
parent 6be6492470
commit 90d1803cf3
1 changed files with 5 additions and 2 deletions

View File

@ -80,10 +80,13 @@ public extension SessionCtl {
// Caps Lock macOS 12 Monterey
if #available(macOS 12, *) {
if event.type == .flagsChanged, event.keyCode == KeyCode.kCapsLock.rawValue {
DispatchQueue.main.async {
DispatchQueue.main.async { [weak self] in
let isCapsLockTurnedOn = Self.isCapsLocked
let status = NSLocalizedString("NotificationSwitchRevolver", comment: "")
if !isCapsLockTurnedOn, self?.isASCIIMode ?? false {
self?.isASCIIMode.toggle()
}
guard PrefMgr.shared.showNotificationsWhenTogglingCapsLock else { return }
let status = NSLocalizedString("NotificationSwitchRevolver", comment: "")
Notifier.notify(
message: isCapsLockTurnedOn
? "Caps Lock " + "Alphanumerical Input Mode".localized + "\n" + status