aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerikbakker-dev <39745006+erikbakker-dev@users.noreply.github.com>2021-02-02 06:52:00 +0100
committerGitHub <noreply@github.com>2021-02-02 16:52:00 +1100
commit80a9649c4f2f74c94ff180b6fe480944fe654800 (patch)
treea8058b5e4ac5d6adb140d8fa39520de21350b260
parent7db826dce89eb16fa0b6362852b97f5a0e4880d5 (diff)
downloadqmk_firmware-80a9649c4f2f74c94ff180b6fe480944fe654800.tar.gz
qmk_firmware-80a9649c4f2f74c94ff180b6fe480944fe654800.zip
add orthodeluxe keymap for Planck keyboard (#11077)
* add orthodeluxe keymap for Planck keyboard * add licence header to config.h * fix indentation * add bootmagic lite and simplify code
-rw-r--r--keyboards/planck/keymaps/orthodeluxe/config.h27
-rw-r--r--keyboards/planck/keymaps/orthodeluxe/keymap.c533
-rw-r--r--keyboards/planck/keymaps/orthodeluxe/readme.md64
-rw-r--r--keyboards/planck/keymaps/orthodeluxe/rules.mk5
4 files changed, 629 insertions, 0 deletions
diff --git a/keyboards/planck/keymaps/orthodeluxe/config.h b/keyboards/planck/keymaps/orthodeluxe/config.h
new file mode 100644
index 000000000..05b5e8deb
--- /dev/null
+++ b/keyboards/planck/keymaps/orthodeluxe/config.h
@@ -0,0 +1,27 @@
1/* Copyright 2020 Erik Bakker
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 ENCODER_RESOLUTION 4
20#define TAPPING_TERM 175
21#define TAPPING_TOGGLE 3
22#define BOOTMAGIC_LITE_ROW 0
23#define BOOTMAGIC_LITE_COLUMN 0
24#define BOOTMAGIC_LITE_MACOS_ROW 2
25#define BOOTMAGIC_LITE_MACOS_COLUMN 7
26#define BOOTMAGIC_LITE_WIN_ROW 0
27#define BOOTMAGIC_LITE_WIN_COLUMN 2
diff --git a/keyboards/planck/keymaps/orthodeluxe/keymap.c b/keyboards/planck/keymaps/orthodeluxe/keymap.c
new file mode 100644
index 000000000..f7a483422
--- /dev/null
+++ b/keyboards/planck/keymaps/orthodeluxe/keymap.c
@@ -0,0 +1,533 @@
1/* Copyright 2020 Erik Bakker
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 QMK_KEYBOARD_H
18#include "muse.h"
19
20enum planck_layers {
21 _BASELAYER_MACOS,
22 _BASELAYER_WINDOWS,
23 _LEFTYLAYER,
24 _NUMLAYER_MACOS,
25 _NUMLAYER_WINDOWS,
26 _NAVLAYER_MACOS,
27 _NAVLAYER_WINDOWS,
28 _SYMLAYER_MACOS,
29 _SYMLAYER_WINDOWS,
30 _UTILSLAYER
31};
32
33enum planck_keycodes {
34 MACOS = SAFE_RANGE,
35 WINDOWS,
36 RCMDCTRL,
37 LEFTYCUT, LEFTYCOPY, LEFTYPASTE,
38 PLUSCOLON,
39 APPSWITCH, TASKVIEW, PREVDESK, NEXTDESK,
40 QUOTES, DQUOTES,
41 POINTYBR, SQUAREBR, CURLYBR, ROUNDBR
42};
43
44enum appswitch_mode {
45 APPSWITCH_OFF,
46 APPSWITCH_FIRST_TIME,
47 APPSWITCH_ON,
48 APPSWITCH_TASK_VIEW
49};
50
51enum quote_shapes {
52 SINGLE_QUOTE, DOUBLE_QUOTE
53};
54
55enum bracket_shapes {
56 POINTY, SQUARE, CURLY, ROUND
57};
58
59uint8_t windowsmode = 0;
60
61#define L_NUM_M MO(_NUMLAYER_MACOS)
62#define L_NUM_W MO(_NUMLAYER_WINDOWS)
63#define L_NAV_M MO(_NAVLAYER_MACOS)
64#define L_NAV_W MO(_NAVLAYER_WINDOWS)
65#define L_SYM_M MO(_SYMLAYER_MACOS)
66#define L_SYM_W MO(_SYMLAYER_WINDOWS)
67#define UTILSLAYER MO(_UTILSLAYER)
68
69static void set_keycodes_for_os(int os);
70static bool handle_app_switch(bool pressed);
71static bool app_switch_valid_keycode(uint16_t keycode);
72static bool handle_right_command_or_control(bool pressed);
73static bool handle_pluscolon(bool pressed);
74static bool type_quotes(uint8_t quote_shape, bool pressed);
75static bool type_brackets(uint8_t bracket_shape, bool pressed);
76
77const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
78
79/* Base layer:
80 * ,-----------------------------------------------------------------------------------.
81 * |BckSpc| Q | W | E | R | T | Y | U | I | O | P | Del |
82 * |------+------+------+------+------+------+------+------+------+------+------+------|
83 * | Esc | A | S | D | F | G | H | J | K | L | ; : | Enter|
84 * |------+------+------+------+------+------+------+------+------+------+------+------|
85 * | Tab- | Z | X | C | V | B | N | M | , < | . > | / ? | Tab |
86 * |------+------+------+------+------+-------------+------+------+------+------+------|
87 * | Shift| | | |NumLyr| Space |NavLyr| | | | Shift|
88 * `-----------------------------------------------------------------------------------'
89 *
90 * Bottom row for MacOS:
91 * |------+------+------+------+------+-------------+------+------+------+------+------|
92 * | Shift| Ctrl |Option| Cmd |NumLyr| Space |NavLyr| Cmd |Option| Ctrl | Shift|
93 * `-----------------------------------------------------------------------------------'
94 *
95 * Bottom row for Windows:
96 * |------+------+------+------+------+-------------+------+------+------+------+------|
97 * | Shift| Win | Alt | Ctrl |NumLyr| Space |NavLyr| Ctrl | Alt | Menu | Shift|
98 * `-----------------------------------------------------------------------------------'
99 */
100[_BASELAYER_MACOS] = LAYOUT_planck_grid(
101 KC_BSPC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL,
102 KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
103 _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_TAB,
104 KC_LSFT, KC_LCTRL, KC_LALT, KC_LGUI, L_NUM_M, KC_SPC, KC_SPC, L_NAV_M, RCMDCTRL, KC_RALT, KC_RCTRL, KC_RSFT
105),
106[_BASELAYER_WINDOWS] = LAYOUT_planck_grid(
107 KC_BSPC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL,
108 KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
109 _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_TAB,
110 KC_LSFT, KC_LGUI, KC_LALT, KC_LCTRL, L_NUM_W, KC_SPC, KC_SPC, L_NAV_W, RCMDCTRL, KC_RALT, KC_APP, KC_RSFT
111),
112
113/* Lefty layer:
114 * This layer enables lefties (who mouse with their left hand) to easily cut, copy and paste using their right hand.
115 * ,-----------------------------------------------------------------------------------.
116 * | | | | | | | | | | | | |
117 * |------+------+------+------+------+------+------+------+------+------+------+------|
118 * | | | | | | | | | | | | |
119 * |------+------+------+------+------+------+------+------+------+------+------+------|
120 * | | | | | | | | Cut | Copy | Paste| | |
121 * |------+------+------+------+------+-------------+------+------+------+------+------|
122 * | | | | | | | |(hold)| | | |
123 * '-----------------------------------------------------------------------------------'
124 */
125
126 [_LEFTYLAYER] = LAYOUT_planck_grid(
127 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
128 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
129 _______, _______, _______, _______, _______, _______, _______, KC_X, KC_C, KC_V, _______, _______,
130 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
131),
132
133/* Numpad layer:
134 * ,-----------------------------------------------------------------------------------.
135 * | | & | | | ! | + | = | % | 7 | 8 | 9 | * | = |
136 * |------+------+------+------+------+------+------+------+------+------+------+------|
137 * | | @ | ' ' | " " | - | _ | € | 4 | 5 | 6 | + : | Enter|
138 * |------+------+------+------+------+------+------+------+------+------+------+------|
139 * | | < > | [ ] | { } | ( ) | \ | $ | 1 | 2 | 3 | / | |
140 * |------+------+------+------+------+-------------+------+------+------+------+------|
141 * | | | | |(hold)| |SymLyr| 0 | . | - | |
142 * `-----------------------------------------------------------------------------------'
143 */
144[_NUMLAYER_MACOS] = LAYOUT_planck_grid(
145 _______, KC_AMPR, KC_PIPE, KC_EXLM, KC_PPLS, KC_EQL, KC_PERC, KC_7, KC_8, KC_9, KC_PAST, KC_EQL,
146 _______, KC_AT, QUOTES, DQUOTES, KC_MINS, KC_UNDS, RALT(KC_2), KC_4, KC_5, KC_6, PLUSCOLON, KC_PENT,
147 _______, POINTYBR, SQUAREBR, CURLYBR, ROUNDBR, KC_BSLS, KC_DLR, KC_1, KC_2, KC_3, KC_PSLS, _______,
148 _______, _______, _______, _______, _______, _______, _______, L_SYM_M, KC_0, KC_PDOT, KC_PMNS, _______
149),
150[_NUMLAYER_WINDOWS] = LAYOUT_planck_grid(
151 _______, KC_AMPR, KC_PIPE, KC_EXLM, KC_PPLS, KC_EQL, KC_PERC, KC_7, KC_8, KC_9, KC_PAST, KC_EQL,
152 _______, KC_AT, QUOTES, DQUOTES, KC_MINS, KC_UNDS, RALT(KC_5), KC_4, KC_5, KC_6, PLUSCOLON, KC_PENT,
153 _______, POINTYBR, SQUAREBR, CURLYBR, ROUNDBR, KC_BSLS, KC_DLR, KC_1, KC_2, KC_3, KC_PSLS, _______,
154 _______, _______, _______, _______, _______, _______, _______, L_SYM_W, KC_0, KC_PDOT, KC_PMNS, _______
155),
156
157/* Symbol layer:
158 * ,-----------------------------------------------------------------------------------.
159 * | | | | € | | ~ | | _ | ^ | | % | |
160 * |------+------+------+------+------+------+------+------+------+------+------+------|
161 * | | @ | $ | $ | | ` | # | | | | | |
162 * |------+------+------+------+------+------+------+------+------+------+------+------|
163 * | | | ! | | | \ | ~ | & | | | ! | |
164 * |------+------+------+------+------+-------------+------+------+------+------+------|
165 * | | | | |(hold)| UtilsLayer |(hold)| | | | |
166 * `-----------------------------------------------------------------------------------'
167 */
168[_SYMLAYER_MACOS] = LAYOUT_planck_grid(
169 _______, XXXXXXX, XXXXXXX, RALT(KC_2), XXXXXXX, KC_TILD, XXXXXXX, KC_UNDS, KC_CIRC, XXXXXXX, KC_PERC, _______,
170 _______, KC_AT, KC_DLR, KC_DLR, XXXXXXX, KC_GRV, KC_HASH, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______,
171 _______, XXXXXXX, KC_EXLM, XXXXXXX, XXXXXXX, KC_BSLS, KC_TILD, KC_AMPR, XXXXXXX, XXXXXXX, KC_EXLM, _______,
172 _______, _______, _______, _______, _______, UTILSLAYER, UTILSLAYER, _______, _______, _______, _______, _______
173),
174[_SYMLAYER_WINDOWS] = LAYOUT_planck_grid(
175 _______, XXXXXXX, XXXXXXX, RALT(KC_5), XXXXXXX, KC_TILD, XXXXXXX, KC_UNDS, KC_CIRC, XXXXXXX, KC_PERC, _______,
176 _______, KC_AT, KC_DLR, KC_DLR, XXXXXXX, KC_GRV, KC_HASH, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______,
177 _______, XXXXXXX, KC_EXLM, XXXXXXX, XXXXXXX, KC_BSLS, KC_TILD, KC_AMPR, XXXXXXX, XXXXXXX, KC_EXLM, _______,
178 _______, _______, _______, _______, _______, UTILSLAYER, UTILSLAYER, _______, _______, _______, _______, _______
179),
180
181/* Navigation layer:
182 * ,-----------------------------------------------------------------------------------.
183 * | | F1 | F2 | F3 | F4 | | PgUp | Home | Up | End |PrtScr| Lock |
184 * |------+------+------+------+------+------+------+------+------+------+------+------|
185 * | | F5 | F6 | F7 | F8 | | PgDn | Left | Down | Right| AppSw| |
186 * |------+------+------+------+------+------+------+------+------+------+------+------|
187 * | | F9 | F10 | F11 | F12 | | |PrDesk| Down |NxDesk|TaskVw| |
188 * |------+------+------+------+------+-------------+------+------+------+------+------|
189 * | | | | |SymLyr| |(hold)| | | | |
190 * `-----------------------------------------------------------------------------------'
191 */
192[_NAVLAYER_MACOS] = LAYOUT_planck_grid(
193 _______, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, KC_PGUP, G(KC_LEFT), KC_UP, G(KC_RGHT), SGUI(KC_4), C(G(KC_Q)),
194 _______, KC_F5, KC_F6, KC_F7, KC_F8, XXXXXXX, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, APPSWITCH, _______,
195 _______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, C(KC_LEFT), KC_DOWN, C(KC_RGHT), C(KC_UP), _______,
196 _______, _______, _______, _______, L_SYM_M, _______, _______, _______, _______, _______, _______, _______
197),
198[_NAVLAYER_WINDOWS] = LAYOUT_planck_grid(
199 _______, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_PSCR, G(KC_L),
200 _______, KC_F5, KC_F6, KC_F7, KC_F8, XXXXXXX, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, APPSWITCH, _______,
201 _______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, C(G(KC_LEFT)), KC_DOWN, C(G(KC_RGHT)), G(KC_TAB), _______,
202 _______, _______, _______, _______, L_SYM_W, _______, _______, _______, _______, _______, _______, _______
203),
204
205/* Utilities layer:
206 * ,-----------------------------------------------------------------------------------.
207 * | | | Win | | Reset| | | | Ins | | Pause| |
208 * |------+------+------+------+------+------+------+------+------+------+------+------|
209 * | | |ScrlLk| Debug| | | | | | | | |
210 * |------+------+------+------+------+------+------+------+------+------+------+------|
211 * | | | |CapsLk| | | NumLk| Mac | | | | |
212 * |------+------+------+------+------+-------------+------+------+------+------+------|
213 * | | | | |(hold)| (hold) |(hold)| | | | |
214 * `-----------------------------------------------------------------------------------'
215 */
216[_UTILSLAYER] = LAYOUT_planck_grid(
217 _______, XXXXXXX, WINDOWS, XXXXXXX, RESET, XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, XXXXXXX, KC_PAUS, _______,
218 _______, XXXXXXX, KC_SLCK, DEBUG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______,
219 _______, XXXXXXX, XXXXXXX, KC_CAPS, XXXXXXX, XXXXXXX, KC_NLCK, MACOS, XXXXXXX, XXXXXXX, XXXXXXX, _______,
220 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
221)
222};
223
224/* Bootmagic keys (hold when plugging in the USB cable):
225 * ,-----------------------------------------------------------------------------------.
226 * |BootLd| | Win | | | | | | | | | |
227 * |------+------+------+------+------+------+------+------+------+------+------+------|
228 * | | | | | | | | | | | | |
229 * |------+------+------+------+------+------+------+------+------+------+------+------|
230 * | | | | | | | | Mac | | | | |
231 * |------+------+------+------+------+-------------+------+------+------+------+------|
232 * | | | | | | | | | | | |
233 * `-----------------------------------------------------------------------------------'
234 */
235
236#ifdef AUDIO_ENABLE
237 float plover_song[][2] = SONG(PLOVER_SOUND);
238 float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
239#endif
240
241bool app_switch_active = false;
242static uint16_t timer;
243static uint16_t duration = 0;
244static bool double_tap = false;
245uint8_t active_modifiers = 0;
246bool shift_modifier_active = false;
247uint8_t keycode_rightcommand;
248uint8_t keycode_appswitch;
249
250/* main loop */
251bool process_record_user(uint16_t keycode, keyrecord_t *record) {
252
253 /* Store modifiers in booleans for easy access in underlying methods. */
254 active_modifiers = get_mods();
255 shift_modifier_active = active_modifiers & ((1<<((KC_LSFT) & 0x07)) | (1<<((KC_RSFT) & 0x07)));
256
257 /* Switch off timer when double click time is exceeded. */
258 if (timer > 0) {
259 duration = timer_elapsed(timer);
260 if (duration > TAPPING_TERM) { timer = 0; }
261 }
262
263 /* Keep app_switch_active true, while a valid key is pressed. */
264 if (app_switch_active) {
265 if ((keycode == L_NAV_M || keycode == L_NAV_W) && record->event.pressed == false) {
266 unregister_code(keycode_appswitch);
267 app_switch_active = false;
268 }
269 if (app_switch_valid_keycode(keycode) == false) {
270 unregister_code(keycode_appswitch);
271 app_switch_active = false;
272 }
273 }
274
275 switch (keycode) {
276 case MACOS:
277 #ifdef AUDIO_ENABLE
278 stop_all_notes();
279 PLAY_SONG(plover_song);
280 #endif
281 set_keycodes_for_os(MACOS);
282 default_layer_set(_BASELAYER_MACOS);
283 layer_on(_BASELAYER_MACOS);
284 layer_off(_BASELAYER_WINDOWS);
285 return false;
286 break;
287 case WINDOWS:
288 #ifdef AUDIO_ENABLE
289 stop_all_notes();
290 PLAY_SONG(plover_gb_song);
291 #endif
292 set_keycodes_for_os(WINDOWS);
293 default_layer_set(_BASELAYER_WINDOWS);
294 layer_on(_BASELAYER_WINDOWS);
295 layer_off(_BASELAYER_MACOS);
296 return false;
297 break;
298 case RCMDCTRL:
299 return handle_right_command_or_control(record->event.pressed);
300 break;
301 case APPSWITCH:
302 return handle_app_switch(record->event.pressed);
303 break;
304 case QUOTES:
305 return type_quotes(SINGLE_QUOTE, record->event.pressed);
306 break;
307 case DQUOTES:
308 return type_quotes(DOUBLE_QUOTE, record->event.pressed);
309 break;
310 case POINTYBR:
311 return type_brackets(POINTY, record->event.pressed);
312 break;
313 case SQUAREBR:
314 return type_brackets(SQUARE, record->event.pressed);
315 break;
316 case CURLYBR:
317 return type_brackets(CURLY, record->event.pressed);
318 break;
319 case ROUNDBR:
320 return type_brackets(ROUND, record->event.pressed);
321 break;
322 case PLUSCOLON:
323 return handle_pluscolon(record->event.pressed);
324 break;
325 }
326 return true;
327}
328
329void set_keycodes_for_os(int os) {
330 if (os == MACOS) {
331 keycode_rightcommand = KC_RGUI;
332 keycode_appswitch = KC_LGUI;
333 } else {
334 keycode_rightcommand = KC_RCTRL;
335 keycode_appswitch = KC_LALT;
336 }
337}
338
339/* While lefties use their mouse with their left hand, it is handy to use their right hand for Cut, Copy and Paste. */
340bool handle_right_command_or_control(bool pressed) {
341 if (pressed) {
342 register_code(keycode_rightcommand);
343 layer_on(_LEFTYLAYER);
344 } else {
345 layer_off(_LEFTYLAYER);
346 unregister_code(keycode_rightcommand);
347 }
348 return false;
349}
350
351/* Key combo to easily switch applications. Press and hold Command or Alt, press and release Tab. Command or Alt is released when an invalid key is pressed in main loop. */
352bool handle_app_switch(bool pressed) {
353 if (pressed) {
354 if (app_switch_active == false) {
355 app_switch_active = true;
356 register_code(keycode_appswitch);
357 }
358 register_code(KC_TAB);
359 } else {
360 unregister_code(KC_TAB);
361 }
362 return false;
363}
364
365/* Defines valid keys for app_switch function. */
366bool app_switch_valid_keycode(uint16_t keycode) {
367 if (keycode == APPSWITCH || KC_UP || KC_LEFT || KC_DOWN || KC_RIGHT) {
368 return true;
369 }
370 return false;
371}
372
373/* Type 1 or 2 quotation marks, either single or double quotation marks.
374 * - Press once: type 1 quote and start timer.
375 * - Quickly press twice: type pair of quotes and put cursor in between.
376 */
377bool type_quotes(uint8_t quote_shape, bool pressed) {
378 clear_mods();
379 bool use_shift = quote_shape == DOUBLE_QUOTE ? true : false;
380
381 duration = timer_elapsed(timer);
382
383 if (pressed) {
384 if ((timer == 0) || (duration == 0) || (duration > TAPPING_TERM)) {
385 if (use_shift) { register_code(KC_LSFT); }
386 register_code(KC_QUOT);
387 double_tap = false;
388 } else {
389 if (duration < TAPPING_TERM) {
390 if (use_shift) {
391 tap_code16(S(KC_QUOT));
392 } else {
393 tap_code(KC_QUOT);
394 }
395 double_tap = true;
396 }
397 }
398 } else {
399 if (double_tap) {
400 tap_code(KC_LEFT);
401 timer = 0;
402 double_tap = false;
403 } else {
404 unregister_code(KC_QUOT);
405 if (use_shift) { unregister_code(KC_LSFT); }
406 timer = timer_read();
407 double_tap = false;
408 }
409 }
410
411 set_mods(active_modifiers);
412 return false;
413}
414
415/* Type a bracket or a pair of brackets
416 * - Press once: type opening bracket.
417 * - Press while holding shift: type closing bracket.
418 * - Quickly press twice: type pair of brackets and put cursor in between.
419 */
420bool type_brackets(uint8_t bracket_shape, bool pressed) {
421 clear_mods();
422
423 uint8_t opening_bracket;
424 uint8_t closing_bracket;
425 bool use_shift;
426 switch (bracket_shape) {
427 case POINTY:
428 opening_bracket = KC_COMM;
429 closing_bracket = KC_DOT;
430 use_shift = true;
431 break;
432 case SQUARE:
433 opening_bracket = KC_LBRC;
434 closing_bracket = KC_RBRC;
435 use_shift = false;
436 break;
437 case CURLY:
438 opening_bracket = KC_LBRC;
439 closing_bracket = KC_RBRC;
440 use_shift = true;
441 break;
442 case ROUND:
443 opening_bracket = KC_9;
444 closing_bracket = KC_0;
445 use_shift = true;
446 break;
447 }
448 duration = timer_elapsed(timer);
449
450 if (pressed) {
451 if ((timer == 0) || (duration == 0) || (duration > TAPPING_TERM) || (shift_modifier_active)) {
452 if (use_shift) { register_code(KC_LSFT); }
453 register_code(shift_modifier_active ? closing_bracket : opening_bracket);
454 double_tap = false;
455 } else {
456 if (duration < TAPPING_TERM) {
457 if (use_shift) {
458 tap_code16(S(closing_bracket));
459 } else {
460 tap_code(closing_bracket);
461 }
462 double_tap = true;
463 }
464 }
465 } else {
466 if (double_tap) {
467 tap_code(KC_LEFT);
468 timer = 0;
469 double_tap = false;
470 } else {
471 unregister_code(shift_modifier_active ? closing_bracket : opening_bracket);
472 if (use_shift) { unregister_code(KC_LSFT); }
473 timer = timer_read();
474 double_tap = false;
475 }
476 }
477
478 set_mods(active_modifiers);
479 return false;
480}
481
482/* On the Numpad-layer, the semicolon key produces a Plus ('+'). But to help entering time values, we like to have a colon (':') when shift is held. */
483bool handle_pluscolon(bool pressed) {
484 if (pressed) {
485 register_code(shift_modifier_active ? KC_SCLN : KC_PPLS);
486 } else {
487 unregister_code(shift_modifier_active ? KC_SCLN : KC_PPLS);
488 }
489 return false;
490}
491
492// Bootmagic configures the keyboard when initializing (starting up after connecting the USB cable)
493void bootmagic_lite(void) {
494 matrix_scan();
495 wait_ms(DEBOUNCE * 2);
496 matrix_scan();
497 int os;
498
499 // hold key in upper left corner while plugging in the USB cable to enter the Bootloader for flashing.
500 if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) {
501 bootloader_jump();
502 }
503
504 // hold M key while plugging in the USB cable to use the keyboard in MacOs mode.
505 if (matrix_get_row(BOOTMAGIC_LITE_MACOS_ROW) & (1 << BOOTMAGIC_LITE_MACOS_COLUMN)) {
506 os = MACOS;
507 }
508
509 // hold W key while plugging in the USB cable to use the keyboard in Windows mode.
510 if (matrix_get_row(BOOTMAGIC_LITE_WIN_ROW) & (1 << BOOTMAGIC_LITE_WIN_COLUMN)) {
511 os = WINDOWS;
512 }
513
514 switch (os){
515 case MACOS:
516 default_layer_set(_BASELAYER_MACOS);
517 layer_on(_BASELAYER_MACOS);
518 layer_off(_BASELAYER_WINDOWS);
519 break;
520 case WINDOWS:
521 default_layer_set(_BASELAYER_WINDOWS);
522 layer_on(_BASELAYER_WINDOWS);
523 layer_off(_BASELAYER_MACOS);
524 break;
525 default:
526 os = MACOS;
527 default_layer_set(_BASELAYER_MACOS);
528 layer_on(_BASELAYER_MACOS);
529 layer_off(_BASELAYER_WINDOWS);
530 break;
531 }
532 set_keycodes_for_os(os);
533}
diff --git a/keyboards/planck/keymaps/orthodeluxe/readme.md b/keyboards/planck/keymaps/orthodeluxe/readme.md
new file mode 100644
index 000000000..51ad27e95
--- /dev/null
+++ b/keyboards/planck/keymaps/orthodeluxe/readme.md
@@ -0,0 +1,64 @@
1![Orthodeluxe Layout Image](https://i.imgur.com/xnq1gNj.png)
2
3# Orthodeluxe layout for Planck keyboards
4
5By Erik Bakker
6
7## Main idea
8
9I use a Planck keyboard as a daily driver since 2018. Over time, I improved the layout and added functionality to the firmware. The main idea was to easily access all keys and functions without moving my hands from the home position (when your fingers rest on ASDF and JKL;). I'd like to share this keyboard layout with you.
10
11## Notes about left handedness
12
13This keyboard layout is perfect for people that use the mouse with their left hand. I am right handed myself. But since a couple of years, I learned to use the mouse with my left hand. I started doing that to relieve strain in my right arm. But now, I really like a setup with the keyboard in the middle, a mouse on the left, and pen and paper on the right. For those that insist on using the mouse with their right hand, I plan to create an alternative layout called 'orthodeluxe-R'.
14
15## Base layer
16
17Apart from the basic QWERTY layout, the base layer features:
18
19- A 2U space bar and 2 keys to switch layers. Rotate you keycaps 180 degrees for comfortable access.
20- Shift keys in the lower left and lower right corners. You hit them with the sides of your hands.
21- 2 sets of modifiers, symmetrically layed out in the bottom row. You can switch between MacOs and Windows layouts.
22- In Windows layout, the Ctrl keys are located where you can easily reach it with your thumbs. Just like the command key on Apple keyboards.
23- Symmetrical layout of the left and right sides of the keyboard. Row 1: Backspace and Delete, row 2: Escape and Enter, row 3: Left and right Tab.
24
25## Numpad layer
26
27The numpad layer contains a numpad and non-alphanumeric characters, like math operators, brackets and quotes.
28
29- Numpad, math operators and currency symbols are all operated by the right hand.
30- All symbols that programmers need are operated by the left hand.
31- Clicking a bracket key produces an opening bracket.
32- Holding shift while clicking a bracket key produces a closing bracket.
33- Double clicking a bracket key produces an opening and closing bracket with the cursor positioned in between.
34- Double clicking the quote keys produces 2 quotes with the cursor positioned in between.
35- The quote/apostrope is conveniently located at the S key, to easily type "It's everyone's favorite keyboard layout".
36
37## Navigation layer
38
39The navigation layer contains the cursor movement keys, keys F1-F12, and more:
40
41- The cursor keys are in an 'inverted T' configuration at the most comfortable position for the right hand (IJKL).
42- An 'App Switch' key to switch appslications, but smarter than just mapping Alt-Tab to that key.
43- A Key to easily access Task View in Windows (or Mission Control in MacOs).
44- Keys to switch virtual desktops in Windows (or spaces in MacOs).
45
46## Additional layers
47
48There are some additional layers for:
49
50- accessing lesser used symbols and functions;
51- switching between MacOs and Windows modes;
52- access Cut, Copy and Paste shortcuts wirth the right hand, for people that use the mouse with their left hand.
53
54## Bootmagic
55
56This keymap supports Bootmagic Lite. Bootmagic configures the keyboard when initializing (starting up after connecting the USB cable).
57- hold key in upper left corner while plugging in the USB cable to enter the Bootloader for flashing.
58- hold M key while plugging in the USB cable to use the keyboard in MacOs mode.
59- hold W key while plugging in the USB cable to use the keyboard in Windows mode.
60
61
62## Build
63
64Owners of an older Planck (rev5 or older, those without a USB-C connector) need to disable audio in file 'rules .mk' before building. Otherwise the firmware size will be too large.
diff --git a/keyboards/planck/keymaps/orthodeluxe/rules.mk b/keyboards/planck/keymaps/orthodeluxe/rules.mk
new file mode 100644
index 000000000..36e0481b6
--- /dev/null
+++ b/keyboards/planck/keymaps/orthodeluxe/rules.mk
@@ -0,0 +1,5 @@
1AUDIO_ENABLE = yes
2BACKLIGHT_ENABLE = no
3KEY_LOCK_ENABLE = yes
4MOUSEKEY_ENABLE = no
5BOOTMAGIC_ENABLE = lite