2018-05-03 14:56:12 +00:00
|
|
|
#include QMK_KEYBOARD_H
|
2016-01-30 04:30:33 +00:00
|
|
|
|
2022-02-22 02:01:34 +00:00
|
|
|
#include "oneshot.h"
|
2022-02-17 16:34:37 +00:00
|
|
|
|
2022-02-22 02:01:34 +00:00
|
|
|
#define LA_SYM MO(SYM)
|
|
|
|
#define LA_NAV MO(NAV)
|
2022-02-17 16:34:37 +00:00
|
|
|
|
2022-02-23 01:38:21 +00:00
|
|
|
#define MUTE LGUI(KC_C)
|
|
|
|
|
2022-02-22 02:01:34 +00:00
|
|
|
enum layers {
|
|
|
|
DEF,
|
|
|
|
SYM,
|
|
|
|
NAV,
|
|
|
|
NUM,
|
|
|
|
};
|
2022-02-19 02:13:08 +00:00
|
|
|
|
2022-02-22 02:01:34 +00:00
|
|
|
enum keycodes {
|
|
|
|
// Custom oneshot mod implementation with no timers.
|
|
|
|
OS_SHFT = SAFE_RANGE,
|
|
|
|
OS_CTRL,
|
|
|
|
OS_ALT,
|
|
|
|
OS_CMD,
|
2022-02-22 15:15:09 +00:00
|
|
|
OS_RALT,
|
2022-02-22 02:01:34 +00:00
|
|
|
};
|
2016-01-30 04:30:33 +00:00
|
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
2022-02-22 02:01:34 +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,
|
2022-02-22 15:15:09 +00:00
|
|
|
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
|
2022-02-22 02:01:34 +00:00
|
|
|
),
|
|
|
|
|
|
|
|
[SYM] = LAYOUT(
|
|
|
|
KC_ESC, KC_LBRC,KC_LCBR,KC_LPRN,KC_TILD, KC_CIRC,KC_RPRN,KC_RCBR,KC_RBRC,KC_GRV,
|
2022-02-22 15:15:09 +00:00
|
|
|
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,
|
2022-02-22 02:01:34 +00:00
|
|
|
XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX
|
|
|
|
),
|
|
|
|
|
|
|
|
[NAV] = LAYOUT(
|
2022-02-23 01:38:21 +00:00
|
|
|
KC_TAB, XXXXXXX,XXXXXXX,XXXXXXX,MUTE, RESET, KC_CAPS,XXXXXXX,XXXXXXX,XXXXXXX,
|
2022-03-17 23:18:27 +00:00
|
|
|
OS_SHFT,OS_ALT, OS_CTRL,OS_CMD, KC_BSPC, KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,XXXXXXX,
|
2022-02-22 15:15:09 +00:00
|
|
|
XXXXXXX,XXXXXXX,OS_RALT,XXXXXXX,KC_PSCR,XXXXXXX,XXXXXXX,XXXXXXX,KC_PGDN,KC_PGUP,XXXXXXX,KC_ENT,
|
2022-02-22 02:01:34 +00:00
|
|
|
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,
|
2022-02-22 15:15:09 +00:00
|
|
|
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,
|
2022-02-22 02:01:34 +00:00
|
|
|
XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX
|
|
|
|
)
|
2017-10-08 13:52:58 +00:00
|
|
|
};
|
2022-02-19 02:13:08 +00:00
|
|
|
|
2022-02-22 02:01:34 +00:00
|
|
|
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:
|
2022-02-22 15:15:09 +00:00
|
|
|
case OS_RALT:
|
2022-02-22 02:01:34 +00:00
|
|
|
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;
|
2022-02-22 15:15:09 +00:00
|
|
|
oneshot_state os_ralt_state = os_up_unqueued;
|
2022-02-22 02:01:34 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
);
|
2022-02-22 15:15:09 +00:00
|
|
|
update_oneshot(
|
|
|
|
&os_ralt_state, KC_RALT, OS_RALT,
|
|
|
|
keycode, record
|
|
|
|
);
|
2022-02-22 02:01:34 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-02-19 02:13:08 +00:00
|
|
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
2022-02-22 02:01:34 +00:00
|
|
|
return update_tri_layer_state(state, SYM, NAV, NUM);
|
|
|
|
}
|