1
0
Fork 0
qmk_firmware/keyboards/atreus/keymaps/default/keymap.c

107 lines
3.2 KiB
C
Raw Normal View History

#include QMK_KEYBOARD_H
2016-01-30 04:30:33 +00:00
2022-02-17 23:51:32 +00:00
#include "oneshot.h"
2022-02-17 16:34:37 +00:00
2022-02-17 23:51:32 +00:00
#define LA_SYM MO(SYM)
#define LA_NAV MO(NAV)
2022-02-17 16:34:37 +00:00
2022-02-17 23:51:32 +00:00
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,
};
2016-01-30 04:30:33 +00:00
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
2022-02-17 23:51:32 +00:00
[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_SLSH,
XXXXXXX,XXXXXXX,XXXXXXX,LA_NAV, KC_BSPC,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_ALT, OS_CTRL,OS_SHFT,
KC_PLUS,KC_PIPE,KC_AT, KC_SLSH,KC_PERC,XXXXXXX,XXXXXXX,XXXXXXX,KC_BSLS,KC_AMPR,KC_QUES,KC_EXLM,
XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX
),
[NAV] = LAYOUT(
KC_TAB, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, RESET, KC_CAPS,XXXXXXX,XXXXXXX,RESET,
OS_SHFT,OS_CTRL,OS_ALT, OS_CMD, XXXXXXX, KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,KC_BSPC,
XXXXXXX,XXXXXXX,XXXXXXX,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_CTRL,OS_ALT, OS_CMD, KC_F11, KC_F12, OS_CMD, OS_ALT, OS_CTRL,OS_SHFT,
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______,_______,KC_F6, KC_F7, KC_F8, KC_F9, KC_F10,
XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX
)
};
2022-02-17 16:34:37 +00:00
2022-02-17 23:51:32 +00:00
bool is_oneshot_cancel_key(uint16_t keycode) {
2022-02-17 16:34:37 +00:00
switch (keycode) {
2022-02-17 23:51:32 +00:00
case LA_SYM:
case LA_NAV:
return true;
default:
return false;
2022-02-17 16:34:37 +00:00
}
}
2022-02-17 23:51:32 +00:00
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_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;
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
);
return true;
}
layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, SYM, NAV, NUM);
}