Skip to content

Commit 6fd0c9f

Browse files
Implement dead key sequences. (#29)
* Functionnal dead key sequences. * Update keyhints correctly. * Updated `layouts/fr(ergol).json` with ergolv0.99.2 * Added missing toml file (with makefile support) * Fixed problems with original PR.
1 parent 67b3e40 commit 6fd0c9f

File tree

7 files changed

+81
-66
lines changed

7 files changed

+81
-66
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ publish:
44
npm publish
55

66
layouts: layouts.yaml
7-
@for file in layouts.yaml/*.yaml; do \
7+
@for file in layouts.yaml/{*.yaml,*.toml}; do \
88
kalamine $$file --out "layouts/$$(basename $${file%.*}).json"; \
99
done

layouts.yaml/fr(ergol).toml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name = "Ergo-L"
2+
name8 = "ergol"
3+
locale = "fr"
4+
variant = "ergol"
5+
description = "French (Ergo-L)"
6+
author = "NuclearSquid"
7+
url = "https://github.com/Nuclear-Squid/ergol"
8+
geometry = "ERGO"
9+
version = "0.99.2"
10+
11+
base = '''
12+
╭╌╌╌╌╌┰─────┬─────┬─────┬─────┬─────┰─────┬─────┬─────┬─────┬─────┰╌╌╌╌╌┬╌╌╌╌╌╮
13+
┆ ~ ┃ ! ¡ │ @ ‘ │ # ’ │ $ ¢ │ % ‰ ┃ ^ │ & │ * │ « │ » ┃ _ – ┆ + ± ┆
14+
┆ ` ┃ 1 „ │ 2 “ │ 3 ” │ 4 £ │ 5 € ┃ 6 ¥ │ 7 ¤ │ 8 § │ 9 ¶ │ 0 ° ┃ / ÷ ┆ = ≠ ┆
15+
╰╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
16+
· ┃ Q │ C │ O │ P │ W ┃ J │ M │ D │** │ F ┃ { ┆ } ┆
17+
· ┃ â │ ç │ œ │ ô │ ┃ │ µ │ _ │***¨ │ ŭ ┃ [ ┆ ] ┆
18+
· ┠─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
19+
· ┃ A │ S │ E │ N │ ; • ┃ L │ R │ T │ I │ U ┃ " ┆ | ┆
20+
· ┃ à │ é │ è │ ê │ , · ┃ │ │ î │ û │ ù ┃ ' ┆ \ ┆
21+
╭╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┴╌╌╌╌╌╯
22+
┆ > ┃ Z │ X │ ? ¿ │ V │ B ┃ : │ H │ G │ Y │ K ┃ ·
23+
┆ < ┃ æ │ ß │ - — │ ñ │ ┃ . … │ │ │ │ ┃ ·
24+
╰╌╌╌╌╌┸─────┴─────┴─────┴─────┴─────┸─────┴─────┴─────┴─────┴─────┚ · · · · · ·
25+
'''
26+
27+
altgr = '''
28+
╭╌╌╌╌╌┰─────┬─────┬─────┬─────┬─────┰─────┬─────┬─────┬─────┬─────┰╌╌╌╌╌┬╌╌╌╌╌╮
29+
┆ ┃ ¹ │ ² │ ³ │ ⁴ │ ⁵ ┃ ⁶ │ ⁷ │ ⁸ │ ⁹ │ ⁰ ┃ ┆ ┆
30+
┆ ┃ ₁ │ ₂ │ ₃ │ ₄ │ ₅ ┃ ₆ │ ₇ │ ₈ │ ₉ │ ₀ ┃ ┆ ┆
31+
╰╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
32+
· ┃ │ ≤ │ ≥ │ *¤ │ ‰ ┃ *^ │ *µ │ × │ *´ │ *` ┃ ┆ ┆
33+
· ┃ @ │ < │ > │ $ │ % ┃ ^ │ & │ * │ ' │ ` ┃ ┆ ┆
34+
· ┠─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
35+
· ┃ │ ⁽ │ ⁾ │ │ ≠ ┃ */ │ ± │ — │ ÷ │ *¨ ┃ ┆ ┆
36+
· ┃ { │ ( │ ) │ } │ = ┃ \ │ + │ - │ / │ " ┃ ┆ ┆
37+
╭╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┴╌╌╌╌╌╯
38+
┆ ┃ *~ │ │ │ – │ ┃ ¦ │ ¬ │ *¸ │ │ ┃ ·
39+
┆ ┃ ~ │ [ │ ] │ _ │ # ┃ | │ ! │ ; │ : │ ? ┃ ·
40+
╰╌╌╌╌╌┸─────┴─────┴─────┴─────┴─────┸─────┴─────┴─────┴─────┴─────┚ · · · · · ·
41+
'''
42+
43+
[spacebar]
44+
shift = "\u202f" # NARROW NO-BREAK SPACE
45+
altgr = "\u0020" # SPACE
46+
altgr_shift = "\u00a0" # NO-BREAK SPACE
47+
1dk = "\u2019" # RIGHT SINGLE QUOTATION MARK
48+
1dk_shift = "\u2019" # RIGHT SINGLE QUOTATION MARK

layouts.yaml/fr(ergol).yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.

layouts/fr(ergol).json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,32 @@
1616
"KeyQ": [ "q", "Q", "@" ],
1717
"KeyW": [ "c", "C", "<", "" ],
1818
"KeyE": [ "o", "O", ">", "" ],
19-
"KeyR": [ "p", "P", "$" ],
19+
"KeyR": [ "p", "P", "$", "" ],
2020
"KeyT": [ "w", "W", "%", "" ],
2121
"KeyY": [ "j", "J", "^", "*^" ],
2222
"KeyU": [ "m", "M", "&", "" ],
2323
"KeyI": [ "d", "D", "*", "×" ],
24-
"KeyO": [ "**", "*¨", "'", "" ],
24+
"KeyO": [ "**", "**", "'", "" ],
2525
"KeyP": [ "f", "F", "`", "*`" ],
2626
"KeyA": [ "a", "A", "{" ],
2727
"KeyS": [ "s", "S", "(", "" ],
2828
"KeyD": [ "e", "E", ")", "" ],
2929
"KeyF": [ "n", "N", "}" ],
30-
"KeyG": [ ",", ";", "=", "" ],
31-
"KeyH": [ "l", "L", "\\" ],
30+
"KeyG": [ ",", ";", "=", "" ],
31+
"KeyH": [ "l", "L", "\\", "*/" ],
3232
"KeyJ": [ "r", "R", "+", "±" ],
3333
"KeyK": [ "t", "T", "-", "" ],
3434
"KeyL": [ "i", "I", "/", "÷" ],
3535
"Semicolon": [ "u", "U", "\"", "" ],
3636
"KeyZ": [ "z", "Z", "~", "*~" ],
3737
"KeyX": [ "x", "X", "[" ],
3838
"KeyC": [ "-", "?", "]" ],
39-
"KeyV": [ "v", "V", "_" ],
39+
"KeyV": [ "v", "V", "_", "" ],
4040
"KeyB": [ "b", "B", "#" ],
4141
"KeyN": [ ".", ":", "|", "¦" ],
42-
"KeyM": [ "h", "H", "!" ],
43-
"Comma": [ "g", "G", ";" ],
44-
"Period": [ "y", "Y", ":", "¬" ],
42+
"KeyM": [ "h", "H", "!", "¬" ],
43+
"Comma": [ "g", "G", ";", "" ],
44+
"Period": [ "y", "Y", ":" ],
4545
"Slash": [ "k", "K", "?" ],
4646
"Minus": [ "/", "_" ],
4747
"Equal": [ "=", "+" ],
@@ -54,14 +54,16 @@
5454
"Space": [ " ", "", " ", " " ]
5555
},
5656
"deadkeys": {
57-
"**": { "**": "`", " ": "", " ": "", " ": "", "!": "¡", "1": "", "@": "", "2": "", "#": "", "3": "", "$": "¢", "4": "£", "%": "", "5": "", "6": "¥", "7": "¤", "8": "§", "9": "", "0": "°", "Q": "Â", "q": "â", "C": "Ç", "c": "ç", "O": "Œ", "o": "œ", "P": "Ô", "p": "ô", "m": "µ", "d": "_", "A": "À", "a": "à", "S": "É", "s": "é", "E": "È", "e": "è", "N": "Ê", "n": "ê", ";": "", ",": "·", "T": "Î", "t": "î", "I": "Û", "i": "û", "U": "Ù", "u": "ù", "X": "", "x": "ß", "?": "¿", "-": "", "V": "Ñ", "v": "ñ", ".": "", "_": "", "/": "÷", "+": "±", "=": "" },
57+
"**": { "**": "", " ": "", " ": "", " ": "", "!": "¡", "1": "", "@": "", "2": "", "#": "", "3": "", "$": "¢", "4": "£", "%": "", "5": "", "6": "¥", "7": "¤", "8": "§", "9": "", "0": "°", "Q": "Â", "q": "â", "C": "Ç", "c": "ç", "O": "Œ", "o": "œ", "P": "Ô", "p": "ô", "m": "µ", "d": "_", "F": "Ŭ", "f": "ŭ", "A": "À", "a": "à", "S": "É", "s": "é", "E": "È", "e": "è", "N": "Ê", "n": "ê", ";": "", ",": "·", "T": "Î", "t": "î", "I": "Û", "i": "û", "U": "Ù", "u": "ù", "Z": "Æ", "z": "æ", "X": "", "x": "ß", "?": "¿", "-": "", "V": "Ñ", "v": "ñ", ".": "", "_": "", "/": "÷", "+": "±", "=": "" },
5858
"*¨": { "*¨": "¨", " ": "\"", " ": "\"", " ": "\"", "A": "Ä", "a": "ä", "E": "Ë", "e": "ë", "H": "", "h": "", "I": "Ï", "i": "ï", "O": "Ö", "o": "ö", "t": "", "U": "Ü", "u": "ü", "W": "", "w": "", "X": "", "x": "", "Y": "Ÿ", "y": "ÿ" },
59+
"*¤": { "*¤": "¤", " ": "¤", " ": "¤", " ": "¤", "A": "", "a": "؋", "B": "", "b": "฿", "C": "", "c": "¢", "D": "", "d": "", "E": "", "e": "", "F": "", "f": "ƒ", "G": "", "g": "", "H": "", "h": "", "I": "", "i": "", "K": "", "k": "", "L": "", "l": "£", "M": "", "m": "", "N": "", "n": "", "O": "", "o": "", "P": "", "p": "", "R": "", "r": "", "S": "$", "s": "", "T": "", "t": "", "U": "", "u": "", "W": "", "w": "", "Y": "", "y": "¥" },
5960
"*^": { "*^": "^", " ": "^", " ": "^", " ": "^", "A": "Â", "a": "â", "C": "Ĉ", "c": "ĉ", "E": "Ê", "e": "ê", "G": "Ĝ", "g": "ĝ", "H": "Ĥ", "h": "ĥ", "I": "Î", "i": "î", "J": "Ĵ", "j": "ĵ", "O": "Ô", "o": "ô", "S": "Ŝ", "s": "ŝ", "U": "Û", "u": "û", "W": "Ŵ", "w": "ŵ", "Y": "Ŷ", "y": "ŷ", "Z": "", "z": "", "0": "", "1": "¹", "2": "²", "3": "³", "4": "", "5": "", "6": "", "7": "", "8": "", "9": "", "+": "", "-": "", "=": "" },
6061
"*µ": { "*µ": "µ", " ": "µ", " ": "µ", " ": "µ", "A": "Α", "a": "α", "B": "Β", "b": "β", "D": "Δ", "d": "δ", "E": "Ε", "e": "ε", "F": "Φ", "f": "φ", "G": "Γ", "g": "γ", "H": "Η", "h": "η", "I": "Ι", "i": "ι", "J": "Θ", "j": "θ", "K": "Κ", "k": "κ", "L": "Λ", "l": "λ", "M": "Μ", "m": "μ", "N": "Ν", "n": "ν", "O": "Ο", "o": "ο", "P": "Π", "p": "π", "Q": "Χ", "q": "χ", "R": "Ρ", "r": "ρ", "S": "Σ", "s": "σ", "T": "Τ", "t": "τ", "U": "Υ", "u": "υ", "W": "Ω", "w": "ω", "X": "Ξ", "x": "ξ", "Y": "Ψ", "y": "ψ", "Z": "Ζ", "z": "ζ" },
6162
"*´": { "*´": "´", " ": "'", " ": "'", " ": "'", "A": "Á", "a": "á", "C": "Ć", "c": "ć", "E": "É", "e": "é", "G": "Ǵ", "g": "ǵ", "I": "Í", "i": "í", "K": "", "k": "", "L": "Ĺ", "l": "ĺ", "M": "", "m": "ḿ", "N": "Ń", "n": "ń", "O": "Ó", "o": "ó", "P": "", "p": "", "R": "Ŕ", "r": "ŕ", "S": "Ś", "s": "ś", "U": "Ú", "u": "ú", "W": "", "w": "", "Y": "Ý", "y": "ý", "Z": "Ź", "z": "ź" },
6263
"*`": { "*`": "`", " ": "`", " ": "`", " ": "`", "A": "À", "a": "à", "E": "È", "e": "è", "I": "Ì", "i": "ì", "N": "Ǹ", "n": "ǹ", "O": "Ò", "o": "ò", "U": "Ù", "u": "ù", "W": "", "w": "", "Y": "", "y": "" },
63-
"*¸": { "*¸": "¸", " ": "¸", " ": "¸", " ": "¸", "C": "Ç", "c": "ç", "D": "", "d": "", "E": "Ȩ", "e": "ȩ", "G": "Ģ", "g": "ģ", "H": "", "h": "", "K": "Ķ", "k": "ķ", "L": "Ļ", "l": "ļ", "N": "Ņ", "n": "ņ", "R": "Ŗ", "r": "ŗ", "S": "Ş", "s": "ş", "T": "Ţ", "t": "ţ" },
64-
"*~": { "*~": "~", " ": "~", " ": "~", " ": "~", "A": "Ã", "a": "ã", "E": "", "e": "", "I": "Ĩ", "i": "ĩ", "N": "Ñ", "n": "ñ", "O": "Õ", "o": "õ", "U": "Ũ", "u": "ũ", "V": "", "v": "", "Y": "", "y": "", "<": "", ">": "", "=": "" }
64+
"*/": { "*/": "/", " ": "/", " ": "/", " ": "/", "A": "Ⱥ", "a": "", "B": "Ƀ", "b": "ƀ", "C": "Ȼ", "c": "ȼ", "D": "Đ", "d": "đ", "E": "Ɇ", "e": "ɇ", "G": "Ǥ", "g": "ǥ", "H": "Ħ", "h": "ħ", "I": "Ɨ", "i": "ɨ", "J": "Ɉ", "j": "ɉ", "L": "Ł", "l": "ł", "O": "Ø", "o": "ø", "P": "", "p": "", "R": "Ɍ", "r": "ɍ", "T": "Ŧ", "t": "ŧ", "U": "Ʉ", "u": "ʉ", "Y": "Ɏ", "y": "ɏ", "Z": "Ƶ", "z": "ƶ", "<": "", ">": "", "=": "" },
65+
"*~": { "*~": "~", " ": "~", " ": "~", " ": "~", "A": "Ã", "a": "ã", "E": "", "e": "", "I": "Ĩ", "i": "ĩ", "N": "Ñ", "n": "ñ", "O": "Õ", "o": "õ", "U": "Ũ", "u": "ũ", "V": "", "v": "", "Y": "", "y": "", "<": "", ">": "", "=": "" },
66+
"*¸": { "*¸": "¸", " ": "¸", " ": "¸", " ": "¸", "C": "Ç", "c": "ç", "D": "", "d": "", "E": "Ȩ", "e": "ȩ", "G": "Ģ", "g": "ģ", "H": "", "h": "", "K": "Ķ", "k": "ķ", "L": "Ļ", "l": "ļ", "N": "Ņ", "n": "ņ", "R": "Ŗ", "r": "ŗ", "S": "Ş", "s": "ş", "T": "Ţ", "t": "ţ" }
6567
},
6668
"altgr": true
6769
}

src/content.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,24 @@ export function drawKey(element, keyMap) {
149149
}
150150

151151
export function drawDK(element, keyMap, deadKey) {
152-
const keyChars = keyMap[element.parentNode.id];
153-
if (!keyChars) {
154-
return;
152+
const drawChar = (element, content) => {
153+
if (isDeadKey(content)) {
154+
element.classList.add('deadKey', 'diacritic');
155+
element.textContent = content[1];
156+
} else {
157+
element.classList.remove('deadKey', 'diacritic');
158+
element.textContent = content || '';
159+
}
155160
}
161+
162+
const keyChars = keyMap[element.parentNode.id];
163+
if (!keyChars) return;
164+
156165
const alt0 = deadKey[keyChars[0]];
157166
const alt1 = deadKey[keyChars[1]];
158-
element.querySelector('.level5').textContent = alt0 || '';
159-
element.querySelector('.level6').textContent = altUpperChar(alt0, alt1);
167+
168+
drawChar(element.querySelector('.level5'), alt0);
169+
drawChar(element.querySelector('.level6'), altUpperChar(alt0, alt1));
160170
}
161171

162172
/**

src/x-keyboard-layout.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,10 @@ export function newKeyboardLayout(keyMap = {}, deadKeys = {}, geometry = '') {
151151
if (!key) {
152152
return '';
153153
}
154-
const value = key[getModifierLevel(modifiers, platform)];
154+
let value = key[getModifierLevel(modifiers, platform)];
155155
if (pendingDK) {
156-
const dk = pendingDK;
156+
value = pendingDK[value] || '';
157157
pendingDK = undefined;
158-
return dk[value] || '';
159158
}
160159
if (isDeadKey(value)) {
161160
pendingDK = deadKeys[value];

src/x-keyboard.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ class Keyboard extends HTMLElement {
179179
span.textContent = '';
180180
});
181181
}
182-
} else if (this.layout.pendingDK) { // show hints for this dead key
182+
}
183+
if (this.layout.pendingDK) { // show hints for this dead key
183184
Array.from(this.root.querySelectorAll('.key')).forEach((key) => {
184185
drawDK(key, this.layout.keyMap, this.layout.pendingDK);
185186
});

0 commit comments

Comments
 (0)