ctlIME // Note: alphanumerical mode toggle only works >= macOS 10.15.

This commit is contained in:
ShikiSuen 2022-08-10 11:12:44 +08:00
parent e3f5d1ec93
commit c02e52e9d2
1 changed files with 12 additions and 10 deletions

View File

@ -187,20 +187,22 @@ class ctlInputMethod: IMKInputController {
@objc(handleEvent:client:) override func handle(_ event: NSEvent!, client sender: Any!) -> Bool { @objc(handleEvent:client:) override func handle(_ event: NSEvent!, client sender: Any!) -> Bool {
_ = sender // _ = sender //
// Shift // Shift macOS 10.15 macOS
if ShiftKeyUpChecker.check(event) { if #available(macOS 10.15, *) {
if !rencentKeyHandledByKeyHandler { if ShiftKeyUpChecker.check(event) {
NotifierController.notify( if !rencentKeyHandledByKeyHandler {
message: String( NotifierController.notify(
format: "%@%@%@", NSLocalizedString("Alphanumerical Mode", comment: ""), "\n", message: String(
toggleASCIIMode() format: "%@%@%@", NSLocalizedString("Alphanumerical Mode", comment: ""), "\n",
toggleASCIIMode()
? NSLocalizedString("NotificationSwitchON", comment: "") ? NSLocalizedString("NotificationSwitchON", comment: "")
: NSLocalizedString("NotificationSwitchOFF", comment: "") : NSLocalizedString("NotificationSwitchOFF", comment: "")
)
) )
) }
rencentKeyHandledByKeyHandler = false
return false
} }
rencentKeyHandledByKeyHandler = false
return false
} }
/// flags使 KeyHandler /// flags使 KeyHandler