diff options
author | walkerstop <walkerstop@gmail.com> | 2019-03-14 08:21:41 -0700 |
---|---|---|
committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-03-14 08:21:41 -0700 |
commit | c3b4f65c640c217a0c9bf99d6b30982f966e585c (patch) | |
tree | 19dc526906daf8eedc4494e96a813c4a538f6d8e /keyboards/mt980/keymaps/walker | |
parent | f9c5b80aedc1ef43baeff6a197dc1c3772e69618 (diff) |
Added info.json for mt980 keyboard and fixes to walker keymap (#5391)
* Added info.json and minor fixes to walker keymap
* Fix url
* Update keyboards/mt980/info.json
Co-Authored-By: walkerstop <walkerstop@gmail.com>
* Update keyboards/mt980/info.json
Co-Authored-By: walkerstop <walkerstop@gmail.com>
* Update keyboards/mt980/info.json
Co-Authored-By: walkerstop <walkerstop@gmail.com>
* Update keyboards/mt980/info.json
Co-Authored-By: walkerstop <walkerstop@gmail.com>
* Update keyboards/mt980/info.json
Co-Authored-By: walkerstop <walkerstop@gmail.com>
* Update keyboards/mt980/info.json
Co-Authored-By: walkerstop <walkerstop@gmail.com>
* Update keyboards/mt980/info.json
Co-Authored-By: walkerstop <walkerstop@gmail.com>
* Fix user calling keymap functions
* cancel oneshot layer on KC_TRNS
* Fix to oneshot layer handling
* Fix oneshot handling of reset
* Move bootmagic key to Esc where it normally resides
* Remove deprecated function
* Treat shift-numlock as shift-insert in Walker layer
Diffstat (limited to 'keyboards/mt980/keymaps/walker')
-rw-r--r-- | keyboards/mt980/keymaps/walker/keymap.c | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/keyboards/mt980/keymaps/walker/keymap.c b/keyboards/mt980/keymaps/walker/keymap.c index c1db4f3d3d..83a3fb8167 100644 --- a/keyboards/mt980/keymaps/walker/keymap.c +++ b/keyboards/mt980/keymaps/walker/keymap.c @@ -99,35 +99,68 @@ void led_set_keymap(uint8_t usb_led) { } bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_TRNS: + case KC_NO: + /* Always cancel one-shot layer when another key gets pressed */ + if (record->event.pressed && is_oneshot_layer_active()) + clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); + return true; + case RESET: + /* Don't allow reset from oneshot layer state */ + if (record->event.pressed && is_oneshot_layer_active()) { + clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); + return false; + } + return true; case KC_PPLS: if (!numlock_on) { - if (get_oneshot_layer() == 1 || layer_state & 0x2) { - register_code(KC_HOME); - unregister_code(KC_HOME); + if (is_oneshot_layer_active() || layer_state & 0x2) { + if (record->event.pressed) + register_code(KC_HOME); + else + unregister_code(KC_HOME); clear_oneshot_layer_state(ONESHOT_START); } else { - register_code(KC_PGUP); - unregister_code(KC_PGUP); + if (record->event.pressed) + register_code(KC_PGUP); + else + unregister_code(KC_PGUP); } return false; } return true; case KC_PENT: if (!numlock_on) { - if (get_oneshot_layer() == 1 || layer_state & 0x2) { - register_code(KC_END); - unregister_code(KC_END); + if (is_oneshot_layer_active() || layer_state & 0x2) { + if (record->event.pressed) + register_code(KC_END); + else + unregister_code(KC_END); clear_oneshot_layer_state(ONESHOT_START); } else { - register_code(KC_PGDN); - unregister_code(KC_PGDN); + if (record->event.pressed) + register_code(KC_PGDN); + else + unregister_code(KC_PGDN); } return false; } return true; + case KC_NLCK: + /* Shift + NumLock will be treated as shift-Insert */ + if ((keyboard_report->mods & MOD_BIT (KC_LSFT)) || (keyboard_report->mods & MOD_BIT (KC_RSFT))) { + if (record->event.pressed) { + register_code(KC_INS); + unregister_code(KC_INS); + } + return false; + } + else + return true; default: return true; } |