#include QMK_KEYBOARD_H #include "oneshot.h" #define LA_SYM MO(SYM) #define LA_NAV MO(NAV) #define MUTE LGUI(KC_C) enum layers { DEF, SYM, NAV, NUM, }; enum keycodes { // Custom oneshot mod implementation with no timers. OS_SHFT = SAFE_RANGE, OS_CTRL, OS_ALT, OS_CMD, OS_RALT, }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [DEF] = LAYOUT( KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_Z, KC_X, KC_C, KC_V, KC_B, XXXXXXX,XXXXXXX,KC_N, KC_M, KC_COMM,KC_DOT, KC_QUOT, XXXXXXX,XXXXXXX,XXXXXXX,LA_NAV, KC_LSFT,XXXXXXX,XXXXXXX,KC_SPC, LA_SYM, XXXXXXX,XXXXXXX,XXXXXXX ), [SYM] = LAYOUT( KC_ESC, KC_LBRC,KC_LCBR,KC_LPRN,KC_TILD, KC_CIRC,KC_RPRN,KC_RCBR,KC_RBRC,KC_GRV, KC_MINS,KC_ASTR,KC_EQL, KC_UNDS,KC_DLR, KC_HASH,OS_CMD, OS_CTRL,OS_ALT, OS_SHFT, KC_PLUS,KC_PIPE,KC_AT, KC_SLSH,KC_PERC,XXXXXXX,XXXXXXX,KC_AMPR,KC_BSLS,OS_RALT,KC_QUES,KC_EXLM, XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX ), [NAV] = LAYOUT( KC_TAB, XXXXXXX,XXXXXXX,XXXXXXX,MUTE, RESET, KC_CAPS,XXXXXXX,XXXXXXX,XXXXXXX, OS_SHFT,OS_ALT, OS_CTRL,OS_CMD, XXXXXXX, KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,KC_BSPC, XXXXXXX,XXXXXXX,OS_RALT,XXXXXXX,KC_PSCR,XXXXXXX,XXXXXXX,XXXXXXX,KC_PGDN,KC_PGUP,XXXXXXX,KC_ENT, XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX ), [NUM] = LAYOUT( KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, OS_SHFT,OS_ALT, OS_CTRL,OS_CMD, KC_F11, KC_F12, OS_CMD, OS_CTRL,OS_ALT, OS_SHFT, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, XXXXXXX,XXXXXXX,KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX ) }; bool is_oneshot_cancel_key(uint16_t keycode) { switch (keycode) { case LA_SYM: case LA_NAV: return true; default: return false; } } bool is_oneshot_ignored_key(uint16_t keycode) { switch (keycode) { case LA_SYM: case LA_NAV: case KC_LSFT: case OS_SHFT: case OS_CTRL: case OS_ALT: case OS_RALT: case OS_CMD: return true; default: return false; } } oneshot_state os_shft_state = os_up_unqueued; oneshot_state os_ctrl_state = os_up_unqueued; oneshot_state os_alt_state = os_up_unqueued; oneshot_state os_cmd_state = os_up_unqueued; oneshot_state os_ralt_state = os_up_unqueued; bool process_record_user(uint16_t keycode, keyrecord_t *record) { update_oneshot( &os_shft_state, KC_LSFT, OS_SHFT, keycode, record ); update_oneshot( &os_ctrl_state, KC_LCTL, OS_CTRL, keycode, record ); update_oneshot( &os_alt_state, KC_LALT, OS_ALT, keycode, record ); update_oneshot( &os_cmd_state, KC_LCMD, OS_CMD, keycode, record ); update_oneshot( &os_ralt_state, KC_RALT, OS_RALT, keycode, record ); return true; } layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, SYM, NAV, NUM); }