From ff723623655cf573ff1c0f3c41778c5dfbd83103 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Sun, 12 Sep 2021 21:58:51 +0200 Subject: [PATCH] Correctly handle layer lockers --- examples/us-terminal-with-scancodes/sq2lv_layouts.c | 2 +- examples/us/sq2lv_layouts.c | 2 +- squeek2lvgl.py | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/us-terminal-with-scancodes/sq2lv_layouts.c b/examples/us-terminal-with-scancodes/sq2lv_layouts.c index 8906896..46450e6 100644 --- a/examples/us-terminal-with-scancodes/sq2lv_layouts.c +++ b/examples/us-terminal-with-scancodes/sq2lv_layouts.c @@ -90,7 +90,7 @@ static const int switcher_idxs_upper_terminal_us[] = { \ }; static const int switcher_dests_upper_terminal_us[] = { \ - 1, 2 \ + 0, 2 \ }; static const int num_scancodes_upper_terminal_us = 5; diff --git a/examples/us/sq2lv_layouts.c b/examples/us/sq2lv_layouts.c index 57267a1..e2fd834 100644 --- a/examples/us/sq2lv_layouts.c +++ b/examples/us/sq2lv_layouts.c @@ -59,7 +59,7 @@ static const int switcher_idxs_upper_us[] = { \ }; static const int switcher_dests_upper_us[] = { \ - 1, 2 \ + 0, 2 \ }; /* Layer: Numbers / symbols - generated from numbers */ diff --git a/squeek2lvgl.py b/squeek2lvgl.py index 60b84ed..9c7d1e9 100644 --- a/squeek2lvgl.py +++ b/squeek2lvgl.py @@ -528,9 +528,11 @@ def get_keycaps_attrs_switchers_scancodes(args, layout_id, view_id, data_views, if 'set_view' in action: dest = action['set_view'] - elif 'locking' in action and 'lock_view' in action['locking']: - dest = action['locking']['lock_view'] - + elif 'locking' in action and 'lock_view' in action['locking'] and 'unlock_view' in action['locking']: + if action['locking']['lock_view'] == view_id: + dest = action['locking']['unlock_view'] + elif action['locking']['unlock_view'] == view_id: + dest = action['locking']['lock_view'] if dest: switcher_idxs.append(idx) switcher_dests.append(dest)