diff options
author | QMK Bot <hello@qmk.fm> | 2022-07-02 12:51:09 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2022-07-02 12:51:09 +0000 |
commit | 84d9996b6d40d57c20ba2017977ebac6b0c224ab (patch) | |
tree | a0499dc4f3eb55885d39fc7766d82bdffdd983e0 /keyboards/keebio/iris/keymaps/radlinskii/keymap.c | |
parent | a6faf3bc9e9bea48679ab17dc840adf5c029d909 (diff) | |
parent | 5a727dbc6dc51b2d7d90e5d2a7e99ca3435153be (diff) |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'keyboards/keebio/iris/keymaps/radlinskii/keymap.c')
-rw-r--r-- | keyboards/keebio/iris/keymaps/radlinskii/keymap.c | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/keyboards/keebio/iris/keymaps/radlinskii/keymap.c b/keyboards/keebio/iris/keymaps/radlinskii/keymap.c new file mode 100644 index 0000000000..380ff82a3c --- /dev/null +++ b/keyboards/keebio/iris/keymaps/radlinskii/keymap.c @@ -0,0 +1,193 @@ +// Copyright 2022 Ignacy Radliński (@radlinskii) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +#include "light_layers.h" + +enum my_layers { + _COLEMAK, + _QWERTY, + _NUM_SYM, + _NAV, + _MOUSE, + _MEDIA_MISC, +}; + +enum custom_keycodes { + COLEMAK = SAFE_RANGE, + QWERTY, + DEFAULT +}; + +#define LALT_KA LALT_T(KC_A) +#define LCTL_KS LCTL_T(KC_S) +#define LGUI_KD LGUI_T(KC_D) +#define LSFT_KF LSFT_T(KC_F) +#define RSFT_KJ RSFT_T(KC_J) +#define RGUI_KK RGUI_T(KC_K) +#define RCTL_KL RCTL_T(KC_L) +#define RA_SCLN RALT_T(KC_SCLN) + +#define LALT_K1 LALT_T(KC_1) +#define LCTL_K2 LCTL_T(KC_2) +#define LGUI_K3 LGUI_T(KC_3) +#define LSFT_K4 LSFT_T(KC_4) +#define RSFT_K7 RSFT_T(KC_7) +#define RGUI_K8 RGUI_T(KC_8) +#define RCTL_K9 RCTL_T(KC_9) +#define RALT_K0 RALT_T(KC_0) + +#define LCTL_KR LCTL_T(KC_R) +#define LGUI_KS LGUI_T(KC_S) +#define LSFT_KT LSFT_T(KC_T) +#define RSFT_KN RSFT_T(KC_N) +#define RGUI_KE RGUI_T(KC_E) +#define RCTL_KI RCTL_T(KC_I) +#define RALT_KO RALT_T(KC_O) + +#define LGUI_BS LGUI_T(KC_BSPC) +#define RALT_TB RALT_T(KC_TAB) + +#define TT_N_S TT(_NUM_SYM) +#define TT_NAV TT(_NAV) +#define TO_QWRT TO(_QWERTY) +#define TO_N_S TO(_NUM_SYM) +#define TO_NAV TO(_NAV) +#define TO_MOUSE TO(_MOUSE) +#define TO_M_M TO(_MEDIA_MISC) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_COLEMAK] = LAYOUT( + //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ + XXXXXXX, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, XXXXXXX, + //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ + KC_CAPS, LALT_KA, LCTL_KR, LGUI_KS, LSFT_KT, KC_G, KC_M, RSFT_KN, RGUI_KE, RCTL_KI, RALT_KO, KC_QUOT, + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + XXXXXXX, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_DEL, KC_ESC, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, XXXXXXX, + //└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘ + KC_BSPC, TT_N_S, KC_ENT, KC_SPC, TT_NAV, KC_TAB + // └────────┴────────┴────────┘ └────────┴────────┴────────┘ + ), + + + [_QWERTY] = LAYOUT( + //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV, + //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ + KC_LCTL, LALT_KA, LCTL_KS, LGUI_KD, LSFT_KF, KC_G, KC_H, RSFT_KJ, RGUI_KK, RCTL_KL, RA_SCLN, KC_QUOT, + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_DEL, KC_ESC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + //└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘ + LGUI_BS, TT_N_S, KC_ENT, KC_SPC, TT_NAV, RALT_TB + // └────────┴────────┴────────┘ └────────┴────────┴────────┘ + ), + + + [_NUM_SYM] = LAYOUT( + //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ + _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_UNDS, KC_PLUS, _______, + //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ + _______, LALT_K1, LCTL_K2, LGUI_K3, LSFT_K4, KC_5, KC_6, RSFT_K7, RGUI_K8, RCTL_K9, RALT_K0, KC_PIPE, + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + _______, _______, KC_GRV, KC_LPRN, KC_LCBR, KC_LBRC, _______, _______, KC_RBRC, KC_RCBR, KC_RPRN, KC_MINS, KC_EQL, _______, + //└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘ + _______, DEFAULT, _______, _______, TO_NAV, _______ + // └────────┴────────┴────────┘ └────────┴────────┴────────┘ + ), + + [_NAV] = LAYOUT( + //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ + _______, _______, _______, _______, _______, _______, _______, KC_PGDN, KC_UP, KC_PGUP, _______, _______, + //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ + _______, _______, _______, _______, _______, _______, KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT, KC_END, _______, + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘ + _______, DEFAULT, _______, _______, TO_MOUSE, _______ + // └────────┴────────┴────────┘ └────────┴────────┴────────┘ + ), + + [_MOUSE] = LAYOUT( + //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ + _______, _______, _______, _______, _______, _______, _______, KC_WH_U, KC_MS_U, KC_WH_D, _______, _______, + //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ + _______, _______, _______, _______, _______, _______, KC_WH_R, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_L, TO_M_M, + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘ + _______, DEFAULT, KC_BTN2, KC_BTN1, TO_NAV, _______ + // └────────┴────────┴────────┘ └────────┴────────┴────────┘ + ), + + [_MEDIA_MISC] = LAYOUT( + //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + RESET, _______, _______, _______, _______, QWERTY, COLEMAK, _______, _______, _______, _______, _______, + //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ + _______, _______, _______, KC_MUTE, _______, _______, _______, _______, _______, _______, _______, _______, + //├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤ + KC_CAPS, KC_MPLY, KC_MNXT, KC_VOLU, KC_BRIU, _______, _______, _______, _______, _______, _______, _______, + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + _______, KC_MSTP, KC_MPRV, KC_VOLD, KC_BRID, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘ + _______, DEFAULT, _______, _______, DEFAULT, _______ + // └────────┴────────┴────────┘ └────────┴────────┴────────┘ + ) +}; + +void keyboard_post_init_user(void) { + rgblight_layers = MY_LIGHT_LAYERS; +} + +layer_state_t default_layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(_COLEMAK, layer_state_cmp(state, _COLEMAK)); + rgblight_set_layer_state(_QWERTY, layer_state_cmp(state, _QWERTY)); + + return state; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(_NUM_SYM, layer_state_cmp(state, _NUM_SYM)); + rgblight_set_layer_state(_NAV, layer_state_cmp(state, _NAV)); + rgblight_set_layer_state(_MOUSE, layer_state_cmp(state, _MOUSE)); + rgblight_set_layer_state(_MEDIA_MISC, layer_state_cmp(state, _MEDIA_MISC)); + + return state; +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + layer_move(_COLEMAK); + } + return false; + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + layer_move(_QWERTY); + } + return false; + case DEFAULT: + if (record->event.pressed) { + if (layer_state_cmp(default_layer_state, _COLEMAK)) { + layer_move(_COLEMAK); + } else if (layer_state_cmp(default_layer_state, _QWERTY)) { + layer_move(_QWERTY); + } + } + return false; + } + return true; +} |