Skip to content

Commit

Permalink
fix swap_hands_toggle_user
Browse files Browse the repository at this point in the history
  • Loading branch information
jerviscui committed May 14, 2024
1 parent 99bea83 commit 928b88a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
6 changes: 0 additions & 6 deletions keyboards/handwired/dactyl_manuform/5x6_3_2/5x6_3_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,9 @@ layer_state_t layer_state_set_user(layer_state_t state) {
}

void swap_hands_toggle_user(void) {
uprintf("toogle");

if (is_swap_hands_on()) {
uprintf("toogle on");

send_combo(KC_F15, KC_9);
} else {
uprintf("toogle off");

send_combo(KC_F15, KC_0);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"KC_DEL",
"OSM(MOD_LALT)",
"OSM(MOD_LCTL)",
"ANY(SH_TG)",
"ANY(SH_TOGG)",
"KC_ENT",
"KC_F11",
"KC_6",
Expand Down Expand Up @@ -77,8 +77,8 @@
"KC_RGHT",
"KC_BSPC",
"KC_ENT",
"OSM(MOD_RALT)",
"OSM(MOD_RCTL)",
"KC_F14",
"KC_F13",
"KC_PSCR",
"KC_INS"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
CW_TOGG, L2, OSMWin, L1, KC_UP, KC_DOWN, KC_LEFT, KC_RGHT,
KC_SPC, KC_DEL, KC_BSPC, KC_ENT,
OSMLA, OSMLC, KC_F13, KC_F14,
SH_TG, KC_ENT, KC_PSCR, KC_INS
SH_TOGG,KC_ENT, KC_PSCR, KC_INS
),

[_FN] = LAYOUT_5x6_3_2(
Expand Down
2 changes: 1 addition & 1 deletion keyboards/handwired/dactyl_manuform/5x6_3_2/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ BOOTLOADER = caterina
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = no # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
Expand Down
29 changes: 19 additions & 10 deletions quantum/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ void set_swap_hands_state(size_t index, uint8_t *swap_state, bool on) {
}
}

__attribute__((weak)) void swap_hands_toggle_user(void) {
}
__attribute__((weak)) void swap_hands_toggle_user(void) { }

void swap_hands_on(void) {
swap_hands = true;
Expand Down Expand Up @@ -259,7 +258,8 @@ void process_record_tap_hint(keyrecord_t *record) {
break;
case OP_SH_TAP_TOGGLE:
default:
swap_hands = !swap_hands;
swap_hands_toggle();
// swap_hands = !swap_hands;
swap_held = true;
}
break;
Expand Down Expand Up @@ -743,23 +743,28 @@ void process_action(keyrecord_t *record, action_t action) {
switch (action.swap.code) {
case OP_SH_TOGGLE:
if (event.pressed) {
swap_hands = !swap_hands;
swap_hands_toggle();
// swap_hands = !swap_hands;
}
break;
case OP_SH_ON_OFF:
// swap_hands_off(); //todo cuizj: same as?
swap_hands = event.pressed;
break;
case OP_SH_OFF_ON:
// swap_hands_on(); //todo cuizj: same as?
swap_hands = !event.pressed;
break;
case OP_SH_ON:
if (!event.pressed) {
swap_hands = true;
swap_hands_on();
// swap_hands = true;
}
break;
case OP_SH_OFF:
if (!event.pressed) {
swap_hands = false;
swap_hands_off();
// swap_hands = false;
}
break;
# ifndef NO_ACTION_ONESHOT
Expand All @@ -780,19 +785,22 @@ void process_action(keyrecord_t *record, action_t action) {
if (swap_held) {
swap_held = false;
} else {
swap_hands = !swap_hands;
swap_hands_toggle();
// swap_hands = !swap_hands;
}
} else {
if (tap_count < TAPPING_TOGGLE) {
swap_hands = !swap_hands;
swap_hands_toggle();
// swap_hands = !swap_hands;
}
}
break;
default:
/* tap key */
if (tap_count > 0) {
if (swap_held) {
swap_hands = !swap_hands; // undo hold set up in _tap_hint
swap_hands_toggle();
// swap_hands = !swap_hands; // undo hold set up in _tap_hint
swap_held = false;
}
if (event.pressed) {
Expand All @@ -804,7 +812,8 @@ void process_action(keyrecord_t *record, action_t action) {
}
} else {
if (swap_held && !event.pressed) {
swap_hands = !swap_hands; // undo hold set up in _tap_hint
swap_hands_toggle();
// swap_hands = !swap_hands; // undo hold set up in _tap_hint
swap_held = false;
}
}
Expand Down

0 comments on commit 928b88a

Please sign in to comment.