Replace unsqu33kr with squeek2lvgl

This commit is contained in:
Johannes Marbach 2021-09-19 13:35:53 +02:00
parent 55410bb5af
commit f8df85dc50
17 changed files with 887 additions and 801 deletions

3
.gitmodules vendored
View file

@ -4,3 +4,6 @@
[submodule "lvgl"]
path = lvgl
url = https://github.com/littlevgl/lvgl.git
[submodule "squeek2lvgl"]
path = squeek2lvgl
url = https://gitlab.com/cherrypicker/squeek2lvgl.git

View file

@ -10,7 +10,7 @@ BIN = unl0kr
#Collect the files to compile
MAINSRC = ./cursor.c ./main.c ./libinput_multi.c ./libinput_xkb.c ./layouts.c ./montserrat_extended_32.c ./uskr_layouts.c
MAINSRC = ./cursor.c ./main.c ./libinput_multi.c ./libinput_xkb.c ./montserrat_extended_32.c ./sq2lv_layouts.c ./squeek2lvgl/sq2lv.c
include $(LVGL_DIR)/lvgl/lvgl.mk
include $(LVGL_DIR)/lv_drivers/lv_drivers.mk

View file

@ -103,12 +103,14 @@ $ npx lv_font_conv --bpp 4 --size 32 --no-compress -o montserrat_extended_32.c -
## Changing layouts
The layouts in [uskr_layouts.h] and [uskr_layouts.c] are generated from [squeekboard layouts] using the [unsqu33kr/unsqu33kr.py] script. To regenerate the files, run
Unl0kr uses [squeekboard layouts] converted to C via [squeek2lvgl]. To regenerate the layouts, run
```
$ ./generate-keymaps.sh
$ ./regenerate-layouts.sh
```
from the root of the repository.
## Screen recording
For demonstration purposes you can record the framebuffer device, e.g. with ffmpeg:
@ -131,17 +133,15 @@ The Font Awesome font is licensed under the Open Font License version 1.1.
[lvgl]: https://github.com/lvgl/lvgl
[lv_drivers]: https://github.com/lvgl/lv_drivers
[lv_port_linux_frame_buffer]: https://github.com/lvgl/lv_port_linux_frame_buffer]
[lv_sim_emscripten]: https://github.com/lvgl/lv_sim_emscripten/blob/master/mouse_cursor_icon.c]
[lv_port_linux_frame_buffer]: https://github.com/lvgl/lv_port_linux_frame_buffer
[lv_sim_emscripten]: https://github.com/lvgl/lv_sim_emscripten/blob/master/mouse_cursor_icon.c
[libinput]: https://gitlab.freedesktop.org/libinput/libinput
[libxkbcommon]: https://github.com/xkbcommon/libxkbcommon
[online font converter]: https://lvgl.io/tools/fontconverter
[Font Awesome]: https://lvgl.io/assets/others/FontAwesome5-Solid+Brands+Regular.woff
[adjust]: https://fontawesome.com/v5.15/icons/adjust?style=solid
[uskr_layouts.h]: uskr_layouts.h
[uskr_layouts.c]: uskr_layouts.c
[unsqu33kr/unsqu33kr.py]: unsqu33kr/unsqu33kr.py
[squeekboard layouts]: https://gitlab.gnome.org/World/Phosh/squeekboard/-/tree/master/data/keyboards
[squeek2lvgl]: https://gitlab.com/cherrypicker/squeek2lvgl
[fix(examples) don't compile assets unless needed]: https://github.com/lvgl/lvgl/pull/2523
[feat(btnmatrix): add option to show popovers on button press]: https://github.com/lvgl/lvgl/pull/2537
[feat(msgbox): add function to get selected button index]: https://github.com/lvgl/lvgl/pull/2538

View file

@ -1,5 +0,0 @@
#!/bin/bash
cd unsqu33kr
pipenv install
pipenv run python unsqu33kr.py --output ..

View file

@ -1,31 +0,0 @@
#include "layouts.h"
#include "uskr_layouts.h"
char *get_layout_names(void) {
return names;
}
char *get_special_layer_trigger(uskr_layout_t layout) {
if (layout < 0 || layout >= USKR_NUM_LAYOUTS) {
return NULL;
}
return triggers_special[layout];
}
void apply_layout(lv_obj_t *keyboard, uskr_layout_t layout) {
if (layout < 0 || layout >= USKR_NUM_LAYOUTS) {
return;
}
if (keys_lower[layout][0] != NULL) {
lv_keyboard_set_map(keyboard, LV_KEYBOARD_MODE_TEXT_LOWER, keys_lower[layout], attributes_lower[layout]);
}
if (keys_upper[layout][0] != NULL) {
lv_keyboard_set_map(keyboard, LV_KEYBOARD_MODE_TEXT_UPPER, keys_upper[layout], attributes_upper[layout]);
}
if (keys_numbers[layout][0] != NULL) {
lv_keyboard_set_map(keyboard, LV_KEYBOARD_MODE_SPECIAL, keys_numbers[layout], attributes_numbers[layout]);
}
if (keys_special[layout][0] != NULL) {
lv_keyboard_set_map(keyboard, LV_KEYBOARD_MODE_NUMBER, keys_special[layout], attributes_special[layout]);
}
}

View file

@ -1,10 +0,0 @@
#ifndef LAYOUTS_H
#define LAYOUTS_H
#include "uskr_layouts.h"
char *get_layout_names(void);
char *get_special_layer_trigger(uskr_layout_t layout);
void apply_layout(lv_obj_t *keyboard, uskr_layout_t layout);
#endif /* LAYOUTS_H */

2
lvgl

@ -1 +1 @@
Subproject commit efc5bb40d9868e01616f20160a83e77ae104fe2c
Subproject commit 3e0ddd028511c6c4a0ba33a15526f404b31a50b8

33
main.c
View file

@ -12,7 +12,8 @@
#include "cursor.h"
#include "libinput_multi.h"
#include "libinput_xkb.h"
#include "layouts.h"
#include "squeek2lvgl/sq2lv.h"
// Custom fonts
@ -32,8 +33,6 @@ lv_obj_t *keyboard = NULL;
lv_style_t style_text_normal;
char *special_layer_trigger = NULL;
// Helpers
void set_theme(bool is_dark);
@ -80,16 +79,16 @@ void keyboard_event_value_changed_cb(lv_event_t * e) {
lv_obj_t *obj = lv_event_get_target(e);
uint16_t btn_id = lv_btnmatrix_get_selected_btn(obj);
if(btn_id == LV_BTNMATRIX_BTN_NONE) return;
const char * txt = lv_btnmatrix_get_btn_text(obj, lv_btnmatrix_get_selected_btn(obj));
if(txt == NULL) return;
if(strcmp(txt, special_layer_trigger) == 0) {
lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_NUMBER);
} else {
lv_keyboard_def_event_cb(e);
if (btn_id == LV_BTNMATRIX_BTN_NONE) {
return;
}
if (sq2lv_is_layer_switcher(obj, btn_id)) {
sq2lv_switch_layer(obj, btn_id);
return;
}
lv_keyboard_def_event_cb(e);
}
void discloser_event_cb(lv_event_t *e);
@ -143,8 +142,7 @@ void keymap_dropdown_event_cb(lv_event_t *e) {
}
case LV_EVENT_VALUE_CHANGED: {
uint16_t idx = lv_dropdown_get_selected(lv_event_get_target(e));
apply_layout(keyboard, idx);
special_layer_trigger = get_special_layer_trigger(idx);
sq2lv_switch_layout(keyboard, idx);
break;
}
default:
@ -368,7 +366,7 @@ int main(void)
// Keymap dropdown
lv_obj_t *dropdown = lv_dropdown_create(btn_row);
lv_dropdown_set_options(dropdown, get_layout_names());
lv_dropdown_set_options(dropdown, sq2lv_layout_short_names);
lv_obj_set_height(dropdown, 64);
lv_obj_set_width(dropdown, 160);
lv_obj_set_grid_cell(dropdown, LV_GRID_ALIGN_START, 2, 1, LV_GRID_ALIGN_CENTER, 0, 1);
@ -385,9 +383,8 @@ int main(void)
lv_label_set_text(power_btn_label, LV_SYMBOL_POWER);
lv_obj_add_event_cb(power_btn, power_btn_event_cb, LV_EVENT_CLICKED, NULL);
// Apply default layout
apply_layout(keyboard, 0);
special_layer_trigger = get_special_layer_trigger(0);
/* Apply default keyboard layout */
sq2lv_switch_layout(keyboard, 0);
// Run lvgl in tickless mode
while(1) {

29
regenerate-layouts.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/bash
# Copyright 2021 Johannes Marbach
#
# This file is part of unl0kr, hereafter referred to as the program.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
cd squeek2lvgl
pipenv install
pipenv run python squeek2lvgl.py \
--input us.yaml \
--input de.yaml \
--input es.yaml \
--input fr.yaml \
--surround-space-with-arrows \
--output ..

770
sq2lv_layouts.c Normal file
View file

@ -0,0 +1,770 @@
/**
* Auto-generated with unsqu33kr
**/
#include "sq2lv_layouts.h"
/**
* Layout: US English - generated from us
**/
static const char * const name_us = "US English";
static const char * const short_name_us = "us";
/* Layer: Lowercase letters - generated from base */
static const int num_keys_lower_us = 34;
static const char * const keycaps_lower_us[] = { \
"q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "\n", \
"a", "s", "d", "f", "g", "h", "j", "k", "l", "\n", \
"ABC", "z", "x", "c", "v", "b", "n", "m", LV_SYMBOL_BACKSPACE, "\n", \
"1#", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, ".", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_lower_us[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_lower_us = 0;
static const int modifier_idxs_lower_us[] = { \
\
};
static const int num_switchers_lower_us = 2;
static const int switcher_idxs_lower_us[] = { \
19, 28 \
};
static const int switcher_dests_lower_us[] = { \
1, 2 \
};
/* Layer: Uppercase letters - generated from upper */
static const int num_keys_upper_us = 34;
static const char * const keycaps_upper_us[] = { \
"Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "\n", \
"A", "S", "D", "F", "G", "H", "J", "K", "L", "\n", \
"abc", "Z", "X", "C", "V", "B", "N", "M", LV_SYMBOL_BACKSPACE, "\n", \
"1#", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, ".", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_upper_us[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_upper_us = 0;
static const int modifier_idxs_upper_us[] = { \
\
};
static const int num_switchers_upper_us = 2;
static const int switcher_idxs_upper_us[] = { \
19, 28 \
};
static const int switcher_dests_upper_us[] = { \
0, 2 \
};
/* Layer: Numbers / symbols - generated from numbers */
static const int num_keys_numbers_us = 34;
static const char * const keycaps_numbers_us[] = { \
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "\n", \
"@", "#", "$", "%", "&", "-", "_", "+", "(", ")", "\n", \
",", "\"", "'", ":", ";", "!", "?", LV_SYMBOL_BACKSPACE, "\n", \
"abc", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, ".", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_numbers_us[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_numbers_us = 0;
static const int modifier_idxs_numbers_us[] = { \
\
};
static const int num_switchers_numbers_us = 1;
static const int switcher_idxs_numbers_us[] = { \
28 \
};
static const int switcher_dests_numbers_us[] = { \
0 \
};
/* Layer array */
static const int num_layers_us = 3;
static const sq2lv_layer_t layers_us[] = {
{
.num_keys = num_keys_lower_us,
.keycaps = keycaps_lower_us,
.attributes = attributes_lower_us,
.num_modifiers = num_modifiers_lower_us,
.modifier_idxs = modifier_idxs_lower_us,
.num_switchers = num_switchers_lower_us,
.switcher_idxs = switcher_idxs_lower_us,
.switcher_dests = switcher_dests_lower_us
},
{
.num_keys = num_keys_upper_us,
.keycaps = keycaps_upper_us,
.attributes = attributes_upper_us,
.num_modifiers = num_modifiers_upper_us,
.modifier_idxs = modifier_idxs_upper_us,
.num_switchers = num_switchers_upper_us,
.switcher_idxs = switcher_idxs_upper_us,
.switcher_dests = switcher_dests_upper_us
},
{
.num_keys = num_keys_numbers_us,
.keycaps = keycaps_numbers_us,
.attributes = attributes_numbers_us,
.num_modifiers = num_modifiers_numbers_us,
.modifier_idxs = modifier_idxs_numbers_us,
.num_switchers = num_switchers_numbers_us,
.switcher_idxs = switcher_idxs_numbers_us,
.switcher_dests = switcher_dests_numbers_us
}
};
/**
* Layout: German - generated from de
**/
static const char * const name_de = "German";
static const char * const short_name_de = "de";
/* Layer: Lowercase letters - generated from base */
static const int num_keys_lower_de = 36;
static const char * const keycaps_lower_de[] = { \
"q", "w", "e", "r", "t", "z", "u", "i", "o", "p", "\n", \
"a", "s", "d", "f", "g", "h", "j", "k", "l", "\n", \
"ABC", "y", "x", "c", "v", "b", "n", "m", LV_SYMBOL_BACKSPACE, "\n", \
"1#", "äöü", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, ",", ".", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_lower_de[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_lower_de = 0;
static const int modifier_idxs_lower_de[] = { \
\
};
static const int num_switchers_lower_de = 3;
static const int switcher_idxs_lower_de[] = { \
19, 28, 29 \
};
static const int switcher_dests_lower_de[] = { \
1, 2, 3 \
};
/* Layer: Uppercase letters - generated from upper */
static const int num_keys_upper_de = 36;
static const char * const keycaps_upper_de[] = { \
"Q", "W", "E", "R", "T", "Z", "U", "I", "O", "P", "\n", \
"A", "S", "D", "F", "G", "H", "J", "K", "L", "\n", \
"abc", "Y", "X", "C", "V", "B", "N", "M", LV_SYMBOL_BACKSPACE, "\n", \
"1#", "äöü", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "!", "?", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_upper_de[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_upper_de = 0;
static const int modifier_idxs_upper_de[] = { \
\
};
static const int num_switchers_upper_de = 2;
static const int switcher_idxs_upper_de[] = { \
19, 28 \
};
static const int switcher_dests_upper_de[] = { \
0, 2 \
};
/* Layer: Numbers / symbols - generated from numbers */
static const int num_keys_numbers_de = 36;
static const char * const keycaps_numbers_de[] = { \
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "\n", \
"@", "#", "", "%", "&", "-", "_", "+", "(", ")", "\n", \
";", "\"", "'", ":", "=", "<", ">", LV_SYMBOL_BACKSPACE, "\n", \
"abc", "äöü", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, ",", ".", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_numbers_de[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_numbers_de = 0;
static const int modifier_idxs_numbers_de[] = { \
\
};
static const int num_switchers_numbers_de = 1;
static const int switcher_idxs_numbers_de[] = { \
28 \
};
static const int switcher_dests_numbers_de[] = { \
0 \
};
/* Layer: Special characters - generated from eschars */
static const int num_keys_special_de = 37;
static const char * const keycaps_special_de[] = { \
"ä", "è", "é", "ö", "ü", "Ä", "È", "É", "Ö", "Ü", "\n", \
"à", "â", "ê", "î", "ô", "À", "Â", "È", "Î", "Ô", "\n", \
"1#", "«", "»", "ç", "Ç", "æ", "œ", "ß", LV_SYMBOL_BACKSPACE, "\n", \
"abc", "äöü", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "", "", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_special_de[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_special_de = 0;
static const int modifier_idxs_special_de[] = { \
\
};
static const int num_switchers_special_de = 3;
static const int switcher_idxs_special_de[] = { \
20, 29, 30 \
};
static const int switcher_dests_special_de[] = { \
2, 0, 0 \
};
/* Layer array */
static const int num_layers_de = 4;
static const sq2lv_layer_t layers_de[] = {
{
.num_keys = num_keys_lower_de,
.keycaps = keycaps_lower_de,
.attributes = attributes_lower_de,
.num_modifiers = num_modifiers_lower_de,
.modifier_idxs = modifier_idxs_lower_de,
.num_switchers = num_switchers_lower_de,
.switcher_idxs = switcher_idxs_lower_de,
.switcher_dests = switcher_dests_lower_de
},
{
.num_keys = num_keys_upper_de,
.keycaps = keycaps_upper_de,
.attributes = attributes_upper_de,
.num_modifiers = num_modifiers_upper_de,
.modifier_idxs = modifier_idxs_upper_de,
.num_switchers = num_switchers_upper_de,
.switcher_idxs = switcher_idxs_upper_de,
.switcher_dests = switcher_dests_upper_de
},
{
.num_keys = num_keys_numbers_de,
.keycaps = keycaps_numbers_de,
.attributes = attributes_numbers_de,
.num_modifiers = num_modifiers_numbers_de,
.modifier_idxs = modifier_idxs_numbers_de,
.num_switchers = num_switchers_numbers_de,
.switcher_idxs = switcher_idxs_numbers_de,
.switcher_dests = switcher_dests_numbers_de
},
{
.num_keys = num_keys_special_de,
.keycaps = keycaps_special_de,
.attributes = attributes_special_de,
.num_modifiers = num_modifiers_special_de,
.modifier_idxs = modifier_idxs_special_de,
.num_switchers = num_switchers_special_de,
.switcher_idxs = switcher_idxs_special_de,
.switcher_dests = switcher_dests_special_de
}
};
/**
* Layout: Spanish - generated from es
**/
static const char * const name_es = "Spanish";
static const char * const short_name_es = "es";
/* Layer: Lowercase letters - generated from base */
static const int num_keys_lower_es = 37;
static const char * const keycaps_lower_es[] = { \
"q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "\n", \
"a", "s", "d", "f", "g", "h", "j", "k", "l", "ñ", "\n", \
"ABC", "z", "x", "c", "v", "b", "n", "m", LV_SYMBOL_BACKSPACE, "\n", \
"1#", "áéí", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "?", ".", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_lower_es[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_lower_es = 0;
static const int modifier_idxs_lower_es[] = { \
\
};
static const int num_switchers_lower_es = 3;
static const int switcher_idxs_lower_es[] = { \
20, 29, 30 \
};
static const int switcher_dests_lower_es[] = { \
1, 2, 3 \
};
/* Layer: Uppercase letters - generated from upper */
static const int num_keys_upper_es = 37;
static const char * const keycaps_upper_es[] = { \
"Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "\n", \
"A", "S", "D", "F", "G", "H", "J", "K", "L", "Ñ", "\n", \
"abc", "Z", "X", "C", "V", "B", "N", "M", LV_SYMBOL_BACKSPACE, "\n", \
"1#", "áéí", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "¿", ".", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_upper_es[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_upper_es = 0;
static const int modifier_idxs_upper_es[] = { \
\
};
static const int num_switchers_upper_es = 2;
static const int switcher_idxs_upper_es[] = { \
20, 29 \
};
static const int switcher_dests_upper_es[] = { \
0, 2 \
};
/* Layer: Numbers / symbols - generated from numbers */
static const int num_keys_numbers_es = 36;
static const char * const keycaps_numbers_es[] = { \
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "\n", \
"@", "#", "", "%", "&", "-", "_", "+", "(", ")", "\n", \
",", "\"", "'", ":", ";", "!", "=", LV_SYMBOL_BACKSPACE, "\n", \
"abc", "áéí", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "?", ".", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_numbers_es[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_numbers_es = 0;
static const int modifier_idxs_numbers_es[] = { \
\
};
static const int num_switchers_numbers_es = 1;
static const int switcher_idxs_numbers_es[] = { \
28 \
};
static const int switcher_dests_numbers_es[] = { \
0 \
};
/* Layer: Special characters - generated from eschars */
static const int num_keys_special_es = 37;
static const char * const keycaps_special_es[] = { \
"á", "é", "í", "ó", "ú", "Á", "É", "Í", "Ó", "Ú", "\n", \
"à", "è", "ì", "ò", "ù", "À", "È", "Ì", "Ò", "Ù", "\n", \
"1#", "ü", "ç", "ï", "Ü", "Ç", "Ï", "¡", LV_SYMBOL_BACKSPACE, "\n", \
"abc", "áéí", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "«", "»", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_special_es[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_special_es = 0;
static const int modifier_idxs_special_es[] = { \
\
};
static const int num_switchers_special_es = 3;
static const int switcher_idxs_special_es[] = { \
20, 29, 30 \
};
static const int switcher_dests_special_es[] = { \
2, 0, 0 \
};
/* Layer array */
static const int num_layers_es = 4;
static const sq2lv_layer_t layers_es[] = {
{
.num_keys = num_keys_lower_es,
.keycaps = keycaps_lower_es,
.attributes = attributes_lower_es,
.num_modifiers = num_modifiers_lower_es,
.modifier_idxs = modifier_idxs_lower_es,
.num_switchers = num_switchers_lower_es,
.switcher_idxs = switcher_idxs_lower_es,
.switcher_dests = switcher_dests_lower_es
},
{
.num_keys = num_keys_upper_es,
.keycaps = keycaps_upper_es,
.attributes = attributes_upper_es,
.num_modifiers = num_modifiers_upper_es,
.modifier_idxs = modifier_idxs_upper_es,
.num_switchers = num_switchers_upper_es,
.switcher_idxs = switcher_idxs_upper_es,
.switcher_dests = switcher_dests_upper_es
},
{
.num_keys = num_keys_numbers_es,
.keycaps = keycaps_numbers_es,
.attributes = attributes_numbers_es,
.num_modifiers = num_modifiers_numbers_es,
.modifier_idxs = modifier_idxs_numbers_es,
.num_switchers = num_switchers_numbers_es,
.switcher_idxs = switcher_idxs_numbers_es,
.switcher_dests = switcher_dests_numbers_es
},
{
.num_keys = num_keys_special_es,
.keycaps = keycaps_special_es,
.attributes = attributes_special_es,
.num_modifiers = num_modifiers_special_es,
.modifier_idxs = modifier_idxs_special_es,
.num_switchers = num_switchers_special_es,
.switcher_idxs = switcher_idxs_special_es,
.switcher_dests = switcher_dests_special_es
}
};
/**
* Layout: French - generated from fr
**/
static const char * const name_fr = "French";
static const char * const short_name_fr = "fr";
/* Layer: Lowercase letters - generated from base */
static const int num_keys_lower_fr = 35;
static const char * const keycaps_lower_fr[] = { \
"a", "z", "e", "r", "t", "y", "u", "i", "o", "p", "\n", \
"q", "s", "d", "f", "g", "h", "j", "k", "l", "m", "\n", \
"ABC", "w", "x", "c", "v", "b", "n", ".", LV_SYMBOL_BACKSPACE, "\n", \
"1#", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "àéô", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_lower_fr[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_lower_fr = 0;
static const int modifier_idxs_lower_fr[] = { \
\
};
static const int num_switchers_lower_fr = 3;
static const int switcher_idxs_lower_fr[] = { \
20, 29, 33 \
};
static const int switcher_dests_lower_fr[] = { \
1, 2, 3 \
};
/* Layer: Uppercase letters - generated from upper */
static const int num_keys_upper_fr = 35;
static const char * const keycaps_upper_fr[] = { \
"A", "Z", "E", "R", "T", "Y", "U", "I", "O", "P", "\n", \
"Q", "S", "D", "F", "G", "H", "J", "K", "L", "M", "\n", \
"abc", "W", "X", "C", "V", "B", "N", ",", LV_SYMBOL_BACKSPACE, "\n", \
"1#", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "àéô", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_upper_fr[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_upper_fr = 0;
static const int modifier_idxs_upper_fr[] = { \
\
};
static const int num_switchers_upper_fr = 2;
static const int switcher_idxs_upper_fr[] = { \
20, 29 \
};
static const int switcher_dests_upper_fr[] = { \
0, 2 \
};
/* Layer: Numbers / symbols - generated from numbers */
static const int num_keys_numbers_fr = 34;
static const char * const keycaps_numbers_fr[] = { \
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "\n", \
"@", "#", "", "%", "&", "-", "_", "+", "(", ")", "\n", \
",", "\"", "'", ":", ";", "!", "?", LV_SYMBOL_BACKSPACE, "\n", \
"abc", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "àéô", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_numbers_fr[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_numbers_fr = 0;
static const int modifier_idxs_numbers_fr[] = { \
\
};
static const int num_switchers_numbers_fr = 1;
static const int switcher_idxs_numbers_fr[] = { \
28 \
};
static const int switcher_dests_numbers_fr[] = { \
0 \
};
/* Layer: Special characters - generated from eschars */
static const int num_keys_special_fr = 35;
static const char * const keycaps_special_fr[] = { \
"à", "â", "ç", "é", "è", "ê", "î", "ô", "ù", "û", "\n", \
"À", "Â", "Ç", "É", "È", "Ê", "Î", "Ô", "Ù", "Û", "\n", \
"1#", "æ", "œ", "ä", "ë", "ï", "ö", "ü", LV_SYMBOL_BACKSPACE, "\n", \
"abc", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "àéô", LV_SYMBOL_OK, "" \
};
static const lv_btnmatrix_ctrl_t attributes_special_fr[] = { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
};
static const int num_modifiers_special_fr = 0;
static const int modifier_idxs_special_fr[] = { \
\
};
static const int num_switchers_special_fr = 3;
static const int switcher_idxs_special_fr[] = { \
20, 29, 33 \
};
static const int switcher_dests_special_fr[] = { \
2, 0, 0 \
};
/* Layer array */
static const int num_layers_fr = 4;
static const sq2lv_layer_t layers_fr[] = {
{
.num_keys = num_keys_lower_fr,
.keycaps = keycaps_lower_fr,
.attributes = attributes_lower_fr,
.num_modifiers = num_modifiers_lower_fr,
.modifier_idxs = modifier_idxs_lower_fr,
.num_switchers = num_switchers_lower_fr,
.switcher_idxs = switcher_idxs_lower_fr,
.switcher_dests = switcher_dests_lower_fr
},
{
.num_keys = num_keys_upper_fr,
.keycaps = keycaps_upper_fr,
.attributes = attributes_upper_fr,
.num_modifiers = num_modifiers_upper_fr,
.modifier_idxs = modifier_idxs_upper_fr,
.num_switchers = num_switchers_upper_fr,
.switcher_idxs = switcher_idxs_upper_fr,
.switcher_dests = switcher_dests_upper_fr
},
{
.num_keys = num_keys_numbers_fr,
.keycaps = keycaps_numbers_fr,
.attributes = attributes_numbers_fr,
.num_modifiers = num_modifiers_numbers_fr,
.modifier_idxs = modifier_idxs_numbers_fr,
.num_switchers = num_switchers_numbers_fr,
.switcher_idxs = switcher_idxs_numbers_fr,
.switcher_dests = switcher_dests_numbers_fr
},
{
.num_keys = num_keys_special_fr,
.keycaps = keycaps_special_fr,
.attributes = attributes_special_fr,
.num_modifiers = num_modifiers_special_fr,
.modifier_idxs = modifier_idxs_special_fr,
.num_switchers = num_switchers_special_fr,
.switcher_idxs = switcher_idxs_special_fr,
.switcher_dests = switcher_dests_special_fr
}
};
/**
* Public interface
**/
const int sq2lv_num_layouts = 4;
const sq2lv_layout_t sq2lv_layouts[] = {
/* US English */
{
.name = name_us,
.short_name = short_name_us,
.num_layers = num_layers_us,
.layers = layers_us
},
/* German */
{
.name = name_de,
.short_name = short_name_de,
.num_layers = num_layers_de,
.layers = layers_de
},
/* Spanish */
{
.name = name_es,
.short_name = short_name_es,
.num_layers = num_layers_es,
.layers = layers_es
},
/* French */
{
.name = name_fr,
.short_name = short_name_fr,
.num_layers = num_layers_fr,
.layers = layers_fr
}
};
const char * const sq2lv_layout_names =
"US English" "\n"
"German" "\n"
"Spanish" "\n"
"French";
const char * const sq2lv_layout_short_names =
"us" "\n"
"de" "\n"
"es" "\n"
"fr";

60
sq2lv_layouts.h Normal file
View file

@ -0,0 +1,60 @@
/**
* Auto-generated with unsqu33kr
**/
#ifndef SQ2LV_LAYOUTS_H
#define SQ2LV_LAYOUTS_H
#include "lvgl/lvgl.h"
#define SQ2LV_SCANCODES_ENABLED 0
/* Layout IDs, values can be used as indexes into the sq2lv_layouts array */
typedef enum {
SQ2LV_LAYOUT_US = 0,
SQ2LV_LAYOUT_DE = 1,
SQ2LV_LAYOUT_ES = 2,
SQ2LV_LAYOUT_FR = 3
} sq2lv_layout_id_t;
/* Layer type */
typedef struct {
/* Number of keys */
const int num_keys;
/* Key caps */
const char ** const keycaps;
/* Button matrix attributes */
const lv_btnmatrix_ctrl_t * const attributes;
/* Number of modifier keys */
const int num_modifiers;
/* Button indexes of modifier keys */
const int * const modifier_idxs;
/* Number of buttons that trigger a layer switch */
const int num_switchers;
/* Button indexes that trigger a layer switch */
const int * const switcher_idxs;
/* Indexes of layers to jump to when triggering layer switch buttons */
const int * const switcher_dests;
} sq2lv_layer_t;
/* Layout type */
typedef struct {
/* Layout name */
const char * const name;
/* Layout short name */
const char * const short_name;
/* Total number of layers */
const int num_layers;
/* Layers array */
const sq2lv_layer_t * const layers;
} sq2lv_layout_t;
/* Layouts */
extern const int sq2lv_num_layouts;
extern const sq2lv_layout_t sq2lv_layouts[];
/* Layout names (suitable for use in lv_dropdown_t) */
extern const char * const sq2lv_layout_names;
extern const char * const sq2lv_layout_short_names;
#endif /* SQ2LV_LAYOUTS_H */

1
squeek2lvgl Submodule

@ -0,0 +1 @@
Subproject commit 061b53670cb495a6bd5c40251491ac73c18b12e6

View file

@ -1,13 +0,0 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
pyyaml = "*"
gitpython = "*"
[dev-packages]
[requires]
python_version = "3.8"

80
unsqu33kr/Pipfile.lock generated
View file

@ -1,80 +0,0 @@
{
"_meta": {
"hash": {
"sha256": "2d598f1754849a1e6f92a1ee95baaf2ced919bf20e44a4eec871521e772b0127"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.8"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"gitdb": {
"hashes": [
"sha256:6c4cc71933456991da20917998acbe6cf4fb41eeaab7d6d67fbc05ecd4c865b0",
"sha256:96bf5c08b157a666fec41129e6d327235284cca4c81e92109260f353ba138005"
],
"markers": "python_version >= '3.4'",
"version": "==4.0.7"
},
"gitpython": {
"hashes": [
"sha256:b838a895977b45ab6f0cc926a9045c8d1c44e2b653c1fcc39fe91f42c6e8f05b",
"sha256:fce760879cd2aebd2991b3542876dc5c4a909b30c9d69dfc488e504a8db37ee8"
],
"index": "pypi",
"version": "==3.1.18"
},
"pyyaml": {
"hashes": [
"sha256:08682f6b72c722394747bddaf0aa62277e02557c0fd1c42cb853016a38f8dedf",
"sha256:0f5f5786c0e09baddcd8b4b45f20a7b5d61a7e7e99846e3c799b05c7c53fa696",
"sha256:129def1b7c1bf22faffd67b8f3724645203b79d8f4cc81f674654d9902cb4393",
"sha256:294db365efa064d00b8d1ef65d8ea2c3426ac366c0c4368d930bf1c5fb497f77",
"sha256:3b2b1824fe7112845700f815ff6a489360226a5609b96ec2190a45e62a9fc922",
"sha256:3bd0e463264cf257d1ffd2e40223b197271046d09dadf73a0fe82b9c1fc385a5",
"sha256:4465124ef1b18d9ace298060f4eccc64b0850899ac4ac53294547536533800c8",
"sha256:49d4cdd9065b9b6e206d0595fee27a96b5dd22618e7520c33204a4a3239d5b10",
"sha256:4e0583d24c881e14342eaf4ec5fbc97f934b999a6828693a99157fde912540cc",
"sha256:5accb17103e43963b80e6f837831f38d314a0495500067cb25afab2e8d7a4018",
"sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e",
"sha256:6c78645d400265a062508ae399b60b8c167bf003db364ecb26dcab2bda048253",
"sha256:72a01f726a9c7851ca9bfad6fd09ca4e090a023c00945ea05ba1638c09dc3347",
"sha256:74c1485f7707cf707a7aef42ef6322b8f97921bd89be2ab6317fd782c2d53183",
"sha256:895f61ef02e8fed38159bb70f7e100e00f471eae2bc838cd0f4ebb21e28f8541",
"sha256:8c1be557ee92a20f184922c7b6424e8ab6691788e6d86137c5d93c1a6ec1b8fb",
"sha256:bb4191dfc9306777bc594117aee052446b3fa88737cd13b7188d0e7aa8162185",
"sha256:bfb51918d4ff3d77c1c856a9699f8492c612cde32fd3bcd344af9be34999bfdc",
"sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db",
"sha256:cb333c16912324fd5f769fff6bc5de372e9e7a202247b48870bc251ed40239aa",
"sha256:d2d9808ea7b4af864f35ea216be506ecec180628aced0704e34aca0b040ffe46",
"sha256:d483ad4e639292c90170eb6f7783ad19490e7a8defb3e46f97dfe4bacae89122",
"sha256:dd5de0646207f053eb0d6c74ae45ba98c3395a571a2891858e87df7c9b9bd51b",
"sha256:e1d4970ea66be07ae37a3c2e48b5ec63f7ba6804bdddfdbd3cfd954d25a82e63",
"sha256:e4fac90784481d221a8e4b1162afa7c47ed953be40d31ab4629ae917510051df",
"sha256:fa5ae20527d8e831e8230cbffd9f8fe952815b2b7dae6ffec25318803a7528fc",
"sha256:fd7f6999a8070df521b6384004ef42833b9bd62cfee11a09bda1079b4b704247",
"sha256:fdc842473cd33f45ff6bce46aea678a54e3d21f1b61a7750ce3c498eedfe25d6",
"sha256:fe69978f3f768926cfa37b867e3843918e012cf83f680806599ddce33c2c68b0"
],
"index": "pypi",
"version": "==5.4.1"
},
"smmap": {
"hashes": [
"sha256:7e65386bd122d45405ddf795637b7f7d2b532e7e401d46bbe3fb49b9986d5182",
"sha256:a9a7479e4c572e2e775c404dcd3080c8dc49f39918c2cf74913d30c4c478e3c2"
],
"markers": "python_version >= '3.5'",
"version": "==4.0.0"
}
},
"develop": {}
}

View file

@ -1,283 +0,0 @@
#!/usr/bin/env python3
import argparse
import git
import os
import sys
import tempfile
import yaml
outfile_c = 'uskr_layouts.c'
outfile_h = 'uskr_layouts.h'
repository_url = 'https://gitlab.gnome.org/World/Phosh/squeekboard.git'
rel_layouts_dir = 'data/keyboards'
layout_whitelist = ['de', 'es', 'fr', 'us']
layer_whitelist = ['base', 'upper', 'numbers', 'eschars']
quote_blacklist = ['LV_SYMBOL_BACKSPACE', 'LV_SYMBOL_LEFT', 'LV_SYMBOL_RIGHT', 'LV_SYMBOL_OK']
key_map = {
'"': '\\"',
'colon': ':',
'BackSpace': 'LV_SYMBOL_BACKSPACE',
'period': '.',
'preferences': None,
'Shift_L': {
'base': 'ABC',
'upper': 'abc'
},
'show_eschars': {
'de': 'äöü',
'es': 'áéí',
'fr': 'àéô'
},
'show_letters': 'abc',
'show_numbers': '1#',
'show_numbers_from_symbols': '1#',
'show_symbols': None,
'space': ['LV_SYMBOL_LEFT', ' ', 'LV_SYMBOL_RIGHT'],
'Return': 'LV_SYMBOL_OK'
}
layer_map = {
'base': 'lower',
'eschars': 'special'
}
layer_to_description = {
'base': 'Lowercase layer',
'upper': 'Uppercase layer',
'numbers': 'Number / symbol layer',
'eschars': 'Special characters'
}
name_map = {
'de': 'German',
'es': 'Spanish',
'fr': 'French',
'us': 'English (US)'
}
def parse_arguments():
parser = argparse.ArgumentParser(description='Convert squeekboard layouts to LVGL-compatible C code.')
parser.add_argument('--output', dest='output', type=str, help='output directory for generated files')
args = parser.parse_args()
if not args.output or not os.path.isdir(args.output):
sys.stderr.write('Error: no valid output directory specified')
sys.exit(1)
return args
def clone_squeekboard_repo(destination):
git.Repo.clone_from(repository_url, destination, depth=1)
def load_yaml(path):
with open(path, 'r') as stream:
try:
return yaml.safe_load(stream)
except yaml.YAMLError as exc:
print(exc)
def map_key(key, layer, name):
mapped = key_map[key] if key in key_map else key
if isinstance(mapped, dict):
if layer in mapped:
mapped = mapped[layer]
elif name in mapped:
mapped = mapped[name]
else:
None
if not mapped:
return []
if isinstance(mapped, list):
return mapped
return [mapped]
def map_layer(layer):
return layer_map[layer] if layer in layer_map else layer
def add_header(lines):
"""Add header comment to a list of lines.
lines -- list of lines to append to
"""
lines += ['/**', ' * Auto-generated with unsqu33kr', ' **/', '']
def add_uskr_include(lines):
"""Add an include statement for the generated header to a list of lines.
lines -- list of lines to append to
"""
lines += [f'#include "{outfile_h}"', '']
def add_lvgl_include(lines):
"""Add an LVGL include statement to a list of lines.
lines -- list of lines to append to
"""
lines += ['#include "lvgl/lvgl.h"', '']
def wrap_header(lines):
"""Wrap header lines to prevent recursive inclusion.
lines -- list of lines to wrap
"""
lines.insert(0, '#ifndef USKR_LAYOUTS_H')
lines.insert(1, '#define USKR_LAYOUTS_H')
lines.insert(2, '')
lines += ['#endif /* USKR_LAYOUTS_H */', '']
def write_files(lines_c, lines_h):
"""Write accumulated output to C and header file, respectively.
lines_c -- sequence of lines to write to C file
lines_h -- sequence of lines to write to header
"""
with open(os.path.join(args.output, outfile_c), 'w') as fp:
fp.write('\n'.join(lines_c))
with open(os.path.join(args.output, outfile_h), 'w') as fp:
fp.write('\n'.join(lines_h))
if __name__ == '__main__':
args = parse_arguments()
lines_c = []
lines_h = []
add_header(lines_c)
add_uskr_include(lines_c)
add_header(lines_h)
add_lvgl_include(lines_h)
layouts = []
with tempfile.TemporaryDirectory() as tmp:
clone_squeekboard_repo(tmp)
layouts_dir = os.path.join(tmp, rel_layouts_dir)
for file in os.listdir(layouts_dir):
path = os.path.join(layouts_dir, file)
if not os.path.isfile(path):
continue
name, extension = os.path.splitext(file)
if name not in layout_whitelist:
continue
data = load_yaml(path)
if not data:
continue
if not 'views' in data:
continue
buttons = data['buttons'] if 'buttons' in data else {}
lines_c.append(f'/**\n * {name_map[name]}\n **/\n')
lines_c.append(f'#define NAME_{name.upper()} "{name}"\n')
for layer in layer_whitelist:
lines_c.append(f'/* {layer_to_description[layer]} */')
if layer not in data['views']:
lines_c.append(f'#define TRIGGER_{map_layer(layer).upper()}_{name.upper()} ""')
lines_c.append(f'#define KEYS_{map_layer(layer).upper()}_{name.upper()} ' + '{ NULL }')
lines_c.append(f'#define ATTRIBUTES_{map_layer(layer).upper()}_{name.upper()} ' + '{ 0 }\n')
continue
if layer == 'eschars':
key = map_key('show_eschars', layer, name)[0]
lines_c.append(f'#define TRIGGER_{map_layer(layer).upper()}_{name.upper()} "{key}"')
rows = data['views'][layer]
keys_by_row = []
attrs_by_row = []
for i, row in enumerate(rows):
keys = []
attrs = []
for key in row.split():
for mapped in map_key(key, layer, name):
keys.append(f'"{mapped}"' if mapped not in quote_blacklist else mapped)
if key in buttons and key not in ['period', 'colon', '"']:
attrs.append(f'LV_KEYBOARD_CTRL_BTN_FLAGS | {7 if mapped == " " else 3}')
else:
attrs.append('2')
keys_by_row.append(keys)
attrs_by_row.append(attrs)
lines_c.append(f'#define KEYS_{map_layer(layer).upper()}_{name.upper()} ' + '{ \\')
for i, keys in enumerate(keys_by_row):
joined = ', '.join(keys)
suffix = '"\\n", \\' if i < len(rows) - 1 else '"" \\'
lines_c.append(f' {joined}, {suffix}')
lines_c.append('}')
lines_c.append(f'#define ATTRIBUTES_{map_layer(layer).upper()}_{name.upper()} ' + '{ \\')
for i, attrs in enumerate(attrs_by_row):
joined = ', '.join(attrs)
suffix = ', \\' if i < len(rows) - 1 else ' \\'
lines_c.append(f' {joined}{suffix}')
lines_c.append('}\n')
layouts.append(name)
lines_c.append('/**\n * All layouts\n **/\n')
lines_h.append('typedef enum {')
for i, name in enumerate(layouts):
suffix = ',' if i < len(layouts) - 1 else ''
lines_h.append(f' USKR_LAYOUT_{name.upper()} = {i}{suffix}')
lines_h.append('} uskr_layout_t;')
lines_h.append ('')
lines_h.append(f'#define USKR_NUM_LAYOUTS {len(layouts)}')
lines_h.append ('')
lines_h.append('extern const char * const names;')
lines_c.append('const char * const names =')
for i, name in enumerate(layouts):
suffix = ' "\\n"' if i < len(layouts) - 1 else ';\n'
lines_c.append(f' LV_SYMBOL_KEYBOARD " " NAME_{name.upper()}{suffix}')
for layer in layer_whitelist:
if layer == 'eschars':
lines_h.append(f'extern const char * const triggers_{map_layer(layer)}[];')
lines_c.append(f'const char * const triggers_{map_layer(layer)}[] = ' + '{')
for i, name in enumerate(layouts):
suffix = ',' if i < len(layouts) - 1 else ''
lines_c.append(f' (const char * const)TRIGGER_{map_layer(layer).upper()}_{name.upper()}{suffix}')
lines_c.append('};')
lines_h.append(f'extern const char ** const keys_{map_layer(layer)}[];')
lines_c.append(f'const char ** const keys_{map_layer(layer)}[] = ' + '{')
for i, name in enumerate(layouts):
suffix = ',' if i < len(layouts) - 1 else ''
lines_c.append(f' (const char * const [])KEYS_{map_layer(layer).upper()}_{name.upper()}{suffix}')
lines_c.append('};')
lines_c.append('')
lines_h.append(f'extern const lv_btnmatrix_ctrl_t * const attributes_{map_layer(layer)}[];')
lines_c.append(f'const lv_btnmatrix_ctrl_t * const attributes_{map_layer(layer)}[] = ' + '{')
for i, name in enumerate(layouts):
suffix = ',' if i < len(layouts) - 1 else ''
lines_c.append(f' (lv_btnmatrix_ctrl_t[])ATTRIBUTES_{map_layer(layer).upper()}_{name.upper()}{suffix}')
lines_c.append('};')
lines_h.append('')
lines_c.append('')
wrap_header(lines_h)
write_files(lines_c, lines_h)

View file

@ -1,319 +0,0 @@
/**
* Auto-generated with unsqu33kr
**/
#include "uskr_layouts.h"
/**
* English (US)
**/
#define NAME_US "us"
/* Lowercase layer */
#define KEYS_LOWER_US { \
"q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "\n", \
"a", "s", "d", "f", "g", "h", "j", "k", "l", "\n", \
"ABC", "z", "x", "c", "v", "b", "n", "m", LV_SYMBOL_BACKSPACE, "\n", \
"1#", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, ".", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_LOWER_US { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/* Uppercase layer */
#define KEYS_UPPER_US { \
"Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "\n", \
"A", "S", "D", "F", "G", "H", "J", "K", "L", "\n", \
"abc", "Z", "X", "C", "V", "B", "N", "M", LV_SYMBOL_BACKSPACE, "\n", \
"1#", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, ".", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_UPPER_US { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/* Number / symbol layer */
#define KEYS_NUMBERS_US { \
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "\n", \
"@", "#", "$", "%", "&", "-", "_", "+", "(", ")", "\n", \
",", "\"", "'", ":", ";", "!", "?", LV_SYMBOL_BACKSPACE, "\n", \
"abc", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, ".", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_NUMBERS_US { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/* Special characters */
#define TRIGGER_SPECIAL_US ""
#define KEYS_SPECIAL_US { NULL }
#define ATTRIBUTES_SPECIAL_US { 0 }
/**
* French
**/
#define NAME_FR "fr"
/* Lowercase layer */
#define KEYS_LOWER_FR { \
"a", "z", "e", "r", "t", "y", "u", "i", "o", "p", "\n", \
"q", "s", "d", "f", "g", "h", "j", "k", "l", "m", "\n", \
"ABC", "w", "x", "c", "v", "b", "n", ".", LV_SYMBOL_BACKSPACE, "\n", \
"1#", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "àéô", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_LOWER_FR { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/* Uppercase layer */
#define KEYS_UPPER_FR { \
"A", "Z", "E", "R", "T", "Y", "U", "I", "O", "P", "\n", \
"Q", "S", "D", "F", "G", "H", "J", "K", "L", "M", "\n", \
"abc", "W", "X", "C", "V", "B", "N", ",", LV_SYMBOL_BACKSPACE, "\n", \
"1#", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "àéô", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_UPPER_FR { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/* Number / symbol layer */
#define KEYS_NUMBERS_FR { \
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "\n", \
"@", "#", "", "%", "&", "-", "_", "+", "(", ")", "\n", \
",", "\"", "'", ":", ";", "!", "?", LV_SYMBOL_BACKSPACE, "\n", \
"abc", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "àéô", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_NUMBERS_FR { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/* Special characters */
#define TRIGGER_SPECIAL_FR "àéô"
#define KEYS_SPECIAL_FR { \
"à", "â", "ç", "é", "è", "ê", "î", "ô", "ù", "û", "\n", \
"À", "Â", "Ç", "É", "È", "Ê", "Î", "Ô", "Ù", "Û", "\n", \
"1#", "æ", "œ", "ä", "ë", "ï", "ö", "ü", LV_SYMBOL_BACKSPACE, "\n", \
"abc", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "àéô", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_SPECIAL_FR { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/**
* Spanish
**/
#define NAME_ES "es"
/* Lowercase layer */
#define KEYS_LOWER_ES { \
"q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "\n", \
"a", "s", "d", "f", "g", "h", "j", "k", "l", "ñ", "\n", \
"ABC", "z", "x", "c", "v", "b", "n", "m", LV_SYMBOL_BACKSPACE, "\n", \
"1#", "áéí", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "?", ".", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_LOWER_ES { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/* Uppercase layer */
#define KEYS_UPPER_ES { \
"Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "\n", \
"A", "S", "D", "F", "G", "H", "J", "K", "L", "Ñ", "\n", \
"abc", "Z", "X", "C", "V", "B", "N", "M", LV_SYMBOL_BACKSPACE, "\n", \
"1#", "áéí", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "¿", ".", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_UPPER_ES { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/* Number / symbol layer */
#define KEYS_NUMBERS_ES { \
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "\n", \
"@", "#", "", "%", "&", "-", "_", "+", "(", ")", "\n", \
",", "\"", "'", ":", ";", "!", "=", LV_SYMBOL_BACKSPACE, "\n", \
"abc", "áéí", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "?", ".", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_NUMBERS_ES { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/* Special characters */
#define TRIGGER_SPECIAL_ES "áéí"
#define KEYS_SPECIAL_ES { \
"á", "é", "í", "ó", "ú", "Á", "É", "Í", "Ó", "Ú", "\n", \
"à", "è", "ì", "ò", "ù", "À", "È", "Ì", "Ò", "Ù", "\n", \
"1#", "ü", "ç", "ï", "Ü", "Ç", "Ï", "¡", LV_SYMBOL_BACKSPACE, "\n", \
"abc", "áéí", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "«", "»", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_SPECIAL_ES { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/**
* German
**/
#define NAME_DE "de"
/* Lowercase layer */
#define KEYS_LOWER_DE { \
"q", "w", "e", "r", "t", "z", "u", "i", "o", "p", "\n", \
"a", "s", "d", "f", "g", "h", "j", "k", "l", "\n", \
"ABC", "y", "x", "c", "v", "b", "n", "m", LV_SYMBOL_BACKSPACE, "\n", \
"1#", "äöü", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, ",", ".", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_LOWER_DE { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/* Uppercase layer */
#define KEYS_UPPER_DE { \
"Q", "W", "E", "R", "T", "Z", "U", "I", "O", "P", "\n", \
"A", "S", "D", "F", "G", "H", "J", "K", "L", "\n", \
"abc", "Y", "X", "C", "V", "B", "N", "M", LV_SYMBOL_BACKSPACE, "\n", \
"1#", "äöü", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "!", "?", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_UPPER_DE { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/* Number / symbol layer */
#define KEYS_NUMBERS_DE { \
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "\n", \
"@", "#", "", "%", "&", "-", "_", "+", "(", ")", "\n", \
";", "\"", "'", ":", "=", "<", ">", LV_SYMBOL_BACKSPACE, "\n", \
"abc", "äöü", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, ",", ".", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_NUMBERS_DE { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/* Special characters */
#define TRIGGER_SPECIAL_DE "äöü"
#define KEYS_SPECIAL_DE { \
"ä", "è", "é", "ö", "ü", "Ä", "È", "É", "Ö", "Ü", "\n", \
"à", "â", "ê", "î", "ô", "À", "Â", "È", "Î", "Ô", "\n", \
"1#", "«", "»", "ç", "Ç", "æ", "œ", "ß", LV_SYMBOL_BACKSPACE, "\n", \
"abc", "äöü", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, "", "", LV_SYMBOL_OK, "" \
}
#define ATTRIBUTES_SPECIAL_DE { \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, 2, 2, 2, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, \
LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 7, LV_KEYBOARD_CTRL_BTN_FLAGS | 3, 2, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 3 \
}
/**
* All layouts
**/
const char * const names =
LV_SYMBOL_KEYBOARD " " NAME_US "\n"
LV_SYMBOL_KEYBOARD " " NAME_FR "\n"
LV_SYMBOL_KEYBOARD " " NAME_ES "\n"
LV_SYMBOL_KEYBOARD " " NAME_DE;
const char ** const keys_lower[] = {
(const char * const [])KEYS_LOWER_US,
(const char * const [])KEYS_LOWER_FR,
(const char * const [])KEYS_LOWER_ES,
(const char * const [])KEYS_LOWER_DE
};
const lv_btnmatrix_ctrl_t * const attributes_lower[] = {
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_LOWER_US,
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_LOWER_FR,
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_LOWER_ES,
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_LOWER_DE
};
const char ** const keys_upper[] = {
(const char * const [])KEYS_UPPER_US,
(const char * const [])KEYS_UPPER_FR,
(const char * const [])KEYS_UPPER_ES,
(const char * const [])KEYS_UPPER_DE
};
const lv_btnmatrix_ctrl_t * const attributes_upper[] = {
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_UPPER_US,
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_UPPER_FR,
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_UPPER_ES,
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_UPPER_DE
};
const char ** const keys_numbers[] = {
(const char * const [])KEYS_NUMBERS_US,
(const char * const [])KEYS_NUMBERS_FR,
(const char * const [])KEYS_NUMBERS_ES,
(const char * const [])KEYS_NUMBERS_DE
};
const lv_btnmatrix_ctrl_t * const attributes_numbers[] = {
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_NUMBERS_US,
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_NUMBERS_FR,
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_NUMBERS_ES,
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_NUMBERS_DE
};
const char * const triggers_special[] = {
(const char * const)TRIGGER_SPECIAL_US,
(const char * const)TRIGGER_SPECIAL_FR,
(const char * const)TRIGGER_SPECIAL_ES,
(const char * const)TRIGGER_SPECIAL_DE
};
const char ** const keys_special[] = {
(const char * const [])KEYS_SPECIAL_US,
(const char * const [])KEYS_SPECIAL_FR,
(const char * const [])KEYS_SPECIAL_ES,
(const char * const [])KEYS_SPECIAL_DE
};
const lv_btnmatrix_ctrl_t * const attributes_special[] = {
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_SPECIAL_US,
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_SPECIAL_FR,
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_SPECIAL_ES,
(lv_btnmatrix_ctrl_t[])ATTRIBUTES_SPECIAL_DE
};

View file

@ -1,33 +0,0 @@
#ifndef USKR_LAYOUTS_H
#define USKR_LAYOUTS_H
/**
* Auto-generated with unsqu33kr
**/
#include "lvgl/lvgl.h"
typedef enum {
USKR_LAYOUT_US = 0,
USKR_LAYOUT_FR = 1,
USKR_LAYOUT_ES = 2,
USKR_LAYOUT_DE = 3
} uskr_layout_t;
#define USKR_NUM_LAYOUTS 4
extern const char * const names;
extern const char ** const keys_lower[];
extern const lv_btnmatrix_ctrl_t * const attributes_lower[];
extern const char ** const keys_upper[];
extern const lv_btnmatrix_ctrl_t * const attributes_upper[];
extern const char ** const keys_numbers[];
extern const lv_btnmatrix_ctrl_t * const attributes_numbers[];
extern const char * const triggers_special[];
extern const char ** const keys_special[];
extern const lv_btnmatrix_ctrl_t * const attributes_special[];
#endif /* USKR_LAYOUTS_H */