diff --git a/vendor/ShortcutRecorder/Sources/ShortcutRecorder/SRKeyCodeTransformer.m b/vendor/ShortcutRecorder/Sources/ShortcutRecorder/SRKeyCodeTransformer.m index e2893303..911e5dbf 100644 --- a/vendor/ShortcutRecorder/Sources/ShortcutRecorder/SRKeyCodeTransformer.m +++ b/vendor/ShortcutRecorder/Sources/ShortcutRecorder/SRKeyCodeTransformer.m @@ -211,6 +211,30 @@ typedef TISInputSourceRef (*_SRKeyCodeTransformerCacheInputSourceCreate)(void); } CFDataRef layoutData = TISGetInputSourceProperty(inputSource, kTISPropertyUnicodeKeyLayoutData); + if (!layoutData) + { + // The current input source has no uchr data — happens when the only enabled + // input source is a non-Latin IME (e.g. WeType Pinyin) and no ASCII-capable + // keyboard layout is enabled. Fall back to the US layout, which is always + // installed on macOS even when not enabled by the user. + NSDictionary *filter = @{(__bridge NSString *)kTISPropertyInputSourceID: @"com.apple.keylayout.US"}; + CFArrayRef sources = TISCreateInputSourceList((__bridge CFDictionaryRef)filter, true); + if (sources) + { + CFAutorelease(sources); + if (CFArrayGetCount(sources) > 0) + { + TISInputSourceRef usSource = (TISInputSourceRef)CFArrayGetValueAtIndex(sources, 0); + layoutData = TISGetInputSourceProperty(usSource, kTISPropertyUnicodeKeyLayoutData); + } + } + if (!layoutData) + { + os_trace_error("#Critical No keyboard layout data available, even US fallback failed"); + return nil; + } + os_trace_debug("Using US layout fallback (no ASCII-capable keyboard layout enabled)"); + } const UCKeyboardLayout *keyLayout = (const UCKeyboardLayout *)CFDataGetBytePtr(layoutData); static const UniCharCount MaxLength = 255; UniCharCount actualLength = 0; diff --git a/vendor/ShortcutRecorder/UPSTREAM b/vendor/ShortcutRecorder/UPSTREAM index 324d1c5e..a6e9a0d5 100644 --- a/vendor/ShortcutRecorder/UPSTREAM +++ b/vendor/ShortcutRecorder/UPSTREAM @@ -1,3 +1,3 @@ -VERSION=alt-tab-current@9013a00dbf5cf05db923b0bcb2f9804b2c834a4b +VERSION=alt-tab-current@52c6273d233f7794e4fd5d22f50d2de0e4e41b19 SOURCE=https://github.com/lwouis/ShortcutRecorder.git -DATE=2026-05-16 +DATE=2026-05-25 diff --git a/vendor/scripts/update_shortcut_recorder.sh b/vendor/scripts/update_shortcut_recorder.sh index 10941f48..8354206d 100755 --- a/vendor/scripts/update_shortcut_recorder.sh +++ b/vendor/scripts/update_shortcut_recorder.sh @@ -4,7 +4,7 @@ set -euo pipefail . "$(dirname "$0")/lib/common.sh" -UPSTREAM_COMMIT="594b360e07a8a368ffec2567f77e465477b9994f" +UPSTREAM_COMMIT="52c6273d233f7794e4fd5d22f50d2de0e4e41b19" UPSTREAM_BRANCH="alt-tab-current" GIT_URL="https://github.com/lwouis/ShortcutRecorder.git" DEST="vendor/ShortcutRecorder"