summaryrefslogtreecommitdiff
path: root/keyboards/psuieee/pluto12/keymaps/wymcg/keymap.c
blob: 96499b8789c99eff401e654884a0131960c41235 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright 2021-22 Will McGLoughlin (wymcg)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

// Defines names for use in layer keycodes and the keymap
enum layer_names {
    _BASE,
    _NAV,
    _PROD
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  [_BASE] = LAYOUT(
    KC_MUTE,    KC_MPRV,    KC_MPLY,    KC_MNXT,
    TO(_NAV),   G(KC_1),    G(KC_2),    G(KC_3),
    TO(_PROD),  G(KC_4),    G(KC_5),    G(KC_6)
  ),
  [_NAV] = LAYOUT(
    TO(_BASE),  KC_HOME,    KC_UP,      KC_END,
    A(KC_TAB),  KC_LEFT,    KC_DOWN,    KC_RIGHT,
    G(KC_TAB),  KC_PGDN,    KC_PGUP,    MO(_BASE)
  ),
  [_PROD] = LAYOUT(
    TO(_BASE),  KC_NO,      KC_NO,      KC_NO,
    C(KC_Z),    C(KC_X),    C(KC_C),    C(KC_V),
    C(KC_A),    C(KC_LEFT), C(KC_RIGHT),MO(_BASE)
  )
};

bool encoder_update_user(uint8_t index, bool clockwise) {
    switch (biton32(layer_state)) {
        case _BASE:
            if (clockwise) {
                tap_code(KC_VOLU);
            } else {
                tap_code(KC_VOLD);
            }
            break;
        case _NAV:
            if (clockwise) {
                tap_code16(C(G(KC_RIGHT)));
            } else {
                tap_code16(C(G(KC_LEFT)));
            }
            break;
        case _PROD:
            if (clockwise) {
                tap_code16(C(KC_Y));
            } else {
                tap_code16(C(KC_Z));
            }
            break;
    }
    return false;
}