forked from learn-alexuser01/tmk_firrmware_hhkb_teensy2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeymap_es.c
142 lines (133 loc) · 6.67 KB
/
keymap_es.c
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*
* SpaceFN
* http://geekhack.org/index.php?topic=51069.0
*/
#include "keymap_common.h"
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Layer 0: Default Layer
* ,----------------------------------------------------------------------------.
* |Esc/~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|VolDn|VolUp|
* |-----------------------------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Bkspc/Pipe|
* |-----------------------------------------------------------------------------|
* |Control | A| S| D| F| G| H| J| K| L| ;| '|Enter |
* |-----------------------------------------------------------------------------|
* |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0 |
* |-----------------------------------------------------------------------------|
* |Gui |Alt | SpaceFN |Alt |Gui |
* `-----------------------------------------------------'
*/
KEYMAP(FN2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, _VOLDOWN, _VOLUP, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, FN3, \
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \
LGUI,LALT, FN1, RALT,RGUI),
/* Layer 1: HHKB mode (HHKB Fn)
* ,-----------------------------------------------------------.
* |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
* |-----------------------------------------------------------|
* |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs|
* |-----------------------------------------------------------|
* | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
* |-----------------------------------------------------------|
* | | | | | | | +| -|End|PgD|Dow| | |
* `-----------------------------------------------------------'
* | | | | | |
* `-------------------------------------------'
*/
KEYMAP(POWER, SLEP, WAKE, F3, F4, F5, F6, F7, F8, F9, F10,TRNS, F11, TRNS, TRNS, \
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS, BSLS, \
TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT, \
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS,TRNS, \
TRNS,TRNS, SPC, TRNS,TRNS),
/* Layer 2: SpaceFN
* ,----------------------------------------------------------------------------.
* |` | F9| F10| F11| F12| | | | | | | | | Mute| OutP|
* ,----------------------------------------------------------------------------.
* |LANG3 | F5| F6| F7| F8| | | | | |PScn| | | \|
* |----------------------------------------------------------------------------|
* | | F1| F2| F3| F4| |Left|Down| Up|Righ|Home| End|LANG1 |
* |----------------------------------------------------------------------------|
* | | | | | |LANG2| | ~| `| | | | |
* |----------------------------------------------------------------------------|
* | | | | | |
* `-----------------------------------------------------'
*
* LANG1 (SpaceFN+ENTER) assigned in i3 to spawn terminal
* LANG2 (SpaceFN+B) assigned in i3 to spawn browser
* LANG3 (SpaceFN+TAB) assigned in i3 to kill window
*/
KEYMAP(GRV, F9, F10, F11, F12,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, _MUTE,OUT, \
LANG3,F5 ,F6 ,F7 ,F8 ,TRNS,TRNS,TRNS,TRNS,TRNS, PSCR,TRNS,TRNS,BSLS, \
LCTL,F1 ,F2 ,F3 ,F4 ,TRNS,LEFT,DOWN,UP,RGHT,HOME,END ,LANG1, \
TRNS,TRNS,TRNS,TRNS,TRNS,LANG2, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,NO, \
TRNS,TRNS, TRNS, TRNS,TRNS),
};
/*
* user defined action function
*/
enum function_id {
SHIFT_ESC, // Shift + Esc -> Tilde
SHIFT_BSPC, // Shift + Backspace -> Pipe
};
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
if (record->event.pressed) dprint("P"); else dprint("R");
if (record->tap.interrupted) dprint("i");
# define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
static uint8_t shift_mod;
switch (id) {
// Shift + Esc -> ~
case SHIFT_ESC:
shift_mod = get_mods()&MODS_SHIFT_MASK;
if (record->event.pressed) {
if (shift_mod) {
add_key(KC_GRV);
send_keyboard_report(); // send grave with shift for tilde result
} else {
del_mods(shift_mod); // remove shift
add_key(KC_ESC);
send_keyboard_report(); // send escape
add_mods(shift_mod); // return shift but not sent
}
} else {
if (shift_mod) {
del_key(KC_GRV);
send_keyboard_report();
} else {
del_key(KC_ESC);
send_keyboard_report();
}
}
break;
case SHIFT_BSPC:
shift_mod = get_mods()&MODS_SHIFT_MASK;
if (record->event.pressed) {
if (shift_mod) {
add_key(KC_BSLS);
send_keyboard_report(); // send backslash with shift for pipe result
} else {
del_mods(shift_mod); // remove shift
add_key(KC_BSPC);
send_keyboard_report(); // send backspace
add_mods(shift_mod); // return shift but not sent
}
} else {
if (shift_mod) {
del_key(KC_BSLS);
send_keyboard_report();
} else {
del_key(KC_BSPC);
send_keyboard_report();
}
}
break;
}
}
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1),
[1] = ACTION_LAYER_TAP_KEY(2, KC_SPACE),
[2] = ACTION_FUNCTION(SHIFT_ESC),
[3] = ACTION_FUNCTION(SHIFT_BSPC),
// [x] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
};