Support Unicode sequences on Windows through WinCompose ONLY
This commit is contained in:
parent
137de41743
commit
0ccd27703d
@ -119,3 +119,4 @@ class UnicodeModes:
|
||||
NOOP = 0
|
||||
LINUX = IBUS = 1
|
||||
MACOS = OSX = RALT = 2
|
||||
WINC = 3
|
||||
|
@ -453,6 +453,7 @@ class KMK(KeycodeCategory):
|
||||
KC_UC_MODE_MACOS = KC_UC_MODE_OSX = KC_UC_MODE_RALT = UnicodeModeKeycode.from_mode_const(
|
||||
UnicodeModes.RALT,
|
||||
)
|
||||
KC_UC_MODE_WINC = UnicodeModeKeycode.from_mode_const(UnicodeModes.WINC)
|
||||
|
||||
|
||||
class Layers(KeycodeCategory):
|
||||
|
@ -21,6 +21,8 @@ def unicode_sequence(codepoints):
|
||||
yield from _ibus_unicode_sequence(codepoints, state)
|
||||
elif state.unicode_mode == UnicodeModes.RALT:
|
||||
yield from _ralt_unicode_sequence(codepoints, state)
|
||||
elif state.unicode_mode == UnicodeModes.WINC:
|
||||
yield from _winc_unicode_sequence(codepoints, state)
|
||||
|
||||
return KMKMacro(keydown=_unicode_sequence)
|
||||
|
||||
@ -43,3 +45,16 @@ def _ibus_unicode_sequence(codepoints, state):
|
||||
seq.append(Common.KC_ENTER)
|
||||
|
||||
yield from simple_key_sequence(seq).keydown(state)
|
||||
|
||||
|
||||
def _winc_unicode_sequence(codepoints, state):
|
||||
'''
|
||||
Send unicode sequence using WinCompose:
|
||||
|
||||
http://wincompose.info/
|
||||
https://github.com/SamHocevar/wincompose
|
||||
'''
|
||||
for codepoint in codepoints:
|
||||
yield keycode_down_event(Modifiers.RALT())
|
||||
yield keycode_down_event(Common.KC_U())
|
||||
yield from simple_key_sequence(generate_codepoint_keysym_seq(codepoint)).keydown(state)
|
||||
|
Loading…
x
Reference in New Issue
Block a user