feat: support setups with non latin keyboard layouts (closes #5607)
This commit is contained in:
1 parent
49778089ea
commit
f0e195d0de
3 files changed
+27
-3
No files matched your search
@@ -211,6 +211,30 @@ typedef TISInputSourceRef (*_SRKeyCodeTransformerCacheInputSourceCreate)(void);
|
|||||||
}
|
}
|
||||||
|
|
||||||
CFDataRef layoutData = TISGetInputSourceProperty(inputSource, kTISPropertyUnicodeKeyLayoutData);
|
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);
|
const UCKeyboardLayout *keyLayout = (const UCKeyboardLayout *)CFDataGetBytePtr(layoutData);
|
||||||
static const UniCharCount MaxLength = 255;
|
static const UniCharCount MaxLength = 255;
|
||||||
UniCharCount actualLength = 0;
|
UniCharCount actualLength = 0;
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
VERSION=alt-tab-current@9013a00dbf5cf05db923b0bcb2f9804b2c834a4b
|
VERSION=alt-tab-current@52c6273d233f7794e4fd5d22f50d2de0e4e41b19
|
||||||
SOURCE=https://github.com/lwouis/ShortcutRecorder.git
|
SOURCE=https://github.com/lwouis/ShortcutRecorder.git
|
||||||
DATE=2026-05-16
|
DATE=2026-05-25
|
||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
. "$(dirname "$0")/lib/common.sh"
|
. "$(dirname "$0")/lib/common.sh"
|
||||||
|
|
||||||
UPSTREAM_COMMIT="594b360e07a8a368ffec2567f77e465477b9994f"
|
UPSTREAM_COMMIT="52c6273d233f7794e4fd5d22f50d2de0e4e41b19"
|
||||||
UPSTREAM_BRANCH="alt-tab-current"
|
UPSTREAM_BRANCH="alt-tab-current"
|
||||||
GIT_URL="https://github.com/lwouis/ShortcutRecorder.git"
|
GIT_URL="https://github.com/lwouis/ShortcutRecorder.git"
|
||||||
DEST="vendor/ShortcutRecorder"
|
DEST="vendor/ShortcutRecorder"
|
||||||
|
|||||||
Reference in new issue
Block a user