summaryrefslogtreecommitdiff
path: root/kanata/chords.py
blob: 1400ad0242f0c11c29b8bd03b0b0b2bdd8eca130 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/python

chord_data = {
    "praw": "prawdopodobnie",
    "pro": "probably",
    "com": "co masz na myśli",
}

output = "(defchordsv2-experimental\n"

for keys, macro in chord_data.items():
    keys_formatted = " ".join(keys)
    first_char_macro = macro[0]

    # The rest of the macro characters are used in (unshift x)
    macro_formatted = ""

    for char in macro[1:]:
        if char == " ":
            macro_formatted += "(unshift spc) "
        else:
            macro_formatted += f"(unicode {char}) "

    macro_formatted = macro_formatted.strip()
    release = "first-release"

    chord_line = f"  ({keys_formatted}) (macro {first_char_macro} {
        macro_formatted}) 75 {release} (gaming)\n"
    output += chord_line

output += ")\n"

file = open("chords.kbd", "w")
file.write(output)
file.close()