~jojo/kyria-keymap

831da63aa29cf04f1e2d7afc8237f766bd0f4d1b — JoJo 2 months ago 02a54ac
Update config
2 files changed, 54 insertions(+), 75 deletions(-)

M config.h
M keymap.c
M config.h => config.h +1 -1
@@ 17,7 17,7 @@
#pragma once

// FIXME: Just here until I've built the right half
#define MASTER_RIGHT
#define MASTER_LEFT

#define TAPPING_TERM 350


M keymap.c => keymap.c +53 -74
@@ 16,13 16,13 @@
#include QMK_KEYBOARD_H

enum layers {
    _QWERTY = 0,
    _LOWER,
    _RAISE,
    _ADJUST
    QWERTY = 0,
    SYMB,
    FUNC,
    GAME
};

#define KC_LSUP KC_LGUI
#define KC_SUP KC_LGUI

enum tapdance {
    TD_MEDIA


@@ 46,119 46,98 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 * Base Layer: QWERTY
 *
 * ,-------------------------------------------.                              ,-------------------------------------------.
 * |RAIS/ESC|   Q  |   W  |   E  |   R  |   T  |                              |   Y  |   U  |   I  |   O  |   P  |  \ |   |
 * | Tab    |   Q  |   W  |   E  |   R  |   T  |                              |   Y  |   U  |   I  |   O  |   P  |  - _   |
 * |--------+------+------+------+------+------|                              |------+------+------+------+------+--------|
 * |Ctrl/BS |   A  |   S  |  D   |   F  |   G  |                              |   H  |   J  |   K  |   L  | ;  : |  ' "   |
 * | AltGr  |   A  |   S  |  D   |   F  |   G  |                              |   H  |   J  |   K  |   L  | ;  : |  ' "   |
 * |--------+------+------+------+------+------+-------------.  ,-------------+------+------+------+------+------+--------|
 * | LShift |   Z  |   X  |   C  |   V  |   B  |LShift|LShift|  |LShift|LShift|   N  |   M  | ,  < | . >  | /  ? |  - _   |
 * | Super  |   Z  |   X  |   C  |   V  |   B  | Esc  | >Game|  | Del  | Bkspc|   N  |   M  | ,  < | . >  | /  ? |  \ |   |
 * `----------------------+------+------+------+------+------|  |------+------+------+------+------+----------------------'
 *                        | GUI  | Del  | Enter| Space| Esc  |  | Enter| Space| Tab  | Bksp | Play |
 *                        |      |      | Alt  | Lower| Raise|  | Lower| Raise|      |      | /N/P |
 *                        | Print| Ctrl | Alt  | Ctrl | Space|  | Enter| Shift| >Symb| >Func| Media|
 *                        |      | +Alt |      |      |      |  |      |      |      |      |      |
 *                        `----------------------------------'  `----------------------------------'
 */
    [_QWERTY] = LAYOUT(
      LT(_RAISE, KC_ESC),      KC_Q,   KC_W,   KC_E,   KC_R,   KC_T,                                         KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_BSLS,
      MT(MOD_LCTL, KC_BSPC),   KC_A,   KC_S,   KC_D,   KC_F,   KC_G,                                         KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,
      KC_LSFT,                 KC_Z,   KC_X,   KC_C,   KC_V,   KC_B,   KC_LSFT,   KC_LSFT, KC_LSFT, KC_LSFT, KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_MINS,
      KC_LSUP, KC_DEL, MT(MOD_LALT, KC_ENT), LT(_LOWER, KC_SPC), LT(_RAISE, KC_ESC), LT(_LOWER, KC_ENT), LT(_RAISE, KC_SPC), KC_TAB,  KC_BSPC, TD(TD_MEDIA)
    [QWERTY] = LAYOUT(
      KC_TAB,    KC_Q,   KC_W,   KC_E,    KC_R,      KC_T,                                         KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_MINS,
      KC_ALGR,   KC_A,   KC_S,   KC_D,    KC_F,      KC_G,                                         KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,
      KC_SUP,    KC_Z,   KC_X,   KC_C,    KC_V,      KC_B,   KC_ESC,  TO(GAME),   KC_DEL, KC_BSPC, KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_BSLS,
                                 KC_PSCR, C(KC_LALT),KC_LALT,KC_LCTL, KC_SPC,     KC_ENT, KC_LSFT, MO(SYMB),MO(FUNC),TD(TD_MEDIA)
    ),
/*
 * Lower Layer: Symbols
 * Symbol & numpad layer
 *
 * ,-------------------------------------------.                              ,-------------------------------------------.
 * |        |  !   |  @   |  {   |  }   |  |   |                              |      |      |      |      |      |  | \   |
 * |        |  !   |  {   |  }   |  $   |  `   |                              |   &  |  7   |  8   |  9   |  =   | Dead¯  |
 * |--------+------+------+------+------+------|                              |------+------+------+------+------+--------|
 * |        |  #   |  $   |  (   |  )   |  `   |                              |   +  |  -   |  /   |  *   |  %   |  ' "   |
 * |        |  @   |  (   |  )   |  %   |  ~   |                              |   *  |  4   |  5   |  6   |  0   | Dead¨  |
 * |--------+------+------+------+------+------+-------------.  ,-------------+------+------+------+------+------+--------|
 * |        |  %   |  ^   |  [   |  ]   |  ~   |      |      |  |      |      |   &  |  =   |  ,   |  .   |  / ? | - _    |
 * |        |  #   |  [   |  ]   |  ^   |  ¡   |      |      |  |      |      |   +  |  1   |  2   |  3   |  ¿   | Dead´  |
 * `----------------------+------+------+------+------+------|  |------+------+------+------+------+----------------------'
 *                        |      |      |      |  ;   |  =   |  |  =   |  ;   |      |      |      |
 *                        |      |      |      |      |      |  |      |      |      |      |      |
 *                        |      |      |      |      |      |  |      |      |      |      |      |
 *                        `----------------------------------'  `----------------------------------'
 */
    [_LOWER] = LAYOUT(
      _______, KC_EXLM, KC_AT,   KC_LCBR, KC_RCBR, KC_PIPE,                                     _______, _______, _______, _______, _______, KC_BSLS,
      _______, KC_HASH, KC_DLR,  KC_LPRN, KC_RPRN, KC_GRV,                                      KC_PLUS, KC_MINS, KC_SLSH, KC_ASTR, KC_PERC, KC_QUOT,
      _______, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, _______, _______, _______, _______, KC_AMPR, KC_EQL,  KC_COMM, KC_DOT,  KC_SLSH, KC_MINS,
                                 _______, _______, _______, KC_SCLN, KC_EQL,  KC_EQL,  KC_SCLN, _______, _______, _______
    [SYMB] = LAYOUT(
      _______, KC_EXLM, KC_LCBR, KC_RCBR, KC_DLR , KC_GRV       ,                                        KC_AMPR, KC_7   , KC_8   , KC_9, KC_EQL       , SAGR(KC_3),
      _______, KC_AT  , KC_LPRN, KC_RPRN, KC_PERC, KC_TILD      ,                                        KC_ASTR, KC_4   , KC_5   , KC_6, KC_0         , SAGR(KC_QUOT),
      _______, KC_HASH, KC_LBRC, KC_RBRC, KC_CIRC, SAGR(KC_EXLM), _______, _______,    _______, _______, KC_PLUS, KC_1   , KC_2   , KC_3, ALGR(KC_QUES), ALGR(KC_QUOT),
                                 _______, _______, _______      , _______, _______,    _______, _______, _______, _______, _______
    ),
/*
 * Raise Layer: Number keys, media, navigation
 * Function layer
 *
 * ,-------------------------------------------.                              ,-------------------------------------------.
 * |        |   1  |  2   |  3   |  4   |  5   |                              |  6   |  7   |  8   |  9   |  0   |        |
 * |        |      |      |      |      |      |                              |      | Home | Up   | End  | PgUp |        |
 * |--------+------+------+------+------+------|                              |------+------+------+------+------+--------|
 * |        |      | Prev | Play | Next | VolUp|                              | Left | Down | Up   | Right|      |        |
 * |        |      |      |      |      |      |                              |      | Left | Down | Right| PgDn |        |
 * |--------+------+------+------+------+------+-------------.  ,-------------+------+------+------+------+------+--------|
 * |        |      |      |      | Mute | VolDn|      |      |  |      |      | MLeft| Mdown| MUp  |MRight|      |        |
 * | F1     |  F2  |  F3  |  F4  |  F5  | F6   |      |      |  |      |      |  F7  |  F8  |  F9  |  F10 |  F11 | F12    |
 * `----------------------+------+------+------+------+------|  |------+------+------+------+------+----------------------'
 *                        |      |      |      |      |      |  |      |      |      |      |      |
 *                        |      |      |      |      |      |  |      |      |      |      |      |
 *                        `----------------------------------'  `----------------------------------'
 */
    [_RAISE] = LAYOUT(
      _______, KC_1, 	  KC_2,    KC_3,    KC_4,    KC_5,                                        KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    _______,
      _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, KC_VOLU,                                     KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT, _______, _______,
      _______, _______, _______, _______, KC_MUTE, KC_VOLD, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, _______, _______,
    [FUNC] = LAYOUT(
      _______, _______, _______, _______, _______, _______,                                     _______, KC_HOME, KC_UP  , KC_END , KC_PGUP, _______,
      _______, _______, _______, _______, _______, _______,                                     _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, _______,
      KC_F1  , KC_F2  , KC_F3  , KC_F4  , KC_F5  , KC_F6  , _______, _______, _______, _______, KC_F7  , KC_F8  , KC_F9  , KC_F10 , KC_F11 , KC_F12 ,
                                 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
    ),
/*
 * Adjust Layer: Function keys, RGB
 * Gaming layer
 *
 * ,-------------------------------------------.                              ,-------------------------------------------.
 * |        | F1   |  F2  | F3   | F4   | F5   |                              | F6   | F7   |  F8  | F9   | F10  |        |
 * | 1      | 2    | Q    | W    | E    | R    |                              |      |      |      |      |      |        |
 * |--------+------+------+------+------+------|                              |------+------+------+------+------+--------|
 * |        | TOG  | SAI  | HUI  | VAI  | MOD  |                              |      |      |      | F11  | F12  |        |
 * | Ctrl   | Shift| A    | S    | D    | F    |                              |      |      |      |      |      |        |
 * |--------+------+------+------+------+------+-------------.  ,-------------+------+------+------+------+------+--------|
 * |        |      | SAD  | HUD  | VAD  | RMOD |      |      |  |      |      |      |      |      |      |      |        |
 * | 3      | 4    | Z    | X    | C    | V    | G    | >DEF |  |      |      |      |      |      |      |      |        |
 * `----------------------+------+------+------+------+------|  |------+------+------+------+------+----------------------'
 *                        |      |      |      |      |      |  |      |      |      |      |      |
 *                        |      |      | Alt  | Space| T    |  |      |      |      | +FUNC|      |
 *                        |      |      |      |      |      |  |      |      |      |      |      |
 *                        `----------------------------------'  `----------------------------------'
 */
    [_ADJUST] = LAYOUT(
      _______, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,                                       KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  _______,
      _______, RGB_TOG, RGB_SAI, RGB_HUI, RGB_VAI, RGB_MOD,                                     _______, _______, _______, KC_F11,  KC_F12,  _______,
      _______, _______, RGB_SAD, RGB_HUD, RGB_VAD, RGB_RMOD,_______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
                                 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
    [GAME] = LAYOUT(
      KC_1   , KC_2   , KC_Q, KC_W   , KC_E   , KC_R   ,                                          _______, _______ , _______, _______, _______, _______,
      KC_LCTL, KC_LSFT, KC_A, KC_S   , KC_D   , KC_F   ,                                          _______, _______ , _______, _______, _______, _______,
      KC_3   , KC_4   , KC_Z, KC_X   , KC_C   , KC_V   , KC_G  , TO(QWERTY),    _______, _______, _______, _______ , _______, _______, _______, _______,
                              _______, _______, KC_LALT, KC_SPC, KC_T      ,    _______, _______, _______, TG(FUNC), _______
    ),
// /*
//  * Layer template
//  *
//  * ,-------------------------------------------.                              ,-------------------------------------------.
//  * |        |      |      |      |      |      |                              |      |      |      |      |      |        |
//  * |--------+------+------+------+------+------|                              |------+------+------+------+------+--------|
//  * |        |      |      |      |      |      |                              |      |      |      |      |      |        |
//  * |--------+------+------+------+------+------+-------------.  ,-------------+------+------+------+------+------+--------|
//  * |        |      |      |      |      |      |      |      |  |      |      |      |      |      |      |      |        |
//  * `----------------------+------+------+------+------+------|  |------+------+------+------+------+----------------------'
//  *                        |      |      |      |      |      |  |      |      |      |      |      |
//  *                        |      |      |      |      |      |  |      |      |      |      |      |
//  *                        `----------------------------------'  `----------------------------------'
//  */
//     [_LAYERINDEX] = LAYOUT(
//       _______, _______, _______, _______, _______, _______,                                     _______, _______, _______, _______, _______, _______,
//       _______, _______, _______, _______, _______, _______,                                     _______, _______, _______, _______, _______, _______,
//       _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
//                                  _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
//     ),
};

layer_state_t layer_state_set_user(layer_state_t state) {
    return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
}

void encoder_update_user(uint8_t index, bool clockwise) {
    if (index == 0) { // Left hand
        // Page up/Page down
        if (clockwise) {
            tap_code(KC_PGDN);
#ifdef MASTER_LEFT
    bool side_clockwise = index ? clockwise : !clockwise;
#else
    bool side_clockwise = index ? !clockwise : clockwise;
#endif
    if (index == 0) { // Left hand, brightness
        if (side_clockwise) {
            tap_code(KC_BRIGHTNESS_UP);
        } else {
            tap_code(KC_PGUP);
            tap_code(KC_BRIGHTNESS_DOWN);
        }
    } else if (index == 1) { // Right hand, volume
        // Not sure why, but clockwise is inverted for me?
        if (!clockwise) {
        if (side_clockwise) {
            tap_code(KC_VOLU);
        } else {
            tap_code(KC_VOLD);