1
Fork 0
qmk-userspace/keyboards/crkbd/keymaps/hadeed/keymap.c

92 lines
3.3 KiB
C

#include QMK_KEYBOARD_H
#include "oneshot.h"
enum LAYERS {
BASE,
NAV,
};
enum KEYCODES {
LC_NAV = MO(NAV),
LC_NUM = MO(NUM),
LC_SYM = MO(SYM),
OS_SHFT = SAFE_RANGE,
OS_CTRL,
OS_GUI,
OS_ALT
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
[] = LAYOUT_split_3x5_3(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______
),
*/
[BASE] = LAYOUT_split_3x5_3(
KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT,
KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O,
KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH,
QK_REP, LC_NAV, KC_ENT, KC_SPC, LC_NUM, LC_SYM
),
[NUM] = LAYOUT_split_3x5_3(
_______, _______, _______, _______, _______, _______, KC_7, KC_8, KC_9, _______,
OS_ALT, OS_GUI, OS_CTRL, OS_SHFT, CW_TOGG, _______, KC_4, KC_5, KC_6, _______,
_______, _______, _______, _______, _______, _______, KC_1, KC_2, KC_3, _______,
_______, _______, _______, _______, KC_0, _______
),
[NAV] = LAYOUT_split_3x5_3(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
OS_ALT, OS_GUI, OS_CTRL, OS_SHFT, CW_TOGG, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_BSPC,
_______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_DEL,
QK_BOOT, _______, _______, KC_TAB, KC_ESC, _______
),
};
bool is_oneshot_cancel_key(uint16_t keycode) {
switch (keycode) {
case LC_NAV:
case LC_NUM:
case LC_SYM:
return true;
}
return false;
}
bool is_oneshot_ignored_key(uint16_t keycode) {
switch (keycode) {
case LC_NAV:
case LC_NUM:
case LC_SYM:
case OS_SHFT:
case OS_CTRL:
case OS_ALT:
case OS_GUI:
return true;
}
return false;
}
static oneshot_state os_shft_state = os_up_unqueued;
static oneshot_state os_ctrl_state = os_up_unqueued;
static oneshot_state os_alt_state = os_up_unqueued;
static 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_GUI, keycode, record);
return true;
}