From be4a3101de1e68b8fa1d6886872917160e14104a Mon Sep 17 00:00:00 2001 From: Cem Aksoylar Date: Sat, 1 Jan 2022 23:01:35 -0800 Subject: [PATCH] Hide momentary layers in Zen layer widget --- app/boards/arm/corneish_zen/widgets/layer_status.c | 10 ++++++++++ app/src/display/Kconfig | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/app/boards/arm/corneish_zen/widgets/layer_status.c b/app/boards/arm/corneish_zen/widgets/layer_status.c index 3dc33613..b7c78121 100644 --- a/app/boards/arm/corneish_zen/widgets/layer_status.c +++ b/app/boards/arm/corneish_zen/widgets/layer_status.c @@ -27,6 +27,16 @@ static void set_layer_symbol(lv_obj_t *label, struct layer_status_state state) { const char *layer_label = state.label; uint8_t active_layer_index = state.index; +#if IS_ENABLED(CONFIG_ZMK_DISPLAY_HIDE_MOMENTARY_LAYERS) + static uint8_t last_perm_index = 255; + if (!zmk_keymap_layer_momentary(active_layer_index) && last_perm_index != active_layer_index) { + last_perm_index = active_layer_index; + LOG_DBG("Last perm layer index updated to %i", active_layer_index); + } else { + return; + } +#endif + if (layer_label == NULL) { char text[6] = {}; diff --git a/app/src/display/Kconfig b/app/src/display/Kconfig index 26b0ba19..1613cfe4 100644 --- a/app/src/display/Kconfig +++ b/app/src/display/Kconfig @@ -183,6 +183,10 @@ config ZMK_DISPLAY_FULL_REFRESH_PERIOD Period in seconds for how often to completely refresh/redraw the whole screen. Most useful for e-ink/EPD displays that require occasional full redraws. +config ZMK_DISPLAY_HIDE_MOMENTARY_LAYERS + bool "Do not update layer widget for momentary layer changes" + default n + rsource "widgets/Kconfig" endif