diff options
author | Peter Johanson <[email protected]> | 2024-07-31 11:54:15 -0600 |
---|---|---|
committer | Pete Johanson <[email protected]> | 2024-09-06 12:20:45 -0600 |
commit | 03b5b38bc4b81b68787bb052613e771279fa049c (patch) | |
tree | 7e15fb7021d9c57777bd19c957c50e58fe000302 /app/src/physical_layouts.c | |
parent | 3975d2fdafe0a71f87187402a10b8db02171475c (diff) | |
download | zmk-03b5b38bc4b81b68787bb052613e771279fa049c.tar.gz zmk-03b5b38bc4b81b68787bb052613e771279fa049c.zip |
feat: Split physical layout selection sync.
* Ensure the split peripherals have the same selected physical
layout on connection and change.
Diffstat (limited to 'app/src/physical_layouts.c')
-rw-r--r-- | app/src/physical_layouts.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/src/physical_layouts.c b/app/src/physical_layouts.c index 00cfa29e78..26bb3ef448 100644 --- a/app/src/physical_layouts.c +++ b/app/src/physical_layouts.c @@ -22,6 +22,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include <zmk/event_manager.h> #include <zmk/events/position_state_changed.h> +ZMK_EVENT_IMPL(zmk_physical_layout_selection_changed); + #define DT_DRV_COMPAT zmk_physical_layout #if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) @@ -227,7 +229,14 @@ int zmk_physical_layouts_select(uint8_t index) { return -EINVAL; } - return zmk_physical_layouts_select_layout(layouts[index]); + int ret = zmk_physical_layouts_select_layout(layouts[index]); + + if (ret >= 0) { + raise_zmk_physical_layout_selection_changed( + (struct zmk_physical_layout_selection_changed){.selection = index}); + } + + return ret; } int zmk_physical_layouts_get_selected(void) { |