Pastebin
Paste #24894: No description
< previous paste - next paste>
Pasted by Anonymous Coward
--- keymap_oryx.c 2023-03-21 20:11:38.000000000 +0100 +++ keymap.c 2023-03-22 22:46:46.890652600 +0100 @@ -55,6 +55,10 @@ HSV_172_255_255, DK_LSPO, DK_RSPC, + CUSTOM_ALTGR1, // Map AltGr+1 to | + CUSTOM_SHIFT4, // Map Shift+4 to ' + CUSTOM_SHIFTBKSP, // Map Shift+Backspace to ? + CUSTOM_CTRLBKSP // Map Ctrl+Backspace to Delete }; @@ -64,7 +68,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_moonlander( - KC_ESCAPE, KC_1, KC_2, KC_3, KC_4, KC_5, DK_QUOT, DK_PLUS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPACE, + KC_ESCAPE, CUSTOM_ALTGR1, KC_2, KC_3, CUSTOM_SHIFT4, KC_5, DK_QUOT, DK_PLUS, KC_6, KC_7, KC_8, KC_9, KC_0, CUSTOM_SHIFTBKSP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, DK_LABK, DK_ACUT, KC_Y, KC_U, KC_I, KC_O, KC_P, DK_ARNG, LT(2,KC_LCTRL), KC_A, KC_S, KC_D, KC_F, KC_G, KC_TRANSPARENT, MT(MOD_RCTL, KC_INSERT),KC_H, KC_J, KC_K, KC_L, DK_AE, DK_OSTR, KC_LSHIFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, DK_COMM, DK_DOT, DK_MINS, KC_RSHIFT, @@ -172,6 +176,7 @@ } bool process_record_user(uint16_t keycode, keyrecord_t *record) { + static uint8_t saved_mods = 0; switch (keycode) { case RGB_SLD: @@ -197,6 +202,77 @@ rgblight_sethsv(172,255,255); } return false; + case CUSTOM_ALTGR1: + if (record->event.pressed) { + if ((get_mods() & MOD_BIT(KC_RALT)) == MOD_BIT(KC_RALT)) { + register_code16(DK_PIPE); + } + else { + register_code(DK_1); + } + } else { + unregister_code16(DK_PIPE); + unregister_code(DK_1); + } + return false; + case CUSTOM_SHIFT4: + if (record->event.pressed) { + saved_mods = get_mods() & MOD_MASK_SHIFT; + if ((get_mods() & MOD_MASK_SHIFT) == MOD_MASK_SHIFT) { + del_mods(saved_mods); + register_code(KC_NUHS); + add_mods(saved_mods); + } + else if (saved_mods) { + del_mods(saved_mods); + register_code(KC_NUHS); + add_mods(saved_mods); + } + else { + register_code(DK_4); + } + } else { + unregister_code(KC_NUHS); + unregister_code(DK_4); + } + return false; + + case CUSTOM_SHIFTBKSP: + if (record->event.pressed) { + saved_mods = get_mods() & MOD_MASK_SHIFT; + if ((saved_mods == MOD_MASK_SHIFT) || saved_mods ){ + register_code(DK_PLUS); + } + else { + register_code(KC_BSPACE); + } + } else { + unregister_code(DK_PLUS); + unregister_code(KC_BSPACE); + } + return false; + + case CUSTOM_CTRLBKSP: + if (record->event.pressed) { + saved_mods = get_mods() & MOD_BIT(KC_LCTRL); + if ((get_mods() & MOD_BIT(KC_LCTRL)) == MOD_BIT(KC_LCTRL)) { + del_mods(saved_mods); + register_code16(DK_PLUS); + add_mods(saved_mods); + } + else if (saved_mods) { + del_mods(saved_mods); + register_code16(DK_PLUS); + add_mods(saved_mods); + } + else { + register_code(KC_BSPACE); + } + } else { + register_code16(DK_PLUS); + unregister_code(KC_BSPACE); + } + return false; } return true; } @@ -271,3 +347,4 @@ qk_tap_dance_action_t tap_dance_actions[] = { [DANCE_0] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_0, dance_0_finished, dance_0_reset), }; +/* vim: set sw=2 sts=2: */
New Paste
Go to most recent paste.