diff options
| author | Jules Aguillon | 2024-07-25 23:40:58 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2024-07-25 23:40:58 +0200 |
| commit | 29b4b665dc12eb613b68e657a28d93fc5ee0f51e (patch) | |
| tree | 4efcf3678c0ba0df68af940b6c4ff899a6be5d20 /srcs/juloo.keyboard2/KeyboardData.java | |
| parent | 35f35b27be295fc3e57e330cff2081f7bdc1c286 (diff) | |
| download | unexpected-keyboard-29b4b665dc12eb613b68e657a28d93fc5ee0f51e.tar.gz unexpected-keyboard-29b4b665dc12eb613b68e657a28d93fc5ee0f51e.zip | |
Allow Ctrl modmaps in layouts
The 'ctrl' modmap is different from the other modmaps as it also applies
the built-in Ctrl modifier to the resulting character, even if it was
first modified by the custom modmap.
For example, this will map Ctrl+в to Ctrl+V (not to v):
<ctrl a="в" b="v"/>
This is intended to add keyboard shortcuts in non-latin layouts.
A caveat is that the latin character appears on the keyboard while Ctrl
is activated.
Diffstat (limited to 'srcs/juloo.keyboard2/KeyboardData.java')
| -rw-r--r-- | srcs/juloo.keyboard2/KeyboardData.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/srcs/juloo.keyboard2/KeyboardData.java b/srcs/juloo.keyboard2/KeyboardData.java index bd9296e..fdcf512 100644 --- a/srcs/juloo.keyboard2/KeyboardData.java +++ b/srcs/juloo.keyboard2/KeyboardData.java @@ -563,18 +563,20 @@ public final class KeyboardData { public final Map<KeyValue, KeyValue> shift; public final Map<KeyValue, KeyValue> fn; + public final Map<KeyValue, KeyValue> ctrl; - public Modmap(Map<KeyValue, KeyValue> s, Map<KeyValue, KeyValue> f) + public Modmap(Map<KeyValue, KeyValue> s, Map<KeyValue, KeyValue> f, Map<KeyValue, KeyValue> c) { shift = s; fn = f; + ctrl = c; } public static Modmap parse(XmlPullParser parser) throws Exception { HashMap<KeyValue, KeyValue> shift = new HashMap<KeyValue, KeyValue>(); HashMap<KeyValue, KeyValue> fn = new HashMap<KeyValue, KeyValue>(); - + HashMap<KeyValue, KeyValue> ctrl = new HashMap<KeyValue, KeyValue>(); while (next_tag(parser)) { switch (parser.getName()) @@ -585,12 +587,15 @@ public final class KeyboardData case "fn": parse_mapping(parser, fn); break; + case "ctrl": + parse_mapping(parser, ctrl); + break; default: throw error(parser, "Expecting tag <shift> or <fn>, got <" + parser.getName() + ">"); } } - return new Modmap(shift, fn); + return new Modmap(shift, fn, ctrl); } private static void parse_mapping(XmlPullParser parser, Map<KeyValue, KeyValue> dst) throws Exception |
