Skip to content

Commit

Permalink
Fix issue where toggle layer modifiers were not one-pulsed
Browse files Browse the repository at this point in the history
  • Loading branch information
malcx95 committed Aug 5, 2024
1 parent 720925e commit cb11cb6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 10 additions & 2 deletions core/keyboard/keymap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,16 @@ void KeyMap::update_current_layer(const KeyboardScanResult& scan_result)
const auto code = action->sequence[0].key;
if (util::key_is_layer_toggle_modifier(code))
{
const auto layer = util::get_layer_toggle_modifier_layer(code);
current_layer = current_layer == layer ? 0 : layer;
if (!just_toggled_layer)
{
const auto layer = util::get_layer_toggle_modifier_layer(code);
current_layer = current_layer == layer ? 0 : layer;
just_toggled_layer = true;
}
}
else
{
just_toggled_layer = false;
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions core/keyboard/keymap.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class KeyMap

void load_default();

bool just_toggled_layer = false;

// TODO make this configurable (see issue #1)
bool layer_fallback = false;

Expand Down

0 comments on commit cb11cb6

Please sign in to comment.