SessionCtl // Turn off Caps Lock if Eisu key is turned off.

This commit is contained in:
ShikiSuen 2023-10-15 21:59:46 +08:00
parent 6c371b844f
commit 6be6492470
1 changed files with 7 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import IMKUtils
import InputMethodKit import InputMethodKit
import NotifierUI import NotifierUI
import Shared import Shared
import SwiftyCapsLockToggler
// MARK: - Facade // MARK: - Facade
@ -183,10 +184,15 @@ public extension SessionCtl {
/// ///
private func toggleAlphanumericalMode() { private func toggleAlphanumericalMode() {
let status = "NotificationSwitchRevolver".localized let status = "NotificationSwitchRevolver".localized
let oldValue = isASCIIMode
let newValue = isASCIIMode.toggled()
Notifier.notify( Notifier.notify(
message: isASCIIMode.toggled() message: newValue
? NSLocalizedString("Alphanumerical Input Mode", comment: "") + "\n" + status ? NSLocalizedString("Alphanumerical Input Mode", comment: "") + "\n" + status
: NSLocalizedString("Chinese Input Mode", comment: "") + "\n" + status : NSLocalizedString("Chinese Input Mode", comment: "") + "\n" + status
) )
if oldValue, !newValue, Self.isCapsLocked {
CapsLockToggler.turnOff()
}
} }
} }