aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2021-11-01 09:27:54 +1100
committerGitHub <noreply@github.com>2021-11-01 09:27:54 +1100
commit928d9f90ec169f49f50c1566132b06adcaf662d7 (patch)
tree5c2c622c1ab75aedd1f87851fa1efa306d7fdb4f
parentb25218ccc1d8f72c14a0c175a7594822ea0f865e (diff)
downloadqmk_firmware-928d9f90ec169f49f50c1566132b06adcaf662d7.tar.gz
qmk_firmware-928d9f90ec169f49f50c1566132b06adcaf662d7.zip
Remove complex `fn_actions` macros (#14662)
* Remove complex `fn_actions` macros * Remove additional `KC_FN*` instances
-rw-r--r--keyboards/40percentclub/ut47/keymaps/rgb/keymap.c4
-rw-r--r--keyboards/hotdox/keymaps/default/keymap.c2
-rw-r--r--keyboards/hotdox/keymaps/via/keymap.c2
-rw-r--r--keyboards/kinesis/keymaps/default/keymap.c2
-rw-r--r--keyboards/kinesis/keymaps/default_pretty/keymap.c2
-rw-r--r--keyboards/kinesis/keymaps/dvorak/keymap.c2
-rw-r--r--keyboards/kinesis/keymaps/stapelberg/keymap.c2
-rw-r--r--keyboards/kinesis/keymaps/tw1t611/keymap.c2
-rw-r--r--keyboards/mechstudio/ud_40_ortho/keymaps/via/keymap.c2
-rw-r--r--keyboards/planck/keymaps/yale/keymap.c4
-rw-r--r--layouts/community/ergodox/algernon/COPYING674
-rw-r--r--layouts/community/ergodox/algernon/NEWS.md229
-rw-r--r--layouts/community/ergodox/algernon/config.h22
-rw-r--r--layouts/community/ergodox/algernon/images/adore-layer.pngbin105611 -> 0 bytes
-rw-r--r--layouts/community/ergodox/algernon/images/base-layer.pngbin106956 -> 0 bytes
-rw-r--r--layouts/community/ergodox/algernon/images/heatmap.pngbin139351 -> 0 bytes
-rw-r--r--layouts/community/ergodox/algernon/images/steno-layer.pngbin64086 -> 0 bytes
-rw-r--r--layouts/community/ergodox/algernon/keymap.c1194
-rw-r--r--layouts/community/ergodox/algernon/readme.md152
-rw-r--r--layouts/community/ergodox/algernon/rules.mk43
-rw-r--r--layouts/community/ergodox/algernon/tools/heatmap-layout.ADORE.json486
-rw-r--r--layouts/community/ergodox/algernon/tools/heatmap-layout.Dvorak.json477
-rwxr-xr-xlayouts/community/ergodox/algernon/tools/hid-commands113
-rwxr-xr-xlayouts/community/ergodox/algernon/tools/log-to-heatmap.py342
-rwxr-xr-xlayouts/community/ergodox/algernon/tools/text-to-log.py106
-rw-r--r--layouts/community/ergodox/dragon788/keymap.c2
-rw-r--r--layouts/community/ergodox/dvorak_plover/keymap.c2
-rw-r--r--layouts/community/ergodox/haegin/keymap.c2
-rw-r--r--layouts/community/ergodox/kines-ish/keymap.c2
-rw-r--r--layouts/community/ergodox/mpiechotka/keymap.c127
-rw-r--r--layouts/community/ergodox/ordinary/keymap.c288
-rw-r--r--layouts/community/ergodox/ordinary_osx/keymap.c288
-rw-r--r--layouts/community/ergodox/osx_whiskey_tango_foxtrot_capslock/keymap.c89
-rw-r--r--layouts/community/ergodox/plover/keymap.c2
-rw-r--r--layouts/community/ergodox/plums/keymap.c84
-rw-r--r--layouts/community/ergodox/teckinesis/keymap.c277
-rw-r--r--layouts/community/ergodox/workman_osx_mdw/keymap.c390
37 files changed, 379 insertions, 5036 deletions
diff --git a/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c b/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c
index 77fa5b401..ae8ad3e37 100644
--- a/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c
+++ b/keyboards/40percentclub/ut47/keymaps/rgb/keymap.c
@@ -43,8 +43,8 @@ LAYOUT(
43), 43),
44 44
45LAYOUT( 45LAYOUT(
46 KC_FN6, KC_FN7, KC_FN8, KC_FN9, KC_FN10, KC_FN11, KC_FN12, KC_FN13, KC_FN14, KC_FN15, KC_FN16, KC_DELETE, 46 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_DELETE,
47 _______, _______, _______, _______, _______, _______, _______, KC_FN17, KC_FN18, KC_FN19, KC_FN20, KC_FN21, 47 _______, _______, _______, _______, _______, _______, _______, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
48 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, 48 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______,
49 _______, _______, _______, KC_CAPS, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END 49 _______, _______, _______, KC_CAPS, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END
50), 50),
diff --git a/keyboards/hotdox/keymaps/default/keymap.c b/keyboards/hotdox/keymaps/default/keymap.c
index 3d6f040f3..fe07e6f91 100644
--- a/keyboards/hotdox/keymaps/default/keymap.c
+++ b/keyboards/hotdox/keymaps/default/keymap.c
@@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
49 TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, 49 TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
50 KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT), 50 KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT),
51 MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, 51 MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
52 KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1, 52 KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_NO,
53 KC_LALT, CTL_T(KC_ESC), 53 KC_LALT, CTL_T(KC_ESC),
54 KC_PGUP, 54 KC_PGUP,
55 KC_PGDN,KC_TAB,KC_ENT 55 KC_PGDN,KC_TAB,KC_ENT
diff --git a/keyboards/hotdox/keymaps/via/keymap.c b/keyboards/hotdox/keymaps/via/keymap.c
index 5cfad55dd..df951542a 100644
--- a/keyboards/hotdox/keymaps/via/keymap.c
+++ b/keyboards/hotdox/keymaps/via/keymap.c
@@ -50,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
50 TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, 50 TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
51 KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT), 51 KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT),
52 MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, 52 MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
53 KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1, 53 KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_NO,
54 KC_LALT, CTL_T(KC_ESC), 54 KC_LALT, CTL_T(KC_ESC),
55 KC_PGUP, 55 KC_PGUP,
56 KC_PGDN,KC_TAB,KC_ENT 56 KC_PGDN,KC_TAB,KC_ENT
diff --git a/keyboards/kinesis/keymaps/default/keymap.c b/keyboards/kinesis/keymaps/default/keymap.c
index 2d43aad07..d46a07cac 100644
--- a/keyboards/kinesis/keymaps/default/keymap.c
+++ b/keyboards/kinesis/keymaps/default/keymap.c
@@ -40,7 +40,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
40 KC_LCTL,KC_LALT, 40 KC_LCTL,KC_LALT,
41 KC_HOME, 41 KC_HOME,
42 KC_BSPC,KC_DEL ,KC_END , 42 KC_BSPC,KC_DEL ,KC_END ,
43 KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_PSCR ,KC_SLCK ,KC_PAUS, KC_FN0, RESET, 43 KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_PSCR ,KC_SLCK ,KC_PAUS, KC_NO, RESET,
44 KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_MINS, 44 KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_MINS,
45 KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_BSLS, 45 KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_BSLS,
46 KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN,KC_QUOT, 46 KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN,KC_QUOT,
diff --git a/keyboards/kinesis/keymaps/default_pretty/keymap.c b/keyboards/kinesis/keymaps/default_pretty/keymap.c
index 9c01b222a..94102a806 100644
--- a/keyboards/kinesis/keymaps/default_pretty/keymap.c
+++ b/keyboards/kinesis/keymaps/default_pretty/keymap.c
@@ -32,7 +32,7 @@
32const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 32const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
33 33
34 [QWERTY] = LAYOUT_pretty( 34 [QWERTY] = LAYOUT_pretty(
35 KC_ESC, 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_SLCK, KC_PAUS, KC_FN0, RESET, 35 KC_ESC, 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_SLCK, KC_PAUS, KC_NO, RESET,
36 KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, 36 KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
37 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, 37 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
38 KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, 38 KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
diff --git a/keyboards/kinesis/keymaps/dvorak/keymap.c b/keyboards/kinesis/keymaps/dvorak/keymap.c
index 3c532628e..6f4d63a7d 100644
--- a/keyboards/kinesis/keymaps/dvorak/keymap.c
+++ b/keyboards/kinesis/keymaps/dvorak/keymap.c
@@ -17,7 +17,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
17 KC_HOME, 17 KC_HOME,
18 KC_BSPC, KC_DEL, KC_END, 18 KC_BSPC, KC_DEL, KC_END,
19 // right hand 19 // right hand
20 KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, KC_FN0, RESET, 20 KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, KC_NO, RESET,
21 KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, 21 KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
22 KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, 22 KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH,
23 KC_D, KC_H, KC_T, KC_N, KC_S, KC_BSLS, 23 KC_D, KC_H, KC_T, KC_N, KC_S, KC_BSLS,
diff --git a/keyboards/kinesis/keymaps/stapelberg/keymap.c b/keyboards/kinesis/keymaps/stapelberg/keymap.c
index c62ffbbcc..d7a0a5e5c 100644
--- a/keyboards/kinesis/keymaps/stapelberg/keymap.c
+++ b/keyboards/kinesis/keymaps/stapelberg/keymap.c
@@ -56,7 +56,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
56 KC_LCTL,KC_LALT, 56 KC_LCTL,KC_LALT,
57 KC_LGUI, 57 KC_LGUI,
58 KC_BSPC,KC_ESC ,KC_END , 58 KC_BSPC,KC_ESC ,KC_END ,
59 KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_PSCR ,KC_SLCK ,KC_PAUS, KC_FN0, RESET, 59 KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_PSCR ,KC_SLCK ,KC_PAUS, KC_NO, RESET,
60 KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_MINS, 60 KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_MINS,
61 KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_BSLS, 61 KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_BSLS,
62 KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN,KC_QUOT, 62 KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN,KC_QUOT,
diff --git a/keyboards/kinesis/keymaps/tw1t611/keymap.c b/keyboards/kinesis/keymaps/tw1t611/keymap.c
index c94f06bbb..e7a6ffd6e 100644
--- a/keyboards/kinesis/keymaps/tw1t611/keymap.c
+++ b/keyboards/kinesis/keymaps/tw1t611/keymap.c
@@ -15,7 +15,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
15 KC_RCTL,KC_LALT, 15 KC_RCTL,KC_LALT,
16 KC_HOME, 16 KC_HOME,
17 KC_SPC ,KC_LSFT,KC_BSPC , 17 KC_SPC ,KC_LSFT,KC_BSPC ,
18 KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_PSCR,KC_SLCK,KC_PAUS,KC_FN0 ,RESET, 18 KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_PSCR,KC_SLCK,KC_PAUS,KC_NO ,RESET,
19 KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,DE_SS , 19 KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,DE_SS ,
20 KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,DE_ADIA, 20 KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,DE_ADIA,
21 KC_H ,KC_J ,KC_K ,KC_L ,DE_SLSH,DE_ODIA, 21 KC_H ,KC_J ,KC_K ,KC_L ,DE_SLSH,DE_ODIA,
diff --git a/keyboards/mechstudio/ud_40_ortho/keymaps/via/keymap.c b/keyboards/mechstudio/ud_40_ortho/keymaps/via/keymap.c
index c61bec5a0..affc42c7b 100644
--- a/keyboards/mechstudio/ud_40_ortho/keymaps/via/keymap.c
+++ b/keyboards/mechstudio/ud_40_ortho/keymaps/via/keymap.c
@@ -20,7 +20,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
20 KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, 20 KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
21 KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, 21 KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
22 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, 22 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
23 _______, KC_LCTRL, KC_LALT, KC_LGUI, KC_FN13, KC_SPC, KC_SPC, KC_FN23, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT), 23 _______, KC_LCTRL, KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT),
24 24
25[1] = LAYOUT_ortho_4x12( 25[1] = LAYOUT_ortho_4x12(
26 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, 26 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL,
diff --git a/keyboards/planck/keymaps/yale/keymap.c b/keyboards/planck/keymaps/yale/keymap.c
index 60bbc758d..0baa24bdb 100644
--- a/keyboards/planck/keymaps/yale/keymap.c
+++ b/keyboards/planck/keymaps/yale/keymap.c
@@ -68,9 +68,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
68), 68),
69 69
70[_NAV] = LAYOUT_planck_grid( 70[_NAV] = LAYOUT_planck_grid(
71 KC_MS_ACCEL2, KC_FN1, KC_FN2, KC_FN3, KC_FN4, XXXXXXX, XXXXXXX, KC_WH_D, KC_WH_U, XXXXXXX, XXXXXXX, XXXXXXX, 71 KC_MS_ACCEL2, KC_NO, KC_NO, KC_NO, KC_NO, XXXXXXX, XXXXXXX, KC_WH_D, KC_WH_U, XXXXXXX, XXXXXXX, XXXXXXX,
72 KC_MS_ACCEL1, KC_MS_BTN4, KC_MS_BTN3, KC_MS_BTN2, KC_MS_BTN1, XXXXXXX, KC_MS_LEFT, KC_MS_DOWN, KC_MS_UP, KC_MS_RIGHT, XXXXXXX, XXXXXXX, 72 KC_MS_ACCEL1, KC_MS_BTN4, KC_MS_BTN3, KC_MS_BTN2, KC_MS_BTN1, XXXXXXX, KC_MS_LEFT, KC_MS_DOWN, KC_MS_UP, KC_MS_RIGHT, XXXXXXX, XXXXXXX,
73 KC_MS_ACCEL0, KC_FN9, KC_FN10, KC_FN11, KC_FN12, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, 73 KC_MS_ACCEL0, KC_NO, KC_NO, KC_NO, KC_NO, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
74 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX 74 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
75), 75),
76 76
diff --git a/layouts/community/ergodox/algernon/COPYING b/layouts/community/ergodox/algernon/COPYING
deleted file mode 100644
index 94a9ed024..000000000
--- a/layouts/community/ergodox/algernon/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
1 GNU GENERAL PUBLIC LICENSE
2 Version 3, 29 June 2007
3
4 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5 Everyone is permitted to copy and distribute verbatim copies
6 of this license document, but changing it is not allowed.
7
8 Preamble
9
10 The GNU General Public License is a free, copyleft license for
11software and other kinds of works.
12
13 The licenses for most software and other practical works are designed
14to take away your freedom to share and change the works. By contrast,
15the GNU General Public License is intended to guarantee your freedom to
16share and change all versions of a program--to make sure it remains free
17software for all its users. We, the Free Software Foundation, use the
18GNU General Public License for most of our software; it applies also to
19any other work released this way by its authors. You can apply it to
20your programs, too.
21
22 When we speak of free software, we are referring to freedom, not
23price. Our General Public Licenses are designed to make sure that you
24have the freedom to distribute copies of free software (and charge for
25them if you wish), that you receive source code or can get it if you
26want it, that you can change the software or use pieces of it in new
27free programs, and that you know you can do these things.
28
29 To protect your rights, we need to prevent others from denying you
30these rights or asking you to surrender the rights. Therefore, you have
31certain responsibilities if you distribute copies of the software, or if
32you modify it: responsibilities to respect the freedom of others.
33
34 For example, if you distribute copies of such a program, whether
35gratis or for a fee, you must pass on to the recipients the same
36freedoms that you received. You must make sure that they, too, receive
37or can get the source code. And you must show them these terms so they
38know their rights.
39
40 Developers that use the GNU GPL protect your rights with two steps:
41(1) assert copyright on the software, and (2) offer you this License
42giving you legal permission to copy, distribute and/or modify it.
43
44 For the developers' and authors' protection, the GPL clearly explains
45that there is no warranty for this free software. For both users' and
46authors' sake, the GPL requires that modified versions be marked as
47changed, so that their problems will not be attributed erroneously to
48authors of previous versions.
49
50 Some devices are designed to deny users access to install or run
51modified versions of the software inside them, although the manufacturer
52can do so. This is fundamentally incompatible with the aim of
53protecting users' freedom to change the software. The systematic
54pattern of such abuse occurs in the area of products for individuals to
55use, which is precisely where it is most unacceptable. Therefore, we
56have designed this version of the GPL to prohibit the practice for those
57products. If such problems arise substantially in other domains, we
58stand ready to extend this provision to those domains in future versions
59of the GPL, as needed to protect the freedom of users.
60
61 Finally, every program is threatened constantly by software patents.
62States should not allow patents to restrict development and use of
63software on general-purpose computers, but in those that do, we wish to
64avoid the special danger that patents applied to a free program could
65make it effectively proprietary. To prevent this, the GPL assures that
66patents cannot be used to render the program non-free.
67
68 The precise terms and conditions for copying, distribution and
69modification follow.
70
71 TERMS AND CONDITIONS
72
73 0. Definitions.
74
75 "This License" refers to version 3 of the GNU General Public License.
76
77 "Copyright" also means copyright-like laws that apply to other kinds of
78works, such as semiconductor masks.
79
80 "The Program" refers to any copyrightable work licensed under this
81License. Each licensee is addressed as "you". "Licensees" and
82"recipients" may be individuals or organizations.
83
84 To "modify" a work means to copy from or adapt all or part of the work
85in a fashion requiring copyright permission, other than the making of an
86exact copy. The resulting work is called a "modified version" of the
87earlier work or a work "based on" the earlier work.
88
89 A "covered work" means either the unmodified Program or a work based
90on the Program.
91
92 To "propagate" a work means to do anything with it that, without
93permission, would make you directly or secondarily liable for
94infringement under applicable copyright law, except executing it on a
95computer or modifying a private copy. Propagation includes copying,
96distribution (with or without modification), making available to the
97public, and in some countries other activities as well.
98
99 To "convey" a work means any kind of propagation that enables other
100parties to make or receive copies. Mere interaction with a user through
101a computer network, with no transfer of a copy, is not conveying.
102
103 An interactive user interface displays "Appropriate Legal Notices"
104to the extent that it includes a convenient and prominently visible
105feature that (1) displays an appropriate copyright notice, and (2)
106tells the user that there is no warranty for the work (except to the
107extent that warranties are provided), that licensees may convey the
108work under this License, and how to view a copy of this License. If
109the interface presents a list of user commands or options, such as a
110menu, a prominent item in the list meets this criterion.
111
112 1. Source Code.
113
114 The "source code" for a work means the preferred form of the work
115for making modifications to it. "Object code" means any non-source
116form of a work.
117
118 A "Standard Interface" means an interface that either is an official
119standard defined by a recognized standards body, or, in the case of
120interfaces specified for a particular programming language, one that
121is widely used among developers working in that language.
122
123 The "System Libraries" of an executable work include anything, other
124than the work as a whole, that (a) is included in the normal form of
125packaging a Major Component, but which is not part of that Major
126Component, and (b) serves only to enable use of the work with that
127Major Component, or to implement a Standard Interface for which an
128implementation is available to the public in source code form. A
129"Major Component", in this context, means a major essential component
130(kernel, window system, and so on) of the specific operating system
131(if any) on which the executable work runs, or a compiler used to
132produce the work, or an object code interpreter used to run it.
133
134 The "Corresponding Source" for a work in object code form means all
135the source code needed to generate, install, and (for an executable
136work) run the object code and to modify the work, including scripts to
137control those activities. However, it does not include the work's
138System Libraries, or general-purpose tools or generally available free
139programs which are used unmodified in performing those activities but
140which are not part of the work. For example, Corresponding Source
141includes interface definition files associated with source files for
142the work, and the source code for shared libraries and dynamically
143linked subprograms that the work is specifically designed to require,
144such as by intimate data communication or control flow between those
145subprograms and other parts of the work.
146
147 The Corresponding Source need not include anything that users
148can regenerate automatically from other parts of the Corresponding
149Source.
150
151 The Corresponding Source for a work in source code form is that
152same work.
153
154 2. Basic Permissions.
155
156 All rights granted under this License are granted for the term of
157copyright on the Program, and are irrevocable provided the stated
158conditions are met. This License explicitly affirms your unlimited
159permission to run the unmodified Program. The output from running a
160covered work is covered by this License only if the output, given its
161content, constitutes a covered work. This License acknowledges your
162rights of fair use or other equivalent, as provided by copyright law.
163
164 You may make, run and propagate covered works that you do not
165convey, without conditions so long as your license otherwise remains
166in force. You may convey covered works to others for the sole purpose
167of having them make modifications exclusively for you, or provide you
168with facilities for running those works, provided that you comply with
169the terms of this License in conveying all material for which you do
170not control copyright. Those thus making or running the covered works
171for you must do so exclusively on your behalf, under your direction
172and control, on terms that prohibit them from making any copies of
173your copyrighted material outside their relationship with you.
174
175 Conveying under any other circumstances is permitted solely under
176the conditions stated below. Sublicensing is not allowed; section 10
177makes it unnecessary.
178
179 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
181 No covered work shall be deemed part of an effective technological
182measure under any applicable law fulfilling obligations under article
18311 of the WIPO copyright treaty adopted on 20 December 1996, or
184similar laws prohibiting or restricting circumvention of such
185measures.
186
187 When you convey a covered work, you waive any legal power to forbid
188circumvention of technological measures to the extent such circumvention
189is effected by exercising rights under this License with respect to
190the covered work, and you disclaim any intention to limit operation or
191modification of the work as a means of enforcing, against the work's
192users, your or third parties' legal rights to forbid circumvention of
193technological measures.
194
195 4. Conveying Verbatim Copies.
196
197 You may convey verbatim copies of the Program's source code as you
198receive it, in any medium, provided that you conspicuously and
199appropriately publish on each copy an appropriate copyright notice;
200keep intact all notices stating that this License and any
201non-permissive terms added in accord with section 7 apply to the code;
202keep intact all notices of the absence of any warranty; and give all
203recipients a copy of this License along with the Program.
204
205 You may charge any price or no price for each copy that you convey,
206and you may offer support or warranty protection for a fee.
207
208 5. Conveying Modified Source Versions.
209
210 You may convey a work based on the Program, or the modifications to
211produce it from the Program, in the form of source code under the
212terms of section 4, provided that you also meet all of these conditions:
213
214 a) The work must carry prominent notices stating that you modified
215 it, and giving a relevant date.
216
217 b) The work must carry prominent notices stating that it is
218 released under this License and any conditions added under section
219 7. This requirement modifies the requirement in section 4 to
220 "keep intact all notices".
221
222 c) You must license the entire work, as a whole, under this
223 License to anyone who comes into possession of a copy. This
224 License will therefore apply, along with any applicable section 7
225 additional terms, to the whole of the work, and all its parts,
226 regardless of how they are packaged. This License gives no
227 permission to license the work in any other way, but it does not
228 invalidate such permission if you have separately received it.
229
230 d) If the work has interactive user interfaces, each must display
231 Appropriate Legal Notices; however, if the Program has interactive
232 interfaces that do not display Appropriate Legal Notices, your
233 work need not make them do so.
234
235 A compilation of a covered work with other separate and independent
236works, which are not by their nature extensions of the covered work,
237and which are not combined with it such as to form a larger program,
238in or on a volume of a storage or distribution medium, is called an
239"aggregate" if the compilation and its resulting copyright are not
240used to limit the access or legal rights of the compilation's users
241beyond what the individual works permit. Inclusion of a covered work
242in an aggregate does not cause this License to apply to the other
243parts of the aggregate.
244
245 6. Conveying Non-Source Forms.
246
247 You may convey a covered work in object code form under the terms
248of sections 4 and 5, provided that you also convey the
249machine-readable Corresponding Source under the terms of this License,
250in one of these ways:
251
252 a) Convey the object code in, or embodied in, a physical product
253 (including a physical distribution medium), accompanied by the
254 Corresponding Source fixed on a durable physical medium
255 customarily used for software interchange.
256
257 b) Convey the object code in, or embodied in, a physical product
258 (including a physical distribution medium), accompanied by a
259 written offer, valid for at least three years and valid for as
260 long as you offer spare parts or customer support for that product
261 model, to give anyone who possesses the object code either (1) a
262 copy of the Corresponding Source for all the software in the
263 product that is covered by this License, on a durable physical
264 medium customarily used for software interchange, for a price no
265 more than your reasonable cost of physically performing this
266 conveying of source, or (2) access to copy the
267 Corresponding Source from a network server at no charge.
268
269 c) Convey individual copies of the object code with a copy of the
270 written offer to provide the Corresponding Source. This
271 alternative is allowed only occasionally and noncommercially, and
272 only if you received the object code with such an offer, in accord
273 with subsection 6b.
274
275 d) Convey the object code by offering access from a designated
276 place (gratis or for a charge), and offer equivalent access to the
277 Corresponding Source in the same way through the same place at no
278 further charge. You need not require recipients to copy the
279 Corresponding Source along with the object code. If the place to
280 copy the object code is a network server, the Corresponding Source
281 may be on a different server (operated by you or a third party)
282 that supports equivalent copying facilities, provided you maintain
283 clear directions next to the object code saying where to find the
284 Corresponding Source. Regardless of what server hosts the
285 Corresponding Source, you remain obligated to ensure that it is
286 available for as long as needed to satisfy these requirements.
287
288 e) Convey the object code using peer-to-peer transmission, provided
289 you inform other peers where the object code and Corresponding
290 Source of the work are being offered to the general public at no
291 charge under subsection 6d.
292
293 A separable portion of the object code, whose source code is excluded
294from the Corresponding Source as a System Library, need not be
295included in conveying the object code work.
296
297 A "User Product" is either (1) a "consumer product", which means any
298tangible personal property which is normally used for personal, family,
299or household purposes, or (2) anything designed or sold for incorporation
300into a dwelling. In determining whether a product is a consumer product,
301doubtful cases shall be resolved in favor of coverage. For a particular
302product received by a particular user, "normally used" refers to a
303typical or common use of that class of product, regardless of the status
304of the particular user or of the way in which the particular user
305actually uses, or expects or is expected to use, the product. A product
306is a consumer product regardless of whether the product has substantial
307commercial, industrial or non-consumer uses, unless such uses represent
308the only significant mode of use of the product.
309
310 "Installation Information" for a User Product means any methods,
311procedures, authorization keys, or other information required to install
312and execute modified versions of a covered work in that User Product from
313a modified version of its Corresponding Source. The information must
314suffice to ensure that the continued functioning of the modified object
315code is in no case prevented or interfered with solely because
316modification has been made.
317
318 If you convey an object code work under this section in, or with, or
319specifically for use in, a User Product, and the conveying occurs as
320part of a transaction in which the right of possession and use of the
321User Product is transferred to the recipient in perpetuity or for a
322fixed term (regardless of how the transaction is characterized), the
323Corresponding Source conveyed under this section must be accompanied
324by the Installation Information. But this requirement does not apply
325if neither you nor any third party retains the ability to install
326modified object code on the User Product (for example, the work has
327been installed in ROM).
328
329 The requirement to provide Installation Information does not include a
330requirement to continue to provide support service, warranty, or updates
331for a work that has been modified or installed by the recipient, or for
332the User Product in which it has been modified or installed. Access to a
333network may be denied when the modification itself materially and
334adversely affects the operation of the network or violates the rules and
335protocols for communication across the network.
336
337 Corresponding Source conveyed, and Installation Information provided,
338in accord with this section must be in a format that is publicly
339documented (and with an implementation available to the public in
340source code form), and must require no special password or key for
341unpacking, reading or copying.
342
343 7. Additional Terms.
344
345 "Additional permissions" are terms that supplement the terms of this
346License by making exceptions from one or more of its conditions.
347Additional permissions that are applicable to the entire Program shall
348be treated as though they were included in this License, to the extent
349that they are valid under applicable law. If additional permissions
350apply only to part of the Program, that part may be used separately
351under those permissions, but the entire Program remains governed by
352this License without regard to the additional permissions.
353
354 When you convey a copy of a covered work, you may at your option
355remove any additional permissions from that copy, or from any part of
356it. (Additional permissions may be written to require their own
357removal in certain cases when you modify the work.) You may place
358additional permissions on material, added by you to a covered work,
359for which you have or can give appropriate copyright permission.
360
361 Notwithstanding any other provision of this License, for material you
362add to a covered work, you may (if authorized by the copyright holders of
363that material) supplement the terms of this License with terms:
364
365 a) Disclaiming warranty or limiting liability differently from the
366 terms of sections 15 and 16 of this License; or
367
368 b) Requiring preservation of specified reasonable legal notices or
369 author attributions in that material or in the Appropriate Legal
370 Notices displayed by works containing it; or
371
372 c) Prohibiting misrepresentation of the origin of that material, or
373 requiring that modified versions of such material be marked in
374 reasonable ways as different from the original version; or
375
376 d) Limiting the use for publicity purposes of names of licensors or
377 authors of the material; or
378
379 e) Declining to grant rights under trademark law for use of some
380 trade names, trademarks, or service marks; or
381
382 f) Requiring indemnification of licensors and authors of that
383 material by anyone who conveys the material (or modified versions of
384 it) with contractual assumptions of liability to the recipient, for
385 any liability that these contractual assumptions directly impose on
386 those licensors and authors.
387
388 All other non-permissive additional terms are considered "further
389restrictions" within the meaning of section 10. If the Program as you
390received it, or any part of it, contains a notice stating that it is
391governed by this License along with a term that is a further
392restriction, you may remove that term. If a license document contains
393a further restriction but permits relicensing or conveying under this
394License, you may add to a covered work material governed by the terms
395of that license document, provided that the further restriction does
396not survive such relicensing or conveying.
397
398 If you add terms to a covered work in accord with this section, you
399must place, in the relevant source files, a statement of the
400additional terms that apply to those files, or a notice indicating
401where to find the applicable terms.
402
403 Additional terms, permissive or non-permissive, may be stated in the
404form of a separately written license, or stated as exceptions;
405the above requirements apply either way.
406
407 8. Termination.
408
409 You may not propagate or modify a covered work except as expressly
410provided under this License. Any attempt otherwise to propagate or
411modify it is void, and will automatically terminate your rights under
412this License (including any patent licenses granted under the third
413paragraph of section 11).
414
415 However, if you cease all violation of this License, then your
416license from a particular copyright holder is reinstated (a)
417provisionally, unless and until the copyright holder explicitly and
418finally terminates your license, and (b) permanently, if the copyright
419holder fails to notify you of the violation by some reasonable means
420prior to 60 days after the cessation.
421
422 Moreover, your license from a particular copyright holder is
423reinstated permanently if the copyright holder notifies you of the
424violation by some reasonable means, this is the first time you have
425received notice of violation of this License (for any work) from that
426copyright holder, and you cure the violation prior to 30 days after
427your receipt of the notice.
428
429 Termination of your rights under this section does not terminate the
430licenses of parties who have received copies or rights from you under
431this License. If your rights have been terminated and not permanently
432reinstated, you do not qualify to receive new licenses for the same
433material under section 10.
434
435 9. Acceptance Not Required for Having Copies.
436
437 You are not required to accept this License in order to receive or
438run a copy of the Program. Ancillary propagation of a covered work
439occurring solely as a consequence of using peer-to-peer transmission
440to receive a copy likewise does not require acceptance. However,
441nothing other than this License grants you permission to propagate or
442modify any covered work. These actions infringe copyright if you do
443not accept this License. Therefore, by modifying or propagating a
444covered work, you indicate your acceptance of this License to do so.
445
446 10. Automatic Licensing of Downstream Recipients.
447
448 Each time you convey a covered work, the recipient automatically
449receives a license from the original licensors, to run, modify and
450propagate that work, subject to this License. You are not responsible
451for enforcing compliance by third parties with this License.
452
453 An "entity transaction" is a transaction transferring control of an
454organization, or substantially all assets of one, or subdividing an
455organization, or merging organizations. If propagation of a covered
456work results from an entity transaction, each party to that
457transaction who receives a copy of the work also receives whatever
458licenses to the work the party's predecessor in interest had or could
459give under the previous paragraph, plus a right to possession of the
460Corresponding Source of the work from the predecessor in interest, if
461the predecessor has it or can get it with reasonable efforts.
462
463 You may not impose any further restrictions on the exercise of the
464rights granted or affirmed under this License. For example, you may
465not impose a license fee, royalty, or other charge for exercise of
466rights granted under this License, and you may not initiate litigation
467(including a cross-claim or counterclaim in a lawsuit) alleging that
468any patent claim is infringed by making, using, selling, offering for
469sale, or importing the Program or any portion of it.
470
471 11. Patents.
472
473 A "contributor" is a copyright holder who authorizes use under this
474License of the Program or a work on which the Program is based. The
475work thus licensed is called the contributor's "contributor version".
476
477 A contributor's "essential patent claims" are all patent claims
478owned or controlled by the contributor, whether already acquired or
479hereafter acquired, that would be infringed by some manner, permitted
480by this License, of making, using, or selling its contributor version,
481but do not include claims that would be infringed only as a
482consequence of further modification of the contributor version. For
483purposes of this definition, "control" includes the right to grant
484patent sublicenses in a manner consistent with the requirements of
485this License.
486
487 Each contributor grants you a non-exclusive, worldwide, royalty-free
488patent license under the contributor's essential patent claims, to
489make, use, sell, offer for sale, import and otherwise run, modify and
490propagate the contents of its contributor version.
491
492 In the following three paragraphs, a "patent license" is any express
493agreement or commitment, however denominated, not to enforce a patent
494(such as an express permission to practice a patent or covenant not to
495sue for patent infringement). To "grant" such a patent license to a
496party means to make such an agreement or commitment not to enforce a
497patent against the party.
498
499 If you convey a covered work, knowingly relying on a patent license,
500and the Corresponding Source of the work is not available for anyone
501to copy, free of charge and under the terms of this License, through a
502publicly available network server or other readily accessible means,
503then you must either (1) cause the Corresponding Source to be so
504available, or (2) arrange to deprive yourself of the benefit of the
505patent license for this particular work, or (3) arrange, in a manner
506consistent with the requirements of this License, to extend the patent
507license to downstream recipients. "Knowingly relying" means you have
508actual knowledge that, but for the patent license, your conveying the
509covered work in a country, or your recipient's use of the covered work
510in a country, would infringe one or more identifiable patents in that
511country that you have reason to believe are valid.
512
513 If, pursuant to or in connection with a single transaction or
514arrangement, you convey, or propagate by procuring conveyance of, a
515covered work, and grant a patent license to some of the parties
516receiving the covered work authorizing them to use, propagate, modify
517or convey a specific copy of the covered work, then the patent license
518you grant is automatically extended to all recipients of the covered
519work and works based on it.
520
521 A patent license is "discriminatory" if it does not include within
522the scope of its coverage, prohibits the exercise of, or is
523conditioned on the non-exercise of one or more of the rights that are
524specifically granted under this License. You may not convey a covered
525work if you are a party to an arrangement with a third party that is
526in the business of distributing software, under which you make payment
527to the third party based on the extent of your activity of conveying
528the work, and under which the third party grants, to any of the
529parties who would receive the covered work from you, a discriminatory
530patent license (a) in connection with copies of the covered work
531conveyed by you (or copies made from those copies), or (b) primarily
532for and in connection with specific products or compilations that
533contain the covered work, unless you entered into that arrangement,
534or that patent license was granted, prior to 28 March 2007.
535
536 Nothing in this License shall be construed as excluding or limiting
537any implied license or other defenses to infringement that may
538otherwise be available to you under applicable patent law.
539
540 12. No Surrender of Others' Freedom.
541
542 If conditions are imposed on you (whether by court order, agreement or
543otherwise) that contradict the conditions of this License, they do not
544excuse you from the conditions of this License. If you cannot convey a
545covered work so as to satisfy simultaneously your obligations under this
546License and any other pertinent obligations, then as a consequence you may
547not convey it at all. For example, if you agree to terms that obligate you
548to collect a royalty for further conveying from those to whom you convey
549the Program, the only way you could satisfy both those terms and this
550License would be to refrain entirely from conveying the Program.
551
552 13. Use with the GNU Affero General Public License.
553
554 Notwithstanding any other provision of this License, you have
555permission to link or combine any covered work with a work licensed
556under version 3 of the GNU Affero General Public License into a single
557combined work, and to convey the resulting work. The terms of this
558License will continue to apply to the part which is the covered work,
559but the special requirements of the GNU Affero General Public License,
560section 13, concerning interaction through a network will apply to the
561combination as such.
562
563 14. Revised Versions of this License.
564
565 The Free Software Foundation may publish revised and/or new versions of
566the GNU General Public License from time to time. Such new versions will
567be similar in spirit to the present version, but may differ in detail to
568address new problems or concerns.
569
570 Each version is given a distinguishing version number. If the
571Program specifies that a certain numbered version of the GNU General
572Public License "or any later version" applies to it, you have the
573option of following the terms and conditions either of that numbered
574version or of any later version published by the Free Software
575Foundation. If the Program does not specify a version number of the
576GNU General Public License, you may choose any version ever published
577by the Free Software Foundation.
578
579 If the Program specifies that a proxy can decide which future
580versions of the GNU General Public License can be used, that proxy's
581public statement of acceptance of a version permanently authorizes you
582to choose that version for the Program.
583
584 Later license versions may give you additional or different
585permissions. However, no additional obligations are imposed on any
586author or copyright holder as a result of your choosing to follow a
587later version.
588
589 15. Disclaimer of Warranty.
590
591 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
600 16. Limitation of Liability.
601
602 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610SUCH DAMAGES.
611
612 17. Interpretation of Sections 15 and 16.
613
614 If the disclaimer of warranty and limitation of liability provided
615above cannot be given local legal effect according to their terms,
616reviewing courts shall apply local law that most closely approximates
617an absolute waiver of all civil liability in connection with the
618Program, unless a warranty or assumption of liability accompanies a
619copy of the Program in return for a fee.
620
621 END OF TERMS AND CONDITIONS
622
623 How to Apply These Terms to Your New Programs
624
625 If you develop a new program, and you want it to be of the greatest
626possible use to the public, the best way to achieve this is to make it
627free software which everyone can redistribute and change under these terms.
628
629 To do so, attach the following notices to the program. It is safest
630to attach them to the start of each source file to most effectively
631state the exclusion of warranty; and each file should have at least
632the "copyright" line and a pointer to where the full notice is found.
633
634 <one line to give the program's name and a brief idea of what it does.>
635 Copyright (C) <year> <name of author>
636
637 This program is free software: you can redistribute it and/or modify
638 it under the terms of the GNU General Public License as published by
639 the Free Software Foundation, either version 3 of the License, or
640 (at your option) any later version.
641
642 This program is distributed in the hope that it will be useful,
643 but WITHOUT ANY WARRANTY; without even the implied warranty of
644 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 GNU General Public License for more details.
646
647 You should have received a copy of the GNU General Public License
648 along with this program. If not, see <http://www.gnu.org/licenses/>.
649
650Also add information on how to contact you by electronic and paper mail.
651
652 If the program does terminal interaction, make it output a short
653notice like this when it starts in an interactive mode:
654
655 <program> Copyright (C) <year> <name of author>
656 This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 This is free software, and you are welcome to redistribute it
658 under certain conditions; type `show c' for details.
659
660The hypothetical commands `show w' and `show c' should show the appropriate
661parts of the General Public License. Of course, your program's commands
662might be different; for a GUI interface, you would use an "about box".
663
664 You should also get your employer (if you work as a programmer) or school,
665if any, to sign a "copyright disclaimer" for the program, if necessary.
666For more information on this, and how to apply and follow the GNU GPL, see
667<http://www.gnu.org/licenses/>.
668
669 The GNU General Public License does not permit incorporating your program
670into proprietary programs. If your program is a subroutine library, you
671may consider it more useful to permit linking proprietary applications with
672the library. If this is what you want to do, use the GNU Lesser General
673Public License instead of this License. But first, please read
674<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/layouts/community/ergodox/algernon/NEWS.md b/layouts/community/ergodox/algernon/NEWS.md
deleted file mode 100644
index a6ce9813b..000000000
--- a/layouts/community/ergodox/algernon/NEWS.md
+++ /dev/null
@@ -1,229 +0,0 @@
1<!-- -*- mode: markdown; fill-column: 8192 -*- -->
2
3## v1.12
4
5*2018-11-22*
6
7### Overall changes
8
9* Updated to work with QMK master.
10
11### Miscellaneous
12
13* The `😂` symbol can be entered with UCIS.
14* `LEAD r` now inputs `Right Alt`.
15
16## v1.11
17
18*2017-10-01*
19
20### Overall changes
21
22* Updated to work with QMK master.
23* The `$` and `^` symbols on the number row were swapped on both the base and the ADORE layers.
24* The bracket tap-dance keys can now be used to input Japanese brackets, `「` and `」` with a third tap.
25* The second column of the top row on the right side will act as a "Social" application selector on the `AppSel` layer.
26* The third key on the same column will select a password manager.
27* The `GUI` key will now launch `rofi` when triple-tapped.
28
29### Miscellaneous
30
31* The `👶` symbol can be entered with UCIS.
32* The `👪` symbol can be entered with UCIS.
33
34### Tools
35
36* `tools/hid-commands` can now find the `Mstdn`, not just `Slack`, as the "Slack"/chat app.
37* `tools/hid-commands` can now find the Plex web app as a music/media player.
38* `tools/hid-commands` now understands the "Social" application selector. It raises the `Mstdn` and `Tweetdeck` windows, but keeps focus on the previous window.
39* `tools/hid-commands` now understands the "Social2" application selector, which raises `Signal` and `Viber`, but keeps focus on the previous window.
40* `tools/hid-commands` is now able to select a password manager (KeePass*).
41* `tools/hid-commands` can now run `rofi` when receiving an `appsel_helper` command (triggered by a triple-tapped `GUI` key).
42
43## v1.10
44
45*2016-12-28*
46
47### Miscellaneous
48
49* `µ` can now be entered with UCIS.
50* `™` can now be entered with UCIS.
51
52### Tools
53
54* `tools/hid-commands` can now find Banshee, and prefers it over Kodi.
55* `tools/hid-commands` can now find Chrome too, not juts Chromium.
56
57## v1.9
58
59*2016-10-16*
60
61### Overall changes
62
63* `F12` was replaced by an `Fx` key, that activate the **Media** layer as a one-shot layer, and also `Alt` as a one-shot modifier.
64
65### Base layer changes
66
67* The `Media Stop` key is now a tap-dance key, and resets the device for programming on the fourth tap.
68
69### Miscellaneous
70
71* `π` can now be entered with UCIS.
72* `🐁` can now be entered with UCIS.
73
74### Tools
75
76* The `tools/layer-notify` tool was removed, it was an example, which I don't use.
77
78#### `tools/hid-commands`
79
80* Now looks at the `DISABLE_APPSEL_START` environment value, and does not display an AppSel notification if it is non-empty.
81* Will attempt to re-program the keyboard when receiving a `reflash` command.
82* No longer tries to select Emacs 24 on `APPSEL_EMACS`, rather, it goes for any Emacs.
83* The `APPSEL_MUSIC` command now includes Kodi in the list too, as the last choice.
84
85## v1.8
86
87*2016-10-03*
88
89### ADORE
90
91* Major rearrangements were made, to reduce pinky use, and to balance out the hand usage.
92
93### Tools
94
95* The `hid-commands` tool will now display a notification when the **AppSel** layer is triggered.
96* The `log-to-heatmap.py` tool now treats the innermost keys on the bottom row as thumb keys, as far as statistics are concerned.
97
98### Miscellaneous
99
100* Fixed the **Steno** toggle key.
101
102## v1.7
103
104*2016-09-18*
105
106### Overall changes
107
108* The number row has been completely rearranged on both the **Base** and the **ADORE** layers.
109* The number/function key behavior was changed: function keys are now on the **Media**.
110* The `:`/`;` and `-`/`_` keys were put back to their thumb position on the bottom row, on both the **Base** and **ADORE** layers.
111* The bottom large keys on the inner side of each half now function as [tmux](http://tmux.github.io/) keys: the left to send the prefix, the right to send the `display-panes` key. The left also doubles as a GNU screen prefix key, and sends `C-a` when double tapped.
112* A number of functions, such as the **AppSel** layer, now require the `hid-commands` tool to be running, with the output of `hid_listen` being piped to it.
113
114### ADORE
115
116* `Y` and `X` have been swapped again.
117
118### Media/Navigation layer
119
120* The function keys are now on this layer.
121* Mouse keys have been removed.
122* Media start/stop/prev/next have been removed.
123* `Print screen` has been removed.
124* There is only one screen lock key now.
125
126### Heatmap
127
128* Fixed a few issues in the finger-stats calculation.
129* The tool now also timestamps and saves all input lines to a logfile, which it loads on start, allowing one to continue the collection after upgrading the tool.
130* The heatmap tool will now colorize the stats by default.
131* The periodic stats are now printed in a more compact format.
132
133### Tools
134
135* Added a new tool, `tools/layer-notify` that listens to layer change events on the HID console, and pops up a notification on layer changes.
136* Another new tool, `tools/text-to-log.py` has been added that converts arbitrary text to a keylogger output, which can be fed to the heatmap generator.
137* A number of features have been moved to the `tools/hid-commands` utility. These generally are OS dependent, and are easier to implement on the software side.
138
139## v1.6
140
141*2016-08-24*
142
143### Base layer changes
144
145* The parentheses & bracket keys have been merged: tapping them results in `[` or `{` (if it was shifted), double tapping leads to `(`.
146* The `:;` and `-_` keys are now available on the base layer, on their **ADORE** location, too, just below `[{(`/`]})`.
147* The `Apps` key has been replaced by `F12`.
148* The `-`/`_` is no longer a tap-dance key.
149
150### ADORE layer changes
151
152* Adjustments were made to the **ADORE** layer, to separate some inconvenient combinations.
153
154### Miscellaneous changes
155
156* `LEAD u` now starts the symbolic unicode input system, instead of the OS-one.
157* The mouse acceleration keys on the **Navigation/Media** layer have been turned into toggles: tap them once to turn them on, until tapped again. Tapping an accelerator button will turn all the others off.
158* When the **ARROW** layer is on, the *red* and *blue* LEDs light up now.
159
160### Heatmap
161
162* The built-in keylogger has been greatly enhanced, it now outputs the pressed state, and the layer (Dvorak or ADORE). As such, the `ADORE_AUTOLOG` option has been removed, instead there is `AUTOLOG_ENABLE` now, which when enabled, makes the keylogger start when the keyboard boots. It defaults to off.
163* The heatmap generator received a lot of updates.
164
165## v1.5
166
167*2016-08-12*
168
169* The **1HAND** layer has been removed.
170* A `Delete` key is now available on the right thumb cluster.
171* The **ADORE** layer received a major update, see the layout image above.
172* It is now possible to enable automatic logging for the **ADORE** layer, by setting the `ADORE_AUTOLOG` makefile variable to `yes` when compiling the keymap. It is off by default.
173* The `~` key and the `Media Next/Prev` key have been swapped on the **Base** layer.
174* On the **ARROW** layer, `Backspace` has been replaced by `Enter`.
175* There is some experimental support for entering Unicode symbols.
176
177## v1.4
178
179*2016-07-29*
180
181* When toggling the key logging on or off, the LEDs will do a little dance.
182* The keylogger is now optional, but enabled by default. Use `KEYLOGGER_ENABLE=no` on the `make` command line to disable it.
183* The `TAB`/`ARRW` key was turned into a tap-dance key, allowing one to toggle the **ARROW** layer on by double-tapping, and as such, avoid the need to hold the key.
184* The `-`/`_` key was turned into a tap-dance key too.
185* There is now a way to travel time with the keyboard, toggle the feature on by hitting `LEAD t`.
186
187## v1.3
188
189*2016-07-06*
190
191* Added support for logging keys, by pressing `LEAD d`. Also included is a tool to generate a *heatmap* out of the logs.
192* The arrow and navigation keys were rearranged again, and now require an additional key being held to activate. See the **Base** layer for an image that shows where arrows are.
193* The **experimental** layer has been redone, and is now called **ADORE**, and as such, can be enabled by `LEAD a` now.
194* Switching between Dvorak and ADORE is now persisted into EEPROM, and survives a reboot.
195
196## v1.2
197
198*2016-06-22*
199
200* The forced NKRO mode can be easily toggled off at compile-time, to make the firmware compatible with certain operating systems.
201* The `:;` key has changed behaviour: to access the `;` symbol, the key needs to be double-tapped, instead of shifted.
202* The `=` and `\` keys were swapped, `=` moved to the home row, on both the **Base** and the **experimental** layers.
203* The arrow and navigation keys were redone, they are now more accessible, but the navigation keys require an extra tap to access.
204* The **Emacs** layer is gone, replaced by a simplified **navigation and media** layer.
205* `LEAD v` types the firmware version, and the keymap version.
206* On the **experimental** layer, the `L` and `Q`, and the `K` and `G` keys were swapped.
207* The **Steno** layer gained a few more `#` and `*` keys, to make it easier on my fingers.
208
209## v1.1
210
211*2016-06-14*
212
213* The keyboard starts in NKRO mode, bootmagic and other things are disabled.
214* A **Steno** layer was added, to be used with Plover.
215* An **experimental** layer was added, something halfway between Dvorak and Capewell-Dvorak. A work in progress.
216* `LEAD y` types `\o/`.
217* Some keys on the **Base** layer have been moved around:
218 - `?` moved to the left pinky, left of `Q`.
219 - `=` shifted one row down, but `F11` stayed where it was.
220 - `-` on the left half was replaced by `Tab`.
221 - `Tab`'s original position is taken by a `Media Next`/`Media Prev` key.
222 - `:` now inputs `;` when shifted.
223* `ESC` cancels the **Hungarian** layer too, not just modifiers.
224
225## v1.0
226
227*2016-05-26*
228
229Initial version.
diff --git a/layouts/community/ergodox/algernon/config.h b/layouts/community/ergodox/algernon/config.h
deleted file mode 100644
index 583c3911f..000000000
--- a/layouts/community/ergodox/algernon/config.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#pragma once
2
3#undef MOUSEKEY_TIME_TO_MAX
4#undef MOUSEKEY_MAX_SPEED
5
6#define MOUSEKEY_TIME_TO_MAX 1
7#define MOUSEKEY_MAX_SPEED 2
8
9#undef MOUSEKEY_DELAY
10#define MOUSEKEY_DELAY 0
11
12#undef MOUSEKEY_WHEEL_DELAY
13#define MOUSEKEY_WHEEL_DELAY 0
14
15#define ONESHOT_TAP_TOGGLE 2
16#define ONESHOT_TIMEOUT 3000
17
18#undef LOCKING_SUPPORT_ENABLE
19#undef LOCKING_RESYNC_ENABLE
20
21#undef LEADER_TIMEOUT
22#define LEADER_TIMEOUT 1000
diff --git a/layouts/community/ergodox/algernon/images/adore-layer.png b/layouts/community/ergodox/algernon/images/adore-layer.png
deleted file mode 100644
index 75d2ca4f0..000000000
--- a/layouts/community/ergodox/algernon/images/adore-layer.png
+++ /dev/null
Binary files differ
diff --git a/layouts/community/ergodox/algernon/images/base-layer.png b/layouts/community/ergodox/algernon/images/base-layer.png
deleted file mode 100644
index 2ca7a273b..000000000
--- a/layouts/community/ergodox/algernon/images/base-layer.png
+++ /dev/null
Binary files differ
diff --git a/layouts/community/ergodox/algernon/images/heatmap.png b/layouts/community/ergodox/algernon/images/heatmap.png
deleted file mode 100644
index 4f55c5adf..000000000
--- a/layouts/community/ergodox/algernon/images/heatmap.png
+++ /dev/null
Binary files differ
diff --git a/layouts/community/ergodox/algernon/images/steno-layer.png b/layouts/community/ergodox/algernon/images/steno-layer.png
deleted file mode 100644
index 9a2ba55ef..000000000
--- a/layouts/community/ergodox/algernon/images/steno-layer.png
+++ /dev/null
Binary files differ
diff --git a/layouts/community/ergodox/algernon/keymap.c b/layouts/community/ergodox/algernon/keymap.c
deleted file mode 100644
index 068087095..000000000
--- a/layouts/community/ergodox/algernon/keymap.c
+++ /dev/null
@@ -1,1194 +0,0 @@
1/*
2 * algernon's ErgoDox EZ layout, please see the readme.md file!
3 */
4
5#include <stdarg.h>
6#include QMK_KEYBOARD_H
7#include "led.h"
8#include "debug.h"
9#include "action_layer.h"
10#include "action_util.h"
11#include "timer.h"
12#include "keymap_plover.h"
13#include "eeconfig.h"
14#include "wait.h"
15#include "version.h"
16#include "print.h"
17
18/* Layers */
19
20enum {
21 BASE = 0,
22 ADORE,
23 ARRW,
24 APPSEL,
25 HUN,
26 NMDIA,
27 PLVR,
28};
29
30/* Macros */
31
32enum {
33 NONE = 0,
34 // Buttons that do extra stuff
35 A_GUI,
36 A_PLVR,
37 A_MPN,
38
39 // Application select keys
40 APP_SLK, // Slack
41 APP_EMCS, // Emacs
42 APP_TERM, // Terminal
43 APP_CHRM, // Chrome
44 APP_MSIC, // Music
45 APP_SOCL, // Social
46 APP_PMGR, // Password manager
47 APP_SCL2, // Social #2
48
49 // Hungarian layer keys
50 HU_AACU, // Á
51 HU_OACU, // Ó
52 HU_EACU, // É
53 HU_UACU, // Ú
54 HU_IACU, // Í
55 HU_ODIA, // Ö
56 HU_UDIA, // Ü
57 HU_ODAC, // Ő
58 HU_UDAC, // Ű
59
60 // number/symbol keys
61 A_1, // 1
62 A_2, // 2
63 A_3, // ...
64 A_4,
65 A_5,
66 A_6,
67 A_7,
68 A_8,
69 A_9,
70 A_0,
71
72 // Fx
73 Fx,
74};
75
76/* Fn keys */
77
78enum {
79 F_BSE = 0,
80 F_HUN,
81 F_GUI,
82};
83
84/* Custom keycodes */
85
86enum {
87 CT_CLN = 0,
88 CT_TA,
89 CT_LBP,
90 CT_RBP,
91 CT_TMUX,
92 CT_TPS,
93 CT_SR,
94};
95
96/* States & timers */
97
98uint16_t gui_timer = 0;
99
100#if KEYLOGGER_ENABLE
101# ifdef AUTOLOG_ENABLE
102bool log_enable = true;
103# else
104bool log_enable = false;
105# endif
106#endif
107
108bool time_travel = false;
109bool skip_leds = false;
110
111static uint8_t is_adore = 0;
112
113/* The Keymap */
114
115const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
116
117/* Keymap 0: Base Layer
118 *
119 * ,-----------------------------------------------------. ,-----------------------------------------------------.
120 * | Next/Prev | 9 | 7 @ | 5 * | 3 ^ | 1 $ | F11 | | Fx | 0 % | 2 ! | 4 # | 6 & | 8 | Plover |
121 * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
122 * | ~ | ' | , | . | P | Y | ( | | ) | F | G | C | R | L | \ |
123 * |-----------+------+------+------+------+------| [ | | ] |------+------+------+------+------+-----------|
124 * | Tab/ARROW | A | O | E | U | I |------| |------| D | H | T | N | S | = / Arrow |
125 * |-----------+------+------+------+------+------| tmux | | tmux |------+------+------+------+------+-----------|
126 * | Play/Pause| / | Q | J | K | X | | | Pane | B | M | W | V | Z | Stop/Reset|
127 * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
128 * | | | | | : | | - | | | | |
129 * `-----------------------------------' `-----------------------------------'
130 * ,-------------. ,-------------.
131 * | LAlt | GUI | | MDIA | Del |
132 * ,------|------|------| |------+------+------.
133 * | | | Ctrl | | LEAD | | |
134 * |Backsp|LShift|------| |------| Enter| Space|
135 * | | | ESC | | HUN | | |
136 * `--------------------' `--------------------'
137 */
138[BASE] = LAYOUT_ergodox(
139// left hand
140 M(A_MPN) ,M(A_9) ,M(A_7) ,M(A_5) ,M(A_3) ,M(A_1) ,KC_F11
141,KC_GRV ,KC_QUOT ,KC_COMM ,KC_DOT ,KC_P ,KC_Y ,TD(CT_LBP)
142,TD(CT_TA) ,KC_A ,KC_O ,KC_E ,KC_U ,KC_I
143,KC_MPLY ,KC_SLSH ,KC_Q ,KC_J ,KC_K ,KC_X ,TD(CT_TMUX)
144,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN)
145
146 ,OSM(MOD_LALT),F(F_GUI)
147 ,OSM(MOD_LCTL)
148 ,KC_BSPC,OSM(MOD_LSFT),KC_ESC
149
150 // right hand
151 ,M(Fx) ,M(A_0) ,M(A_2) ,M(A_4) ,M(A_6) ,M(A_8) ,M(A_PLVR)
152 ,TD(CT_RBP),KC_F ,KC_G ,KC_C ,KC_R ,KC_L ,KC_BSLS
153 ,KC_D ,KC_H ,KC_T ,KC_N ,KC_S ,KC_EQL
154 ,TD(CT_TPS),KC_B ,KC_M ,KC_W ,KC_V ,KC_Z ,TD(CT_SR)
155 ,KC_MINS ,KC_NO ,KC_NO ,KC_NO ,KC_NO
156
157 ,OSL(NMDIA),KC_DEL
158 ,KC_LEAD
159 ,F(F_HUN) ,KC_ENT ,KC_SPC
160 ),
161
162/* Keymap 1: Adore layer
163 *
164 * ,-----------------------------------------------------. ,-----------------------------------------------------.
165 * | Play/Pause| 9 | 7 @ | 5 * | 3 ^ | 1 $ | F11 | | Fx | 0 % | 2 ! | 4 # | 6 & | 8 | Plover |
166 * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
167 * | \ | X | W | C | H | F | ( | | ) | M | G | L | P | / | `~ |
168 * |-----------+------+------+------+------+------| [ | | ] |------+------+------+------+------+-----------|
169 * | Tab/Arrow | A | O | E | I | U |------| |------| D | R | T | N | S | = |
170 * |-----------+------+------+------+------+------| tmux | | tmux |------+------+------+------+------+-----------|
171 * | | Z | Q | ' | , | . | | | pane | B | K | V | Y | J | |
172 * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
173 * | | | | | : | | - | | | | |
174 * `-----------------------------------' `-----------------------------------'
175 * ,-------------. ,-------------.
176 * | LAlt | GUI | | MDIA | Del |
177 * ,------|------|------| |------+------+------.
178 * | | | Ctrl | | HUN | | |
179 * |Backsp|LShift|------| |------| Enter| Space|
180 * | | | ESC | | LEAD | | |
181 * `--------------------' `--------------------'
182 */
183[ADORE] = LAYOUT_ergodox(
184// left hand
185 KC_MPLY ,M(A_9) ,M(A_7) ,M(A_5) ,M(A_3) ,M(A_1) ,KC_F11
186,KC_BSLS ,KC_X ,KC_W ,KC_C ,KC_H ,KC_F ,TD(CT_LBP)
187,TD(CT_TA) ,KC_A ,KC_O ,KC_E ,KC_I ,KC_U
188,KC_NO ,KC_Z ,KC_Q ,KC_QUOT ,KC_COMM ,KC_DOT ,TD(CT_TMUX)
189,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN)
190
191 ,OSM(MOD_LALT),F(F_GUI)
192 ,OSM(MOD_LCTL)
193 ,KC_BSPC,OSM(F_LSFT),KC_ESC
194
195 // right hand
196 ,M(Fx) ,M(A_0) ,M(A_2) ,M(A_4) ,M(A_6) ,M(A_8) ,M(A_PLVR)
197 ,TD(CT_RBP),KC_M ,KC_G ,KC_L ,KC_P ,KC_SLSH ,KC_GRV
198 ,KC_D ,KC_R ,KC_T ,KC_N ,KC_S ,KC_EQL
199 ,TD(CT_TPS),KC_B ,KC_K ,KC_V ,KC_Y ,KC_J ,KC_NO
200 ,KC_MINS ,KC_NO ,KC_NO ,KC_NO ,KC_NO
201
202 ,OSL(NMDIA),KC_DEL
203 ,F(F_HUN)
204 ,KC_LEAD ,KC_ENT ,KC_SPC
205 ),
206
207/* Keymap 2: Arrow layer
208 *
209 * ,-----------------------------------------------------. ,-----------------------------------------------------.
210 * | | | | | | | | | | | | | | | |
211 * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
212 * | | | | | | | | | | | Home | Up | End | | |
213 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
214 * | | | | | | |------| |------| | Left | Down | Rght | | |
215 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
216 * | | | | | | | | | | | | | | | |
217 * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
218 * | | | | | | | | | | | |
219 * `----------------------------------' `----------------------------------'
220 * ,-------------. ,-------------.
221 * | | | | | |
222 * ,------|------|------| |------+------+------.
223 * | | | | | | | |
224 * | Enter| |------| |------| PgUp | PgDn |
225 * | | | | | | | |
226 * `--------------------' `--------------------'
227 */
228
229[ARRW] = LAYOUT_ergodox(
230// left hand
231 KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
232,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
233,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
234,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
235,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
236
237 ,KC_TRNS ,KC_TRNS
238 ,KC_TRNS
239 ,KC_ENT ,KC_TRNS ,KC_TRNS
240
241 // right hand
242 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
243 ,KC_TRNS ,KC_TRNS ,KC_HOME ,KC_UP ,KC_END ,KC_TRNS ,KC_TRNS
244 ,KC_TRNS ,KC_LEFT ,KC_DOWN ,KC_RGHT ,KC_TRNS ,KC_TRNS
245 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
246 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
247
248 ,KC_TRNS ,KC_TRNS
249 ,KC_TRNS
250 ,KC_TRNS ,KC_PGUP ,KC_PGDN
251 ),
252
253/* Keymap 3: Application select layer
254 *
255 * ,-----------------------------------------------------. ,-----------------------------------------------------.
256 * | |Music |Slack |Emacs |Term |Chrome| | | |Social|PWMgr |Scl2 | | | |
257 * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
258 * | | | | | | | | | | | | | | | |
259 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
260 * | | | | | | |------| |------| | | | | | |
261 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
262 * | | | | | | | | | | | | | | | |
263 * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
264 * | | | | | | | | | | | |
265 * `----------------------------------' `----------------------------------'
266 * ,-------------. ,-------------.
267 * | | | | | |
268 * ,------|------|------| |------+------+------.
269 * | | | | | | | |
270 * | | |------| |------| | |
271 * | | | | | | | |
272 * `--------------------' `--------------------'
273 */
274
275[APPSEL] = LAYOUT_ergodox(
276// left hand
277 KC_TRNS ,M(APP_MSIC),M(APP_SLK),M(APP_EMCS),M(APP_TERM),M(APP_CHRM),KC_TRNS
278,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
279,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
280,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
281,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
282
283 ,KC_TRNS ,KC_TRNS
284 ,KC_TRNS
285 ,KC_TRNS ,KC_TRNS ,KC_TRNS
286
287 // right hand
288 ,KC_TRNS ,M(APP_SOCL) ,M(APP_PMGR) ,M(APP_SCL2) ,KC_NO ,KC_NO ,KC_TRNS
289 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
290 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
291 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
292 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
293
294 ,KC_TRNS ,KC_TRNS
295 ,KC_TRNS
296 ,KC_TRNS ,KC_TRNS ,KC_TRNS
297 ),
298
299
300/* Keymap 4: Hungarian Layer
301 *
302 * ,-----------------------------------------------------. ,-----------------------------------------------------.
303 * | | | | | | | | | | | | | | | |
304 * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
305 * | | | Ő | | Ű | | | | | | | | | | |
306 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
307 * | | Á | Ó | É | Ú | Í |------| |------| | | | | | |
308 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
309 * | | | Ö | | Ü | | | | | | | | | | |
310 * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
311 * | | | | | | | | | | | |
312 * `----------------------------------' `----------------------------------'
313 * ,-------------. ,-------------.
314 * | | | | | |
315 * ,------|------|------| |------+------+------.
316 * | | | | | | | |
317 * | | |------| |------| | |
318 * | | | | | BASE | | |
319 * `--------------------' `--------------------'
320 */
321
322[HUN] = LAYOUT_ergodox(
323// left hand
324 KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
325,KC_NO ,KC_NO ,M(HU_ODAC),KC_NO ,M(HU_UDAC),KC_NO ,KC_NO
326,KC_NO ,M(HU_AACU),M(HU_OACU) ,M(HU_EACU),M(HU_UACU) ,M(HU_IACU)
327,KC_NO ,KC_NO ,M(HU_ODIA) ,KC_NO ,M(HU_UDIA) ,KC_NO ,KC_NO
328,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
329
330 ,KC_NO ,KC_NO
331 ,KC_NO
332 ,KC_NO ,KC_TRNS ,KC_TRNS
333
334 // right hand
335 ,KC_TRNS ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
336 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
337 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
338 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
339 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
340
341 ,KC_NO ,KC_NO
342 ,KC_NO
343 ,F(F_BSE),KC_TRNS ,KC_TRNS
344 ),
345
346/* Keymap 5: Navigation & Media layer
347 *
348 * ,-----------------------------------------------------. ,-----------------------------------------------------.
349 * | | F9 | F7 | F5 | F3 | F1 |ScrLCK| | | F10 | F2 | F4 | F6 | F8 | |
350 * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
351 * | | | | | | | | | | | | | | | |
352 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
353 * | | | | | | |------| |------| | | | | | |
354 * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
355 * | | | | | | | | | | | | | | | |
356 * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
357 * | | | | | | | | | | | |
358 * `----------------------------------' `----------------------------------'
359 * ,-------------. ,-------------.
360 * | Mute | VlUp | | BASE | |
361 * ,------|------|------| |------+------+------.
362 * | | | VlDn | | | | |
363 * | | |------| |------| | |
364 * | | | | | | | |
365 * `--------------------' `--------------------'
366 */
367[NMDIA] = LAYOUT_ergodox(
368// left hand
369 KC_NO ,KC_F9 ,KC_F7 ,KC_F5 ,KC_F3 ,KC_F1 ,LGUI(KC_L)
370,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
371,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
372,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
373,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
374 ,KC_MUTE ,KC_VOLU
375 ,KC_VOLD
376 ,KC_NO ,KC_NO ,KC_TRNS
377
378 // right hand
379 ,KC_TRNS ,KC_F10 ,KC_F2 ,KC_F4 ,KC_F6 ,KC_F8 ,KC_NO
380 ,KC_NO ,KC_NO ,KC_NO ,KC_UP ,KC_NO ,KC_NO ,KC_NO
381 ,KC_NO ,KC_LEFT ,KC_DOWN ,KC_RGHT ,KC_NO ,KC_NO
382 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
383 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
384
385 ,KC_TRNS ,KC_NO
386 ,KC_NO
387 ,KC_NO ,KC_NO ,KC_NO
388 ),
389
390/* Keymap 6: Steno for Plover
391 *
392 * ,--------------------------------------------------. ,--------------------------------------------------.
393 * | | | | | | | | | | | | | | | BASE |
394 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
395 * | | # | # | # | # | # | # | | # | # | # | # | # | # | # |
396 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
397 * | | | T | P | H | |------| |------| | F | P | L | T | D |
398 * |--------+ S +------+------+------+ * | * | | * | * +------+------+------+------+--------|
399 * | | | K | W | R | | | | | | R | B | G | S | Z |
400 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
401 * | | | | | | | | | | | |
402 * `----------------------------------' `----------------------------------'
403 * ,-------------. ,-------------.
404 * | | | | | |
405 * ,------|------|------| |------+------+------.
406 * | | | | | | | |
407 * | A | O |------| |------| E | U |
408 * | | | | | | | |
409 * `--------------------' `--------------------'
410 */
411
412[PLVR] = LAYOUT_ergodox(
413// left hand
414KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
415KC_NO, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM,
416KC_NO, PV_LS, PV_LT, PV_LP, PV_LH, PV_STAR,
417KC_NO, PV_LS, PV_LK, PV_LW, PV_LR, PV_STAR, PV_STAR,
418KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
419 KC_NO, KC_NO,
420 KC_NO,
421 PV_A, PV_O, KC_NO,
422
423 // right hand
424 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, M(A_PLVR),
425 PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM,
426 PV_STAR, PV_RF, PV_RP, PV_RL, PV_RT, PV_RD,
427 PV_STAR, PV_STAR, PV_RR, PV_RB, PV_RG, PV_RS, PV_RZ,
428 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
429 KC_NO, KC_NO,
430 KC_NO,
431 KC_NO,PV_E, PV_U
432 ),
433
434};
435
436const uint16_t PROGMEM fn_actions[] = {
437 [F_BSE] = ACTION_LAYER_CLEAR(ON_PRESS)
438 ,[F_HUN] = ACTION_LAYER_INVERT(HUN, ON_PRESS)
439 ,[F_GUI] = ACTION_MACRO_TAP(A_GUI)
440};
441
442static void toggle_steno(int pressed)
443{
444 uint8_t layer = biton32(layer_state);
445
446 if (pressed) {
447 if (layer != PLVR) layer_on(PLVR); else layer_off(PLVR);
448
449 register_code(PV_LP);
450 register_code(PV_LH);
451 register_code(PV_LR);
452 register_code(PV_O);
453 register_code(PV_RL);
454 register_code(PV_RG);
455 } else {
456 unregister_code(PV_LP);
457 unregister_code(PV_LH);
458 unregister_code(PV_LR);
459 unregister_code(PV_O);
460 unregister_code(PV_RL);
461 unregister_code(PV_RG);
462 }
463}
464
465static macro_t *ang_do_hun (keyrecord_t *record, uint16_t accent, uint16_t hun_char)
466{
467 uint8_t need_shift = 0;
468 uint8_t hold_shift = 0;
469
470 if (!record->event.pressed)
471 return MACRO_NONE;
472
473 layer_off (HUN);
474
475 if (keyboard_report->mods & MOD_BIT (KC_LSFT)) {
476 hold_shift = 1;
477 need_shift = 1;
478 unregister_code (KC_LSFT);
479 }
480 if ((get_oneshot_mods () & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out ()) {
481 need_shift = 1;
482 hold_shift = 0;
483 unregister_code (KC_LSFT);
484 }
485
486 clear_oneshot_mods ();
487
488 register_code (KC_RALT);
489 unregister_code (KC_RALT);
490 if (accent == (KC_DQT)) {
491 register_code (KC_RSFT);
492 }
493 register_code (accent);
494 unregister_code (accent);
495 if (need_shift && accent != (KC_DQT)) {
496 register_code (KC_RSFT);
497 } else if (accent == (KC_DQT) && !need_shift) {
498 unregister_code (KC_RSFT);
499 }
500 register_code (hun_char);
501 unregister_code (hun_char);
502 if (need_shift || accent == (KC_DQT))
503 unregister_code (KC_RSFT);
504 if (hold_shift)
505 register_code (KC_LSFT);
506
507 return MACRO_NONE;
508}
509
510static void ang_handle_num_row(uint8_t id, keyrecord_t *record) {
511 uint8_t idx = id - A_1;
512 uint8_t kc;
513 static bool shifted[10];
514
515 if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
516 ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out())) {
517 if (record->event.pressed)
518 shifted[idx] = true;
519 }
520
521 if (!shifted[idx]) {
522 kc = idx + KC_1;
523 } else {
524 switch (id) {
525 case A_8:
526 case A_9:
527 shifted[idx] = false;
528 return;
529
530 case A_7:
531 kc = KC_2;
532 break;
533 case A_5:
534 kc = KC_8;
535 break;
536 case A_3:
537 kc = KC_4;
538 break;
539 case A_1:
540 kc = KC_6;
541 break;
542
543 case A_0:
544 kc = KC_5;
545 break;
546 case A_2:
547 kc = KC_1;
548 break;
549 case A_4:
550 kc = KC_3;
551 break;
552 case A_6:
553 kc = KC_7;
554 break;
555 }
556 }
557
558 if (record->event.pressed) {
559 register_code (kc);
560 } else {
561 unregister_code (kc);
562 shifted[idx] = false;
563 }
564}
565
566const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
567{
568 switch(id) {
569 case A_MPN:
570 if (record->event.pressed) {
571 if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
572 ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out())) {
573 int oneshot = ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out());
574
575 if (oneshot)
576 clear_oneshot_mods ();
577 unregister_code (KC_LSFT);
578
579 register_code (KC_MPRV);
580 unregister_code (KC_MPRV);
581
582 if (!oneshot)
583 register_code (KC_LSFT);
584 } else {
585 return MACRO (T(MNXT), END);
586 }
587 }
588 break;
589
590 /* Hungarian layer */
591 case HU_AACU:
592 return ang_do_hun (record, KC_QUOT, KC_A);
593 case HU_OACU:
594 return ang_do_hun (record, KC_QUOT, KC_O);
595 case HU_EACU:
596 return ang_do_hun (record, KC_QUOT, KC_E);
597 case HU_UACU:
598 return ang_do_hun (record, KC_QUOT, KC_U);
599 case HU_IACU:
600 return ang_do_hun (record, KC_QUOT, KC_I);
601 case HU_ODIA:
602 return ang_do_hun (record, KC_DQT, KC_O);
603 case HU_UDIA:
604 return ang_do_hun (record, KC_DQT, KC_U);
605 case HU_ODAC:
606 return ang_do_hun (record, KC_EQL, KC_O);
607 case HU_UDAC:
608 return ang_do_hun (record, KC_EQL, KC_U);
609
610 /* Plover base */
611 case A_PLVR:
612 toggle_steno(record->event.pressed);
613 break;
614
615 /* Fx */
616 case Fx:
617 if (record->event.pressed) {
618 set_oneshot_mods (MOD_LALT);
619 layer_on (NMDIA);
620 set_oneshot_layer (NMDIA, ONESHOT_START);
621 } else {
622 clear_oneshot_layer_state (ONESHOT_PRESSED);
623 }
624 break;
625
626 /* GUI & AppSel */
627 case A_GUI:
628 if (record->event.pressed) {
629 register_code (KC_LGUI);
630 if (record->tap.count && !record->tap.interrupted) {
631 if (record->tap.count == 2) {
632 uprintf("CMD:appsel_start\n");
633 layer_on (APPSEL);
634 set_oneshot_layer (APPSEL, ONESHOT_START);
635 } else if (record->tap.count >= 3) {
636 uprintf("CMD:appsel_helper\n");
637 layer_off (APPSEL);
638 clear_oneshot_layer_state (ONESHOT_PRESSED);
639 }
640 } else {
641 record->tap.count = 0;
642 }
643 gui_timer = 0;
644 } else {
645 if (record->tap.count >= 2)
646 {
647 clear_oneshot_layer_state (ONESHOT_PRESSED);
648 }
649 gui_timer = timer_read ();
650 }
651 break;
652
653 case APP_SLK:
654 if (record->event.pressed)
655 uprintf("CMD:appsel_slack\n");
656 break;
657
658 case APP_EMCS:
659 if (record->event.pressed)
660 uprintf("CMD:appsel_emacs\n");
661 break;
662
663 case APP_TERM:
664 if (record->event.pressed)
665 uprintf("CMD:appsel_term\n");
666 break;
667
668 case APP_CHRM:
669 if (record->event.pressed)
670 uprintf("CMD:appsel_chrome\n");
671 break;
672
673 case APP_MSIC:
674 if (record->event.pressed)
675 uprintf("CMD:appsel_music\n");
676 break;
677
678 case APP_SOCL:
679 if (record->event.pressed)
680 uprintf("CMD:appsel_social\n");
681 break;
682
683 case APP_PMGR:
684 if (record->event.pressed)
685 uprintf("CMD:appsel_pwmgr\n");
686 break;
687
688 case APP_SCL2:
689 if (record->event.pressed)
690 uprintf("CMD:appsel_social2\n");
691 break;
692
693 // number row and symbols
694 case A_1 ... A_0:
695 ang_handle_num_row(id, record);
696 break;
697 }
698
699 return MACRO_NONE;
700};
701
702// Runs just one time when the keyboard initializes.
703void matrix_init_user(void) {
704 uint8_t dl;
705
706 set_unicode_input_mode(UC_LNX);
707
708 ergodox_led_all_on();
709 for (int i = LED_BRIGHTNESS_HI; i > LED_BRIGHTNESS_LO; i--) {
710 ergodox_led_all_set (i);
711 wait_ms (5);
712 }
713 wait_ms(1000);
714 for (int i = LED_BRIGHTNESS_LO; i > 0; i--) {
715 ergodox_led_all_set (i);
716 wait_ms (10);
717 }
718 ergodox_led_all_off();
719
720 if (!eeconfig_is_enabled())
721 eeconfig_init();
722 dl = eeconfig_read_default_layer ();
723 if (dl == (1UL << ADORE)) {
724 is_adore = 1;
725 }
726};
727
728LEADER_EXTERNS();
729
730static void ang_tap (uint16_t code, ...) {
731 uint16_t kc = code;
732 va_list ap;
733
734 va_start(ap, code);
735
736 do {
737 register_code16(kc);
738 unregister_code16(kc);
739 wait_ms(50);
740 kc = va_arg(ap, int);
741 } while (kc != 0);
742 va_end(ap);
743}
744
745#define TAP_ONCE(code) \
746 register_code (code); \
747 unregister_code (code)
748
749typedef struct {
750 bool layer_toggle;
751 bool sticky;
752} td_ta_state_t;
753
754static void ang_tap_dance_ta_finished (qk_tap_dance_state_t *state, void *user_data) {
755 td_ta_state_t *td_ta = (td_ta_state_t *) user_data;
756
757 if (td_ta->sticky) {
758 td_ta->sticky = false;
759 td_ta->layer_toggle = false;
760 layer_off (ARRW);
761 return;
762 }
763
764 if (state->count == 1 && !state->pressed) {
765 register_code (KC_TAB);
766 td_ta->sticky = false;
767 td_ta->layer_toggle = false;
768 } else {
769 td_ta->layer_toggle = true;
770 layer_on (ARRW);
771 td_ta->sticky = (state->count == 2);
772 }
773}
774
775static void ang_tap_dance_ta_reset (qk_tap_dance_state_t *state, void *user_data) {
776 td_ta_state_t *td_ta = (td_ta_state_t *) user_data;
777
778 if (!td_ta->layer_toggle)
779 unregister_code (KC_TAB);
780 if (!td_ta->sticky)
781 layer_off (ARRW);
782}
783
784static void ang_tap_dance_tmux_finished (qk_tap_dance_state_t *state, void *user_data) {
785 if (state->count == 1) {
786 register_code(KC_LALT);
787 register_code(KC_SPC);
788 unregister_code(KC_SPC);
789 unregister_code(KC_LALT);
790 } else {
791 register_code(KC_LCTL);
792 register_code(KC_A);
793 unregister_code(KC_A);
794 unregister_code(KC_LCTL);
795 }
796}
797
798static void ang_tap_dance_tmux_pane_select (qk_tap_dance_state_t *state, void *user_data) {
799 uint8_t kc = KC_P;
800
801 if (state->count >= 2) {
802 kc = KC_Z;
803 }
804
805 register_code(KC_LALT);
806 register_code(KC_SPC);
807 unregister_code(KC_SPC);
808 unregister_code(KC_LALT);
809
810 register_code(kc);
811 unregister_code(kc);
812}
813
814static void
815_td_sr_each (qk_tap_dance_state_t *state, void *user_data) {
816 skip_leds = true;
817
818 switch (state->count) {
819 case 1:
820 ergodox_right_led_3_on ();
821 break;
822 case 2:
823 ergodox_right_led_2_on ();
824 break;
825 case 3:
826 ergodox_right_led_1_on ();
827 break;
828 case 4:
829 ergodox_right_led_3_off ();
830 wait_ms (50);
831 ergodox_right_led_2_off ();
832 wait_ms (50);
833 ergodox_right_led_1_off ();
834 break;
835 }
836}
837
838static void
839_td_sr_finished (qk_tap_dance_state_t *state, void *user_data) {
840 if (state->count == 1) {
841 register_code (KC_MSTP);
842 }
843 if (state->count >= 4) {
844 uprintf("CMD:reflash\n");
845 wait_ms (1000);
846 reset_keyboard ();
847 reset_tap_dance (state);
848 }
849}
850
851static void
852_td_sr_reset (qk_tap_dance_state_t *state, void *user_data) {
853 ergodox_right_led_1_off ();
854 wait_ms (50);
855 ergodox_right_led_2_off ();
856 wait_ms (50);
857 ergodox_right_led_3_off ();
858
859 if (state->count == 1) {
860 unregister_code (KC_MSTP);
861 }
862}
863
864static void
865_td_brackets_finished (qk_tap_dance_state_t *state, void *user_data) {
866 if (state->count == 1) {
867 if (state->keycode == TD(CT_LBP))
868 register_code16 (KC_LBRC);
869 else
870 register_code16 (KC_RBRC);
871 } else if (state->count == 2) {
872 if (state->keycode == TD(CT_LBP))
873 register_code16 (KC_LPRN);
874 else
875 register_code16 (KC_RPRN);
876 } else if (state->count == 3) {
877 unicode_input_start();
878
879 if (state->keycode == TD(CT_LBP))
880 register_hex (0x300c);
881 else
882 register_hex (0x300d);
883
884 unicode_input_finish();
885 }
886}
887
888static void
889_td_brackets_reset (qk_tap_dance_state_t *state, void *user_data) {
890 if (state->count == 1) {
891 if (state->keycode == TD(CT_LBP))
892 unregister_code16 (KC_LBRC);
893 else
894 unregister_code16 (KC_RBRC);
895 } else if (state->count == 2) {
896 if (state->keycode == TD(CT_LBP))
897 unregister_code16 (KC_LPRN);
898 else
899 unregister_code16 (KC_RPRN);
900 }
901}
902
903qk_tap_dance_action_t tap_dance_actions[] = {
904 [CT_CLN] = ACTION_TAP_DANCE_DOUBLE (KC_COLN, KC_SCLN)
905 ,[CT_TA] = {
906 .fn = { NULL, ang_tap_dance_ta_finished, ang_tap_dance_ta_reset },
907 .user_data = (void *)&((td_ta_state_t) { false, false })
908 }
909 ,[CT_LBP] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, _td_brackets_finished, _td_brackets_reset)
910 ,[CT_RBP] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, _td_brackets_finished, _td_brackets_reset)
911 ,[CT_TMUX]= ACTION_TAP_DANCE_FN (ang_tap_dance_tmux_finished)
912 ,[CT_TPS] = ACTION_TAP_DANCE_FN (ang_tap_dance_tmux_pane_select)
913 ,[CT_SR] = ACTION_TAP_DANCE_FN_ADVANCED (_td_sr_each, _td_sr_finished, _td_sr_reset)
914};
915
916// Runs constantly in the background, in a loop.
917void matrix_scan_user(void) {
918 uint8_t layer = biton32(layer_state);
919 bool is_arrow = false;
920
921 if (gui_timer && timer_elapsed (gui_timer) > TAPPING_TERM)
922 unregister_code (KC_LGUI);
923
924 if (!skip_leds) {
925 if (layer == HUN) {
926 ergodox_right_led_2_on();
927 ergodox_right_led_3_on();
928 } else if (layer == NMDIA) {
929 ergodox_right_led_1_on();
930 ergodox_right_led_2_on();
931 } else if (layer == PLVR) {
932 ergodox_right_led_1_on ();
933 ergodox_right_led_2_on ();
934 ergodox_right_led_3_on ();
935 } else if (layer == ADORE) {
936 ergodox_right_led_1_on ();
937 ergodox_right_led_2_on ();
938 ergodox_right_led_3_on ();
939
940 ergodox_right_led_2_set (LED_BRIGHTNESS_HI);
941 }
942 }
943
944 if (layer_state & (1UL << ARRW)) {
945 if (!skip_leds) {
946 ergodox_right_led_1_on ();
947 ergodox_right_led_3_on ();
948 }
949 is_arrow = true;
950 }
951
952 if (!skip_leds) {
953 if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
954 ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out())) {
955 ergodox_right_led_1_set (LED_BRIGHTNESS_HI);
956 ergodox_right_led_1_on ();
957 } else {
958 ergodox_right_led_1_set (LED_BRIGHTNESS_LO);
959 if (layer != NMDIA && layer != PLVR && layer != ADORE && !is_arrow)
960 ergodox_right_led_1_off ();
961 }
962
963 if (keyboard_report->mods & MOD_BIT(KC_LALT) ||
964 ((get_oneshot_mods() & MOD_BIT(KC_LALT)) && !has_oneshot_mods_timed_out())) {
965 ergodox_right_led_2_set (LED_BRIGHTNESS_HI);
966 ergodox_right_led_2_on ();
967 } else {
968 ergodox_right_led_2_set (LED_BRIGHTNESS_LO);
969 if (layer != HUN && layer != NMDIA && layer != PLVR && layer != ADORE)
970 ergodox_right_led_2_off ();
971 }
972
973 if (keyboard_report->mods & MOD_BIT(KC_LCTRL) ||
974 ((get_oneshot_mods() & MOD_BIT(KC_LCTRL)) && !has_oneshot_mods_timed_out())) {
975 ergodox_right_led_3_set (LED_BRIGHTNESS_HI);
976 ergodox_right_led_3_on ();
977 } else {
978 ergodox_right_led_3_set (LED_BRIGHTNESS_LO);
979 if (layer != HUN && layer != PLVR && layer != ADORE && !is_arrow)
980 ergodox_right_led_3_off ();
981 }
982 }
983
984 LEADER_DICTIONARY() {
985 leading = false;
986 leader_end ();
987
988 SEQ_ONE_KEY (KC_C) {
989 ang_tap (LSFT(KC_C), KC_S, KC_I, KC_L, KC_L, KC_RALT, KC_QUOT, KC_A, KC_M, KC_A, KC_S,
990 KC_S, KC_Z, KC_O, KC_N, KC_Y, KC_K, KC_RALT, KC_QUOT, KC_A, KC_M, 0);
991 }
992
993 SEQ_ONE_KEY (KC_K) {
994 ang_tap (KC_SPC, LSFT(KC_7), KC_SPC, 0);
995 register_code(KC_LCTL);
996 register_code(KC_LSFT);
997 register_code(KC_U);
998 unregister_code(KC_U);
999 unregister_code(KC_LSFT);
1000 unregister_code(KC_LCTL);
1001 ang_tap (KC_1, KC_F, KC_4, KC_7, KC_6, 0);
1002 register_code (KC_ENT);
1003 unregister_code (KC_ENT);
1004 ang_tap (KC_END, 0);
1005 register_code(KC_LCTL);
1006 register_code(KC_LSFT);
1007 register_code(KC_U);
1008 unregister_code(KC_U);
1009 unregister_code(KC_LSFT);
1010 unregister_code(KC_LCTL);
1011 ang_tap (KC_1, KC_F, KC_4, KC_7, KC_6, 0);
1012 register_code (KC_SPC);
1013 unregister_code (KC_SPC);
1014 }
1015
1016 SEQ_ONE_KEY (KC_G) {
1017 ang_tap (LSFT(KC_G), KC_E, KC_J, KC_G, KC_RALT, KC_EQL, KC_O,
1018 KC_RALT, KC_EQL, KC_O,
1019 KC_RALT, KC_EQL, KC_O, 0);
1020 }
1021
1022#if KEYLOGGER_ENABLE
1023 SEQ_ONE_KEY (KC_D) {
1024 ergodox_led_all_on();
1025 wait_ms(100);
1026 ergodox_led_all_off();
1027 log_enable = !log_enable;
1028 }
1029#endif
1030
1031 SEQ_ONE_KEY (KC_R) {
1032 ang_tap(KC_RALT, 0);
1033 }
1034
1035 SEQ_ONE_KEY (KC_T) {
1036 time_travel = !time_travel;
1037 }
1038
1039 SEQ_ONE_KEY (KC_U) {
1040 qk_ucis_start();
1041 }
1042
1043 SEQ_ONE_KEY (KC_V) {
1044 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ (" QMK_VERSION "/" LAYOUT_ergodox_VERSION ")");
1045 }
1046
1047 SEQ_ONE_KEY (KC_L) {
1048 /* λ */
1049 unicode_input_start();
1050 register_hex(0x03bb);
1051 unicode_input_finish();
1052 }
1053
1054 SEQ_ONE_KEY (KC_Y) {
1055 ang_tap (KC_BSLS, KC_O, KC_SLSH, 0);
1056 }
1057
1058 SEQ_ONE_KEY (KC_S) {
1059 unicode_input_start(); register_hex(0xaf); unicode_input_finish();
1060 TAP_ONCE (KC_BSLS);
1061 register_code (KC_RSFT); TAP_ONCE (KC_MINS); TAP_ONCE (KC_9); unregister_code (KC_RSFT);
1062 unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
1063 register_code (KC_RSFT); TAP_ONCE (KC_0); TAP_ONCE (KC_MINS); unregister_code (KC_RSFT);
1064 TAP_ONCE (KC_SLSH);
1065 unicode_input_start (); register_hex(0xaf); unicode_input_finish();
1066 }
1067
1068 SEQ_TWO_KEYS (KC_W, KC_M) {
1069 uprintf("CMD:wm\n");
1070 }
1071
1072 SEQ_ONE_KEY (KC_A) {
1073 if (is_adore == 0) {
1074 default_layer_and (0);
1075 default_layer_or ((1UL << ADORE));
1076 eeconfig_update_default_layer ((1UL << ADORE));
1077 is_adore = 1;
1078
1079 ergodox_led_all_off ();
1080 ergodox_right_led_3_on ();
1081 wait_ms (100);
1082 ergodox_right_led_2_on ();
1083 wait_ms (100);
1084 ergodox_right_led_3_off ();
1085 ergodox_right_led_1_on ();
1086 wait_ms (100);
1087 ergodox_right_led_2_off ();
1088 wait_ms (100);
1089 ergodox_right_led_1_off ();
1090 } else {
1091 is_adore = 0;
1092 default_layer_and (0);
1093 default_layer_or (1UL << BASE);
1094 eeconfig_update_default_layer ((1UL << BASE));
1095
1096 ergodox_led_all_off ();
1097 ergodox_right_led_1_on ();
1098 wait_ms (100);
1099 ergodox_right_led_2_on ();
1100 wait_ms (100);
1101 ergodox_right_led_1_off ();
1102 ergodox_right_led_3_on ();
1103 wait_ms (100);
1104 ergodox_right_led_2_off ();
1105 wait_ms (100);
1106 ergodox_right_led_3_off ();
1107 }
1108 }
1109 }
1110}
1111
1112static uint16_t last4[4];
1113
1114const qk_ucis_symbol_t ucis_symbol_table[] = UCIS_TABLE
1115(
1116 UCIS_SYM("poop", 0x1f4a9),
1117 UCIS_SYM("rofl", 0x1f923),
1118 UCIS_SYM("kiss", 0x1f619),
1119 UCIS_SYM("snowman", 0x2603),
1120 UCIS_SYM("coffee", 0x2615),
1121 UCIS_SYM("heart", 0x2764),
1122 UCIS_SYM("bolt", 0x26a1),
1123 UCIS_SYM("pi", 0x03c0),
1124 UCIS_SYM("mouse", 0x1f401),
1125 UCIS_SYM("micro", 0x00b5),
1126 UCIS_SYM("tm", 0x2122),
1127 UCIS_SYM("child", 0x1f476),
1128 UCIS_SYM("family", 0x1F46A),
1129 UCIS_SYM("joy", 0x1F602)
1130);
1131
1132bool process_record_user (uint16_t keycode, keyrecord_t *record) {
1133#if KEYLOGGER_ENABLE
1134 if (log_enable) {
1135 uint8_t layer = biton32(layer_state);
1136
1137 if ((layer == ADORE) || (layer == BASE))
1138 uprintf ("KL: col=%02d, row=%02d, pressed=%d, layer=%s\n", record->event.key.col,
1139 record->event.key.row, record->event.pressed, (is_adore) ? "ADORE" : "Dvorak");
1140 }
1141#endif
1142
1143 if (keycode == KC_ESC && record->event.pressed) {
1144 bool queue = true;
1145
1146 if ((get_oneshot_mods ()) && !has_oneshot_mods_timed_out ()) {
1147 clear_oneshot_mods ();
1148 queue = false;
1149 }
1150 if (layer_state & (1UL<<HUN)) {
1151 layer_off (HUN);
1152 queue = false;
1153 }
1154 return queue;
1155 }
1156
1157 if (time_travel && !record->event.pressed) {
1158 uint8_t p;
1159
1160 // shift cache one to the left
1161 for (p = 0; p < 3; p++) {
1162 last4[p] = last4[p + 1];
1163 }
1164 last4[3] = keycode;
1165
1166 if (last4[0] == KC_D && last4[1] == KC_A && last4[2] == KC_T && last4[3] == KC_E) {
1167 ang_tap (KC_E, KC_SPC, KC_MINS, KC_D, KC_SPC, KC_QUOT, 0);
1168 register_code (KC_RSFT);
1169 register_code (KC_EQL);
1170 unregister_code (KC_EQL);
1171 unregister_code (KC_RSFT);
1172
1173 ang_tap (KC_4, KC_SPC, KC_D, KC_A, KC_Y, KC_S, KC_QUOT, 0);
1174
1175 return false;
1176 }
1177 }
1178
1179 return true;
1180}
1181
1182void qk_ucis_symbol_fallback (void) {
1183 for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) {
1184 uint8_t code;
1185
1186 if ((qk_ucis_state.codes[i] >= M(A_1)) && (qk_ucis_state.codes[i] <= M(A_0)))
1187 code = qk_ucis_state.codes[i] - M(A_1) + KC_1;
1188 else
1189 code = qk_ucis_state.codes[i];
1190 register_code(code);
1191 unregister_code(code);
1192 wait_ms (10);
1193 }
1194}
diff --git a/layouts/community/ergodox/algernon/readme.md b/layouts/community/ergodox/algernon/readme.md
deleted file mode 100644
index a25018a7b..000000000
--- a/layouts/community/ergodox/algernon/readme.md
+++ /dev/null
@@ -1,152 +0,0 @@
1<!-- -*- mode: markdown; fill-column: 8192 -*- -->
2
3algernon's layout
4=======================
5
6This is the layout I used to use on my [ErgoDox EZ][ez], while I was using [QMK][qmk]. I no longer do so, and this repository is obsolete, and not updated anymore. My current firmware is based on [Kaleidoscope][kaleidoscope], and is located [elsewhere][ergodox-sketch]. I'm keeping the repo around for historical and educational purposes.
7
8 [kaleidoscope]: https://github.com/keyboardio/Kaleidoscope
9 [ergodox-sketch]: https://git.madhouse-project.org/algernon/ErgoDox-sketch
10
11Nevertheless, this is an unconventional layout for the [ErgoDox EZ][ez]. For more details about the history of the layout, see my [blog posts about my ErgoDox journey][blog-ergodox].
12
13 [ez]: https://ergodox-ez.com/
14 [blog-ergodox]: https://asylum.madhouse-project.org/blog/tags/ergodox/
15
16Some of the things in the layout only work when one uses [Spacemacs][spacemacs] and [GNOME][gnome] under Linux. Your mileage may vary.
17
18 [spacemacs]: http://spacemacs.org/
19 [gnome]: https://www.gnome.org/
20
21## Table of Contents
22
23* [Layouts](#layouts)
24 - [Base layer](#base-layer)
25 - [ADORE layer](#adore-layer)
26 - [Steno layer](#steno-layer)
27 - [LED states](#led-states)
28* [Tools](#tools)
29 - [Heatmap](#heatmap)
30 - [Layer notification](#layer-notification)
31* [Special features](#special-features)
32 - [Unicode Symbol Input](#unicode-symbol-input)
33* [Building](#building)
34 - [Using on Windows](#using-on-windows)
35* [Changelog](https://github.com/algernon/ergodox-layout/blob/master/NEWS.md#readme)
36* [License](#license)
37
38# Layouts
39
40## Base layer
41
42[![Base layer](https://github.com/algernon/ergodox-layout/raw/master/images/base-layer.png)](http://www.keyboard-layout-editor.com/#/gists/28f7eb305fdbff943613e1dc7aa9e82b)
43
44At its core, this is a Dvorak layout, with some minor changes. The more interesting parts are how certain keys behave:
45
46* The number row is the same as in the [ADORE](#adore-layer) layer. The function keys are on the **Media** layer.
47* The `Shift`, `Alt`, and `Control` modifiers are one-shot. When tapped, they are considered active for the next key press only. When double tapped, they toggle on, until a third, single tap sometime later. When held, they act as expected. My usual pattern is that I use these for the next keypress only, so this behaviour is perfect. If I need them held, I'll just double-tap.
48* The `GUI` key is special, because while a single tap works as usual, when double-tapped, it turns the number row into an application selector, and when triple tapped, it runs an application selector program on the host.
49* The `ESC` key also doubles as a one-shot cancel key: if tapped while any of the one-shot modifiers are in-flight (as in, single-tapped, and not expired yet), it cancels all one-shot modifiers. It also cancels the **Hun** layer, if active. Otherwise it sends the usual keycode.
50* The **Media** and **Hun** layer keys are one-shot, the **STENO** key is a toggle.
51* The **Fx** key is one-shot, and activates the **Media** layer, along with a one-shot `Alt`.
52* When holding the `Tab`/**Arrow** key, the arrow layer activates while the key is held. Tapping the key produces the normal, `Tab` key. Double-tapping it toggles the **Arrow** layer on until a third tap.
53* Tapping the `:` key once yields `:`, tapping it twice yields `;`.
54* Tapping the `[{(`/`)}]` keys once yields `[` (or `{` when shifted), tapping them twice yields `(`.
55* The **Lead** key allows me to type in a sequence of keys, and trigger some actions:
56 - `LEAD l` uses the unicode input method to enter a `λ`.
57 - `LEAD s` does a lot of magic to type in a shruggie: `¯\_(ツ)_/¯`
58 - `LEAD y` types `\o/`.
59 - `LEAD w m` maximises the currently focused window.
60 - `LEAD a` makes the [ADORE layer](#adore-layer) the default.
61 - `LEAD v` prints the firmware version, the keyboard and the keymap.
62 - `LEAD d` toggles logging keypress positions to the HID console.
63 - `LEAD t` toggles time travel. Figuring out the current `date` is left as an exercise to the reader.
64 - `LEAD u` enters the [Unicode symbol input](#unicode-symbol-input) mode.
65 - `LEAD r` inputs `Right Alt`, which is the `Compose` key of my choice.
66
67The symbols on the front in the image above have the same color as the key that activates them, with the exception of the **Arrow** layer, which is just black on the front.
68
69## ADORE layer
70
71[![ADORE layer](https://github.com/algernon/ergodox-layout/raw/master/images/adore-layer.png)](http://www.keyboard-layout-editor.com/#/gists/45681a17453d235925b6028dd83bf12a)
72
73My experimental layout, that I keep tweaking. No full description here, because things are very much in flux.
74
75Note that the **HUN** layer does not work well with ADORE: it still has the same layout as on the [Base](#base-layer) layer. This will remain until ADORE becomes the default.
76
77## Steno layer
78
79[![Steno layer for Plover](https://github.com/algernon/ergodox-layout/raw/master/images/steno-layer.png)](http://www.keyboard-layout-editor.com/#/gists/401ef9a84369e47c57f9aedcf0a0d667)
80
81This is to be used with [Plover](http://www.openstenoproject.org/plover/), nothing really fancy here. The **STENO** key toggles the layer on and off, and sends the toggle command to Plover too.
82
83## LED states
84
85The primary purpose of the LEDs is to show the modifier status, a secondary, to show which layer is active. Each modifier, `Shift`, `Alt` and `Control` each have their designated LEDs: the *red*, *green* and *blue*, respectively. When a modifier is in a one-shot state, the respective LED will turn on with a dimmer light. If the modifier is toggled on, the brightness of the LED turns full.
86
87For the layers, the following rules apply:
88
89* When the [ADORE layer](#adore-layer) is toggled on, LEDs will light up from left to right in a sequence, then turn off. When the layer is toggled off, the LEDs light up and turn off in the other direction. No LEDs are on while the layer is active.
90* When the **Hungarian** layer is active, the *green* and *blue* LEDs are on.
91* When the **Media** layer is active, the *red* and *green* ones are on.
92* When the **ARROW** layer is active, the *red* and *blue* ones are on.
93* For the [Steno layer](#steno-layer), all LEDs will be turned on.
94
95Unless noted otherwise, the layers use a dim light for the LEDs, while modifiers use a stronger one, and modifiers override any layer preferences. For example, when on the one-handed layer, with the left side active (*red* light blinking), if `Shift` is on, the *red* light will be constantly on.
96
97# Special features
98
99## Unicode Symbol Input
100
101Once in the Unicode Symbol Input mode, one is able to type in symbol names, press `Enter` or `Space`, and get the Unicode symbol itself back. When in the mode, a capital `U` is printed first. Once the sequence is finished, all of it is erased by sending enough `Backspace` taps, and the firmware starts the OS-specific unicode input sequence. Then, it looks up the symbol name, and enters the associated code. If it is not found, it will just replay the pressed keycodes.
102
103For the list of supported symbols, please see the source.
104
105This is an experimental feature, and may or may not work reliably.
106
107# Tools
108
109## Heatmap
110
111When the keypress logging functionality is enabled (by `LEAD d`), the keyboard will output a line every time a key is pressed, containing the position of the key in the matrix. This allows one to collect this information, and build analytics over it, such as a heat map, including dead keys too.
112
113Included with the firmware is a small tool that can parse these logs, and create a heatmap that one can import into [KLE][kle]. To use it, either pipe the output of `hid_listen` into it, or pipe it an already saved log, and it will save the results into files in an output directory (given on the command-line). See the output of `tools/log-to-heatmap.py --help` for more information.
114
115 [kle]: http://www.keyboard-layout-editor.com/
116
117The generated heatmap looks somewhat like this:
118
119 ![Heatmap](https://github.com/algernon/ergodox-layout/raw/master/images/heatmap.png)
120
121## Layer notification
122
123There is a very small tool in `tools/layer-notify`, that listens to the HID console, looking for layer change events, and pops up a notification for every detected change. It is a very simple tool, mainly serving as an example.
124
125# Building
126
127To make my workflow easier, this layout is maintained in [its own repository][algernon:ez-layout]. To build it, you will need the [QMK][qmk] firmware checked out, and this repo either checked out to something like `layouts/community/algernon_master`, or symlinked there. One way to achieve that is this:
128
129 [algernon:ez-layout]: https://github.com/algernon/ergodox-layout
130 [qmk]: https://github.com/qmk/qmk_firmware
131
132```
133$ git clone https://github.com/qmk/qmk_firmware.git
134$ cd qmk_firmware
135$ git clone https://github.com/algernon/ergodox-layout.git \
136 layouts/community/ergodox/algernon_master
137$ make ergodox_ez:algernon_master
138```
139
140From time to time, updates may be submitted back to the QMK repository. If you are reading it there, you can build the firmware like any other firmware included with it (assuming you are in the root directory of the firmware):
141
142```
143$ make ergodox_ez:algernon
144```
145
146## Using on Windows
147
148The keymap default to forcing NKRO, which seems to upset Windows, and except the modifiers, none of them work. If you experience this problem, recompile the firmware with `FORCE_NKRO=no` added to the `make` command line.
149
150# License
151
152The layout, being a derivative of the original TMK firmware which is under the GPL-2+, this layout is under the GPL as well, but GPL-3+, rather than the older version.
diff --git a/layouts/community/ergodox/algernon/rules.mk b/layouts/community/ergodox/algernon/rules.mk
deleted file mode 100644
index e8972cf10..000000000
--- a/layouts/community/ergodox/algernon/rules.mk
+++ /dev/null
@@ -1,43 +0,0 @@
1BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
2COMMAND_ENABLE=no
3SLEEP_LED_ENABLE=no
4FORCE_NKRO ?= yes
5DEBUG_ENABLE = no
6CONSOLE_ENABLE = no
7TAP_DANCE_ENABLE = yes
8KEYLOGGER_ENABLE ?= yes
9UCIS_ENABLE = yes
10MOUSEKEY_ENABLE = no
11LEADER_ENABLE = yes
12RGBLIGHT_ENABLE = no
13
14AUTOLOG_ENABLE ?= yes
15
16ifeq (${FORCE_NKRO},yes)
17OPT_DEFS += -DFORCE_NKRO
18endif
19
20ifeq (${AUTOLOG_ENABLE},yes)
21KEYLOGGER_ENABLE = yes
22OPT_DEFS += -DAUTOLOG_ENABLE
23endif
24
25ifeq (${KEYLOGGER_ENABLE},yes)
26OPT_DEFS += -DKEYLOGGER_ENABLE
27CONSOLE_ENABLE = yes
28endif
29
30OPT_DEFS += -DUSER_PRINT
31
32LAYOUT_ergodox_VERSION = $(shell \
33 if [ -d "${LAYOUT_ergodox_PATH}/.git" ]; then \
34 cd "${LAYOUT_ergodox_PATH}" && git describe --abbrev=6 --dirty --always --tags --match 'v*' 2>/dev/null; \
35 else echo QMK; fi)
36
37LAYOUT_ergodox_BRANCH = $(shell \
38 if [ -d "${LAYOUT_ergodox_PATH}/.git" ]; then \
39 cd "${LAYOUT_ergodox_PATH}"; \
40 fi; \
41 git rev-parse --abbrev-ref HEAD 2>/dev/null)
42
43OPT_DEFS += -DLAYOUT_ergodox_VERSION=\"$(LAYOUT_ergodox_VERSION)\\\#$(LAYOUT_ergodox_BRANCH)\"
diff --git a/layouts/community/ergodox/algernon/tools/heatmap-layout.ADORE.json b/layouts/community/ergodox/algernon/tools/heatmap-layout.ADORE.json
deleted file mode 100644
index e09efecc4..000000000
--- a/layouts/community/ergodox/algernon/tools/heatmap-layout.ADORE.json
+++ /dev/null
@@ -1,486 +0,0 @@
1[
2 {
3 "backcolor": "#ffffff",
4 "name": "ErgoDox - algernon's layout: Heatmap",
5 "author": "Gergely Nagy <kbd@gergo.csillger.hu>",
6 "notes": "See [here](https://github.com/algernon/ergodox-layout#readme) for the QMK keymap source.",
7 "switchMount": "cherry",
8 "switchBrand": "gateron",
9 "switchType": "KS-3-Tea",
10 "pcb": true,
11 "css": ".keyborder { -webkit-filter: blur(5px); filter: blur(5px); } .keytop { -webkit-filter: blur(10px); } .keylabels { border: 1px solid black; }"
12 },
13 [
14 {
15 "x": 3.5,
16 "fa": [
17 0,
18 0,
19 2
20 ]
21 },
22 "*\n5\nF5",
23 {
24 "x": 10.5,
25 "a": 4,
26 "fa": [
27 0,
28 0,
29 2
30 ]
31 },
32 "#\n4\nF4"
33 ],
34 [
35 {
36 "y": -0.875,
37 "x": 2.5
38 },
39 "@\n7\nF7",
40 {
41 "x": 1
42 },
43 "^\n3\nF3",
44 {
45 "x": 8.5
46 },
47 "!\n2\nF2",
48 {
49 "x": 1
50 },
51 "&\n6\nF6"
52 ],
53 [
54 {
55 "y": -0.875,
56 "x": 5.5
57 },
58 "$\n1\nF1",
59 {
60 "a": 7,
61 "f": 3
62 },
63 "F11",
64 {
65 "x": 4.5,
66 "f": 3
67 },
68 "Fx",
69 {
70 "a": 4,
71 "f": 3,
72 "fa": [
73 0,
74 0,
75 2
76 ]
77 },
78 "%\n0\nF10"
79 ],
80 [
81 {
82 "y": -0.875,
83 "f": 9,
84 "a": 6,
85 "w": 1.5
86 },
87 "\n\n<i class='kb kb-Multimedia-Play-Pause'></i>",
88 {
89 "f": 3,
90 "a": 4,
91 "fa": [
92 0,
93 0,
94 2
95 ]
96 },
97 " \n9\nF9",
98 {
99 "x": 14.5
100 },
101 " \n8\nF8",
102 {
103 "a": 7,
104 "w": 1.5
105 },
106 "STENO"
107 ],
108 [
109 {
110 "y": -0.375,
111 "x": 3.5,
112 "a": 6
113 },
114 "C",
115 {
116 "x": 10.5
117 },
118 "L"
119 ],
120 [
121 {
122 "y": -0.875,
123 "x": 2.5,
124 "a": 6
125 },
126 "W",
127 {
128 "x": 1,
129 "a": 6
130 },
131 "H",
132 {
133 "x": 8.5
134 },
135 "G",
136 {
137 "x": 1
138 },
139 "P"
140 ],
141 [
142 {
143 "y": -0.875,
144 "x": 5.5
145 },
146 "F",
147 {
148 "a": 4,
149 "fa": [0, 0, 0],
150 "h": 1.5
151 },
152 "{\n(\n[",
153 {
154 "x": 4.5,
155 "h": 1.5
156 },
157 "}\n)\n]",
158 {
159 "a": 6
160 },
161 "M"
162 ],
163 [
164 {
165 "y": -0.875,
166 "f": 3,
167 "a": 4,
168 "w": 1.5
169 },
170 "\n\n|\n\\",
171 {
172 "a": 6,
173 "f": 3
174 },
175 "X",
176 {
177 "x": 14.5,
178 "a": 4
179 },
180 "/\n?",
181 {
182 "a": 4,
183 "w": 1.5
184 },
185 "~\n`"
186 ],
187 [
188 {
189 "y": -0.375,
190 "x": 3.5,
191 "a": 6
192 },
193 "E",
194 {
195 "x": 10.5
196 },
197 "T"
198 ],
199 [
200 {
201 "y": -0.875,
202 "x": 2.5
203 },
204 "O",
205 {
206 "x": 1,
207 "n": true
208 },
209 "I",
210 {
211 "x": 8.5,
212 "n": true
213 },
214 "R",
215 {
216 "x": 1
217 },
218 "N"
219 ],
220 [
221 {
222 "y": -0.875,
223 "x": 5.5
224 },
225 "U",
226 {
227 "x": 6.5
228 },
229 "D"
230 ],
231 [
232 {
233 "y": -0.875,
234 "fa": [
235 6
236 ],
237 "w": 1.5
238 },
239 "<i class='fa fa-arrows'></i>\n\nTab",
240 {
241 "f": 3
242 },
243 "A",
244 {
245 "x": 14.5,
246 "f": 3
247 },
248 "S",
249 {
250 "a": 4,
251 "fa": [
252 0,
253 0,
254 0,
255 0,
256 0,
257 0,
258 0,
259 6
260 ],
261 "w": 1.5
262 },
263 "+\n="
264 ],
265 [
266 {
267 "y": -0.625,
268 "x": 6.5,
269 "a": 7,
270 "f": 9,
271 "h": 1.5
272 },
273 "<i class='fa fa-columns'></i>",
274 {
275 "x": 4.5,
276 "h": 1.5
277 },
278 "<i class='fa fa-table'></i>"
279 ],
280 [
281 {
282 "y": -0.75,
283 "x": 3.5,
284 "a": 4,
285 "f": 3
286 },
287 "\"\n'",
288 {
289 "x": 10.5,
290 "a": 6,
291 "f": 3
292 },
293 "V"
294 ],
295 [
296 {
297 "y": -0.875,
298 "x": 2.5,
299 "a": 6
300 },
301 "Q",
302 {
303 "x": 1,
304 "a": 4
305 },
306 "<\n,",
307 {
308 "x": 8.5,
309 "a": 6
310 },
311 "K",
312 {
313 "x": 1
314 },
315 "Y"
316 ],
317 [
318 {
319 "y": -0.875,
320 "x": 5.5,
321 "a": 4
322 },
323 ">\n.",
324 {
325 "x": 6.5,
326 "a": 6
327 },
328 "B"
329 ],
330 [
331 {
332 "y": -0.875,
333 "f": 9,
334 "w": 1.5,
335 "g": true
336 },
337 "",
338 {
339 "a": 6,
340 "f": 3,
341 "g": false
342 },
343 "Z",
344 {
345 "x": 14.5
346 },
347 "J",
348 {
349 "f": 9,
350 "g": true,
351 "w": 1.5,
352 "a": 4
353 },
354 ""
355 ],
356 [
357 {
358 "y": -0.375,
359 "x": 3.5,
360 "g": true,
361 "a": 7,
362 "f": 3
363 },
364 "",
365 {
366 "x": 10.5
367 },
368 ""
369 ],
370 [
371 {
372 "y": -0.875,
373 "x": 2.5
374 },
375 "",
376 {
377 "x": 1,
378 "g": false,
379 "a": 5
380 },
381 ";\n:",
382 {
383 "x": 8.5
384 },
385 "_\n-",
386 {
387 "x": 1,
388 "g": true,
389 "a": 7
390 },
391 ""
392 ],
393 [
394 {
395 "y": -0.75,
396 "x": 0.5
397 },
398 "",
399 {},
400 "",
401 {
402 "x": 14.5
403 },
404 "",
405 {},
406 ""
407 ],
408 [
409 {
410 "r": 30,
411 "rx": 6.5,
412 "ry": 4.25,
413 "y": -1,
414 "x": 1,
415 "g": false
416 },
417 "Alt",
418 {
419 "a": 4,
420 "fa": [
421 0,
422 0,
423 0,
424 9
425 ]
426 },
427 "\n\n\n<i class='kb kb-logo-linux-debian fa-large'></i>"
428 ],
429 [
430 {
431 "a": 7,
432 "f": 9,
433 "h": 2
434 },
435 "<i class='kb kb-Unicode-BackSpace-DeleteLeft-Big'></i>",
436 {
437 "h": 2
438 },
439 "<i class='fa fa-angle-double-up'></i>",
440 {
441 "f": 3
442 },
443 "Ctrl"
444 ],
445 [
446 {
447 "x": 2
448 },
449 "ESC"
450 ],
451 [
452 {
453 "r": -30,
454 "rx": 13,
455 "y": -1,
456 "x": -3,
457 "f": 2
458 },
459 "MEDIA",
460 {},
461 "DEL"
462 ],
463 [
464 {
465 "x": -3
466 },
467 "HUN",
468 {
469 "f": 9,
470 "h": 2
471 },
472 "<i class='kb kb-Return-2'></i>",
473 {
474 "f": 3,
475 "h": 2
476 },
477 "SPC"
478 ],
479 [
480 {
481 "x": -3,
482 "f": 2
483 },
484 "LEAD"
485 ]
486]
diff --git a/layouts/community/ergodox/algernon/tools/heatmap-layout.Dvorak.json b/layouts/community/ergodox/algernon/tools/heatmap-layout.Dvorak.json
deleted file mode 100644
index 1e53281c5..000000000
--- a/layouts/community/ergodox/algernon/tools/heatmap-layout.Dvorak.json
+++ /dev/null
@@ -1,477 +0,0 @@
1[
2 {
3 "backcolor": "#ffffff",
4 "name": "ErgoDox - algernon's layout: Heatmap",
5 "author": "Gergely Nagy <kbd@gergo.csillger.hu>",
6 "notes": "See [here](https://github.com/algernon/ergodox-layout#readme) for the QMK keymap source.",
7 "switchMount": "cherry",
8 "switchBrand": "gateron",
9 "switchType": "KS-3-Tea",
10 "pcb": true,
11 "css": ".keyborder { -webkit-filter: blur(5px); filter: blur(5px); } .keytop { -webkit-filter: blur(10px); } .keylabels { border: 1px solid black; }"
12 },
13 [
14 {
15 "x": 3.5,
16 "fa": [
17 0,
18 0,
19 2
20 ]
21 },
22 "*\n5\nF5",
23 {
24 "x": 10.5,
25 "a": 4,
26 "fa": [
27 0,
28 0,
29 2
30 ]
31 },
32 "#\n4\nF4"
33 ],
34 [
35 {
36 "y": -0.875,
37 "x": 2.5
38 },
39 "@\n7\nF7",
40 {
41 "x": 1
42 },
43 "^\n3\nF3",
44 {
45 "x": 8.5
46 },
47 "!\n2\nF2",
48 {
49 "x": 1
50 },
51 "&\n6\nF6"
52 ],
53 [
54 {
55 "y": -0.875,
56 "x": 5.5
57 },
58 "$\n1\nF1",
59 {
60 "a": 7,
61 "f": 3
62 },
63 "F11",
64 {
65 "x": 4.5,
66 "f": 3
67 },
68 "Fx",
69 {
70 "a": 4,
71 "f": 3,
72 "fa": [
73 0,
74 0,
75 2
76 ]
77 },
78 "%\n0\nF10"
79 ],
80 [
81 {
82 "y": -0.875,
83 "f": 6,
84 "a": 6,
85 "w": 1.5
86 },
87 "<i class='fa fa-fast-backward'></i>\n\n<i class='fa fa-fast-forward'></i>",
88 {
89 "f": 3,
90 "a": 4,
91 "fa": [
92 0,
93 0,
94 2
95 ]
96
97 },
98 " \n9\nF9",
99 {
100 "x": 14.5
101 },
102 " \n8\nF8",
103 {
104 "a": 7,
105 "w": 1.5
106 },
107 "STENO"
108 ],
109 [
110 {
111 "y": -0.375,
112 "x": 3.5,
113 "a": 4
114 },
115 ">\n.",
116 {
117 "x": 10.5,
118 "a": 6
119 },
120 "C"
121 ],
122 [
123 {
124 "y": -0.875,
125 "x": 2.5,
126 "a": 4
127 },
128 "<\n,",
129 {
130 "x": 1,
131 "a": 6
132 },
133 "P",
134 {
135 "x": 8.5
136 },
137 "G",
138 {
139 "x": 1
140 },
141 "R"
142 ],
143 [
144 {
145 "y": -0.875,
146 "x": 5.5
147 },
148 "Y",
149 {
150 "a": 4,
151 "h": 1.5
152 },
153 "{\n(\n[",
154 {
155 "x": 4.5,
156 "h": 1.5
157 },
158 "}\n)\n]",
159 {
160 "a": 6
161 },
162 "F"
163 ],
164 [
165 {
166 "y": -0.875,
167 "f": 3,
168 "a": 4,
169 "w": 1.5
170 },
171 "\n\n~\n`",
172 {
173 "a": 4,
174 "f": 3
175 },
176 "\"\n'",
177 {
178 "x": 14.5,
179 "a": 6
180 },
181 "L",
182 {
183 "a": 4,
184 "w": 1.5
185 },
186 "|\n\\"
187 ],
188 [
189 {
190 "y": -0.375,
191 "x": 3.5,
192 "a": 6
193 },
194 "E",
195 {
196 "x": 10.5
197 },
198 "T"
199 ],
200 [
201 {
202 "y": -0.875,
203 "x": 2.5
204 },
205 "O",
206 {
207 "x": 1,
208 "n": true
209 },
210 "U",
211 {
212 "x": 8.5,
213 "n": true
214 },
215 "H",
216 {
217 "x": 1
218 },
219 "N"
220 ],
221 [
222 {
223 "y": -0.875,
224 "x": 5.5
225 },
226 "I",
227 {
228 "x": 6.5
229 },
230 "D"
231 ],
232 [
233 {
234 "y": -0.875,
235 "fa": [
236 6
237 ],
238 "w": 1.5
239 },
240 "<i class='fa fa-arrows'></i>\n\nTab",
241 {
242 "f": 3
243 },
244 "A",
245 {
246 "x": 14.5,
247 "f": 3
248 },
249 "S",
250 {
251 "a": 4,
252 "fa": [
253 0,
254 0,
255 0,
256 0,
257 0,
258 0,
259 0,
260 6
261 ],
262 "w": 1.5
263 },
264 "+\n="
265 ],
266 [
267 {
268 "y": -0.625,
269 "x": 6.5,
270 "a": 7,
271 "f": 9,
272 "h": 1.5
273 },
274 "<i class='fa fa-columns'></i>",
275 {
276 "x": 4.5,
277 "h": 1.5
278 },
279 "<i class='fa fa-table'></i>"
280 ],
281 [
282 {
283 "y": -0.75,
284 "x": 3.5,
285 "f": 3,
286 "a": 6
287 },
288 "J",
289 {
290 "x": 10.5
291 },
292 "W"
293 ],
294 [
295 {
296 "y": -0.875,
297 "x": 2.5
298 },
299 "Q",
300 {
301 "x": 1
302 },
303 "K",
304 {
305 "x": 8.5
306 },
307 "M",
308 {
309 "x": 1
310 },
311 "V"
312 ],
313 [
314 {
315 "y": -0.875,
316 "x": 5.5
317 },
318 "X",
319 {
320 "x": 6.5
321 },
322 "B"
323 ],
324 [
325 {
326 "y": -0.875,
327 "f": 9,
328 "w": 1.5
329 },
330 "\n\n<i class='kb kb-Multimedia-Play-Pause'></i>",
331 {
332 "a": 4,
333 "f": 3
334 },
335 "?\n/",
336 {
337 "x": 14.5,
338 "a": 6
339 },
340 "Z",
341 {
342 "f": 9,
343 "w": 1.5
344 },
345 "<i class='kb kb-Multimedia-Stop'></i>"
346 ],
347 [
348 {
349 "y": -0.375,
350 "x": 3.5,
351 "g": true,
352 "a": 7,
353 "f": 3
354 },
355 "",
356 {
357 "x": 10.5
358 },
359 ""
360 ],
361 [
362 {
363 "y": -0.875,
364 "x": 2.5
365 },
366 "",
367 {
368 "x": 1,
369 "g": false,
370 "a": 5
371 },
372 ";\n:",
373 {
374 "x": 8.5
375 },
376 "_\n-",
377 {
378 "x": 1,
379 "g": true,
380 "a": 7
381 },
382 ""
383 ],
384 [
385 {
386 "y": -0.75,
387 "x": 0.5
388 },
389 "",
390 {},
391 "",
392 {
393 "x": 14.5
394 },
395 "",
396 {},
397 ""
398 ],
399 [
400 {
401 "r": 30,
402 "rx": 6.5,
403 "ry": 4.25,
404 "y": -1,
405 "x": 1,
406 "g": false
407 },
408 "Alt",
409 {
410 "a": 4,
411 "fa": [
412 0,
413 0,
414 0,
415 9
416 ]
417 },
418 "\n\n\n<i class='kb kb-logo-linux-debian fa-large'></i>"
419 ],
420 [
421 {
422 "a": 7,
423 "f": 9,
424 "h": 2
425 },
426 "<i class='kb kb-Unicode-BackSpace-DeleteLeft-Big'></i>",
427 {
428 "h": 2
429 },
430 "<i class='fa fa-angle-double-up'></i>",
431 {
432 "f": 3
433 },
434 "Ctrl"
435 ],
436 [
437 {
438 "x": 2
439 },
440 "ESC"
441 ],
442 [
443 {
444 "r": -30,
445 "rx": 13,
446 "y": -1,
447 "x": -3,
448 "f": 2
449 },
450 "MEDIA",
451 {},
452 "DEL"
453 ],
454 [
455 {
456 "x": -3
457 },
458 "LEAD",
459 {
460 "f": 9,
461 "h": 2
462 },
463 "<i class='kb kb-Return-2'></i>",
464 {
465 "f": 3,
466 "h": 2
467 },
468 "SPC"
469 ],
470 [
471 {
472 "x": -3,
473 "f": 2
474 },
475 "HUN"
476 ]
477]
diff --git a/layouts/community/ergodox/algernon/tools/hid-commands b/layouts/community/ergodox/algernon/tools/hid-commands
deleted file mode 100755
index 86bff2978..000000000
--- a/layouts/community/ergodox/algernon/tools/hid-commands
+++ /dev/null
@@ -1,113 +0,0 @@
1#!/bin/bash
2set -e
3
4LAST_APPSEL_START=0
5
6cmd_wm () {
7 WIN="$(xdotool getactivewindow)"
8 wmctrl -i -r ${WIN} -b remove,maximized_vert,maximized_horz
9 xdotool windowsize ${WIN} 100% 100%
10 wmctrl -i -r ${WIN} -b add,maximized_vert,maximized_horz
11}
12
13cmd_appsel_helper () {
14 rofi -show window
15}
16
17_cmd_appsel () {
18 wmctrl -x -a $1 || true
19 xdotool key Escape
20}
21
22cmd_appsel_music () {
23 wmctrl -x -a rhythmbox || wmctrl -x -a spotify || \
24 wmctrl -x -a banshee || wmctrl -x -a kodi || \
25 wmctrl -x -a plex || true
26 xdotool key Escape
27}
28
29cmd_appsel_slack () {
30 wmctrl -x -a slack || wmctrl -x -a Mstdn || true
31 xdotool key Escape
32}
33
34cmd_appsel_emacs () {
35 _cmd_appsel emacs
36}
37
38cmd_appsel_term () {
39 _cmd_appsel gnome-terminal
40}
41
42cmd_appsel_chrome () {
43 wmctrl -x -a chrom || wmctrl -x -a Chrome || true
44 xdotool key Escape
45}
46
47cmd_appsel_start () {
48 if [ ! -z "${DISABLE_APPSEL_START}" ]; then
49 return
50 fi
51
52 APPSEL_START=$(date +%s)
53 if [ $APPSEL_START -lt $(expr $LAST_APPSEL_START + 10) ]; then
54 return
55 fi
56 LAST_APPSEL_START=$APPSEL_START
57 notify-send -t 1000 "Please select an application!" -c device -u low \
58 -i /usr/share/icons/Adwaita/24x24/devices/video-display.png
59}
60
61cmd_appsel_social () {
62 # Save the current window
63 a=$(xdotool getactivewindow)
64 # Raise & Focus Mstdn & Tweetdeck
65 wmctrl -x -a trunk.mad-scientist.club.Google-chrome || true; wmctrl -x -a tweetdeck || true
66 # Focus the previously active window
67 xdotool windowfocus $a || true; xdotool windowactivate $a || true
68
69 xdotool key Escape
70}
71
72cmd_appsel_social2 () {
73 # Save the current window
74 a=$(xdotool getactivewindow)
75 # Raise & Focus Viber & Signal
76 wmctrl -x -a Viber || true; wmctrl -a Signal || true
77 # Focus the previously active window
78 xdotool windowfocus $a || true; xdotool windowactivate $a || true
79
80 xdotool key Escape
81}
82
83cmd_appsel_pwmgr () {
84 _cmd_appsel keepass
85}
86
87cmd_reflash () {
88 teensy_loader_cli -v -w ~/src/ext/qmk_firmware/algernon.hex --mcu atmega32u4 || true
89}
90
91cmd_help () {
92 cat <<EOF
93Use the source, Luke!
94EOF
95}
96
97while read l; do
98 case "$l" in
99 "CMD:"*)
100 ;;
101 *)
102 continue
103 ;;
104 esac
105
106 cmd="$(echo $l | cut -d: -f2-)"
107
108 echo "Got command: ${cmd}"
109
110 if type cmd_${cmd} >/dev/null 2>&1; then
111 cmd_${cmd}
112 fi
113done
diff --git a/layouts/community/ergodox/algernon/tools/log-to-heatmap.py b/layouts/community/ergodox/algernon/tools/log-to-heatmap.py
deleted file mode 100755
index 5f52d9932..000000000
--- a/layouts/community/ergodox/algernon/tools/log-to-heatmap.py
+++ /dev/null
@@ -1,342 +0,0 @@
1#! /usr/bin/env python3
2import json
3import os
4import sys
5import re
6import argparse
7import time
8
9from math import floor
10from os.path import dirname
11from blessings import Terminal
12
13class Heatmap(object):
14 coords = [
15 [
16 # Row 0
17 [ 4, 0], [ 4, 2], [ 2, 0], [ 1, 0], [ 2, 2], [ 3, 0], [ 3, 2],
18 [ 3, 4], [ 3, 6], [ 2, 4], [ 1, 2], [ 2, 6], [ 4, 4], [ 4, 6],
19 ],
20 [
21 # Row 1
22 [ 8, 0], [ 8, 2], [ 6, 0], [ 5, 0], [ 6, 2], [ 7, 0], [ 7, 2],
23 [ 7, 4], [ 7, 6], [ 6, 4], [ 5, 2], [ 6, 6], [ 8, 4], [ 8, 6],
24 ],
25 [
26 # Row 2
27 [12, 0], [12, 2], [10, 0], [ 9, 0], [10, 2], [11, 0], [ ],
28 [ ], [11, 2], [10, 4], [ 9, 2], [10, 6], [12, 4], [12, 6],
29 ],
30 [
31 # Row 3
32 [17, 0], [17, 2], [15, 0], [14, 0], [15, 2], [16, 0], [13, 0],
33 [13, 2], [16, 2], [15, 4], [14, 2], [15, 6], [17, 4], [17, 6],
34 ],
35 [
36 # Row 4
37 [20, 0], [20, 2], [19, 0], [18, 0], [19, 2], [], [], [], [],
38 [19, 4], [18, 2], [19, 6], [20, 4], [20, 6], [], [], [], []
39 ],
40 [
41 # Row 5
42 [ ], [23, 0], [22, 2], [22, 0], [22, 4], [21, 0], [21, 2],
43 [24, 0], [24, 2], [25, 0], [25, 4], [25, 2], [26, 0], [ ],
44 ],
45 ]
46
47 def set_attr_at(self, block, n, attr, fn, val):
48 blk = self.heatmap[block][n]
49 if attr in blk:
50 blk[attr] = fn(blk[attr], val)
51 else:
52 blk[attr] = fn(None, val)
53
54 def coord(self, col, row):
55 return self.coords[row][col]
56
57 @staticmethod
58 def set_attr(orig, new):
59 return new
60
61 def set_bg(self, coords, color):
62 (block, n) = coords
63 self.set_attr_at(block, n, "c", self.set_attr, color)
64 #self.set_attr_at(block, n, "g", self.set_attr, False)
65
66 def set_tap_info(self, coords, count, cap):
67 (block, n) = coords
68 def _set_tap_info(o, _count, _cap):
69 ns = 4 - o.count ("\n")
70 return o + "\n" * ns + "%.02f%%" % (float(_count) / float(_cap) * 100)
71
72 if not cap:
73 cap = 1
74 self.heatmap[block][n + 1] = _set_tap_info (self.heatmap[block][n + 1], count, cap)
75
76 @staticmethod
77 def heatmap_color (v):
78 colors = [ [0.3, 0.3, 1], [0.3, 1, 0.3], [1, 1, 0.3], [1, 0.3, 0.3]]
79 fb = 0
80 if v <= 0:
81 idx1, idx2 = 0, 0
82 elif v >= 1:
83 idx1, idx2 = len(colors) - 1, len(colors) - 1
84 else:
85 val = v * (len(colors) - 1)
86 idx1 = int(floor(val))
87 idx2 = idx1 + 1
88 fb = val - float(idx1)
89
90 r = (colors[idx2][0] - colors[idx1][0]) * fb + colors[idx1][0]
91 g = (colors[idx2][1] - colors[idx1][1]) * fb + colors[idx1][1]
92 b = (colors[idx2][2] - colors[idx1][2]) * fb + colors[idx1][2]
93
94 r, g, b = [x * 255 for x in (r, g, b)]
95 return "#%02x%02x%02x" % (int(r), int(g), int(b))
96
97 def __init__(self, layout):
98 self.log = {}
99 self.total = 0
100 self.max_cnt = 0
101 self.layout = layout
102
103 def update_log(self, coords):
104 (c, r) = coords
105 if not (c, r) in self.log:
106 self.log[(c, r)] = 0
107 self.log[(c, r)] = self.log[(c, r)] + 1
108 self.total = self.total + 1
109 if self.max_cnt < self.log[(c, r)]:
110 self.max_cnt = self.log[(c, r)]
111
112 def get_heatmap(self):
113 with open("%s/heatmap-layout.%s.json" % (dirname(sys.argv[0]), self.layout), "r") as f:
114 self.heatmap = json.load (f)
115
116 ## Reset colors
117 for row in self.coords:
118 for coord in row:
119 if coord != []:
120 self.set_bg (coord, "#d9dae0")
121
122 for (c, r) in self.log:
123 coords = self.coord(c, r)
124 cap = self.max_cnt
125 if cap == 0:
126 cap = 1
127 v = float(self.log[(c, r)]) / cap
128 self.set_bg (coords, self.heatmap_color (v))
129 self.set_tap_info (coords, self.log[(c, r)], self.total)
130 return self.heatmap
131
132 def get_stats(self):
133 usage = [
134 # left hand
135 [0, 0, 0, 0, 0],
136 # right hand
137 [0, 0, 0, 0, 0]
138 ]
139 finger_map = [0, 0, 1, 2, 3, 3, 3, 1, 1, 1, 2, 3, 4, 4]
140 for (c, r) in self.log:
141 if r == 5: # thumb cluster
142 if c <= 6: # left side
143 usage[0][4] = usage[0][4] + self.log[(c, r)]
144 else:
145 usage[1][0] = usage[1][0] + self.log[(c, r)]
146 elif r == 4 and (c == 4 or c == 9): # bottom row thumb keys
147 if c <= 6: # left side
148 usage[0][4] = usage[0][4] + self.log[(c, r)]
149 else:
150 usage[1][0] = usage[1][0] + self.log[(c, r)]
151 else:
152 fc = c
153 hand = 0
154 if fc >= 7:
155 hand = 1
156 fm = finger_map[fc]
157 usage[hand][fm] = usage[hand][fm] + self.log[(c, r)]
158 hand_usage = [0, 0]
159 for f in usage[0]:
160 hand_usage[0] = hand_usage[0] + f
161 for f in usage[1]:
162 hand_usage[1] = hand_usage[1] + f
163
164 total = self.total
165 if total == 0:
166 total = 1
167 stats = {
168 "total-keys": total,
169 "hands": {
170 "left": {
171 "usage": round(float(hand_usage[0]) / total * 100, 2),
172 "fingers": {
173 "pinky": 0,
174 "ring": 0,
175 "middle": 0,
176 "index": 0,
177 "thumb": 0,
178 }
179 },
180 "right": {
181 "usage": round(float(hand_usage[1]) / total * 100, 2),
182 "fingers": {
183 "thumb": 0,
184 "index": 0,
185 "middle": 0,
186 "ring": 0,
187 "pinky": 0,
188 }
189 },
190 }
191 }
192
193 hmap = ['left', 'right']
194 fmap = ['pinky', 'ring', 'middle', 'index', 'thumb',
195 'thumb', 'index', 'middle', 'ring', 'pinky']
196 for hand_idx in range(len(usage)):
197 hand = usage[hand_idx]
198 for finger_idx in range(len(hand)):
199 stats['hands'][hmap[hand_idx]]['fingers'][fmap[finger_idx + hand_idx * 5]] = round(float(hand[finger_idx]) / total * 100, 2)
200 return stats
201
202def dump_all(out_dir, heatmaps):
203 stats = {}
204 t = Terminal()
205 t.clear()
206 sys.stdout.write("\x1b[2J\x1b[H")
207
208 print ('{t.underline}{outdir}{t.normal}\n'.format(t=t, outdir=out_dir))
209
210 keys = list(heatmaps.keys())
211 keys.sort()
212
213 for layer in keys:
214 if len(heatmaps[layer].log) == 0:
215 continue
216
217 with open ("%s/%s.json" % (out_dir, layer), "w") as f:
218 json.dump(heatmaps[layer].get_heatmap(), f)
219 stats[layer] = heatmaps[layer].get_stats()
220
221 left = stats[layer]['hands']['left']
222 right = stats[layer]['hands']['right']
223
224 print ('{t.bold}{layer}{t.normal} ({total:,} taps):'.format(t=t, layer=layer,
225 total=int(stats[layer]['total-keys'] / 2)))
226 print (('{t.underline} | ' + \
227 'left ({l[usage]:6.2f}%) | ' + \
228 'right ({r[usage]:6.2f}%) |{t.normal}').format(t=t, l=left, r=right))
229 print ((' {t.bright_magenta}pinky{t.white} | {left[pinky]:6.2f}% | {right[pinky]:6.2f}% |\n' + \
230 ' {t.bright_cyan}ring{t.white} | {left[ring]:6.2f}% | {right[ring]:6.2f}% |\n' + \
231 ' {t.bright_blue}middle{t.white} | {left[middle]:6.2f}% | {right[middle]:6.2f}% |\n' + \
232 ' {t.bright_green}index{t.white} | {left[index]:6.2f}% | {right[index]:6.2f}% |\n' + \
233 ' {t.bright_red}thumb{t.white} | {left[thumb]:6.2f}% | {right[thumb]:6.2f}% |\n' + \
234 '').format(left=left['fingers'], right=right['fingers'], t=t))
235
236def process_line(line, heatmaps, opts, stamped_log = None):
237 m = re.search ('KL: col=(\d+), row=(\d+), pressed=(\d+), layer=(.*)', line)
238 if not m:
239 return False
240 if stamped_log is not None:
241 if line.startswith("KL:"):
242 print ("%10.10f %s" % (time.time(), line),
243 file = stamped_log, end = '')
244 else:
245 print (line,
246 file = stamped_log, end = '')
247 stamped_log.flush()
248
249 (c, r, l) = (int(m.group (2)), int(m.group (1)), m.group (4))
250 if (c, r) not in opts.allowed_keys:
251 return False
252
253 heatmaps[l].update_log ((c, r))
254
255 return True
256
257def setup_allowed_keys(opts):
258 if len(opts.only_key):
259 incmap={}
260 for v in opts.only_key:
261 m = re.search ('(\d+),(\d+)', v)
262 if not m:
263 continue
264 (c, r) = (int(m.group(1)), int(m.group(2)))
265 incmap[(c, r)] = True
266 else:
267 incmap={}
268 for r in range(0, 6):
269 for c in range(0, 14):
270 incmap[(c, r)] = True
271
272 for v in opts.ignore_key:
273 m = re.search ('(\d+),(\d+)', v)
274 if not m:
275 continue
276 (c, r) = (int(m.group(1)), int(m.group(2)))
277 del(incmap[(c, r)])
278
279 return incmap
280
281def main(opts):
282 heatmaps = {"Dvorak": Heatmap("Dvorak"),
283 "ADORE": Heatmap("ADORE")
284 }
285 cnt = 0
286 out_dir = opts.outdir
287
288 if not os.path.exists(out_dir):
289 os.makedirs(out_dir)
290
291 opts.allowed_keys = setup_allowed_keys(opts)
292
293 if not opts.one_shot:
294
295 try:
296 with open("%s/stamped-log" % out_dir, "r") as f:
297 while True:
298 line = f.readline()
299 if not line:
300 break
301 if not process_line(line, heatmaps, opts):
302 continue
303 except Exception:
304 pass
305
306 stamped_log = open ("%s/stamped-log" % (out_dir), "a+")
307 else:
308 stamped_log = None
309
310 while True:
311 line = sys.stdin.readline()
312 if not line:
313 break
314 if not process_line(line, heatmaps, opts, stamped_log):
315 continue
316
317 cnt = cnt + 1
318
319 if opts.dump_interval != -1 and cnt >= opts.dump_interval and not opts.one_shot:
320 cnt = 0
321 dump_all(out_dir, heatmaps)
322
323 dump_all (out_dir, heatmaps)
324
325if __name__ == "__main__":
326 parser = argparse.ArgumentParser (description = "keylog to heatmap processor")
327 parser.add_argument ('outdir', action = 'store',
328 help = 'Output directory')
329 parser.add_argument ('--dump-interval', dest = 'dump_interval', action = 'store', type = int,
330 default = 100, help = 'Dump stats and heatmap at every Nth event, -1 for dumping at EOF only')
331 parser.add_argument ('--ignore-key', dest = 'ignore_key', action = 'append', type = str,
332 default = [], help = 'Ignore the key at position (x, y)')
333 parser.add_argument ('--only-key', dest = 'only_key', action = 'append', type = str,
334 default = [], help = 'Only include key at position (x, y)')
335 parser.add_argument ('--one-shot', dest = 'one_shot', action = 'store_true',
336 help = 'Do not load previous data, and do not update it, either.')
337 args = parser.parse_args()
338 if len(args.ignore_key) and len(args.only_key):
339 print ("--ignore-key and --only-key are mutually exclusive, please only use one of them!",
340 file = sys.stderr)
341 sys.exit(1)
342 main(args)
diff --git a/layouts/community/ergodox/algernon/tools/text-to-log.py b/layouts/community/ergodox/algernon/tools/text-to-log.py
deleted file mode 100755
index ba60a2e28..000000000
--- a/layouts/community/ergodox/algernon/tools/text-to-log.py
+++ /dev/null
@@ -1,106 +0,0 @@
1#!/usr/bin/env python3
2
3import sys
4
5charmap = {
6 '9': [[1, 0]],
7 '7': [[2, 0]], '@': [[2, 5], [2, 0]],
8 '5': [[3, 0]], '*': [[2, 5], [3, 0]],
9 '3': [[4, 0]], '^': [[2, 5], [4, 0]],
10 '1': [[5, 0]], '$': [[2, 5], [5, 0]],
11 '0': [[8, 0]], '%': [[2, 5], [8, 0]],
12 '2': [[9, 0]], '!': [[2, 5], [9, 0]],
13 '4': [[10, 0]], '#': [[2, 5], [10, 0]],
14 '6': [[11, 0]], '&': [[2, 5], [11, 0]],
15 '8': [[12, 0]],
16
17 '\\': [[0, 1]], '|': [[2, 5], [0, 1]],
18 'x': [[1, 1]], 'X': [[2, 5], [1, 1]],
19 'w': [[2, 1]], 'W': [[2, 5], [2, 1]],
20 'c': [[3, 1]], 'C': [[2, 5], [3, 1]],
21 'h': [[4, 1]], 'H': [[2, 5], [4, 1]],
22 'f': [[5, 1]], 'F': [[2, 5], [5, 1]],
23 '[': [[6, 1]], '{': [[2, 5], [6, 1]], '(': [[6, 1], [6, 1]],
24 ']': [[7, 1]], '}': [[2, 5], [7, 1]], ')': [[7, 1], [7, 1]],
25 'm': [[8, 1]], 'M': [[2, 5], [8, 1]],
26 'g': [[9, 1]], 'G': [[2, 5], [9, 1]],
27 'l': [[10, 1]], 'L': [[2, 5], [10, 1]],
28 'p': [[11, 1]], 'P': [[2, 5], [11, 1]],
29 '/': [[12, 1]], '?': [[2, 5], [12, 1]],
30 '`': [[13, 1]], '~': [[2, 5], [13, 1]],
31
32 '\t': [[0, 2]],
33 'a': [[1, 2]], 'A': [[2, 5], [1, 2]],
34 'o': [[2, 2]], 'O': [[2, 5], [2, 2]],
35 'e': [[3, 2]], 'E': [[2, 5], [3, 2]],
36 'i': [[4, 2]], 'I': [[2, 5], [4, 2]],
37 'u': [[5, 2]], 'U': [[2, 5], [5, 2]],
38 'd': [[8, 2]], 'D': [[2, 5], [8, 2]],
39 'r': [[9, 2]], 'R': [[2, 5], [9, 2]],
40 't': [[10, 2]], 'T': [[2, 5], [10, 2]],
41 'n': [[11, 2]], 'N': [[2, 5], [11, 2]],
42 's': [[12, 2]], 'S': [[2, 5], [12, 2]],
43 '=': [[13, 2]], '+': [[2, 5], [13, 2]],
44
45 'z': [[1, 3]], 'Z': [[2, 5], [1, 3]],
46 'q': [[2, 3]], 'Q': [[2, 5], [2, 3]],
47 '\'': [[3, 3]], '"': [[2, 5], [3, 3]],
48 ',': [[4, 3]], '<': [[2, 5], [4, 3]],
49 '.': [[5, 3]], '>': [[2, 5], [5, 3]],
50 'b': [[8, 3]], 'B': [[2, 5], [8, 3]],
51 'k': [[9, 3]], 'K': [[2, 5], [9, 3]],
52 'v': [[10, 3]], 'V': [[2, 5], [10, 3]],
53 'y': [[11, 3]], 'Y': [[2, 5], [11, 3]],
54 'j': [[12, 3]], 'J': [[2, 5], [12, 3]],
55
56 ':': [[4, 4]], ';': [[4, 4], [4, 4]],
57 '-': [[9, 4]], '_': [[2, 5], [9, 4]],
58
59 ' ': [[10, 5]],
60 '\n': [[11, 5]],
61
62 ## Layered things
63 # Hungarian
64 'á': [[9, 5], [1, 2]], 'Á': [[2, 5], [9, 5], [1, 2]],
65 'ó': [[9, 5], [2, 2]], 'Ó': [[2, 5], [9, 5], [2, 2]],
66 'ő': [[9, 5], [2, 1]], 'Ő': [[2, 5], [9, 5], [2, 1]],
67 'ö': [[9, 5], [2, 3]], 'Ö': [[2, 5], [9, 5], [2, 3]],
68 'é': [[9, 5], [3, 2]], 'É': [[2, 5], [9, 5], [3, 2]],
69 'ú': [[9, 5], [4, 2]], 'Ú': [[2, 5], [9, 5], [4, 2]],
70 'ű': [[9, 5], [4, 1]], 'Ű': [[2, 5], [9, 5], [4, 1]],
71 'ü': [[9, 5], [4, 3]], 'Ü': [[2, 5], [9, 5], [4, 3]],
72 'í': [[9, 5], [5, 2]], 'Í': [[2, 5], [9, 5], [5, 2]],
73}
74
75def lookup_char(layer, ch):
76 if ch in charmap:
77 return charmap[ch]
78 return None
79
80def process_char(layer, ch, out=sys.stdout):
81 keys = lookup_char(layer, ch)
82 if not keys:
83 print ("Unknown char: %s" % ch, file=sys.stderr)
84 else:
85 for (c, r) in keys:
86 print ("KL: col=%d, row=%d, pressed=1, layer=%s" % (r, c, layer), file=out)
87 print ("KL: col=%d, row=%d, pressed=0, layer=%s" % (r, c, layer), file=out)
88
89def process_file(fn, layer, out=sys.stdout):
90 with open(fn, "r") as f:
91 ch = f.read(1)
92 while ch:
93 process_char(layer, ch, out)
94 ch = f.read(1)
95
96if sys.argv[1] == '-':
97 out='/dev/stdin'
98else:
99 out=sys.argv[1]
100
101if len(sys.argv) >= 2:
102 layer = 'ADORE'
103else:
104 layer = sys.argv[2]
105
106process_file(out, layer = layer)
diff --git a/layouts/community/ergodox/dragon788/keymap.c b/layouts/community/ergodox/dragon788/keymap.c
index e77786485..956a592b6 100644
--- a/layouts/community/ergodox/dragon788/keymap.c
+++ b/layouts/community/ergodox/dragon788/keymap.c
@@ -164,7 +164,7 @@ LAYOUT_ergodox(
164 KC_NO, KC_Q, KC_W, KC_E, KC_R, KC_T, 164 KC_NO, KC_Q, KC_W, KC_E, KC_R, KC_T,
165 KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G, KC_NO, 165 KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G, KC_NO,
166 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 166 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
167 KC_FN4, KC_NO, 167 KC_NO, KC_NO,
168 KC_NO, 168 KC_NO,
169 KC_C, KC_V, KC_NO, 169 KC_C, KC_V, KC_NO,
170 // right hand 170 // right hand
diff --git a/layouts/community/ergodox/dvorak_plover/keymap.c b/layouts/community/ergodox/dvorak_plover/keymap.c
index 882a351d1..989aafb90 100644
--- a/layouts/community/ergodox/dvorak_plover/keymap.c
+++ b/layouts/community/ergodox/dvorak_plover/keymap.c
@@ -122,7 +122,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
122 KC_NO, KC_Q, KC_W, KC_E, KC_R, KC_T, 122 KC_NO, KC_Q, KC_W, KC_E, KC_R, KC_T,
123 KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G, KC_NO, 123 KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G, KC_NO,
124 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 124 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
125 KC_FN4, KC_NO, 125 KC_NO, KC_NO,
126 KC_NO, 126 KC_NO,
127 KC_C, KC_V, KC_NO, 127 KC_C, KC_V, KC_NO,
128 // right hand 128 // right hand
diff --git a/layouts/community/ergodox/haegin/keymap.c b/layouts/community/ergodox/haegin/keymap.c
index fbbe3e72e..c3c2afecb 100644
--- a/layouts/community/ergodox/haegin/keymap.c
+++ b/layouts/community/ergodox/haegin/keymap.c
@@ -55,7 +55,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
55 KC_NO, KC_F, KC_G, KC_C, KC_R, KC_L, LT(MEDIA, KC_BSLS), 55 KC_NO, KC_F, KC_G, KC_C, KC_R, KC_L, LT(MEDIA, KC_BSLS),
56 KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, 56 KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS,
57 MEH_T(KC_NO), KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSPC, 57 MEH_T(KC_NO), KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSPC,
58 ALT_T(KC_UP), KC_DOWN, KC_LBRC, KC_RBRC, KC_FN2, 58 ALT_T(KC_UP), KC_DOWN, KC_LBRC, KC_RBRC, KC_NO,
59 KC_PGUP, CTL_T(KC_ESC), 59 KC_PGUP, CTL_T(KC_ESC),
60 KC_PGDN, 60 KC_PGDN,
61 LCTL(KC_B), LT(MEDIA, KC_TAB), LT(SYMBOLS, KC_ENT) 61 LCTL(KC_B), LT(MEDIA, KC_TAB), LT(SYMBOLS, KC_ENT)
diff --git a/layouts/community/ergodox/kines-ish/keymap.c b/layouts/community/ergodox/kines-ish/keymap.c
index 8acab5ca5..2d1513667 100644
--- a/layouts/community/ergodox/kines-ish/keymap.c
+++ b/layouts/community/ergodox/kines-ish/keymap.c
@@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
45 TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, 45 TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
46 KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, 46 KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
47 MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, 47 MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT,
48 KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN2, 48 KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_NO,
49 KC_LGUI, KC_RCTL, 49 KC_LGUI, KC_RCTL,
50 KC_PGUP, 50 KC_PGUP,
51 KC_PGDN, KC_ENT, KC_SPC 51 KC_PGDN, KC_ENT, KC_SPC
diff --git a/layouts/community/ergodox/mpiechotka/keymap.c b/layouts/community/ergodox/mpiechotka/keymap.c
index 6a89e38a3..a83725519 100644
--- a/layouts/community/ergodox/mpiechotka/keymap.c
+++ b/layouts/community/ergodox/mpiechotka/keymap.c
@@ -1,21 +1,20 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2#include "debug.h" 2
3#include "action_layer.h"
4#include "keymap_colemak.h" 3#include "keymap_colemak.h"
5 4
6enum { 5enum layer_names {
7 BASE = 0, 6 BASE = 0,
8 BASE_CM, 7 BASE_CM,
9 SYMB, 8 SYMB,
10 MACR 9 MACR
11}; 10};
12 11
13enum { 12enum custom_keycodes {
14 LWIN = 1, 13 LWIN = SAFE_RANGE,
15 PC1, 14 KC_PC1,
16 PC2, 15 KC_PC2,
17 PC3, 16 KC_PC3,
18 PC4 17 KC_PC4
19}; 18};
20 19
21const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 20const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -50,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
50 KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, 49 KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D,
51 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_EQL, 50 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_EQL,
52 LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT, 51 LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT,
53 KC_LALT, F(LWIN), 52 KC_LALT, LWIN,
54 KC_HOME, 53 KC_HOME,
55 SFT_T(KC_SPC),CTL_T(KC_BSPC),LT(SYMB, KC_END), 54 SFT_T(KC_SPC),CTL_T(KC_BSPC),LT(SYMB, KC_END),
56 // right hand 55 // right hand
@@ -94,7 +93,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
94 KC_ESC, CM_A, CM_R, CM_S, CM_T, CM_D, 93 KC_ESC, CM_A, CM_R, CM_S, CM_T, CM_D,
95 KC_LSFT, CM_Z, CM_X, CM_C, CM_V, CM_B, KC_EQL, 94 KC_LSFT, CM_Z, CM_X, CM_C, CM_V, CM_B, KC_EQL,
96 LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT, 95 LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT,
97 KC_LALT, F(LWIN), 96 KC_LALT, LWIN,
98 KC_HOME, 97 KC_HOME,
99 SFT_T(KC_SPC),CTL_T(KC_BSPC),LT(SYMB, KC_END), 98 SFT_T(KC_SPC),CTL_T(KC_BSPC),LT(SYMB, KC_END),
100 // right hand 99 // right hand
@@ -174,7 +173,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
174[MACR] = LAYOUT_ergodox( 173[MACR] = LAYOUT_ergodox(
175 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 174 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
176 KC_NO, DF(BASE), DF(BASE_CM), KC_NO, KC_NO, KC_NO, KC_NO, 175 KC_NO, DF(BASE), DF(BASE_CM), KC_NO, KC_NO, KC_NO, KC_NO,
177 KC_NO, F(PC1), F(PC2), F(PC3), F(PC4), KC_NO, 176 KC_NO, KC_PC1, KC_PC2, KC_PC3, KC_PC4, KC_NO,
178 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 177 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
179 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 178 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
180 KC_TRNS,KC_TRNS, 179 KC_TRNS,KC_TRNS,
@@ -192,72 +191,60 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
192), 191),
193}; 192};
194 193
195const uint16_t PROGMEM fn_actions[] = { 194bool process_record_user(uint16_t keycode, keyrecord_t *record) {
196 [LWIN] = ACTION_MACRO(LWIN), 195 switch (keycode) {
197 [PC1] = ACTION_MACRO(PC1), 196 case LWIN:
198 [PC2] = ACTION_MACRO(PC2), 197 if (record->event.pressed) {
199 [PC3] = ACTION_MACRO(PC3), 198 tap_code(KC_RSFT);
200 [PC4] = ACTION_MACRO(PC4) 199 register_code(KC_LGUI);
201}; 200 } else {
202 201 unregister_code(KC_LGUI);
203const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 202 }
204{ 203 return false;
205 switch(id) { 204 case KC_PC1:
206 case 0: 205 if (record->event.pressed) {
207 if (record->event.pressed) { 206 tap_code_delay(KC_SLCK, 50);
208 register_code(KC_RSFT); 207 wait_ms(50);
209 } else { 208 tap_code_delay(KC_1, 50);
210 unregister_code(KC_RSFT); 209 tap_code(KC_ENT);
211 } 210 }
212 break; 211 return false;
213 case LWIN: 212 case KC_PC2:
214 if (record->event.pressed) { 213 if (record->event.pressed) {
215 register_code(KC_RSFT); 214 tap_code_delay(KC_SLCK, 50);
216 unregister_code(KC_RSFT); 215 wait_ms(50);
217 register_code(KC_LGUI); 216 tap_code_delay(KC_2, 50);
218 } else { 217 tap_code(KC_ENT);
219 unregister_code(KC_LGUI); 218 }
220 } 219 return false;
221 break; 220 case KC_PC3:
222 case PC1: 221 if (record->event.pressed) {
223 if (!record->event.pressed) { 222 tap_code_delay(KC_SLCK, 50);
224 return MACRO(T(SLCK), W(50), T(SLCK), W(50), T(1), W(50), T(ENT), END); 223 wait_ms(50);
225 } 224 tap_code_delay(KC_3, 50);
226 break; 225 tap_code(KC_ENT);
227 case PC2: 226 }
228 if (!record->event.pressed) { 227 return false;
229 return MACRO(T(SLCK), W(50), T(SLCK), W(50), T(2), W(50), T(ENT), END); 228 case KC_PC4:
230 } 229 if (record->event.pressed) {
231 break; 230 tap_code_delay(KC_SLCK, 50);
232 case PC3: 231 wait_ms(50);
233 if (!record->event.pressed) { 232 tap_code_delay(KC_4, 50);
234 return MACRO(T(SLCK), W(50), T(SLCK), W(50), T(3), W(50), T(ENT), END); 233 tap_code(KC_ENT);
235 } 234 }
236 break; 235 return false;
237 case PC4:
238 if (!record->event.pressed) {
239 return MACRO(T(SLCK), W(50), T(SLCK), W(50), T(4), W(50), T(ENT), END);
240 }
241 break;
242 } 236 }
243 return MACRO_NONE; 237 return true;
244} 238}
245 239
246// Runs just one time when the keyboard initializes.
247void matrix_init_user(void) {
248
249};
250
251// Runs constantly in the background, in a loop. 240// Runs constantly in the background, in a loop.
252void matrix_scan_user(void) { 241void matrix_scan_user(void) {
253
254 uint8_t layer = biton32(layer_state);
255
256 ergodox_board_led_off(); 242 ergodox_board_led_off();
257 ergodox_right_led_1_off(); 243 ergodox_right_led_1_off();
258 ergodox_right_led_2_off(); 244 ergodox_right_led_2_off();
259 ergodox_right_led_3_off(); 245 ergodox_right_led_3_off();
260 switch (layer) { 246
247 switch (get_highest_layer(layer_state)) {
261 // TODO: Make this relevant to the ErgoDox EZ. 248 // TODO: Make this relevant to the ErgoDox EZ.
262 case SYMB: 249 case SYMB:
263 ergodox_right_led_1_on(); 250 ergodox_right_led_1_on();
@@ -269,4 +256,4 @@ void matrix_scan_user(void) {
269 // none 256 // none
270 break; 257 break;
271 } 258 }
272}; 259}
diff --git a/layouts/community/ergodox/ordinary/keymap.c b/layouts/community/ergodox/ordinary/keymap.c
index 86ab86491..8d0425e49 100644
--- a/layouts/community/ergodox/ordinary/keymap.c
+++ b/layouts/community/ergodox/ordinary/keymap.c
@@ -1,34 +1,12 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2#include "led.h"
3#include "mousekey.h"
4#include "debug.h"
5#include "action_layer.h"
6#include "action_util.h"
7
8#define BASE 0 // default layer
9#define SYMB 1 // symbols layer
10#define MDIA 2 // media layer
11#define SPEC 3 // special layer
12#define RBASE 4 // reverse default layer
13
14#define LSymb 10 // left symbol-shift key
15#define LMdia 11 // left media-shift key
16#define LSpec 12 // left special-shift key
17#define RSymb 13 // right symbol-shift key
18#define RMdia 14 // right media-shift key
19#define RSpec 15 // right special-shift key
20
21#define NotEq 16 // != macro
22#define GrtEq 17 // >= macro
23#define LesEq 18 // <= macro
24#define DeRef 19 // -> macro
25
26#define MUL 20 // mouse up left
27#define MUR 21 // mouse up right
28#define MDL 22 // mouse down left
29#define MDR 23 // mouse down right
30
31 2
3enum layer_names {
4 BASE, // default layer
5 SYMB, // symbols layer
6 MDIA, // media layer
7 SPEC, // special layer
8 RBASE // reverse default layer
9};
32 10
33/* 11/*
34 * The Ordinary Layout for the Ergodox EZ keyboard, v5 12 * The Ordinary Layout for the Ergodox EZ keyboard, v5
@@ -69,18 +47,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
69 */ 47 */
70[BASE] = LAYOUT_ergodox( 48[BASE] = LAYOUT_ergodox(
71// left hand 49// left hand
72 F(LSpec) ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_ESC 50 KC_NO ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_ESC
73,F(LMdia) ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC 51,KC_NO ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC
74,M(LSymb) ,LT(RBASE, KC_A),KC_S ,KC_D ,LT(RBASE, KC_F) ,KC_G 52,KC_NO ,LT(RBASE, KC_A),KC_S ,KC_D ,LT(RBASE, KC_F) ,KC_G
75,KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,LSFT(KC_TAB) 53,KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,LSFT(KC_TAB)
76,KC_LCTL ,MEH_T(KC_NO) ,ALL_T(KC_NO),KC_LALT,KC_LGUI 54,KC_LCTL ,MEH_T(KC_NO) ,ALL_T(KC_NO),KC_LALT,KC_LGUI
77 ,KC_HOME,KC_END 55 ,KC_HOME,KC_END
78 ,KC_PGUP 56 ,KC_PGUP
79 ,KC_BSPC,KC_DEL ,KC_PGDN 57 ,KC_BSPC,KC_DEL ,KC_PGDN
80 // right hand 58 // right hand
81 ,KC_MINS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,F(RSpec) 59 ,KC_MINS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_NO
82 ,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,F(RMdia) 60 ,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_NO
83 ,KC_H ,LT(RBASE, KC_J),KC_K ,KC_L ,LT(RBASE,KC_SCLN),F(RSymb) 61 ,KC_H ,LT(RBASE, KC_J),KC_K ,KC_L ,LT(RBASE,KC_SCLN),KC_NO
84 ,KC_TAB ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,KC_RSFT 62 ,KC_TAB ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,KC_RSFT
85 ,KC_RGUI ,KC_RALT,KC_HYPR,KC_MEH ,KC_RCTL 63 ,KC_RGUI ,KC_RALT,KC_HYPR,KC_MEH ,KC_RCTL
86 ,KC_LEFT ,KC_RGHT 64 ,KC_LEFT ,KC_RGHT
@@ -116,9 +94,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
116,KC_TRNS ,KC_HASH ,KC_DLR ,KC_LPRN ,KC_RPRN ,KC_GRV 94,KC_TRNS ,KC_HASH ,KC_DLR ,KC_LPRN ,KC_RPRN ,KC_GRV
117,KC_TRNS ,KC_PERC ,KC_CIRC ,KC_LBRC ,KC_RBRC ,KC_TILD ,KC_QUOT 95,KC_TRNS ,KC_PERC ,KC_CIRC ,KC_LBRC ,KC_RBRC ,KC_TILD ,KC_QUOT
118,KC_SCLN ,KC_AMPR ,KC_ASTR ,LSFT(KC_COMM),LSFT(KC_DOT) 96,KC_SCLN ,KC_AMPR ,KC_ASTR ,LSFT(KC_COMM),LSFT(KC_DOT)
119 ,M(GrtEq),M(LesEq) 97 ,KC_NO,KC_NO
120 ,KC_NO 98 ,KC_NO
121 ,KC_PLUS ,KC_EQL ,M(NotEq) 99 ,KC_PLUS ,KC_EQL ,KC_NO
122 // right hand 100 // right hand
123 ,KC_MINS ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_TRNS 101 ,KC_MINS ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_TRNS
124 ,LSFT(KC_DOT),KC_PIPE ,KC_7 ,KC_8 ,KC_9 ,KC_SLSH ,KC_TRNS 102 ,LSFT(KC_DOT),KC_PIPE ,KC_7 ,KC_8 ,KC_9 ,KC_SLSH ,KC_TRNS
@@ -127,7 +105,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
127 ,KC_0 ,KC_DOT ,KC_EQL,KC_PLUS ,KC_ENT 105 ,KC_0 ,KC_DOT ,KC_EQL,KC_PLUS ,KC_ENT
128 ,KC_NO ,KC_NO 106 ,KC_NO ,KC_NO
129 ,KC_NO 107 ,KC_NO
130 ,M(DeRef) ,LSFT(KC_MINS),KC_MINS 108 ,KC_NO ,LSFT(KC_MINS),KC_MINS
131), 109),
132 110
133/******* Media Layer ******************************************************************************************************* 111/******* Media Layer *******************************************************************************************************
@@ -154,9 +132,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
154[MDIA] = LAYOUT_ergodox( 132[MDIA] = LAYOUT_ergodox(
155// left hand 133// left hand
156 KC_TRNS ,KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,KC_ESC 134 KC_TRNS ,KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,KC_ESC
157,KC_TRNS ,KC_POWER ,M(MUL) ,KC_MS_U ,M(MUR) ,KC_VOLU ,KC_WH_U 135,KC_TRNS ,KC_POWER ,KC_NO ,KC_MS_U ,KC_NO ,KC_VOLU ,KC_WH_U
158,KC_TRNS ,KC_SLEP ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_VOLD 136,KC_TRNS ,KC_SLEP ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_VOLD
159,KC_TRNS ,KC_NO ,M(MDL) ,KC_MS_D ,M(MDR) ,KC_MUTE ,KC_WH_D 137,KC_TRNS ,KC_NO ,KC_NO ,KC_MS_D ,KC_NO ,KC_MUTE ,KC_WH_D
160,KC_NO ,KC_NO ,KC_BTN3 ,KC_BTN1 ,KC_BTN2 138,KC_NO ,KC_NO ,KC_BTN3 ,KC_BTN1 ,KC_BTN2
161 ,KC_WSTP ,KC_WREF 139 ,KC_WSTP ,KC_WREF
162 ,KC_WSCH 140 ,KC_WSCH
@@ -257,248 +235,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
257) 235)
258}; 236};
259 237
260const uint16_t PROGMEM fn_actions[] = {
261 // the faux shift keys are implemented as macro taps
262 [LSymb] = ACTION_MACRO_TAP(LSymb)
263 ,[LMdia] = ACTION_MACRO_TAP(LMdia)
264 ,[LSpec] = ACTION_MACRO_TAP(LSpec)
265 ,[RSymb] = ACTION_MACRO_TAP(RSymb)
266 ,[RMdia] = ACTION_MACRO_TAP(RMdia)
267 ,[RSpec] = ACTION_MACRO_TAP(RSpec)
268};
269
270uint16_t symb_shift = 0;
271uint16_t mdia_shift = 0;
272uint16_t spec_shift = 0;
273
274bool mdia_lock = false;
275bool symb_lock = false;
276
277const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
278{
279 switch(id) {
280 // There are two shift keys for each layer so we increment a layer_shift var when one
281 // is pressed and decrement when one is released. The shift counts are bound between 0 and 2
282 // only because sometimes rapid pressing led to irregular events; this way the states
283 // are self healing during use.
284
285 case LSymb: //
286 if (record->event.pressed) { // when the LSymb button is pressed
287 if(++symb_shift > 2) symb_shift = 2; // increment the symb shift count, max two
288 if(spec_shift) symb_lock = !symb_lock; // if the Special layer is on, toggle the shift lock
289 layer_on(SYMB); // in any case, turn on the Symbols layer
290 } else { // when the LSymb button is released
291 if(--symb_shift < 0) symb_shift = 0; // decrement the shift count, minimum zero
292 if((!symb_shift) && (!symb_lock)) layer_off(SYMB); // if both shifts are released and the lock is off, turn off the Symbols layer
293 }
294 break;
295
296 case LMdia:
297 if (record->event.pressed) {
298 if (record->tap.count && (!mdia_shift) && (!mdia_lock) && (!spec_shift)) {
299 register_code(KC_TAB);
300 } else {
301 if(spec_shift) mdia_lock = !mdia_lock;
302 if(++mdia_shift > 2) mdia_shift = 2;
303 layer_on(MDIA);
304 }
305 } else {
306 if(record->tap.count && (!mdia_shift) && (!mdia_lock) && (!spec_shift)) {
307 unregister_code(KC_TAB);
308 } else {
309 if(--mdia_shift < 0) mdia_shift = 0;
310 if((!mdia_shift) && (!mdia_lock)) layer_off(MDIA);
311 }
312 }
313 break;
314
315 case LSpec:
316 if (record->event.pressed) { // when the LSpec button is pressed
317 if(symb_shift) symb_lock = !symb_lock; // if another layer button is engaged, then
318 else if(mdia_shift) mdia_lock = !mdia_lock; // lock that layer, be it caps or symb or mdia
319 else if (record->tap.count && !record->tap.interrupted && (!spec_shift)) {
320 register_code(KC_GRV); // otherwise, if it's an uninterrupted tap, emit a char
321 } else {
322 if(++spec_shift > 2) spec_shift = 2;
323 layer_on(SPEC); // otherwise, turn on the Special layer
324 }
325 } else {
326 if(record->tap.count && !record->tap.interrupted && (!spec_shift)) {
327 unregister_code(KC_GRV);
328 } else {
329 if(--spec_shift < 0) spec_shift = 0;
330 if(!spec_shift) layer_off(SPEC);
331 }
332 }
333 break;
334
335 case RSymb:
336 if (record->event.pressed) {
337 if (record->tap.count && (!symb_shift) && (!symb_lock) && (!spec_shift)) {
338 register_code(KC_QUOT);
339 } else {
340 if(++symb_shift > 2) symb_shift = 2;
341 if(spec_shift) symb_lock = !symb_lock;
342 layer_on(SYMB);
343 }
344 } else {
345 if(record->tap.count && (!symb_shift) && (!symb_lock) && (!spec_shift)) {
346 unregister_code(KC_QUOT);
347 } else {
348 if(--symb_shift < 0) symb_shift = 0;
349 if((!symb_shift) && (!symb_lock)) layer_off(SYMB);
350 }
351 }
352 break;
353
354 case RMdia:
355 if (record->event.pressed) {
356 if (record->tap.count && (!mdia_shift) && (!mdia_lock) && (!spec_shift)) {
357 register_code(KC_BSLS);
358 } else {
359 if(++mdia_shift > 2) mdia_shift = 2;
360 if(spec_shift) mdia_lock = !mdia_lock;
361 layer_on(MDIA);
362 }
363 } else {
364 if(record->tap.count && (!mdia_shift) && (!mdia_lock) && (!spec_shift)) {
365 unregister_code(KC_BSLS);
366 } else {
367 if(--mdia_shift < 0) mdia_shift = 0;
368 if((!mdia_shift) && (!mdia_lock)) layer_off(MDIA);
369 }
370 }
371 break;
372
373 case RSpec:
374 if (record->event.pressed) {
375 if(symb_shift) symb_lock = !symb_lock;
376 else if(mdia_shift) mdia_lock = !mdia_lock;
377 else if (record->tap.count && !record->tap.interrupted && (!spec_shift)) {
378 register_code(KC_EQL);
379 } else {
380 if(++spec_shift > 2) spec_shift = 2;
381 layer_on(SPEC);
382 }
383 } else {
384 if(record->tap.count && !record->tap.interrupted && (!spec_shift)) {
385 unregister_code(KC_EQL);
386 } else {
387 if(--spec_shift < 0) spec_shift = 0;
388 if(!spec_shift) layer_off(SPEC);
389 }
390 }
391 break;
392
393 case NotEq:
394 if (record->event.pressed) {
395 return MACRO( I(10), D(LSFT), T(1), U(LSFT), T(EQL), END ); // !=
396 }
397 break;
398
399 case GrtEq:
400 if (record->event.pressed) {
401 return MACRO( I(10), D(LSFT), T(COMM), U(LSFT), T(EQL), END ); // <=
402 }
403 break;
404
405 case LesEq:
406 if (record->event.pressed) {
407 return MACRO( I(10), D(LSFT), T(DOT), U(LSFT), T(EQL), END ); // >=
408 }
409 break;
410
411 case DeRef:
412 if (record->event.pressed) {
413 return MACRO( I(10), T(MINS), D(LSFT), T(DOT), U(LSFT), END ); // ->
414 }
415 break;
416
417 // mouse diagonals
418
419 case MUL: // mouse up left
420 if (record->event.pressed) {
421 mousekey_on(KC_MS_UP);
422 mousekey_on(KC_MS_LEFT);
423 mousekey_send();
424 } else {
425 mousekey_off(KC_MS_UP);
426 mousekey_off(KC_MS_LEFT);
427 mousekey_send();
428 }
429 break;
430
431 case MUR: // mouse up right
432 if (record->event.pressed) {
433 mousekey_on(KC_MS_UP);
434 mousekey_on(KC_MS_RIGHT);
435 mousekey_send();
436 } else {
437 mousekey_off(KC_MS_UP);
438 mousekey_off(KC_MS_RIGHT);
439 mousekey_send();
440 }
441 break;
442
443 case MDL: // mouse down left
444 if (record->event.pressed) {
445 mousekey_on(KC_MS_DOWN);
446 mousekey_on(KC_MS_LEFT);
447 mousekey_send();
448 } else {
449 mousekey_off(KC_MS_DOWN);
450 mousekey_off(KC_MS_LEFT);
451 mousekey_send();
452 }
453 break;
454
455 case MDR: // mouse down right
456 if (record->event.pressed) {
457 mousekey_on(KC_MS_DOWN);
458 mousekey_on(KC_MS_RIGHT);
459 mousekey_send();
460 } else {
461 mousekey_off(KC_MS_DOWN);
462 mousekey_off(KC_MS_RIGHT);
463 mousekey_send();
464 }
465 break;
466
467 default:
468 // none
469 break;
470 }
471
472 return MACRO_NONE;
473};
474
475// Runs just one time when the keyboard initializes.
476void matrix_init_user(void) {
477
478};
479
480// Runs constantly in the background, in a loop. 238// Runs constantly in the background, in a loop.
481void matrix_scan_user(void) { 239void matrix_scan_user(void) {
482 // shift or caps lock turns on red light 240 // shift or caps lock turns on red light
483 if((keyboard_report->mods & MOD_BIT(KC_LSFT)) 241 if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) {
484 || (keyboard_report->mods & MOD_BIT(KC_RSFT))
485 || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) {
486 ergodox_right_led_1_on(); 242 ergodox_right_led_1_on();
487 } else { 243 } else {
488 ergodox_right_led_1_off(); 244 ergodox_right_led_1_off();
489 } 245 }
490 246
491 // Symbol layer turns on green light 247 // Symbol layer turns on green light
492 if(layer_state & (1UL<<SYMB)) { 248 if (layer_state & (1UL<<SYMB)) {
493 ergodox_right_led_2_on(); 249 ergodox_right_led_2_on();
494 } else { 250 } else {
495 ergodox_right_led_2_off(); 251 ergodox_right_led_2_off();
496 } 252 }
497 253
498 // Media layer turns on blue light 254 // Media layer turns on blue light
499 if(layer_state & (1UL<<MDIA)) { 255 if (layer_state & (1UL<<MDIA)) {
500 ergodox_right_led_3_on(); 256 ergodox_right_led_3_on();
501 } else { 257 } else {
502 ergodox_right_led_3_off(); 258 ergodox_right_led_3_off();
503 } 259 }
504}; 260}
diff --git a/layouts/community/ergodox/ordinary_osx/keymap.c b/layouts/community/ergodox/ordinary_osx/keymap.c
index 17c1c837d..5f794cbba 100644
--- a/layouts/community/ergodox/ordinary_osx/keymap.c
+++ b/layouts/community/ergodox/ordinary_osx/keymap.c
@@ -1,34 +1,12 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2#include "led.h"
3#include "mousekey.h"
4#include "debug.h"
5#include "action_layer.h"
6#include "action_util.h"
7
8#define BASE 0 // default layer
9#define SYMB 1 // symbols layer
10#define MDIA 2 // media layer
11#define SPEC 3 // special layer
12#define RBASE 4 // reverse default layer
13
14#define LSymb 10 // left symbol-shift key
15#define LMdia 11 // left media-shift key
16#define LSpec 12 // left special-shift key
17#define RSymb 13 // right symbol-shift key
18#define RMdia 14 // right media-shift key
19#define RSpec 15 // right special-shift key
20
21#define NotEq 16 // != macro
22#define GrtEq 17 // >= macro
23#define LesEq 18 // <= macro
24#define DeRef 19 // -> macro
25
26#define MUL 20 // mouse up left
27#define MUR 21 // mouse up right
28#define MDL 22 // mouse down left
29#define MDR 23 // mouse down right
30
31 2
3enum layer_names {
4 BASE, // default layer
5 SYMB, // symbols layer
6 MDIA, // media layer
7 SPEC, // special layer
8 RBASE // reverse default layer
9};
32 10
33/* 11/*
34 * The Ordinary Layout for the Ergodox EZ keyboard, v5 12 * The Ordinary Layout for the Ergodox EZ keyboard, v5
@@ -69,18 +47,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
69 */ 47 */
70[BASE] = LAYOUT_ergodox( 48[BASE] = LAYOUT_ergodox(
71// left hand 49// left hand
72 F(LSpec) ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_ESC 50 KC_NO ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_ESC
73,F(LMdia) ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,LSFT(KC_TAB) 51,KC_NO ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,LSFT(KC_TAB)
74,M(LSymb) ,LT(RBASE, KC_A),KC_S ,KC_D ,LT(RBASE, KC_F) ,KC_G 52,KC_NO ,LT(RBASE, KC_A),KC_S ,KC_D ,LT(RBASE, KC_F) ,KC_G
75,KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,KC_LBRC 53,KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,KC_LBRC
76,KC_LEFT ,KC_RIGHT ,KC_LCTL,KC_LALT,KC_LGUI 54,KC_LEFT ,KC_RIGHT ,KC_LCTL,KC_LALT,KC_LGUI
77 ,KC_HOME,KC_END 55 ,KC_HOME,KC_END
78 ,KC_PGUP 56 ,KC_PGUP
79 ,KC_BSPC,KC_DEL ,KC_PGDN 57 ,KC_BSPC,KC_DEL ,KC_PGDN
80 // right hand 58 // right hand
81 ,KC_MINS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,F(RSpec) 59 ,KC_MINS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_NO
82 ,KC_TAB ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,F(RMdia) 60 ,KC_TAB ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_NO
83 ,KC_H ,LT(RBASE, KC_J),KC_K ,KC_L ,LT(RBASE,KC_SCLN),F(RSymb) 61 ,KC_H ,LT(RBASE, KC_J),KC_K ,KC_L ,LT(RBASE,KC_SCLN),KC_NO
84 ,KC_RBRC ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,KC_RSFT 62 ,KC_RBRC ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,KC_RSFT
85 ,KC_RGUI ,KC_RALT,KC_RCTL,KC_UP ,KC_DOWN 63 ,KC_RGUI ,KC_RALT,KC_RCTL,KC_UP ,KC_DOWN
86 ,KC_LEFT ,KC_RGHT 64 ,KC_LEFT ,KC_RGHT
@@ -116,9 +94,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
116,KC_TRNS ,KC_HASH ,KC_DLR ,KC_LPRN ,KC_RPRN ,KC_GRV 94,KC_TRNS ,KC_HASH ,KC_DLR ,KC_LPRN ,KC_RPRN ,KC_GRV
117,KC_TRNS ,KC_PERC ,KC_CIRC ,KC_LBRC ,KC_RBRC ,KC_TILD ,KC_QUOT 95,KC_TRNS ,KC_PERC ,KC_CIRC ,KC_LBRC ,KC_RBRC ,KC_TILD ,KC_QUOT
118,KC_SCLN ,KC_AMPR ,KC_ASTR ,LSFT(KC_COMM),LSFT(KC_DOT) 96,KC_SCLN ,KC_AMPR ,KC_ASTR ,LSFT(KC_COMM),LSFT(KC_DOT)
119 ,M(GrtEq),M(LesEq) 97 ,KC_NO,KC_NO
120 ,KC_NO 98 ,KC_NO
121 ,KC_PLUS ,KC_EQL ,M(NotEq) 99 ,KC_PLUS ,KC_EQL ,KC_NO
122 // right hand 100 // right hand
123 ,KC_MINS ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_TRNS 101 ,KC_MINS ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_TRNS
124 ,LSFT(KC_DOT),KC_PIPE ,KC_7 ,KC_8 ,KC_9 ,KC_SLSH ,KC_TRNS 102 ,LSFT(KC_DOT),KC_PIPE ,KC_7 ,KC_8 ,KC_9 ,KC_SLSH ,KC_TRNS
@@ -127,7 +105,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
127 ,KC_0 ,KC_DOT ,KC_EQL,KC_PLUS ,KC_ENT 105 ,KC_0 ,KC_DOT ,KC_EQL,KC_PLUS ,KC_ENT
128 ,KC_NO ,KC_NO 106 ,KC_NO ,KC_NO
129 ,KC_NO 107 ,KC_NO
130 ,M(DeRef) ,LSFT(KC_MINS),KC_MINS 108 ,KC_NO ,LSFT(KC_MINS),KC_MINS
131), 109),
132 110
133/******* Media Layer ******************************************************************************************************* 111/******* Media Layer *******************************************************************************************************
@@ -154,9 +132,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
154[MDIA] = LAYOUT_ergodox( 132[MDIA] = LAYOUT_ergodox(
155// left hand 133// left hand
156 KC_TRNS ,KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,KC_ESC 134 KC_TRNS ,KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,KC_ESC
157,KC_TRNS ,KC_POWER ,M(MUL) ,KC_MS_U ,M(MUR) ,KC_VOLU ,KC_WH_U 135,KC_TRNS ,KC_POWER ,KC_NO ,KC_MS_U ,KC_NO ,KC_VOLU ,KC_WH_U
158,KC_TRNS ,KC_SLEP ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_VOLD 136,KC_TRNS ,KC_SLEP ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_VOLD
159,KC_TRNS ,KC_NO ,M(MDL) ,KC_MS_D ,M(MDR) ,KC_MUTE ,KC_WH_D 137,KC_TRNS ,KC_NO ,KC_NO ,KC_MS_D ,KC_NO ,KC_MUTE ,KC_WH_D
160,KC_NO ,KC_NO ,KC_BTN3 ,KC_BTN1 ,KC_BTN2 138,KC_NO ,KC_NO ,KC_BTN3 ,KC_BTN1 ,KC_BTN2
161 ,KC_WSTP ,KC_WREF 139 ,KC_WSTP ,KC_WREF
162 ,KC_WSCH 140 ,KC_WSCH
@@ -257,248 +235,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
257) 235)
258}; 236};
259 237
260const uint16_t PROGMEM fn_actions[] = {
261 // the faux shift keys are implemented as macro taps
262 [LSymb] = ACTION_MACRO_TAP(LSymb)
263 ,[LMdia] = ACTION_MACRO_TAP(LMdia)
264 ,[LSpec] = ACTION_MACRO_TAP(LSpec)
265 ,[RSymb] = ACTION_MACRO_TAP(RSymb)
266 ,[RMdia] = ACTION_MACRO_TAP(RMdia)
267 ,[RSpec] = ACTION_MACRO_TAP(RSpec)
268};
269
270uint16_t symb_shift = 0;
271uint16_t mdia_shift = 0;
272uint16_t spec_shift = 0;
273
274bool mdia_lock = false;
275bool symb_lock = false;
276
277const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
278{
279 switch(id) {
280 // There are two shift keys for each layer so we increment a layer_shift var when one
281 // is pressed and decrement when one is released. The shift counts are bound between 0 and 2
282 // only because sometimes rapid pressing led to irregular events; this way the states
283 // are self healing during use.
284
285 case LSymb: //
286 if (record->event.pressed) { // when the LSymb button is pressed
287 if(++symb_shift > 2) symb_shift = 2; // increment the symb shift count, max two
288 if(spec_shift) symb_lock = !symb_lock; // if the Special layer is on, toggle the shift lock
289 layer_on(SYMB); // in any case, turn on the Symbols layer
290 } else { // when the LSymb button is released
291 if(--symb_shift < 0) symb_shift = 0; // decrement the shift count, minimum zero
292 if((!symb_shift) && (!symb_lock)) layer_off(SYMB); // if both shifts are released and the lock is off, turn off the Symbols layer
293 }
294 break;
295
296 case LMdia:
297 if (record->event.pressed) {
298 if (record->tap.count && (!mdia_shift) && (!mdia_lock) && (!spec_shift)) {
299 register_code(KC_TAB);
300 } else {
301 if(spec_shift) mdia_lock = !mdia_lock;
302 if(++mdia_shift > 2) mdia_shift = 2;
303 layer_on(MDIA);
304 }
305 } else {
306 if(record->tap.count && (!mdia_shift) && (!mdia_lock) && (!spec_shift)) {
307 unregister_code(KC_TAB);
308 } else {
309 if(--mdia_shift < 0) mdia_shift = 0;
310 if((!mdia_shift) && (!mdia_lock)) layer_off(MDIA);
311 }
312 }
313 break;
314
315 case LSpec:
316 if (record->event.pressed) { // when the LSpec button is pressed
317 if(symb_shift) symb_lock = !symb_lock; // if another layer button is engaged, then
318 else if(mdia_shift) mdia_lock = !mdia_lock; // lock that layer, be it caps or symb or mdia
319 else if (record->tap.count && !record->tap.interrupted && (!spec_shift)) {
320 register_code(KC_GRV); // otherwise, if it's an uninterrupted tap, emit a char
321 } else {
322 if(++spec_shift > 2) spec_shift = 2;
323 layer_on(SPEC); // otherwise, turn on the Special layer
324 }
325 } else {
326 if(record->tap.count && !record->tap.interrupted && (!spec_shift)) {
327 unregister_code(KC_GRV);
328 } else {
329 if(--spec_shift < 0) spec_shift = 0;
330 if(!spec_shift) layer_off(SPEC);
331 }
332 }
333 break;
334
335 case RSymb:
336 if (record->event.pressed) {
337 if (record->tap.count && (!symb_shift) && (!symb_lock) && (!spec_shift)) {
338 register_code(KC_QUOT);
339 } else {
340 if(++symb_shift > 2) symb_shift = 2;
341 if(spec_shift) symb_lock = !symb_lock;
342 layer_on(SYMB);
343 }
344 } else {
345 if(record->tap.count && (!symb_shift) && (!symb_lock) && (!spec_shift)) {
346 unregister_code(KC_QUOT);
347 } else {
348 if(--symb_shift < 0) symb_shift = 0;
349 if((!symb_shift) && (!symb_lock)) layer_off(SYMB);
350 }
351 }
352 break;
353
354 case RMdia:
355 if (record->event.pressed) {
356 if (record->tap.count && (!mdia_shift) && (!mdia_lock) && (!spec_shift)) {
357 register_code(KC_BSLS);
358 } else {
359 if(++mdia_shift > 2) mdia_shift = 2;
360 if(spec_shift) mdia_lock = !mdia_lock;
361 layer_on(MDIA);
362 }
363 } else {
364 if(record->tap.count && (!mdia_shift) && (!mdia_lock) && (!spec_shift)) {
365 unregister_code(KC_BSLS);
366 } else {
367 if(--mdia_shift < 0) mdia_shift = 0;
368 if((!mdia_shift) && (!mdia_lock)) layer_off(MDIA);
369 }
370 }
371 break;
372
373 case RSpec:
374 if (record->event.pressed) {
375 if(symb_shift) symb_lock = !symb_lock;
376 else if(mdia_shift) mdia_lock = !mdia_lock;
377 else if (record->tap.count && !record->tap.interrupted && (!spec_shift)) {
378 register_code(KC_EQL);
379 } else {
380 if(++spec_shift > 2) spec_shift = 2;
381 layer_on(SPEC);
382 }
383 } else {
384 if(record->tap.count && !record->tap.interrupted && (!spec_shift)) {
385 unregister_code(KC_EQL);
386 } else {
387 if(--spec_shift < 0) spec_shift = 0;
388 if(!spec_shift) layer_off(SPEC);
389 }
390 }
391 break;
392
393 case NotEq:
394 if (record->event.pressed) {
395 return MACRO( I(10), D(LSFT), T(1), U(LSFT), T(EQL), END ); // !=
396 }
397 break;
398
399 case GrtEq:
400 if (record->event.pressed) {
401 return MACRO( I(10), D(LSFT), T(COMM), U(LSFT), T(EQL), END ); // <=
402 }
403 break;
404
405 case LesEq:
406 if (record->event.pressed) {
407 return MACRO( I(10), D(LSFT), T(DOT), U(LSFT), T(EQL), END ); // >=
408 }
409 break;
410
411 case DeRef:
412 if (record->event.pressed) {
413 return MACRO( I(10), T(MINS), D(LSFT), T(DOT), U(LSFT), END ); // ->
414 }
415 break;
416
417 // mouse diagonals
418
419 case MUL: // mouse up left
420 if (record->event.pressed) {
421 mousekey_on(KC_MS_UP);
422 mousekey_on(KC_MS_LEFT);
423 mousekey_send();
424 } else {
425 mousekey_off(KC_MS_UP);
426 mousekey_off(KC_MS_LEFT);
427 mousekey_send();
428 }
429 break;
430
431 case MUR: // mouse up right
432 if (record->event.pressed) {
433 mousekey_on(KC_MS_UP);
434 mousekey_on(KC_MS_RIGHT);
435 mousekey_send();
436 } else {
437 mousekey_off(KC_MS_UP);
438 mousekey_off(KC_MS_RIGHT);
439 mousekey_send();
440 }
441 break;
442
443 case MDL: // mouse down left
444 if (record->event.pressed) {
445 mousekey_on(KC_MS_DOWN);
446 mousekey_on(KC_MS_LEFT);
447 mousekey_send();
448 } else {
449 mousekey_off(KC_MS_DOWN);
450 mousekey_off(KC_MS_LEFT);
451 mousekey_send();
452 }
453 break;
454
455 case MDR: // mouse down right
456 if (record->event.pressed) {
457 mousekey_on(KC_MS_DOWN);
458 mousekey_on(KC_MS_RIGHT);
459 mousekey_send();
460 } else {
461 mousekey_off(KC_MS_DOWN);
462 mousekey_off(KC_MS_RIGHT);
463 mousekey_send();
464 }
465 break;
466
467 default:
468 // none
469 break;
470 }
471
472 return MACRO_NONE;
473};
474
475// Runs just one time when the keyboard initializes.
476void matrix_init_user(void) {
477
478};
479
480// Runs constantly in the background, in a loop. 238// Runs constantly in the background, in a loop.
481void matrix_scan_user(void) { 239void matrix_scan_user(void) {
482 // shift or caps lock turns on red light 240 // shift or caps lock turns on red light
483 if((keyboard_report->mods & MOD_BIT(KC_LSFT)) 241 if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) {
484 || (keyboard_report->mods & MOD_BIT(KC_RSFT))
485 || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) {
486 ergodox_right_led_1_on(); 242 ergodox_right_led_1_on();
487 } else { 243 } else {
488 ergodox_right_led_1_off(); 244 ergodox_right_led_1_off();
489 } 245 }
490 246
491 // Symbol layer turns on green light 247 // Symbol layer turns on green light
492 if(layer_state & (1UL<<SYMB)) { 248 if (layer_state & (1UL<<SYMB)) {
493 ergodox_right_led_2_on(); 249 ergodox_right_led_2_on();
494 } else { 250 } else {
495 ergodox_right_led_2_off(); 251 ergodox_right_led_2_off();
496 } 252 }
497 253
498 // Media layer turns on blue light 254 // Media layer turns on blue light
499 if(layer_state & (1UL<<MDIA)) { 255 if (layer_state & (1UL<<MDIA)) {
500 ergodox_right_led_3_on(); 256 ergodox_right_led_3_on();
501 } else { 257 } else {
502 ergodox_right_led_3_off(); 258 ergodox_right_led_3_off();
503 } 259 }
504}; 260}
diff --git a/layouts/community/ergodox/osx_whiskey_tango_foxtrot_capslock/keymap.c b/layouts/community/ergodox/osx_whiskey_tango_foxtrot_capslock/keymap.c
index 6bf0285ab..54e1183e9 100644
--- a/layouts/community/ergodox/osx_whiskey_tango_foxtrot_capslock/keymap.c
+++ b/layouts/community/ergodox/osx_whiskey_tango_foxtrot_capslock/keymap.c
@@ -4,21 +4,17 @@
4 */ 4 */
5 5
6#include QMK_KEYBOARD_H 6#include QMK_KEYBOARD_H
7#include "debug.h"
8#include "action_layer.h"
9#include "timer.h"
10 7
11#define BASE 0 // default layer 8enum layer_names {
12#define SYMB 1 // symbols 9 BASE, // default layer
13#define MDIA 2 // media keys 10 SYMB, // symbols
11 MDIA // media keys
12};
14 13
15#define BLINK_BASE 150U // timer threshold for blinking on MDIA layer 14#define BLINK_BASE 150U // timer threshold for blinking on MDIA layer
16 15
17typedef enum onoff_t {OFF, ON} onoff; 16typedef enum onoff_t {OFF, ON} onoff;
18 17
19#define caps_led_on ergodox_right_led_2_on
20#define caps_led_off ergodox_right_led_2_off
21
22const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 18const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
23/* Keymap 0: Basic layer 19/* Keymap 0: Basic layer
24 * 20 *
@@ -45,18 +41,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
45 [BASE] = LAYOUT_ergodox( // layer 0 : default 41 [BASE] = LAYOUT_ergodox( // layer 0 : default
46 // left hand 42 // left hand
47 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, 43 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6,
48 KC_TAB, M(KC_Q), M(KC_W), M(KC_E), M(KC_R), M(KC_T), KC_LBRC, 44 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC,
49 M(KC_CAPS), M(KC_A), M(KC_S), M(KC_D), M(KC_F), M(KC_G), 45 KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G,
50 KC_LSFT, M(KC_Z), M(KC_X), M(KC_C), M(KC_V), M(KC_B), MO(SYMB), 46 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, MO(SYMB),
51 KC_LCTL, KC_LALT, KC_LGUI, KC_LEFT, KC_RGHT, 47 KC_LCTL, KC_LALT, KC_LGUI, KC_LEFT, KC_RGHT,
52 KC_TRNS, F(1), 48 KC_TRNS, TG(SYMB),
53 KC_HOME, 49 KC_HOME,
54 KC_BSPC, KC_DEL, KC_END, 50 KC_BSPC, KC_DEL, KC_END,
55 // right hand 51 // right hand
56 KC_GRV, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, 52 KC_GRV, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL,
57 KC_RBRC, M(KC_Y), M(KC_U), M(KC_I), M(KC_O), M(KC_P), KC_BSLS, 53 KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
58 M(KC_H), M(KC_J), M(KC_K), M(KC_L), KC_SCLN, KC_QUOT, 54 KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
59 MO(SYMB), M(KC_N), M(KC_M), KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, 55 MO(SYMB), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
60 KC_DOWN, KC_UP, KC_RCTL, KC_RGUI, KC_RALT, 56 KC_DOWN, KC_UP, KC_RCTL, KC_RGUI, KC_RALT,
61 KC_RALT, KC_RCTL, 57 KC_RALT, KC_RCTL,
62 KC_PGUP, 58 KC_PGUP,
@@ -91,7 +87,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
91 KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, 87 KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
92 KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, 88 KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
93 KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, 89 KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
94 F(3), F(2), 90 TG(SYMB),TG(MDIA),
95 KC_TRNS, 91 KC_TRNS,
96 KC_TRNS,KC_TRNS,KC_TRNS, 92 KC_TRNS,KC_TRNS,KC_TRNS,
97 // right hand 93 // right hand
@@ -132,7 +128,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
132 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 128 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
133 KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 129 KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
134 KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, 130 KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO,
135 F(4), KC_NO, 131 TG(MDIA),KC_NO,
136 KC_TRNS, 132 KC_TRNS,
137 KC_TRNS, KC_TRNS, KC_TRNS, 133 KC_TRNS, KC_TRNS, KC_TRNS,
138 // right hand 134 // right hand
@@ -147,64 +143,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
147 ), 143 ),
148}; 144};
149 145
150const uint16_t PROGMEM fn_actions[] = {
151 [1] = ACTION_LAYER_ON(SYMB,ON_RELEASE), // FN1 - Enable Layer 1 (Symbols)
152 [2] = ACTION_LAYER_ON(MDIA,ON_RELEASE), // FN2 - Enable Layer 2 (Media)
153 [3] = ACTION_LAYER_OFF(SYMB,ON_RELEASE), // FN3 - Disable Layer 1 (Symbols)
154 [4] = ACTION_LAYER_OFF(MDIA,ON_RELEASE), // FN4 - Disable Layer 2 (MMedia)
155};
156
157
158const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
159 static onoff caps_state = OFF;
160 switch(id) {
161 case KC_CAPS:
162 if (record->event.pressed) {
163 // Toggle caps state;
164 if (caps_state == OFF) {
165 // Turn it on then!
166 caps_led_on();
167 caps_state = ON;
168 } else {
169 caps_led_off();
170 caps_state = OFF;
171 }
172 }
173 break;
174 default:
175 if (record->event.pressed) {
176 bool shifted = false;
177 if (caps_state == ON && get_mods() == 0) {
178 register_code(KC_LSFT);
179 shifted = true;
180 }
181 register_code(id);
182 if(shifted) {
183 unregister_code(KC_LSFT);
184 }
185 } else {
186 unregister_code(id);
187 }
188 break;
189 }
190 return MACRO_NONE;
191};
192
193// Runs just one time when the keyboard initializes.
194void matrix_init_user(void) {
195
196}
197// Runs constantly in the background, in a loop. 146// Runs constantly in the background, in a loop.
198void matrix_scan_user(void) { 147void matrix_scan_user(void) {
199 uint8_t layer = biton32(layer_state); 148 uint8_t layer = get_highest_layer(layer_state);
200 149
201 static onoff board_led_state = OFF; 150 static onoff board_led_state = OFF;
202 static uint16_t dt = 0; 151 static uint16_t dt = 0;
203 static uint8_t oldlayer = 0; 152 static uint8_t oldlayer = 0;
204 153
205 if(oldlayer != layer) { 154 if (oldlayer != layer) {
206 // Layer was just toggled. 155 // Layer was just toggled.
207 if(layer == BASE) { 156 if (layer == BASE) {
208 ergodox_board_led_off(); 157 ergodox_board_led_off();
209 board_led_state = OFF; 158 board_led_state = OFF;
210 } else { 159 } else {
@@ -213,10 +162,10 @@ void matrix_scan_user(void) {
213 } 162 }
214 } else if (layer >= MDIA) { 163 } else if (layer >= MDIA) {
215 // We need to do blinking. 164 // We need to do blinking.
216 if(timer_elapsed(dt) > BLINK_BASE) { 165 if (timer_elapsed(dt) > BLINK_BASE) {
217 // toggle 166 // toggle
218 dt = timer_read(); 167 dt = timer_read();
219 if(board_led_state == OFF) { 168 if (board_led_state == OFF) {
220 ergodox_board_led_on(); 169 ergodox_board_led_on();
221 board_led_state = ON; 170 board_led_state = ON;
222 } else { 171 } else {
diff --git a/layouts/community/ergodox/plover/keymap.c b/layouts/community/ergodox/plover/keymap.c
index b19634643..ffb869309 100644
--- a/layouts/community/ergodox/plover/keymap.c
+++ b/layouts/community/ergodox/plover/keymap.c
@@ -164,7 +164,7 @@ LAYOUT_ergodox(
164 KC_NO, KC_Q, KC_W, KC_E, KC_R, KC_T, 164 KC_NO, KC_Q, KC_W, KC_E, KC_R, KC_T,
165 KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G, KC_NO, 165 KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G, KC_NO,
166 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, 166 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
167 KC_FN4, KC_NO, 167 KC_NO, KC_NO,
168 KC_NO, 168 KC_NO,
169 KC_C, KC_V, KC_NO, 169 KC_C, KC_V, KC_NO,
170 // right hand 170 // right hand
diff --git a/layouts/community/ergodox/plums/keymap.c b/layouts/community/ergodox/plums/keymap.c
index c75ce0f97..dd273e579 100644
--- a/layouts/community/ergodox/plums/keymap.c
+++ b/layouts/community/ergodox/plums/keymap.c
@@ -1,6 +1,4 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2#include "debug.h"
3#include "action_layer.h"
4 2
5#define BASE 0 // default layer 3#define BASE 0 // default layer
6#define SYMB 1 // symbols 4#define SYMB 1 // symbols
@@ -36,7 +34,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
36 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, 34 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC,
37 KC_LGUI, KC_A, KC_S, KC_D, KC_F, KC_G, 35 KC_LGUI, KC_A, KC_S, KC_D, KC_F, KC_G,
38 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, TG(SYMB), 36 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, TG(SYMB),
39 F(0), KC_LCBR, KC_LPRN,KC_PIPE,KC_COLN, 37 KC_NO, KC_LCBR, KC_LPRN,KC_PIPE,KC_COLN,
40 LGUI(KC_LALT), KC_LALT, 38 LGUI(KC_LALT), KC_LALT,
41 KC_HOME, 39 KC_HOME,
42 KC_BSPC, KC_ESC, KC_END, 40 KC_BSPC, KC_ESC, KC_END,
@@ -45,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
45 KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, 43 KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
46 KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, 44 KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
47 TG(MDIA), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, 45 TG(MDIA), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
48 KC_MINS, KC_EQL, KC_RPRN, KC_RCBR, F(1), 46 KC_MINS, KC_EQL, KC_RPRN, KC_RCBR, KC_NO,
49 KC_RALT, KC_MPLY, 47 KC_RALT, KC_MPLY,
50 KC_PGUP, 48 KC_PGUP,
51 KC_PGDN, KC_ENT, KC_SPC 49 KC_PGDN, KC_ENT, KC_SPC
@@ -135,85 +133,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
135), 133),
136}; 134};
137 135
138const uint16_t PROGMEM fn_actions[] = {
139 [0] = ACTION_MACRO_TAP(0), // FN0 - Ctrl + a (For screen/tmux)
140 [1] = ACTION_MACRO_TAP(1) // FN1 - Ctrl + ` (For quake style console)
141};
142
143const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // this is the function signature -- just copy/paste it into your keymap file as it is.
144{
145 switch(id) {
146 case 0:
147 if (record->event.pressed) {
148 if (record->tap.count) {
149 if (record->tap.interrupted) {
150 record->tap.count = 0;
151 // hold press action
152 register_code(KC_LCTL);
153 } else {
154 // tap press action
155 return MACRO( D(LCTL), T(A), U(LCTL), END );
156 }
157 } else {
158 // hold press action
159 register_code(KC_LCTL);
160 }
161 } else {
162 if (record->tap.count) {
163 // tap release action
164 } else {
165 // hold release action
166 unregister_code(KC_LCTL);
167 }
168 record->tap.count = 0;
169 }
170 break;
171 case 1:
172 if (record->event.pressed) {
173 if (record->tap.count) {
174 if (record->tap.interrupted) {
175 record->tap.count = 0;
176 // hold press action
177 register_code(KC_RCTL);
178 } else {
179 // tap press action
180 return MACRO( DOWN(KC_RCTL), TYPE(KC_GRV), UP(KC_RCTL), END );
181 }
182 } else {
183 // hold press action
184 register_code(KC_RCTL);
185 }
186 } else {
187 if (record->tap.count) {
188 // tap release action
189 } else {
190 // hold release action
191 unregister_code(KC_RCTL);
192 }
193 record->tap.count = 0;
194 }
195 break;
196 }
197 return MACRO_NONE;
198};
199
200
201
202// Runs just one time when the keyboard initializes.
203void matrix_init_user(void) {
204
205};
206
207// Runs constantly in the background, in a loop. 136// Runs constantly in the background, in a loop.
208void matrix_scan_user(void) { 137void matrix_scan_user(void) {
209
210 uint8_t layer = biton32(layer_state);
211
212 ergodox_board_led_off(); 138 ergodox_board_led_off();
213 ergodox_right_led_1_off(); 139 ergodox_right_led_1_off();
214 ergodox_right_led_2_off(); 140 ergodox_right_led_2_off();
215 ergodox_right_led_3_off(); 141 ergodox_right_led_3_off();
216 switch (layer) { 142
143 switch (get_highest_layer(layer_state)) {
217 // TODO: Make this relevant to the ErgoDox EZ. 144 // TODO: Make this relevant to the ErgoDox EZ.
218 case 1: 145 case 1:
219 ergodox_right_led_1_on(); 146 ergodox_right_led_1_on();
@@ -225,5 +152,4 @@ void matrix_scan_user(void) {
225 // none 152 // none
226 break; 153 break;
227 } 154 }
228 155}
229};
diff --git a/layouts/community/ergodox/teckinesis/keymap.c b/layouts/community/ergodox/teckinesis/keymap.c
index 0b65572f6..509b91af9 100644
--- a/layouts/community/ergodox/teckinesis/keymap.c
+++ b/layouts/community/ergodox/teckinesis/keymap.c
@@ -1,28 +1,11 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2#include "led.h"
3#include "debug.h"
4#include "action_layer.h"
5#include "action_util.h"
6#include "mousekey.h"
7 2
8#define BASE 0 // default layer 3enum layer_names {
9#define SYMB 1 // symbols layer 4 BASE, // default layer
10#define MDIA 2 // media layer 5 SYMB, // symbols layer
11#define SPEC 3 // special layer 6 MDIA, // media layer
12 7 SPEC // special layer
13#define LCaps 10 // left caps-shift key 8};
14#define LSymb 11 // left symbol-shift key
15#define LMdia 12 // left media-shift key
16#define LSpec 13 // left special-shift key
17#define RCaps 14 // right caps-shift key
18#define RSymb 15 // right symbol-shift key
19#define RMdia 16 // right media-shift key
20#define RSpec 17 // right special-shift key
21
22#define MUL 20 // mouse up left
23#define MUR 21 // mouse up right
24#define MDL 22 // mouse down left
25#define MDR 23 // mouse down right
26 9
27/* 10/*
28 * teckinesis layout for ErgoDox (EZ) 11 * teckinesis layout for ErgoDox (EZ)
@@ -62,19 +45,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
62 */ 45 */
63[BASE] = LAYOUT_ergodox( 46[BASE] = LAYOUT_ergodox(
64// left hand 47// left hand
65 F(LSpec),KC_1,KC_2,KC_3 ,KC_4 ,KC_5 ,KC_ESC 48 KC_NO ,KC_1,KC_2,KC_3 ,KC_4 ,KC_5 ,KC_ESC
66,F(LMdia) ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC 49,KC_NO ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC
67,M(LSymb) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G 50,KC_NO ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G
68,M(LCaps) ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,LSFT(KC_TAB) 51,KC_NO ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,LSFT(KC_TAB)
69,KC_LCTL,MEH_T(KC_BSLS),ALL_T(KC_SLSH),KC_LALT,KC_LGUI 52,KC_LCTL,MEH_T(KC_BSLS),ALL_T(KC_SLSH),KC_LALT,KC_LGUI
70 ,KC_HOME,KC_END 53 ,KC_HOME,KC_END
71 ,KC_PGUP 54 ,KC_PGUP
72 ,KC_BSPC,KC_DEL ,KC_PGDN 55 ,KC_BSPC,KC_DEL ,KC_PGDN
73 // right hand 56 // right hand
74 ,KC_GRV ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,F(RSpec) 57 ,KC_GRV ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_NO
75 ,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,F(RMdia) 58 ,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_NO
76 ,KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,F(RSymb) 59 ,KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,KC_NO
77 ,KC_TAB ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,M(RCaps) 60 ,KC_TAB ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,KC_NO
78 ,KC_RGUI,KC_RALT,ALL_T(KC_LBRC),MEH_T(KC_RBRC),KC_RCTL 61 ,KC_RGUI,KC_RALT,ALL_T(KC_LBRC),MEH_T(KC_RBRC),KC_RCTL
79 ,KC_LEFT ,KC_RGHT 62 ,KC_LEFT ,KC_RGHT
80 ,KC_UP 63 ,KC_UP
@@ -147,9 +130,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
147[MDIA] = LAYOUT_ergodox( 130[MDIA] = LAYOUT_ergodox(
148// left hand 131// left hand
149 KC_TRNS ,KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,KC_ESC 132 KC_TRNS ,KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,KC_ESC
150,KC_TRNS ,KC_NO ,M(MUL) ,KC_MS_U ,M(MUR) ,KC_VOLU ,KC_WH_U 133,KC_TRNS ,KC_NO ,KC_NO ,KC_MS_U ,KC_NO ,KC_VOLU ,KC_WH_U
151,KC_TRNS ,KC_NO ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_VOLD 134,KC_TRNS ,KC_NO ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_VOLD
152,KC_TRNS ,KC_NO ,M(MDL) ,KC_MS_D ,M(MDR) ,KC_MUTE ,KC_WH_D 135,KC_TRNS ,KC_NO ,KC_NO ,KC_MS_D ,KC_NO ,KC_MUTE ,KC_WH_D
153,KC_LCTL ,KC_MEH ,KC_BTN3 ,KC_BTN1 ,KC_BTN2 136,KC_LCTL ,KC_MEH ,KC_BTN3 ,KC_BTN1 ,KC_BTN2
154 ,KC_WSTP ,KC_WREF 137 ,KC_WSTP ,KC_WREF
155 ,KC_WSCH 138 ,KC_WSCH
@@ -210,246 +193,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
210 ) 193 )
211}; 194};
212 195
213const uint16_t PROGMEM fn_actions[] = {
214 // the faux shift keys are implemented as macro taps
215 [LCaps] = ACTION_MACRO_TAP(LCaps)
216 ,[LSymb] = ACTION_MACRO_TAP(LSymb)
217 ,[LMdia] = ACTION_MACRO_TAP(LMdia)
218 ,[LSpec] = ACTION_MACRO_TAP(LSpec)
219 ,[RCaps] = ACTION_MACRO_TAP(RCaps)
220 ,[RSymb] = ACTION_MACRO_TAP(RSymb)
221 ,[RMdia] = ACTION_MACRO_TAP(RMdia)
222 ,[RSpec] = ACTION_MACRO_TAP(RSpec)
223};
224
225uint16_t caps_shift = 0;
226uint16_t symb_shift = 0;
227uint16_t mdia_shift = 0;
228
229bool symb_lock = false;
230bool mdia_lock = false;
231
232const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
233{
234 switch(id) {
235 // There are two shift keys for each layer so we increment a layer_shift var when one
236 // is pressed and decrement when one is released. If both are pressed at the same time
237 // then the layer is locked (or unlocked). The shift counts are bound between 0 and 2
238 // only because sometimes rapid pressing led to irregular events; this way the states
239 // are self healing during use.
240
241 case LCaps: // both caps-shift keys trigger Left Shift
242 case RCaps: // so they don't interfere with the magic combo
243 if (record->event.pressed && !record->tap.count) {
244 if(++caps_shift > 2) caps_shift = 2;
245 if(caps_shift == 2) {
246 register_code(KC_CAPS);
247 unregister_code(KC_CAPS);
248 } else if(caps_shift == 1) {
249 register_code(KC_LSFT);
250 }
251 } else {
252 if(--caps_shift < 0) caps_shift = 0;
253 if(caps_shift == 0) unregister_code(KC_LSFT);
254 }
255 break;
256
257 case LSymb:
258 if (record->event.pressed) {
259 if(++symb_shift > 2) symb_shift = 2;
260 if(symb_shift == 2) {
261 symb_lock = !symb_lock;
262 } else if(symb_shift == 1) {
263 layer_on(SYMB);
264 }
265 } else {
266 if(--symb_shift < 0) symb_shift = 0;
267 if((symb_shift == 0) && (!symb_lock)) layer_off(SYMB);
268 }
269 break;
270
271 case LMdia:
272 if (record->event.pressed) {
273 if (record->tap.count && (!mdia_shift) && (!mdia_lock)) {
274 register_code(KC_TAB);
275 } else {
276 if(++mdia_shift > 2) mdia_shift = 2;
277 if(mdia_shift == 2) {
278 mdia_lock = !mdia_lock;
279 } else if(mdia_shift == 1) {
280 layer_on(MDIA);
281 }
282 }
283 } else {
284 if(record->tap.count && (!mdia_shift) && (!mdia_lock)) {
285 unregister_code(KC_TAB);
286 } else {
287 if(--mdia_shift < 0) mdia_shift = 0;
288 if((!mdia_shift) && (!mdia_lock)) layer_off(MDIA);
289 }
290 }
291 break;
292
293 case LSpec:
294 if (record->event.pressed) {
295 if (record->tap.count && !record->tap.interrupted) {
296 register_code(KC_EQL);
297 } else {
298 layer_on(SPEC);
299 }
300 } else {
301 if(record->tap.count && !record->tap.interrupted) {
302 unregister_code(KC_EQL);
303 } else {
304 layer_off(SPEC);
305 }
306 }
307 break;
308
309 case RSymb:
310 if (record->event.pressed) {
311 if (record->tap.count && (!symb_shift) && (!symb_lock)) {
312 register_code(KC_QUOT);
313 } else {
314 if(++symb_shift > 2) symb_shift = 2;
315 if(symb_shift == 2) {
316 symb_lock = !symb_lock;
317 } else if(symb_shift == 1) {
318 layer_on(SYMB);
319 }
320 }
321 } else {
322 if(record->tap.count && symb_shift == 0) {
323 unregister_code(KC_QUOT);
324 } else {
325 if(--symb_shift < 0) symb_shift = 0;
326 if((!symb_shift) && (!symb_lock)) layer_off(SYMB);
327 }
328 }
329 break;
330
331 case RMdia:
332 if (record->event.pressed) {
333 if (record->tap.count && (!mdia_shift) && (!mdia_lock)) {
334 register_code(KC_BSLS);
335 } else {
336 if(++mdia_shift > 2) mdia_shift = 2;
337 if(mdia_shift == 2) {
338 mdia_lock = !mdia_lock;
339 } else if(mdia_shift == 1) {
340 layer_on(MDIA);
341 }
342 }
343 } else {
344 if(record->tap.count && (!mdia_shift) && (!mdia_lock)) {
345 unregister_code(KC_BSLS);
346 } else {
347 if(--mdia_shift < 0) mdia_shift = 0;
348 if((!mdia_shift) && (!mdia_lock)) layer_off(MDIA);
349 }
350 }
351 break;
352
353 case RSpec:
354 if (record->event.pressed) {
355 if (record->tap.count && !record->tap.interrupted) {
356 register_code(KC_MINS);
357 } else {
358 layer_on(SPEC);
359 }
360 } else {
361 if(record->tap.count && !record->tap.interrupted) {
362 unregister_code(KC_MINS);
363 } else {
364 layer_off(SPEC);
365 }
366 }
367 break;
368
369 // mouse diagonals
370
371 case MUL: // mouse up left
372 if (record->event.pressed) {
373 mousekey_on(KC_MS_UP);
374 mousekey_on(KC_MS_LEFT);
375 mousekey_send();
376 } else {
377 mousekey_off(KC_MS_UP);
378 mousekey_off(KC_MS_LEFT);
379 mousekey_send();
380 }
381 break;
382
383 case MUR: // mouse up right
384 if (record->event.pressed) {
385 mousekey_on(KC_MS_UP);
386 mousekey_on(KC_MS_RIGHT);
387 mousekey_send();
388 } else {
389 mousekey_off(KC_MS_UP);
390 mousekey_off(KC_MS_RIGHT);
391 mousekey_send();
392 }
393 break;
394
395 case MDL: // mouse down left
396 if (record->event.pressed) {
397 mousekey_on(KC_MS_DOWN);
398 mousekey_on(KC_MS_LEFT);
399 mousekey_send();
400 } else {
401 mousekey_off(KC_MS_DOWN);
402 mousekey_off(KC_MS_LEFT);
403 mousekey_send();
404 }
405 break;
406
407 case MDR: // mouse down right
408 if (record->event.pressed) {
409 mousekey_on(KC_MS_DOWN);
410 mousekey_on(KC_MS_RIGHT);
411 mousekey_send();
412 } else {
413 mousekey_off(KC_MS_DOWN);
414 mousekey_off(KC_MS_RIGHT);
415 mousekey_send();
416 }
417 break;
418
419 default:
420 // none
421 break;
422 }
423
424 return MACRO_NONE;
425};
426
427// Runs just one time when the keyboard initializes.
428void matrix_init_user(void) {
429
430};
431
432// Runs constantly in the background, in a loop. 196// Runs constantly in the background, in a loop.
433void matrix_scan_user(void) { 197void matrix_scan_user(void) {
434 // shift or caps lock turns on red light 198 // shift or caps lock turns on red light
435 if(caps_shift || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) { 199 if((keyboard_report->mods & MOD_BIT(KC_RSFT)) || (host_keyboard_led_state().caps_lock)) {
436 ergodox_right_led_1_on(); 200 ergodox_right_led_1_on();
437 } else { 201 } else {
438 ergodox_right_led_1_off(); 202 ergodox_right_led_1_off();
439 } 203 }
440 204
441 // Symbol layer turns on green light 205 // Symbol layer turns on green light
442 if(layer_state & (1UL<<SYMB)) { 206 if(IS_LAYER_ON(SYMB)) {
443 ergodox_right_led_2_on(); 207 ergodox_right_led_2_on();
444 } else { 208 } else {
445 ergodox_right_led_2_off(); 209 ergodox_right_led_2_off();
446 } 210 }
447 211
448 // Media layer turns on blue light 212 // Media layer turns on blue light
449 if(layer_state & (1UL<<MDIA)) { 213 if(IS_LAYER_ON(MDIA)) {
450 ergodox_right_led_3_on(); 214 ergodox_right_led_3_on();
451 } else { 215 } else {
452 ergodox_right_led_3_off(); 216 ergodox_right_led_3_off();
453 } 217 }
454}; 218}
455
diff --git a/layouts/community/ergodox/workman_osx_mdw/keymap.c b/layouts/community/ergodox/workman_osx_mdw/keymap.c
index f14d9cf4c..5b2c7d718 100644
--- a/layouts/community/ergodox/workman_osx_mdw/keymap.c
+++ b/layouts/community/ergodox/workman_osx_mdw/keymap.c
@@ -1,6 +1,5 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2#include "debug.h" 2
3#include "action_layer.h"
4// readme 3// readme
5// This keyboard layout is based on the [Workman Dead layout](https://github.com/ojbucao/Workman/tree/master/mac#workman-dead-for-programmers), which uses the comma as a dead key to trigger a second layer. 4// This keyboard layout is based on the [Workman Dead layout](https://github.com/ojbucao/Workman/tree/master/mac#workman-dead-for-programmers), which uses the comma as a dead key to trigger a second layer.
6// Since I have more keys at my disposal on the ErgoDox, I moved the dead key to the bottom right. There are still a lot of 5// Since I have more keys at my disposal on the ErgoDox, I moved the dead key to the bottom right. There are still a lot of
@@ -9,12 +8,46 @@
9// triggers the key you pressed AND switches the layout back to the original. For now I do this with a super kludgey macro and I 8// triggers the key you pressed AND switches the layout back to the original. For now I do this with a super kludgey macro and I
10// look forward to learning about a more elegant way to do the same thing. Until then, this will have to do. 9// look forward to learning about a more elegant way to do the same thing. Until then, this will have to do.
11 10
11enum layer_names {
12 BASE, // default layer
13 SYMB, // symbols
14 MDIA, // media keys
15 DEAD // dead version of the symbols layer
16};
12 17
13// TODO: Define layer names that make sense for the ErgoDox EZ. 18enum custom_keycodes {
14#define BASE 0 // default layer 19 M_100 = SAFE_RANGE,
15#define SYMB 1 // symbols 20 M_101,
16#define MDIA 2 // media keys 21 M_102,
17#define DEAD 3 // dead version of the symbols layer 22 M_103,
23 M_104,
24 M_105,
25 M_106,
26 M_107,
27 M_108,
28 M_109,
29 M_110,
30 M_111,
31 M_112,
32 M_113,
33 M_114,
34 M_115,
35 M_116,
36 M_117,
37 M_118,
38 M_119,
39 M_120,
40 M_121,
41 M_122,
42 M_123,
43 M_124,
44 M_125,
45 M_126,
46 M_127,
47 M_128,
48 M_129,
49 M_130
50};
18 51
19const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 52const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
20/* Keymap 0: Basic layer 53/* Keymap 0: Basic layer
@@ -43,7 +76,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
43[BASE] = LAYOUT_ergodox( // layer 0 : default 76[BASE] = LAYOUT_ergodox( // layer 0 : default
44 // left hand 77 // left hand
45 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, 78 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT,
46 KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, TG(1), 79 KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, TG(SYMB),
47 ALL_T(KC_ESC), KC_A, KC_S, KC_H, KC_T, KC_G, 80 ALL_T(KC_ESC), KC_A, KC_S, KC_H, KC_T, KC_G,
48 KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_NO, 81 KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_NO,
49 KC_NO, KC_NO, KC_LCTL,KC_LALT,KC_LGUI, 82 KC_NO, KC_NO, KC_LCTL,KC_LALT,KC_LGUI,
@@ -52,10 +85,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
52 KC_BSPC,KC_SPC,KC_END, 85 KC_BSPC,KC_SPC,KC_END,
53 // right hand 86 // right hand
54 KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, 87 KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
55 TG(1), KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSLS, 88 TG(SYMB), KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSLS,
56 KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOT, 89 KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOT,
57 MEH_T(KC_NO),KC_K, KC_L, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, 90 MEH_T(KC_NO),KC_K, KC_L, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
58 KC_LEFT,KC_DOWN,KC_UP, KC_RGHT, F(4), 91 KC_LEFT,KC_DOWN,KC_UP, KC_RGHT, TG(DEAD),
59 KC_NO, KC_NO, 92 KC_NO, KC_NO,
60 KC_PGUP, 93 KC_PGUP,
61 KC_PGDN,KC_SPC,KC_ENT 94 KC_PGDN,KC_SPC,KC_ENT
@@ -168,18 +201,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
168[DEAD] = LAYOUT_ergodox( 201[DEAD] = LAYOUT_ergodox(
169 // left hand 202 // left hand
170 KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, 203 KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
171 KC_TRNS, M(100), M(101), M(102), M(103), M(104), KC_TRNS, 204 KC_TRNS, M_100, M_101, M_102, M_103, M_104, KC_TRNS,
172 KC_TRNS, M(109), M(110), M(111), M(112), M(113), 205 KC_TRNS, M_109, M_110, M_111, M_112, M_113,
173 KC_TRNS, M(120), M(121), M(122), M(123), M(124), KC_TRNS, 206 KC_TRNS, M_120, M_121, M_122, M_123, M_124, KC_TRNS,
174 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 207 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
175 KC_TRNS,KC_TRNS, 208 KC_TRNS,KC_TRNS,
176 KC_TRNS, 209 KC_TRNS,
177 KC_TRNS,KC_TRNS,KC_TRNS, 210 KC_TRNS,KC_TRNS,KC_TRNS,
178 // right hand 211 // right hand
179 KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, 212 KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
180 KC_TRNS, M(105), M(106), M(107), M(108), M(130), KC_F12, 213 KC_TRNS, M_105, M_106, M_107, M_108, M_130, KC_F12,
181 M(114), M(115), M(116), M(117), M(118), M(119), 214 M_114, M_115, M_116, M_117, M_118, M_119,
182 KC_TRNS, M(125), M(126), M(127), M(128), M(129), KC_TRNS, 215 KC_TRNS, M_125, M_126, M_127, M_128, M_129, KC_TRNS,
183 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 216 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
184 KC_TRNS, KC_TRNS, 217 KC_TRNS, KC_TRNS,
185 KC_TRNS, 218 KC_TRNS,
@@ -187,169 +220,181 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
187), 220),
188}; 221};
189 222
190const uint16_t PROGMEM fn_actions[] = { 223void tap_dead_code(uint16_t keycode) {
191 [2] = ACTION_LAYER_ON(BASE,0), // FN2 - Go back to the base layer 224 layer_clear();
192 [3] = ACTION_LAYER_ON(DEAD,0), 225 tap_code16(keycode);
193 [4] = ACTION_LAYER_TOGGLE(DEAD), 226 layer_on(DEAD);
194}; 227}
195
196const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
197{
198 // MACRODOWN only works in this function
199 switch(id) {
200 case 0:
201 if (record->event.pressed) {
202 register_code(KC_RSFT);
203 } else {
204 unregister_code(KC_RSFT);
205 }
206 break;
207 case 100:
208 layer_clear();
209 return MACRODOWN(D(LSFT), T(5), U(LSFT), T(FN4), END);
210 break;
211 case 101:
212 layer_clear();
213 return MACRODOWN(D(LSFT), T(7), U(LSFT), T(FN4), END);
214 break;
215 case 102:
216 layer_clear();
217 return MACRODOWN(D(LSFT), T(SLSH), U(LSFT), T(FN4), END);
218 break;
219 case 103:
220 layer_clear();
221 return MACRODOWN(D(LSFT), T(EQL), U(LSFT), T(FN4), END);
222 break;
223 case 104:
224 layer_clear();
225 return MACRODOWN(D(LSFT), T(2), U(LSFT), T(FN4), END);
226 break;
227 case 105:
228 layer_clear();
229 return MACRODOWN(D(LSFT), T(4), U(LSFT), T(FN4), END);
230 break;
231 case 106:
232 layer_clear();
233 return MACRODOWN(D(LSFT), T(MINS), U(LSFT), T(FN4), END);
234 break;
235 case 107:
236 layer_clear();
237 return MACRODOWN(T(LBRC), T(FN4), END);
238 break;
239 case 108:
240 layer_clear();
241 return MACRODOWN(T(RBRC), T(FN4), END);
242 break;
243 case 130:
244 layer_clear();
245 return MACRODOWN(D(LSFT), T(1), U(LSFT), T(FN4), END);
246 break;
247 case 109:
248 layer_clear();
249 return MACRODOWN(T(SLSH), T(FN4), END);
250 break;
251 case 110:
252 layer_clear();
253 return MACRODOWN(D(LSFT), T(9), U(LSFT), T(FN4), END);
254 break;
255 case 111:
256 layer_clear();
257 return MACRODOWN(T(EQL), T(FN4), END);
258 break;
259 case 112:
260 layer_clear();
261 return MACRODOWN(T(0), T(FN4), END);
262 break;
263 case 113:
264 layer_clear();
265 return MACRODOWN(D(LSFT), T(LBRC), U(LSFT), T(FN4), END);
266 break;
267 case 114:
268 layer_clear();
269 return MACRODOWN(D(LSFT), T(RBRC), U(LSFT), T(FN4), END);
270 break;
271 case 115:
272 layer_clear();
273 return MACRODOWN(T(1), T(FN4), END);
274 break;
275 case 116:
276 layer_clear();
277 return MACRODOWN(D(LSFT), T(8), U(LSFT), T(FN4), END);
278 break;
279 case 117:
280 layer_clear();
281 return MACRODOWN(D(LSFT), T(0), U(LSFT), T(FN4), END);
282 break;
283 case 118:
284 layer_clear();
285 return MACRODOWN(T(MINS), T(FN4), END);
286 break;
287 case 119:
288 layer_clear();
289 return MACRODOWN(D(LSFT), T(QUOT), U(LSFT), T(FN4), END);
290 break;
291 case 120:
292 layer_clear();
293 return MACRODOWN(T(6), T(FN4), END);
294 break;
295 case 121:
296 layer_clear();
297 return MACRODOWN(T(7), T(FN4), END);
298 break;
299 case 122:
300 layer_clear();
301 return MACRODOWN(T(8), T(FN4), END);
302 break;
303 case 123:
304 layer_clear();
305 return MACRODOWN(T(9), T(FN4), END);
306 break;
307 case 124:
308 layer_clear();
309 return MACRODOWN(D(LSFT), T(BSLS), U(LSFT), T(FN4), END);
310 break;
311 case 125:
312 layer_clear();
313 return MACRODOWN(T(BSLS), T(FN4), END);
314 break;
315 case 126:
316 layer_clear();
317 return MACRODOWN(T(2), T(FN4), END);
318 break;
319 case 127:
320 layer_clear();
321 return MACRODOWN(T(3), T(FN4), END);
322 break;
323 case 128:
324 layer_clear();
325 return MACRODOWN(T(4), T(FN4), END);
326 break;
327 case 129:
328 layer_clear();
329 return MACRODOWN(T(5), T(FN4), END);
330 break;
331
332 default:
333 return MACRO_NONE;
334 }
335 return MACRO_NONE;
336};
337
338// Runs just one time when the keyboard initializes.
339void matrix_init_user(void) {
340 228
341}; 229bool process_record_user(uint16_t keycode, keyrecord_t *record) {
230 switch (keycode) {
231 case M_100:
232 if (record->event.pressed) {
233 tap_dead_code(S(KC_5));
234 }
235 return false;
236 case M_101:
237 if (record->event.pressed) {
238 tap_dead_code(S(KC_7));
239 }
240 return false;
241 case M_102:
242 if (record->event.pressed) {
243 tap_dead_code(S(KC_SLSH));
244 }
245 return false;
246 case M_103:
247 if (record->event.pressed) {
248 tap_dead_code(S(KC_EQL));
249 }
250 return false;
251 case M_104:
252 if (record->event.pressed) {
253 tap_dead_code(S(KC_2));
254 }
255 return false;
256 case M_105:
257 if (record->event.pressed) {
258 tap_dead_code(S(KC_4));
259 }
260 return false;
261 case M_106:
262 if (record->event.pressed) {
263 tap_dead_code(S(KC_MINS));
264 }
265 return false;
266 case M_107:
267 if (record->event.pressed) {
268 tap_dead_code(KC_LBRC);
269 }
270 return false;
271 case M_108:
272 if (record->event.pressed) {
273 tap_dead_code(KC_RBRC);
274 }
275 return false;
276 case M_109:
277 if (record->event.pressed) {
278 tap_dead_code(KC_SLSH);
279 }
280 return false;
281 case M_110:
282 if (record->event.pressed) {
283 tap_dead_code(S(KC_9));
284 }
285 return false;
286 case M_111:
287 if (record->event.pressed) {
288 tap_dead_code(KC_EQL);
289 }
290 return false;
291 case M_112:
292 if (record->event.pressed) {
293 tap_dead_code(KC_0);
294 }
295 return false;
296 case M_113:
297 if (record->event.pressed) {
298 tap_dead_code(S(KC_LBRC));
299 }
300 return false;
301 case M_114:
302 if (record->event.pressed) {
303 tap_dead_code(S(KC_RBRC));
304 }
305 return false;
306 case M_115:
307 if (record->event.pressed) {
308 tap_dead_code(KC_1);
309 }
310 return false;
311 case M_116:
312 if (record->event.pressed) {
313 tap_dead_code(S(KC_8));
314 }
315 return false;
316 case M_117:
317 if (record->event.pressed) {
318 tap_dead_code(S(KC_0));
319 }
320 return false;
321 case M_118:
322 if (record->event.pressed) {
323 tap_dead_code(KC_MINS);
324 }
325 return false;
326 case M_119:
327 if (record->event.pressed) {
328 tap_dead_code(S(KC_QUOT));
329 }
330 return false;
331 case M_120:
332 if (record->event.pressed) {
333 tap_dead_code(KC_6);
334 }
335 return false;
336 case M_121:
337 if (record->event.pressed) {
338 tap_dead_code(KC_7);
339 }
340 return false;
341 case M_122:
342 if (record->event.pressed) {
343 tap_dead_code(KC_8);
344 }
345 return false;
346 case M_123:
347 if (record->event.pressed) {
348 tap_dead_code(KC_9);
349 }
350 return false;
351 case M_124:
352 if (record->event.pressed) {
353 tap_dead_code(S(KC_BSLS));
354 }
355 return false;
356 case M_125:
357 if (record->event.pressed) {
358 tap_dead_code(KC_BSLS);
359 }
360 return false;
361 case M_126:
362 if (record->event.pressed) {
363 tap_dead_code(KC_2);
364 }
365 return false;
366 case M_127:
367 if (record->event.pressed) {
368 tap_dead_code(KC_3);
369 }
370 return false;
371 case M_128:
372 if (record->event.pressed) {
373 tap_dead_code(KC_4);
374 }
375 return false;
376 case M_129:
377 if (record->event.pressed) {
378 tap_dead_code(KC_5);
379 }
380 return false;
381 case M_130:
382 if (record->event.pressed) {
383 tap_dead_code(S(KC_1));
384 }
385 return false;
386 }
387 return true;
388}
342 389
343// Runs constantly in the background, in a loop. 390// Runs constantly in the background, in a loop.
344void matrix_scan_user(void) { 391void matrix_scan_user(void) {
345
346 uint8_t layer = biton32(layer_state);
347
348 ergodox_board_led_off(); 392 ergodox_board_led_off();
349 ergodox_right_led_1_off(); 393 ergodox_right_led_1_off();
350 ergodox_right_led_2_off(); 394 ergodox_right_led_2_off();
351 ergodox_right_led_3_off(); 395 ergodox_right_led_3_off();
352 switch (layer) { 396
397 switch (get_highest_layer(layer_state)) {
353 // TODO: Make this relevant to the ErgoDox EZ. 398 // TODO: Make this relevant to the ErgoDox EZ.
354 case 1: 399 case 1:
355 ergodox_right_led_1_on(); 400 ergodox_right_led_1_on();
@@ -361,5 +406,4 @@ void matrix_scan_user(void) {
361 // none 406 // none
362 break; 407 break;
363 } 408 }
364 409}
365};