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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
/* Copyright 2021 James Won <me@jwon.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
enum layer_names {
_BASE_DVORAK,
_RAISE_DVORAK,
_KEYPAD,
_QWERTY,
};
// Mac-specific macros
#define MACCOPY LGUI(KC_C)
#define MACPAST LGUI(KC_V)
#define MACUNDO LGUI(KC_Z)
#define MACREDO LGUI(KC_Y)
#define MACLOCK LGUI(LCTL(KC_Q))
#define LSA_ LSA(KC_NO)
#define SFT_ESC SFT_T(KC_ESC)
#define KEYPAD TG(_KEYPAD)
#define QWERTY TG(_QWERTY)
#define RAISE MO(_RAISE_DVORAK)
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE_DVORAK] = LAYOUT (
MACLOCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_PAUS, QWERTY, QK_BOOT,
KC_PIPE, KC_PLUS, KC_LBRC, KC_LCBR, KC_LPRN, KC_AMPR, KC_EQL, KC_RPRN, KC_RCBR, KC_RBRC, KC_ASTR, KC_EXLM,
KC_TAB, KC_SCLN, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSLS,
SFT_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS,
KC_LCTL, KC_QUOT, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT,
KC_DLR, KC_BSLS, KC_LEFT, KC_RGHT, KC_DOWN, KC_UP, KC_SLSH, KC_AT,
KC_LGUI, KC_LALT, KEYPAD, LSA_,
MACPAST, MACUNDO,
KC_BSPC, KC_SPC, MACCOPY, MACREDO, RAISE, KC_ENT
),
[_RAISE_DVORAK] = LAYOUT (
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_PERC,
_______, KC_COLN, KC_LABK, KC_RABK, S(KC_P), S(KC_Y), S(KC_F), S(KC_G), S(KC_C), S(KC_R), S(KC_L), KC_HASH,
_______, S(KC_A), S(KC_O), S(KC_E), S(KC_U), S(KC_I), S(KC_D), S(KC_H), S(KC_T), S(KC_N), S(KC_S), KC_UNDS,
_______, KC_DQUO, S(KC_Q), S(KC_J), S(KC_K), S(KC_X), S(KC_B), S(KC_M), S(KC_W), S(KC_V), S(KC_Z), _______,
KC_TILD, KC_PIPE, _______, _______, _______, _______, KC_QUES, KC_CIRC,
_______, _______, _______, _______,
_______, _______,
_______, _______, _______, _______, _______, _______
),
[_KEYPAD] = LAYOUT (
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, KC_NUM, KC_PEQL, KC_PSLS, KC_PAST, _______,
_______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PMNS, _______,
_______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, KC_PPLS, _______,
_______, _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, KC_PENT, _______,
_______, _______, _______, _______, _______, _______, KC_PDOT, KC_PENT,
_______, _______, _______, _______,
_______, _______,
_______, _______, _______, _______, _______, KC_P0
),
[_QWERTY] = LAYOUT(
KC_ESC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_CAPS, 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_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_GRV, KC_INS, KC_LEFT, KC_RGHT, KC_UP, KC_DOWN, KC_LBRC, KC_RBRC,
KC_LGUI, KC_LALT, KC_RGUI, KC_RCTL,
KC_HOME, KC_PGUP,
KC_BSPC, KC_DEL, KC_END , KC_PGDN, KC_ENT, KC_SPC
)
};
layer_state_t layer_state_set_user(layer_state_t state) {
switch (get_highest_layer(state)) {
case _KEYPAD:
writePinLow(LED_COMPOSE_PIN);
break;
case _RAISE_DVORAK:
writePinLow(LED_NUM_LOCK_PIN);
break;
case _QWERTY:
writePinLow(LED_SCROLL_LOCK_PIN);
break;
default: // for any other layers, or the default layer
writePinHigh(LED_NUM_LOCK_PIN);
writePinHigh(LED_SCROLL_LOCK_PIN);
writePinHigh(LED_COMPOSE_PIN);
break;
}
return state;
}
bool led_update_user(led_t led_state) {
// Disable led_update_kb() so that layer indication code doesn't get overridden.
return false;
}
void matrix_scan_user(void) {
writePin(LED_CAPS_LOCK_PIN, !(get_mods() & MOD_MASK_SHIFT));
}
|