diff --git a/scripts/globals/layout_config.gd b/scripts/globals/layout_config.gd index 956d8de..b514871 100644 --- a/scripts/globals/layout_config.gd +++ b/scripts/globals/layout_config.gd @@ -20,6 +20,8 @@ var layouts: Dictionary[String, AbstractLayout] = { "ansi-104.json": LayoutKLE.new("res://scripts/layouts/kle/ansi-104.json"), "ansi-104-big-enter.json": LayoutKLE.new("res://scripts/layouts/kle/ansi-104-big-enter.json"), + "iso-105.json": LayoutKLE.new("res://scripts/layouts/kle/iso-105.json"), + "keycool-84.json": LayoutKLE.new("res://scripts/layouts/kle/keycool-84.json"), } diff --git a/scripts/layouts/kle/iso-105.json b/scripts/layouts/kle/iso-105.json new file mode 100644 index 0000000..c0797a8 --- /dev/null +++ b/scripts/layouts/kle/iso-105.json @@ -0,0 +1,220 @@ +[ + { + "name": "ISO 105" + }, + [ + "Esc", + { + "x": 1 + }, + "F1", + "F2", + "F3", + "F4", + { + "x": 0.5 + }, + "F5", + "F6", + "F7", + "F8", + { + "x": 0.5 + }, + "F9", + "F10", + "F11", + "F12", + { + "x": 0.25 + }, + "PrtSc", + "Scroll Lock", + "Pause\nBreak" + ], + [ + { + "y": 0.5 + }, + "¬\n`", + "!\n1", + "\"\n2", + "£\n3", + "$\n4", + "%\n5", + "^\n6", + "&\n7", + "*\n8", + "(\n9", + ")\n0", + "_\n-", + "+\n=", + { + "w": 2 + }, + "Backspace", + { + "x": 0.25 + }, + "Insert", + "Home", + "PgUp", + { + "x": 0.25 + }, + "Num Lock", + "/", + "*", + "-" + ], + [ + { + "w": 1.5 + }, + "Tab", + "Q", + "W", + "E", + "R", + "T", + "Y", + "U", + "I", + "O", + "P", + "{\n[", + "}\n]", + { + "x": 0.25, + "w": 1.25, + "h": 2, + "w2": 1.5, + "h2": 1, + "x2": -0.25 + }, + "Enter", + { + "x": 0.25 + }, + "Delete", + "End", + "PgDn", + { + "x": 0.25 + }, + "7\nHome", + "8\n↑", + "9\nPgUp", + { + "h": 2 + }, + "+" + ], + [ + { + "w": 1.75 + }, + "Caps Lock", + "A", + "S", + "D", + "F", + "G", + "H", + "J", + "K", + "L", + ":\n;", + "@\n'", + "~\n#", + { + "x": 4.75 + }, + "4\n←", + "5", + "6\n→" + ], + [ + { + "w": 1.25 + }, + "Shift", + "|\n\\", + "Z", + "X", + "C", + "V", + "B", + "N", + "M", + "<\n,", + ">\n.", + "?\n/", + { + "w": 2.75 + }, + "Shift", + { + "x": 1.25 + }, + "↑", + { + "x": 1.25 + }, + "1\nEnd", + "2\n↓", + "3\nPgDn", + { + "h": 2 + }, + "Enter" + ], + [ + { + "w": 1.25 + }, + "Ctrl", + { + "w": 1.25 + }, + "Win", + { + "w": 1.25 + }, + "Alt", + { + "a": 7, + "w": 6.25 + }, + "", + { + "a": 4, + "w": 1.25 + }, + "AltGr", + { + "w": 1.25 + }, + "Win", + { + "w": 1.25 + }, + "Menu", + { + "w": 1.25 + }, + "Ctrl", + { + "x": 0.25 + }, + "←", + "↓", + "→", + { + "x": 0.25, + "w": 2 + }, + "0\nIns", + ".\nDel" + ] +] \ No newline at end of file diff --git a/scripts/layouts/kle/keycool-84.json b/scripts/layouts/kle/keycool-84.json new file mode 100644 index 0000000..777483c --- /dev/null +++ b/scripts/layouts/kle/keycool-84.json @@ -0,0 +1,167 @@ +[ + { + "name": "Keycool 84" + }, + [ + { + "a": 6 + }, + "Esc", + "F1", + "F2", + "F3", + "F4", + "F5", + "F6", + "F7", + "F8", + "F9", + "F10", + "F11", + "F12", + { + "a": 5 + }, + "PrtSc\nNmLk", + "Pause\nScrLk", + "Delete\nInsert" + ], + [ + { + "a": 4 + }, + "~\n`", + "!\n1", + "@\n2", + "#\n3", + "$\n4", + "%\n5", + "^\n6", + "&\n7", + "*\n8", + "(\n9", + ")\n0", + "_\n-", + "+\n=", + { + "a": 6, + "w": 2 + }, + "Backspace", + "Home" + ], + [ + { + "a": 4, + "w": 1.5 + }, + "Tab", + "Q", + "W", + "E", + "R", + "T", + "Y", + "U", + "I", + "O", + "P", + "{\n[", + "}\n]", + { + "w": 1.5 + }, + "|\n\\", + { + "a": 6 + }, + "Page Up" + ], + [ + { + "a": 4, + "w": 1.75 + }, + "Caps Lock", + "A", + "S", + "D", + "F", + "G", + "H", + "J", + "K", + "L", + ":\n;", + "\"\n'", + { + "a": 6, + "w": 2.25 + }, + "Enter", + "Page Down" + ], + [ + { + "w": 2.25 + }, + "Shift", + { + "a": 4 + }, + "Z", + "X", + "C", + "V", + "B", + "N", + "M", + "<\n,", + ">\n.", + "?\n/", + { + "a": 6, + "w": 1.75 + }, + "Shift", + { + "a": 7 + }, + "↑", + { + "a": 6 + }, + "End" + ], + [ + { + "w": 1.25 + }, + "Ctrl", + { + "w": 1.25 + }, + "Win", + { + "w": 1.25 + }, + "Alt", + { + "a": 7, + "w": 6.25 + }, + "", + { + "a": 6 + }, + "Alt", + "Fn", + "Ctrl", + { + "a": 7 + }, + "←", + "↓", + "→" + ] +] \ No newline at end of file diff --git a/scripts/layouts/layout_kle.gd b/scripts/layouts/layout_kle.gd index 3fbc648..1755ecd 100644 --- a/scripts/layouts/layout_kle.gd +++ b/scripts/layouts/layout_kle.gd @@ -12,14 +12,18 @@ const LABEL_TO_KEYCODE_MAP: Dictionary[String, Key] = { ",": KEY_COMMA, ".": KEY_PERIOD, "/": KEY_SLASH, + "#": KEY_NUMBERSIGN, "Esc": KEY_ESCAPE, "Back Space": KEY_BACKSPACE, "Caps Lock": KEY_CAPSLOCK, "Win": KEY_META, + "AltGr": KEY_ALT, "PrtSc": KEY_PRINT, "Scroll Lock": KEY_SCROLLLOCK, "PgUp": KEY_PAGEUP, + "Page Up": KEY_PAGEUP, "PgDn": KEY_PAGEDOWN, + "Page Down": KEY_PAGEDOWN, "Num Lock": KEY_NUMLOCK, "*": KEY_KP_MULTIPLY, "+": KEY_KP_ADD, @@ -181,7 +185,11 @@ func _get_keycode_from_legend(legend: String, data_key: Dictionary) -> Key: ): keycode = LABEL_TO_KEYCODE_MAP[labels[1] if labels.size() == 2 else labels[0]] + if keycode == KEY_NONE and labels.size() == 2: + keycode = LABEL_TO_KEYCODE_MAP[labels[0]] + if keycode == KEY_NONE: - printerr("could not recognize key label '%s'" % legend) + printerr("could not recognize key label %s" % labels) + return KEY_UNKNOWN return keycode