summaryrefslogtreecommitdiffstats
path: root/keyboards/mt980/keymaps
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/mt980/keymaps')
-rw-r--r--keyboards/mt980/keymaps/walker/keymap.c53
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;
}