aboutsummaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
authorMats Nilsson <matni403@gmail.com>2021-06-19 02:55:56 +0200
committerGitHub <noreply@github.com>2021-06-18 17:55:56 -0700
commit8de028f1889da418de52bdc1da138687c4944378 (patch)
treee99c298cf3a55bc4ef6a6f9f942cc832b996ee26 /users
parent8694e2d3f074ffbdc9f3fc1c0a5fe3c6b4163f5d (diff)
downloadqmk_firmware-8de028f1889da418de52bdc1da138687c4944378.tar.gz
qmk_firmware-8de028f1889da418de52bdc1da138687c4944378.zip
[Keymap] Add my keymaps for the Keebio Iris and Planck (#13005)
Diffstat (limited to 'users')
-rw-r--r--users/mnil/config.h21
-rw-r--r--users/mnil/mnil.c146
-rw-r--r--users/mnil/mnil.h85
-rw-r--r--users/mnil/readme.md23
-rw-r--r--users/mnil/rules.mk7
5 files changed, 282 insertions, 0 deletions
diff --git a/users/mnil/config.h b/users/mnil/config.h
new file mode 100644
index 000000000..3547785ff
--- /dev/null
+++ b/users/mnil/config.h
@@ -0,0 +1,21 @@
1/* Copyright 2021 Mats Nilsson
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#define MK_3_SPEED
20#define MK_MOMENTARY_ACCEL
21#define PERMISSIVE_HOLD
diff --git a/users/mnil/mnil.c b/users/mnil/mnil.c
new file mode 100644
index 000000000..11d5ee28d
--- /dev/null
+++ b/users/mnil/mnil.c
@@ -0,0 +1,146 @@
1/* Copyright 2021 Mats Nilsson
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "mnil.h"
18
19bool process_record_user(uint16_t keycode, keyrecord_t *record) {
20 switch (keycode) {
21 case M_TILD: // ~
22 if (record->event.pressed) {
23 tap_code16(RALT(KC_RBRC));
24 tap_code(KC_SPC);
25 } else {
26 }
27 break;
28 case M_CIRC: // ^
29 if (record->event.pressed) {
30 tap_code16(S(KC_RBRC));
31 tap_code(KC_SPC);
32 } else {
33 }
34 break;
35 case M_BTCK: // `
36 if (record->event.pressed) {
37 tap_code16(S(KC_EQL));
38 tap_code(KC_SPC);
39 } else {
40 }
41 break;
42 case QWE_COL: // Swap default keymap layer
43 if (record->event.pressed) {
44 if (get_highest_layer(default_layer_state) == _COLEMAK) {
45 default_layer_set(1UL << _QWERTY);
46 } else {
47 default_layer_set(1UL << _COLEMAK);
48 }
49 }
50 break;
51 }
52 return true;
53};
54
55// Tap Dance
56// Determine the current tap dance state
57int cur_dance(qk_tap_dance_state_t *state) {
58 if (state->count == 1) {
59 if (state->interrupted || !state->pressed)
60 return SINGLE_TAP;
61 else
62 return SINGLE_HOLD;
63 } else if (state->count == 2) {
64 if (state->interrupted)
65 return DOUBLE_SINGLE_TAP;
66 else if (state->pressed)
67 return DOUBLE_HOLD;
68 else
69 return DOUBLE_SINGLE_TAP;
70 }
71 if (state->count == 3) {
72 if (state->interrupted || !state->pressed)
73 return TRIPLE_TAP;
74 else
75 return TRIPLE_HOLD;
76 } else
77 return 8;
78}
79
80static tap ae_tap_state = {.is_press_action = true, .state = 0};
81
82void ae_finished(qk_tap_dance_state_t *state, void *user_data) {
83 ae_tap_state.state = cur_dance(state);
84 switch (ae_tap_state.state) {
85 case SINGLE_TAP:
86 register_code(KC_A);
87 break;
88 case SINGLE_HOLD:
89 tap_code(SE_AE);
90 break;
91 case DOUBLE_SINGLE_TAP:
92 tap_code(KC_A);
93 register_code(KC_A);
94 break;
95 }
96}
97
98void ae_reset(qk_tap_dance_state_t *state, void *user_data) {
99 switch (ae_tap_state.state) {
100 case SINGLE_TAP:
101 unregister_code(KC_A);
102 break;
103 case DOUBLE_SINGLE_TAP:
104 unregister_code(KC_A);
105 break;
106 }
107 ae_tap_state.state = 0;
108}
109
110static tap aa_tap_state = {.is_press_action = true, .state = 0};
111
112void aa_finished(qk_tap_dance_state_t *state, void *user_data) {
113 aa_tap_state.state = cur_dance(state);
114 switch (aa_tap_state.state) {
115 case SINGLE_TAP:
116 register_code(SE_OSLH);
117 break;
118 case SINGLE_HOLD:
119 register_code(SE_AA);
120 unregister_code(SE_AA);
121 break;
122 case DOUBLE_SINGLE_TAP:
123 tap_code(SE_OSLH);
124 register_code(SE_OSLH);
125 break;
126 }
127}
128
129void aa_reset(qk_tap_dance_state_t *state, void *user_data) {
130 switch (aa_tap_state.state) {
131 case SINGLE_TAP:
132 unregister_code(SE_OSLH);
133 break;
134 case DOUBLE_SINGLE_TAP:
135 unregister_code(SE_OSLH);
136 break;
137 }
138 aa_tap_state.state = 0;
139}
140
141// clang-format off
142qk_tap_dance_action_t tap_dance_actions[] = {
143 [AAE] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, ae_finished, ae_reset, 250),
144 [OAA] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, aa_finished, aa_reset, 250)
145};
146// clang-format on
diff --git a/users/mnil/mnil.h b/users/mnil/mnil.h
new file mode 100644
index 000000000..357acfe3c
--- /dev/null
+++ b/users/mnil/mnil.h
@@ -0,0 +1,85 @@
1/* Copyright 2021 Mats Nilsson
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include QMK_KEYBOARD_H
20#include "keymap_swedish.h"
21
22// Layers
23enum layers {
24 _COLEMAK,
25 _QWERTY,
26 _SYMBOLS,
27 _NAVIGATION,
28 _NUMPAD,
29};
30
31// Custom Keycodes
32#define _NAV_SPC LT(_NAVIGATION, KC_SPC) // _NAVIGATION when held, SPACE when tapped
33#define _SYM_ENT LT(_SYMBOLS, KC_ENT) // _SYMBOLS when held, ENTER when tapped
34#define CTL_BSPC MT(MOD_LCTL, KC_BSPC) // CTRL when held, BACKSPACE when tapped
35#define ALT_DEL MT(MOD_LALT, KC_DEL) // ALT when held, DELETE when tapped
36#define SFT_TAB MT(MOD_LSFT, KC_TAB) // SHIFT when held, TAB when tapped
37#define C_TAB C(KC_TAB) // CTRL+TAB
38#define CS_TAB C(S(KC_TAB)) // SHIFT+CTRL+TAB
39#define CUT C(KC_X) // CTRL+X
40#define COPY C(KC_INS) // CTRL+INSERT
41#define PASTE S(KC_INS) // SHIFT+INSERT
42#define AUTOFILL C(S(KC_L)) // Bitwarden Autofill, CTRL+SHIFT+L
43
44// i3 config
45#define I3MOD KC_LGUI // $mod
46#define OPEN G(KC_SPC) // $mod+SPACE
47#define QUIT G(S(KC_Q)) // $mod+SHIFT+Q
48#define WIN G(C(KC_SPC)) // $mod+CTRL+SPACE
49#define BROWSER G(KC_ENTER) // $mod+ENTER
50#define TERM G(S(KC_ENTER)) // $mod+CTRL+ENTER
51#define NXTWS G(KC_TAB) // $mod+TAB
52#define PRVWS G(S(KC_TAB)) // $mod+SHIFT+TAB
53#define MOVWS G(KC_LSFT) // $mod+SHIFT+$X
54#define CRYWS G(KC_LALT) // $mod+ALT+$X
55#define MVWSL G(C(S(KC_LEFT))) // $mod+CTRL+SHIFT+LEFT
56#define MVWSR G(C(S(KC_RGHT))) // $mod+CTRL+SHIFT+RIGHT
57
58enum custom_keycodes {
59 M_TILD = SAFE_RANGE, // ~
60 M_CIRC, // ^
61 M_BTCK, // `
62 QWE_COL, // Swaps default layer
63};
64
65// Tap Dance
66typedef struct {
67 bool is_press_action;
68 int state;
69} tap;
70
71// Define a type for as many tap dance states as you need
72enum {
73 SINGLE_TAP = 1,
74 SINGLE_HOLD = 2,
75 DOUBLE_TAP = 3,
76 DOUBLE_HOLD = 4,
77 DOUBLE_SINGLE_TAP = 5, // send two single taps
78 TRIPLE_TAP = 6,
79 TRIPLE_HOLD = 7
80};
81
82enum {
83 AAE = 0, // a and ae
84 OAA, // o and aa
85};
diff --git a/users/mnil/readme.md b/users/mnil/readme.md
new file mode 100644
index 000000000..f688ea388
--- /dev/null
+++ b/users/mnil/readme.md
@@ -0,0 +1,23 @@
1# mnil's user settings
2This keymap consist of four primary layers, `_COLEMAK`, `_SYMBOL`, `_NAVIGATION` and `_NUMPAD`.
3Colemak layout for less finger travel distance and to reduce RSI.
4The `_SYMBOL` layer is optimized for programming, specifically in `C++`.
5Space and Enter do double duties as layer toggle on hold where the `_NUMPAD` is entered when both are held down.
6`ALT+TAB` and `SHIFT+ALT+TAB` keys is implemented to register `ALT` and then `TAB` on each subsequent key press one leaves the `_NUMPAD`-layer.
7The Swedish characters `åäöÅÄÖ` are added as a tap dances on top of the Colemak layer since they are rarely needed.
8
9# License
10Copyright 2021 Mats Nilsson matni403@gmail.com @mnil
11
12This program is free software: you can redistribute it and/or modify
13it under the terms of the GNU General Public License as published by
14the Free Software Foundation, either version 2 of the License, or
15(at your option) any later version.
16
17This program is distributed in the hope that it will be useful,
18but WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License
23along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/users/mnil/rules.mk b/users/mnil/rules.mk
new file mode 100644
index 000000000..22cebfaee
--- /dev/null
+++ b/users/mnil/rules.mk
@@ -0,0 +1,7 @@
1SRC += mnil.c
2MOUSEKEY_ENABLE = yes # Enable mouse keys
3LTO_ENABLE = yes # Enable link time optimization
4BACKLIGHT_ENABLE = no
5CONSOLE_ENABLE = no
6AUTO_SHIFT_ENABLE = no
7TAP_DANCE_ENABLE = yes