From 3ec7910be273167dc713b9943ecbaed8d9a5a52e Mon Sep 17 00:00:00 2001 From: Maximilian Engl Date: Mon, 17 Jun 2024 11:22:21 +0200 Subject: [PATCH] Add config option to use mac modifiers --- README.md | 9 ++++++-- .../shields/dongle_display/Kconfig.defconfig | 3 +++ .../dongle_display/widgets/modifiers.c | 22 +++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cb15258..5df9126 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,7 @@ manifest: import: app/west.yml - name: zmk-dongle-display remote: englmaxi - revision: win # Windows modifier symbols - # revision: mac # MacOS modifier symbols + revision: main self: path: config ``` @@ -56,6 +55,12 @@ To also display the battery level of the dongle/central device, use the followin CONFIG_ZMK_DONGLE_DISPLAY_DONGLE_BATTERY=y ``` +If you want to use MacOS modifier symbols instead of the Windows modifier symbols, use the following configuration property: + +```ini +CONFIG_ZMK_DONGLE_DISPLAY_MAC_MODIFIERS=y +``` + ## Demo ![output](https://github.com/englmaxi/zmk-config/assets/43675074/8d268f23-1a4f-44c3-817e-c36dc96a1f8b) ![mods](https://github.com/englmaxi/zmk-config/assets/43675074/af9ec3f5-8f61-4629-abed-14ba0047f0bd) diff --git a/boards/shields/dongle_display/Kconfig.defconfig b/boards/shields/dongle_display/Kconfig.defconfig index d3be14d..f023d54 100644 --- a/boards/shields/dongle_display/Kconfig.defconfig +++ b/boards/shields/dongle_display/Kconfig.defconfig @@ -22,6 +22,9 @@ config ZMK_DONGLE_DISPLAY_DONGLE_BATTERY bool "Show also the battery level of the dongle" depends on BT && (!ZMK_SPLIT_BLE || ZMK_SPLIT_ROLE_CENTRAL) +config ZMK_DONGLE_DISPLAY_MAC_MODIFIERS + bool "Use MacOS modifier symbols instead of the Windows symbols" + choice ZMK_DISPLAY_WORK_QUEUE default ZMK_DISPLAY_WORK_QUEUE_DEDICATED endchoice diff --git a/boards/shields/dongle_display/widgets/modifiers.c b/boards/shields/dongle_display/widgets/modifiers.c index 4fb1cf5..5aac8e2 100644 --- a/boards/shields/dongle_display/widgets/modifiers.c +++ b/boards/shields/dongle_display/widgets/modifiers.c @@ -42,6 +42,27 @@ struct modifier_symbol ms_shift = { .symbol_dsc = &shift_icon, }; +#if IS_ENABLED(CONFIG_ZMK_DONGLE_DISPLAY_MAC_MODIFIERS) +LV_IMG_DECLARE(opt_icon); +struct modifier_symbol ms_opt = { + .modifier = MOD_LALT | MOD_RALT, + .symbol_dsc = &opt_icon, +}; + +LV_IMG_DECLARE(cmd_icon); +struct modifier_symbol ms_cmd = { + .modifier = MOD_LGUI | MOD_RGUI, + .symbol_dsc = &cmd_icon, +}; + +struct modifier_symbol *modifier_symbols[] = { + // this order determines the order of the symbols + &ms_control, + &ms_opt, + &ms_cmd, + &ms_shift +}; +#else LV_IMG_DECLARE(alt_icon); struct modifier_symbol ms_alt = { .modifier = MOD_LALT | MOD_RALT, @@ -61,6 +82,7 @@ struct modifier_symbol *modifier_symbols[] = { &ms_control, &ms_shift }; +#endif #define NUM_SYMBOLS (sizeof(modifier_symbols) / sizeof(struct modifier_symbol *))