diff options
| author | Jules Aguillon | 2024-05-29 15:56:08 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2024-05-29 15:56:08 +0200 |
| commit | cf1aaa3bdfcb25388dd0ced888d2ad024fe4a029 (patch) | |
| tree | b7adbb2947d290732908aac704f63450b65d31dd /srcs/compose/compile.py | |
| parent | 39b3f50aa31df9786e4a10a27633137a4369f6ae (diff) | |
| download | unexpected-keyboard-cf1aaa3bdfcb25388dd0ced888d2ad024fe4a029.tar.gz unexpected-keyboard-cf1aaa3bdfcb25388dd0ced888d2ad024fe4a029.zip | |
Add compose sequences for Greek, Cyrillic, Hebrew and more
Parse key names from keysymdef.h, which is distributed with Xorg. The
Greek, Cyrillic and Hebrew sequences referenced these keysyms.
This increases the number of sequences from 2043 to 2668.
Diffstat (limited to 'srcs/compose/compile.py')
| -rw-r--r-- | srcs/compose/compile.py | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/srcs/compose/compile.py b/srcs/compose/compile.py index 2cb060e..aa3b7f8 100644 --- a/srcs/compose/compile.py +++ b/srcs/compose/compile.py @@ -1,23 +1,17 @@ -import textwrap, sys, re, string, json +import textwrap, sys, re, string, json, os -# Names not defined in Compose.pre -xkb_char_extra_names = { - "space": " ", - "minus": "-", - "asterisk": "*", - "colon": ":", - "equal": "=", - "exclam": "!", - "grave": "`", - "parenleft": "(", - "parenright": ")", - "percent": "%", - "period": ".", - "plus": "+", - "question": "?", - "semicolon": ";", - "underscore": "_", - } +# Parse symbol names from keysymdef.h. Many compose sequences in +# en_US_UTF_8_Compose.pre reference theses. For example, all the sequences on +# the Greek, Cyrillic and Hebrew scripts need these symbols. +def parse_keysymdef_h(): + with open(os.path.join(os.path.dirname(__file__), "keysymdef.h"), "r") as inp: + keysym_re = re.compile(r'^#define XK_(\S+)\s+\S+\s*/\*.U\+([0-9a-fA-F]+)\s') + for line in inp: + m = re.match(keysym_re, line) + if m != None: + yield (m.group(1), chr(int(m.group(2), 16))) + +xkb_char_extra_names = dict(parse_keysymdef_h()) dropped_sequences = 0 |
