{"id":15142140,"url":"https://github.com/neradoc/circuitpython_keyboard_layouts","last_synced_at":"2025-10-23T19:31:13.679Z","repository":{"id":39676016,"uuid":"384568783","full_name":"Neradoc/Circuitpython_Keyboard_Layouts","owner":"Neradoc","description":"A repository of keyboard layouts for Circuitpython, for HID keyboards over USB or BLE.","archived":false,"fork":false,"pushed_at":"2023-11-21T23:08:07.000Z","size":2677,"stargazers_count":91,"open_issues_count":9,"forks_count":18,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-10-09T22:41:42.793Z","etag":null,"topics":["circuitpython","keyboard","keyboard-layout"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Neradoc.png","metadata":{"files":{"readme":"README-DEV.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-09T23:07:16.000Z","updated_at":"2024-10-02T16:32:21.000Z","dependencies_parsed_at":"2024-09-21T15:00:33.957Z","dependency_job_id":"85906bda-ce26-47d3-be28-05ad9d74a561","html_url":"https://github.com/Neradoc/Circuitpython_Keyboard_Layouts","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neradoc%2FCircuitpython_Keyboard_Layouts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neradoc%2FCircuitpython_Keyboard_Layouts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neradoc%2FCircuitpython_Keyboard_Layouts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neradoc%2FCircuitpython_Keyboard_Layouts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Neradoc","download_url":"https://codeload.github.com/Neradoc/Circuitpython_Keyboard_Layouts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219867955,"owners_count":16555810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circuitpython","keyboard","keyboard-layout"],"created_at":"2024-09-26T09:23:36.094Z","updated_at":"2025-10-23T19:31:12.694Z","avatar_url":"https://github.com/Neradoc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### KeyboardLayoutBase class\n\n- ASCII_TO_KEYCODE is a bytes string with the keycode for each low-ascii character at the ascii value place. The keycode for \"u\" is at: `ASCII_TO_KEYCODE[ord(\"u\")]`. Since the keycode value is below 0x80, the high bit is used to encode if the shift key is needed.\n- `NEED_ALTGR` lists characters that require the altgr key in addition.\n- `HIGHER_ASCII` is a dictionary that associates the `ord()` int value of high ascii and utf8 characters of one or more bytes to the keycode.\n- `COMBINED_KEYS` is a table (dictionary) of characters like `Ñ` that can be accessed by typing first a dead key (like `~`) followed by a regular key (like `N`) - on a Windows French keyboard for example.\n  - Indexes are `ord()` int values of each character.\n  - The value is an int encoding 2 bytes.\n  - The upper byte is the keycode of the first key, including the shift bit.\n  - The lower byte is the ascii code of the second key (a-z, A-Z or space).\n  - The lower byte's high bit also encodes whether or not the first key needs altgr, so as not to pack NEEDS_ALTGR with a bunch of characters.\n\nWith the `Ñ` example:\n- `~` is altgr + `é`, `é` is keycode 0x1F\n- `N` is ascii code 0x4E, with the altgr bit becomes 0xCE\n- `Ñ` is therefore `0xD1: 0x1FCE,`\n- When typing, \"N\" is looked up: `ASCII_TO_KEYCODE[0x4E] == 0x91` (shift+0x11)\n- So `write(\"Ñ\")` sends the keycodes: `(0xE6, 0x1F)` (altgr+é) then `(0xE1, 0x11)` (shift+n)\n\nUsing int values to index the dictionaries, and as values for the `COMBINED_KEYS` table reduces the memory size compared to strings and bytestrings.\n\n### Layouts and KeyboardLayout classes\n\nEvery layout class is called KeyboardLayout, to make changing layout easier without having a different class name in every file, and have to guess or lookup the class name (is it CamelCase of the module name ? Is it US or Us ?). For compatibility, I added `KeyboardLayout = KeyboardLayoutUS` in the US keyboard layout. Importing multiple layouts is possible by using the full `module.KeyboardLayout` name, or `import KeyboardLayout as ...`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneradoc%2Fcircuitpython_keyboard_layouts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneradoc%2Fcircuitpython_keyboard_layouts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneradoc%2Fcircuitpython_keyboard_layouts/lists"}