summaryrefslogtreecommitdiff
path: root/keyboards/ergodox/keymaps/algernon
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/ergodox/keymaps/algernon')
-rw-r--r--keyboards/ergodox/keymaps/algernon/Makefile10
-rw-r--r--keyboards/ergodox/keymaps/algernon/images/adore-layer.pngbin95615 -> 93893 bytes
-rw-r--r--keyboards/ergodox/keymaps/algernon/images/base-layer.pngbin95654 -> 95204 bytes
-rw-r--r--keyboards/ergodox/keymaps/algernon/images/one-handed-layer.pngbin91140 -> 0 bytes
-rw-r--r--keyboards/ergodox/keymaps/algernon/keymap.c2274
-rw-r--r--keyboards/ergodox/keymaps/algernon/readme.md115
-rw-r--r--keyboards/ergodox/keymaps/algernon/tools/heatmap-layout.ADORE.json (renamed from keyboards/ergodox/keymaps/algernon/tools/heatmap-adore-layout.json)108
-rw-r--r--keyboards/ergodox/keymaps/algernon/tools/heatmap-layout.Dvorak.json (renamed from keyboards/ergodox/keymaps/algernon/tools/heatmap-base-layout.json)29
-rwxr-xr-xkeyboards/ergodox/keymaps/algernon/tools/log-to-heatmap.py368
9 files changed, 1470 insertions, 1434 deletions
diff --git a/keyboards/ergodox/keymaps/algernon/Makefile b/keyboards/ergodox/keymaps/algernon/Makefile
index 6bf3976b9..7c2b3ad97 100644
--- a/keyboards/ergodox/keymaps/algernon/Makefile
+++ b/keyboards/ergodox/keymaps/algernon/Makefile
@@ -1,17 +1,25 @@
BOOTMAGIC_ENABLE=no
COMMAND_ENABLE=no
SLEEP_LED_ENABLE=no
-UNICODE_ENABLE=no
FORCE_NKRO ?= yes
DEBUG_ENABLE = no
CONSOLE_ENABLE = no
TAP_DANCE_ENABLE = yes
KEYLOGGER_ENABLE ?= yes
+UCIS_ENABLE = yes
+MOUSEKEY_ENABLE ?= yes
+
+AUTOLOG_ENABLE ?= no
ifeq (${FORCE_NKRO},yes)
OPT_DEFS += -DFORCE_NKRO
endif
+ifeq (${AUTOLOG_ENABLE},yes)
+KEYLOGGER_ENABLE = yes
+OPT_DEFS += -DAUTOLOG_ENABLE
+endif
+
ifeq (${KEYLOGGER_ENABLE},yes)
OPT_DEFS += -DKEYLOGGER_ENABLE
CONSOLE_ENABLE = yes
diff --git a/keyboards/ergodox/keymaps/algernon/images/adore-layer.png b/keyboards/ergodox/keymaps/algernon/images/adore-layer.png
index 3df68ea53..3d0a5fb20 100644
--- a/keyboards/ergodox/keymaps/algernon/images/adore-layer.png
+++ b/keyboards/ergodox/keymaps/algernon/images/adore-layer.png
Binary files differ
diff --git a/keyboards/ergodox/keymaps/algernon/images/base-layer.png b/keyboards/ergodox/keymaps/algernon/images/base-layer.png
index 7b25a05b3..7ea57aae3 100644
--- a/keyboards/ergodox/keymaps/algernon/images/base-layer.png
+++ b/keyboards/ergodox/keymaps/algernon/images/base-layer.png
Binary files differ
diff --git a/keyboards/ergodox/keymaps/algernon/images/one-handed-layer.png b/keyboards/ergodox/keymaps/algernon/images/one-handed-layer.png
deleted file mode 100644
index 698d11e5f..000000000
--- a/keyboards/ergodox/keymaps/algernon/images/one-handed-layer.png
+++ /dev/null
Binary files differ
diff --git a/keyboards/ergodox/keymaps/algernon/keymap.c b/keyboards/ergodox/keymaps/algernon/keymap.c
index c4de53da2..9f476d8a6 100644
--- a/keyboards/ergodox/keymaps/algernon/keymap.c
+++ b/keyboards/ergodox/keymaps/algernon/keymap.c
@@ -1,1218 +1,1058 @@
-/*
- * algernon's ErgoDox EZ layout, please see the readme.md file!
- */
-
-#include "ergodox.h"
-#include "led.h"
-#include "debug.h"
-#include "action_layer.h"
-#include "action_util.h"
-#include "mousekey.h"
-#include "timer.h"
-#include "keymap_plover.h"
-#include "eeconfig.h"
-#include "wait.h"
+/*
+ * algernon's ErgoDox EZ layout, please see the readme.md file!
+ */
+
+#include <stdarg.h>
+#include "ergodox.h"
+#include "led.h"
+#include "debug.h"
+#include "action_layer.h"
+#include "action_util.h"
+#include "mousekey.h"
+#include "timer.h"
+#include "keymap_plover.h"
+#include "eeconfig.h"
+#include "wait.h"
#include "version.h"
-
-/* Layers */
-
-enum {
- BASE = 0,
- ADORE,
- ARRW,
- APPSEL,
- HUN,
- NMDIA,
- OHLFT,
- OHRGT,
- PLVR,
-};
-
-/* Macros */
-
-enum {
- NONE = 0,
- // Buttons that do extra stuff
- A_GUI,
- A_PLVR,
- A_ESC,
- A_MPN,
-
- // Function / number keys
- KF_1, // 1, F1
- KF_2, // 2, F2
- KF_3, // ...
- KF_4,
- KF_5,
- KF_6,
- KF_7,
- KF_8,
- KF_9,
- KF_10,
- KF_11, // =, F11
-
- // Application select keys
- APP_SLK, // Slack
- APP_EMCS, // Emacs
- APP_TERM, // Terminal
- APP_CHRM, // Chrome
- APP_MSIC, // Music
-
- // Diagonal mouse movement
- A_MUL,
- A_MUR,
- A_MDL,
- A_MDR,
-
- // Hungarian layer keys
- HU_AA, // Á
- HU_OO, // Ó
- HU_EE, // É
- HU_UU, // Ú
- HU_II, // Í
- HU_OE, // Ö
- HU_UE, // Ü
- HU_OEE, // Ő
- HU_UEE, // Ű
-
- // One-handed layout specials
- OH_BSSPC,
- OH_ENTSFT,
- OH_BASE,
- OH_LEFT,
- OH_RIGHT,
-};
-
-/* Fn keys */
-
-enum {
- F_BSE = 0,
- F_HUN,
- F_GUI,
- F_SFT,
- F_ALT,
- F_CTRL
-};
-
-/* Custom keycodes */
-
-enum {
- CT_CLN = 0,
- CT_MNS,
- CT_TA,
-};
-
-/* States & timers */
-
-uint16_t gui_timer = 0;
-
-uint16_t kf_timers[12];
-
-uint16_t oh_base_timer = 0;
-uint16_t oh_bsspc_timer = 0;
-uint16_t oh_entsft_timer = 0;
-
-#define OH_BLINK_INTERVAL 500
-
-uint8_t oh_left_blink = 0;
-uint16_t oh_left_blink_timer = 0;
-uint8_t oh_right_blink = 0;
-uint16_t oh_right_blink_timer = 0;
-
-#if KEYLOGGER_ENABLE
-bool log_enable = false;
-#endif
-
-bool time_travel = false;
-
-/* The Keymap */
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-
-/* Keymap 0: Base Layer
- *
- * ,-----------------------------------------------------. ,-----------------------------------------------------.
- * | `~ | 1 F1 | 2 F2 | 3 F3 | 4 F4 | 5 F5 | Plvr | | Apps | 6 F6 | 7 F7 | 8 F8 | 9 F9 | 0 F10| F11 |
- * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
- * | Next/Prev | ' | , | . | P | Y | [ | | ] | F | G | C | R | L | \ |
- * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
- * | Tab/ARROW | A | O | E | U | I |------| |------| D | H | T | N | S | = / Arrow |
- * |-----------+------+------+------+------+------| ( | | ) |------+------+------+------+------+-----------|
- * | Play/Pause| / | Q | J | K | X | | | | B | M | W | V | Z | Stop |
- * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
- * | | | | | : | | - | | | | |
- * `-----------------------------------' `-----------------------------------'
- * ,-------------. ,-------------.
- * | LAlt | GUI | | MDIA | 1HND |
- * ,------|------|------| |------+------+------.
- * | | | Ctrl | | LEAD | | |
- * |Backsp|LShift|------| |------| Enter| Space|
- * | | | ESC | | HUN | | |
- * `--------------------' `--------------------'
- */
-[BASE] = KEYMAP(
-// left hand
- KC_GRV ,M(KF_1) ,M(KF_2) ,M(KF_3),M(KF_4),M(KF_5),M(A_PLVR)
-,M(A_MPN) ,KC_QUOT ,KC_COMM ,KC_DOT ,KC_P ,KC_Y ,KC_LBRC
-,TD(CT_TA) ,KC_A ,KC_O ,KC_E ,KC_U ,KC_I
-,KC_MPLY ,KC_SLSH ,KC_Q ,KC_J ,KC_K ,KC_X ,KC_LPRN
-,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN)
-
- ,F(F_ALT),F(F_GUI)
- ,F(F_CTRL)
- ,KC_BSPC,F(F_SFT),M(A_ESC)
-
- // right hand
- ,KC_APP ,M(KF_6),M(KF_7) ,M(KF_8),M(KF_9) ,M(KF_10) ,KC_F11
- ,KC_RBRC ,KC_F ,KC_G ,KC_C ,KC_R ,KC_L ,KC_BSLS
- ,KC_D ,KC_H ,KC_T ,KC_N ,KC_S ,KC_EQL
- ,KC_RPRN ,KC_B ,KC_M ,KC_W ,KC_V ,KC_Z ,KC_MSTP
- ,TD(CT_MNS),KC_NO ,KC_NO ,KC_NO ,KC_NO
-
- ,OSL(NMDIA),M(OH_LEFT)
- ,KC_LEAD
- ,F(F_HUN) ,KC_ENT ,KC_SPC
- ),
-
-/* Keymap 1: Adore layer
- *
- * ,-----------------------------------------------------. ,-----------------------------------------------------.
- * | `~ | 1 F1 | 2 F2 | 3 F3 | 4 F4 | 5 F5 | Plvr | | Apps | 6 F6 | 7 F7 | 8 F8 | 9 F9 | 0 F10| F11 |
- * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
- * | Next/Prev | , | . | L | W | M | [ | | ] | F | H | C | P | Y | \ |
- * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
- * | Tab/Arrow | A | O | E | I | U |------| |------| D | R | T | N | S | = / Arrow |
- * |-----------+------+------+------+------+------| ( | | ) |------+------+------+------+------+-----------|
- * | Play/Pause| / | Z | ' | K | X | | | | B | G | V | J | Q | Stop |
- * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
- * | | | | | : | | - | | | | |
- * `-----------------------------------' `-----------------------------------'
- * ,-------------. ,-------------.
- * | LAlt | GUI | | MDIA | 1HND |
- * ,------|------|------| |------+------+------.
- * | | | Ctrl | | LEAD | | |
- * |Backsp|LShift|------| |------| Enter| Space|
- * | | | ESC | | HUN | | |
- * `--------------------' `--------------------'
- */
-[ADORE] = KEYMAP(
-// left hand
- KC_GRV ,M(KF_1) ,M(KF_2) ,M(KF_3),M(KF_4),M(KF_5),M(A_PLVR)
-,M(A_MPN) ,KC_COMM ,KC_DOT ,KC_L ,KC_W ,KC_M ,KC_LBRC
-,TD(CT_TA) ,KC_A ,KC_O ,KC_E ,KC_I ,KC_U
-,KC_MPLY ,KC_SLSH ,KC_Z ,KC_QUOT,KC_K ,KC_X ,KC_LPRN
-,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN)
-
- ,F(F_ALT),F(F_GUI)
- ,F(F_CTRL)
- ,KC_BSPC,F(F_SFT),M(A_ESC)
-
- // right hand
- ,KC_APP ,M(KF_6),M(KF_7) ,M(KF_8),M(KF_9) ,M(KF_10) ,KC_F11
- ,KC_RBRC ,KC_F ,KC_H ,KC_C ,KC_P ,KC_Y ,KC_BSLS
- ,KC_D ,KC_R ,KC_T ,KC_N ,KC_S ,KC_EQL
- ,KC_RPRN ,KC_B ,KC_G ,KC_V ,KC_J ,KC_Q ,KC_MSTP
- ,TD(CT_MNS),KC_NO ,KC_NO ,KC_NO ,KC_NO
-
- ,OSL(NMDIA),M(OH_LEFT)
- ,KC_LEAD
- ,F(F_HUN) ,KC_ENT ,KC_SPC
- ),
-
-/* Keymap 2: Arrow layer
- *
- * ,-----------------------------------------------------. ,-----------------------------------------------------.
- * | | | | | | | | | | | | | | | |
- * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
- * | | | | | | | | | | | Home | Up | End | | |
- * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
- * | | | | | | |------| |------| | Left | Down | Rght | | |
- * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
- * | | | | | | | | | | | | | | | |
- * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
- * | | | | | | | | | | | |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | | | | | |
- * ,------|------|------| |------+------+------.
- * | | | | | | | |
- * | | |------| |------| PgUp | PgDn |
- * | | | | | | | |
- * `--------------------' `--------------------'
- */
-
-[ARRW] = KEYMAP(
-// left hand
- KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
-,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
-,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
-,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
-,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
-
- ,KC_TRNS ,KC_TRNS
- ,KC_TRNS
- ,KC_TRNS ,KC_TRNS ,KC_TRNS
-
- // right hand
- ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
- ,KC_TRNS ,KC_TRNS ,KC_HOME ,KC_UP ,KC_END ,KC_TRNS ,KC_TRNS
- ,KC_TRNS ,KC_LEFT ,KC_DOWN ,KC_RGHT ,KC_TRNS ,KC_TRNS
- ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
- ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
-
- ,KC_TRNS ,KC_TRNS
- ,KC_TRNS
- ,KC_TRNS ,KC_PGUP ,KC_PGDN
- ),
-
-/* Keymap 3: Application select layer
- *
- * ,-----------------------------------------------------. ,-----------------------------------------------------.
- * | |Music |Slack |Emacs |Term |Chrome| | | | | | | | | |
- * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
- * | | | | | | | | | | | | | | | |
- * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
- * | | | | | | |------| |------| | | | | | |
- * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
- * | | | | | | | | | | | | | | | |
- * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
- * | | | | | | | | | | | |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | | | | | |
- * ,------|------|------| |------+------+------.
- * | | | | | | | |
- * | | |------| |------| | |
- * | | | | | | | |
- * `--------------------' `--------------------'
- */
-
-[APPSEL] = KEYMAP(
-// left hand
- KC_TRNS ,M(APP_MSIC),M(APP_SLK),M(APP_EMCS),M(APP_TERM),M(APP_CHRM),KC_TRNS
-,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
-,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
-,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
-,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
-
- ,KC_TRNS ,KC_TRNS
- ,KC_TRNS
- ,KC_TRNS ,KC_TRNS ,KC_TRNS
-
- // right hand
- ,KC_TRNS ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_TRNS
- ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
- ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
- ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
- ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
-
- ,KC_TRNS ,KC_TRNS
- ,KC_TRNS
- ,KC_TRNS ,KC_TRNS ,KC_TRNS
- ),
-
-
-/* Keymap 4: Hungarian Layer
- *
- * ,-----------------------------------------------------. ,-----------------------------------------------------.
- * | | | | | | | | | | | | | | | |
- * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
- * | | | Ő | | Ű | | | | | | | | | | |
- * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
- * | | Á | Ó | É | Ú | Í |------| |------| | | | | | |
- * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
- * | | | Ö | | Ü | | | | | | | | | | |
- * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
- * | | | | | | | | | | | |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | | | | | |
- * ,------|------|------| |------+------+------.
- * | | | | | | | |
- * | | |------| |------| | |
- * | | | | | BASE | | |
- * `--------------------' `--------------------'
- */
-
-[HUN] = KEYMAP(
-// left hand
- KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
-,KC_NO ,KC_NO ,M(HU_OEE),KC_NO ,M(HU_UEE),KC_NO ,KC_NO
-,KC_NO ,M(HU_AA),M(HU_OO) ,M(HU_EE),M(HU_UU) ,M(HU_II)
-,KC_NO ,KC_NO ,M(HU_OE) ,KC_NO ,M(HU_UE) ,KC_NO ,KC_NO
-,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
-
- ,KC_NO ,KC_NO
- ,KC_NO
- ,KC_NO ,KC_TRNS ,KC_TRNS
-
- // right hand
- ,KC_TRNS ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
-
- ,KC_NO ,KC_NO
- ,KC_NO
- ,F(F_BSE),KC_TRNS ,KC_TRNS
- ),
-
-/* Keymap 5: Navigation & Media layer
- *
- * ,-----------------------------------------------------. ,-----------------------------------------------------.
- * | MS Slow | | | | | |ScrLCK| |ScrLCK| | | | | | |
- * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
- * | MS Normal | | Home | Up | PgUp | | | |Scroll| |MsUpL | MsUp |MsUpR | |PrintScreen|
- * |-----------+------+------+------+------+------| | | Up |------+------+------+------+------+-----------|
- * | MS Fast | | Left | Down | Right| |------| |------| |MsLeft| MsDn |MsRght| | |
- * |-----------+------+------+------+------+------| | |Scroll|------+------+------+------+------+-----------|
- * | Play/Pause| | End | Down | PgDn | | | | Down | |MsDnL | MsDn |MsDnR | | Stop |
- * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
- * | | | | | | | | | | | |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | Mute | VlUp | | BASE | MClk |
- * ,------|------|------| |------+------+------.
- * | | | VlDn | | Prev |Left |Right |
- * | SPC | Enter|------| |------| Click| Click|
- * | | | ESC | | Next | | |
- * `--------------------' `--------------------'
- */
-[NMDIA] = KEYMAP(
-// left hand
- KC_ACL0 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,LGUI(KC_L)
-,KC_ACL1 ,KC_NO ,KC_HOME ,KC_UP ,KC_PGUP ,KC_NO ,KC_NO
-,KC_ACL2 ,KC_NO ,KC_LEFT ,KC_DOWN ,KC_RIGHT,KC_NO
-,KC_MPLY ,KC_NO ,KC_END ,KC_DOWN ,KC_PGDN ,KC_NO ,KC_NO
-,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
- ,KC_MUTE ,KC_VOLU
- ,KC_VOLD
- ,KC_SPC,KC_ENTER,M(A_ESC)
-
- // right hand
- ,LGUI(KC_L),KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
- ,KC_WH_U ,KC_NO ,M(A_MUL),KC_MS_U ,M(A_MUR),KC_NO ,KC_PSCR
- ,KC_NO ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_NO ,KC_NO
- ,KC_WH_D ,KC_NO ,M(A_MDL),KC_MS_D ,M(A_MDR),KC_NO ,KC_MSTP
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
-
- ,KC_TRNS ,KC_MS_BTN3
- ,KC_MPRV
- ,KC_MNXT ,KC_BTN1 ,KC_BTN2
- ),
-
-/* Keymap 6: One-handed, left side
- *
- * ,-----------------------------------------------------.
- * | `~ | 1 F1 | 2 F2 | 3 F3 | 4 F4 | 5 F5 |A BSE|
- * |-----------+------+------+------+------+-------------|
- * | Tab | ' | , | . | P | Y | [ |
- * |-----------+------+------+------+------+------| |
- * | - | A | O | E | U | I |------|
- * |-----------+------+------+------+------+------| ( |
- * | Play/Pause| ; | Q | J | K | X | |
- * `-----------+------+------+------+------+-------------'
- * | Home | End | Down | Up | ESC |
- * `-----------------------------------'
- * ,-------------.
- * | LAlt | GUI |
- * ,------|------|------|
- * |BackSp|LShift| Ctrl |
- * | | |------|
- * |Space |Enter |OTHER |
- * `--------------------'
- */
-[OHLFT] = KEYMAP(
-// left hand
- KC_GRV ,M(KF_1) ,M(KF_2) ,M(KF_3) ,M(KF_4) ,M(KF_5) ,M(OH_BASE)
-,KC_TAB ,KC_QUOT ,KC_COMM ,KC_DOT ,KC_P ,KC_Y ,KC_LBRC
-,KC_MINS ,KC_A ,KC_O ,KC_E ,KC_U ,KC_I
-,KC_MPLY ,KC_SCLN ,KC_Q ,KC_J ,KC_K ,KC_X ,KC_LPRN
-,KC_HOME ,KC_END ,KC_DOWN ,KC_UP ,M(A_ESC)
-
- ,KC_TRNS ,KC_TRNS
- ,KC_TRNS
- ,M(OH_BSSPC),M(OH_ENTSFT),M(OH_RIGHT)
-
- // right hand
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
-
- ,KC_NO ,KC_NO
- ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO
- ),
-
-/* Keymap 7: One-handed, right side
- *
- * ,-----------------------------------------------------.
- * | = F11 | 0 F10| 9 F9 | 8 F8 | 7 F7 | 6 F6 |A BSE|
- * |-----------+------+------+------+------+-------------|
- * | / | L | R | C | G | F | ] |
- * |-----------+------+------+------+------+------| |
- * | \ | S | N | T | H | D |------|
- * |-----------+------+------+------+------+------| ) |
- * | Stop | Z | V | W | M | B | |
- * `-----------+------+------+------+------+-------------'
- * | PgDn | PgUp | Right| Left | ESC |
- * `-----------------------------------'
- * ,-------------.
- * | LAlt | GUI |
- * ,------|------|------|
- * |BackSp|LShift| Ctrl |
- * | | |------|
- * |Space |Enter |OTHER |
- * `--------------------'
- */
-[OHRGT] = KEYMAP(
-// left hand
- M(KF_11) ,M(KF_10) ,M(KF_9) ,M(KF_8) ,M(KF_7) ,M(KF_6) ,M(OH_BASE)
-,KC_SLSH ,KC_L ,KC_R ,KC_C ,KC_G ,KC_F ,KC_RBRC
-,KC_BSLS ,KC_S ,KC_N ,KC_T ,KC_H ,KC_D
-,KC_MSTP ,KC_Z ,KC_V ,KC_W ,KC_M ,KC_B ,KC_RPRN
-,KC_PGDN ,KC_PGUP ,KC_RGHT ,KC_LEFT ,M(A_ESC)
-
- ,KC_TRNS ,KC_TRNS
- ,KC_TRNS
- ,M(OH_BSSPC),M(OH_ENTSFT),M(OH_LEFT)
-
- // right hand
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
-
- ,KC_NO ,KC_NO
- ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO
- ),
-
-/* Keymap 8: Steno for Plover
- *
- * ,--------------------------------------------------. ,--------------------------------------------------.
- * | | | | | | | BASE | | | | | | | | |
- * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
- * | | # | # | # | # | # | # | | # | # | # | # | # | # | # |
- * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
- * | | | T | P | H | |------| |------| | F | P | L | T | D |
- * |--------+ S +------+------+------+ * | * | | * | * +------+------+------+------+--------|
- * | | | K | W | R | | | | | | R | B | G | S | Z |
- * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
- * | | | | | | | | | | | |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | | | | | |
- * ,------|------|------| |------+------+------.
- * | | | | | | | |
- * | A | O |------| |------| E | U |
- * | | | | | | | |
- * `--------------------' `--------------------'
- */
-
-[PLVR] = KEYMAP(
-// left hand
-KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, M(A_PLVR),
-KC_NO, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM,
-KC_NO, PV_LS, PV_LT, PV_LP, PV_LH, PV_STAR,
-KC_NO, PV_LS, PV_LK, PV_LW, PV_LR, PV_STAR, PV_STAR,
-KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
- KC_NO, KC_NO,
- KC_NO,
- PV_A, PV_O, KC_NO,
-
- // right hand
- KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
- PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM,
- PV_STAR, PV_RF, PV_RP, PV_RL, PV_RT, PV_RD,
- PV_STAR, PV_STAR, PV_RR, PV_RB, PV_RG, PV_RS, PV_RZ,
- KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
- KC_NO, KC_NO,
- KC_NO,
- KC_NO,PV_E, PV_U
- ),
-
-};
-
-const uint16_t PROGMEM fn_actions[] = {
- [F_BSE] = ACTION_LAYER_CLEAR(ON_PRESS)
- ,[F_HUN] = ACTION_LAYER_INVERT(HUN, ON_PRESS)
- ,[F_GUI] = ACTION_MACRO_TAP(A_GUI)
- ,[F_SFT] = ACTION_MODS_ONESHOT (MOD_LSFT)
- ,[F_ALT] = ACTION_MODS_ONESHOT (MOD_LALT)
- ,[F_CTRL] = ACTION_MODS_ONESHOT (MOD_LCTL)
-};
-
-void toggle_steno(int pressed)
-{
- uint8_t layer = biton32(layer_state);
-
- if (pressed) {
- if (layer != PLVR) layer_on(PLVR); else layer_off(PLVR);
-
- register_code(PV_LP);
- register_code(PV_LH);
- register_code(PV_LR);
- register_code(PV_O);
- register_code(PV_RL);
- register_code(PV_RG);
- } else {
- unregister_code(PV_LP);
- unregister_code(PV_LH);
- unregister_code(PV_LR);
- unregister_code(PV_O);
- unregister_code(PV_RL);
- unregister_code(PV_RG);
- }
-}
-
-macro_t *ang_do_hun (keyrecord_t *record, uint16_t accent, uint16_t hun_char)
-{
- uint8_t need_shift = 0;
- uint8_t hold_shift = 0;
-
- if (!record->event.pressed)
- return MACRO_NONE;
-
- layer_off (HUN);
-
- if (keyboard_report->mods & MOD_BIT (KC_LSFT)) {
- hold_shift = 1;
- need_shift = 1;
- unregister_code (KC_LSFT);
- }
- if ((get_oneshot_mods () & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out ()) {
- need_shift = 1;
- hold_shift = 0;
- unregister_code (KC_LSFT);
- }
-
- clear_oneshot_mods ();
-
- register_code (KC_RALT);
- unregister_code (KC_RALT);
- if (accent == (KC_DQT)) {
- register_code (KC_RSFT);
- }
- register_code (accent);
- unregister_code (accent);
- if (need_shift && accent != (KC_DQT)) {
- register_code (KC_RSFT);
- } else if (accent == (KC_DQT) && !need_shift) {
- unregister_code (KC_RSFT);
- }
- register_code (hun_char);
- unregister_code (hun_char);
- if (need_shift || accent == (KC_DQT))
- unregister_code (KC_RSFT);
- if (hold_shift)
- register_code (KC_LSFT);
-
- return MACRO_NONE;
-}
-
-void ang_handle_kf (keyrecord_t *record, uint8_t id)
-{
- uint8_t code = id - KF_1;
-
- if (record->event.pressed) {
- kf_timers[code] = timer_read ();
- } else {
- uint8_t kc;
-
- if (timer_elapsed (kf_timers[code]) > TAPPING_TERM) {
- // Long press
- kc = KC_F1 + code;
- } else {
- if (id == KF_11)
- kc = KC_EQL;
- else
- kc = KC_1 + code;
- }
-
- register_code (kc);
- unregister_code (kc);
- }
-}
-
-const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
-{
- switch(id) {
- case A_ESC:
- if (record->event.pressed) {
- if ((get_oneshot_mods ()) && !has_oneshot_mods_timed_out ()) {
- clear_oneshot_mods ();
- } else {
- register_code (KC_ESC);
- }
- layer_off (HUN);
- } else {
- unregister_code (KC_ESC);
- }
- break;
-
- case A_MPN:
- if (record->event.pressed) {
- if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
- ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out())) {
- int oneshot = ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out());
-
- if (oneshot)
- clear_oneshot_mods ();
- unregister_code (KC_LSFT);
-
- register_code (KC_MPRV);
- unregister_code (KC_MPRV);
-
- if (!oneshot)
- register_code (KC_LSFT);
- } else {
- return MACRO (T(MNXT), END);
- }
- }
- break;
-
- /* Hungarian layer */
- case HU_AA:
- return ang_do_hun (record, KC_QUOT, KC_A);
- case HU_OO:
- return ang_do_hun (record, KC_QUOT, KC_O);
- case HU_EE:
- return ang_do_hun (record, KC_QUOT, KC_E);
- case HU_UU:
- return ang_do_hun (record, KC_QUOT, KC_U);
- case HU_II:
- return ang_do_hun (record, KC_QUOT, KC_I);
- case HU_OE:
- return ang_do_hun (record, KC_DQT, KC_O);
- case HU_UE:
- return ang_do_hun (record, KC_DQT, KC_U);
- case HU_OEE:
- return ang_do_hun (record, KC_EQL, KC_O);
- case HU_UEE:
- return ang_do_hun (record, KC_EQL, KC_U);
-
- /* Mouse movement */
- case A_MUL:
- if (record->event.pressed) {
- mousekey_on(KC_MS_UP);
- mousekey_on(KC_MS_LEFT);
- } else {
- mousekey_off(KC_MS_UP);
- mousekey_off(KC_MS_LEFT);
- }
- mousekey_send();
- break;
-
- case A_MUR:
- if (record->event.pressed) {
- mousekey_on(KC_MS_UP);
- mousekey_on(KC_MS_RIGHT);
- } else {
- mousekey_off(KC_MS_UP);
- mousekey_off(KC_MS_RIGHT);
- }
- mousekey_send();
- break;
-
- case A_MDL:
- if (record->event.pressed) {
- mousekey_on(KC_MS_DOWN);
- mousekey_on(KC_MS_LEFT);
- } else {
- mousekey_off(KC_MS_DOWN);
- mousekey_off(KC_MS_LEFT);
- }
- mousekey_send();
- break;
-
- case A_MDR:
- if (record->event.pressed) {
- mousekey_on(KC_MS_DOWN);
- mousekey_on(KC_MS_RIGHT);
- } else {
- mousekey_off(KC_MS_DOWN);
- mousekey_off(KC_MS_RIGHT);
- }
- mousekey_send();
- break;
-
- /* Plover base */
- case A_PLVR:
- toggle_steno(record->event.pressed);
- break;
-
- /* GUI & AppSel */
- case A_GUI:
- if (record->event.pressed) {
- register_code (KC_LGUI);
- if (record->tap.count && !record->tap.interrupted) {
- if (record->tap.count >= 2) {
- register_code (KC_W);
- layer_on (APPSEL);
- set_oneshot_layer (APPSEL, ONESHOT_START);
- }
- } else {
- record->tap.count = 0;
- }
- gui_timer = 0;
- } else {
- if (record->tap.count >= 2)
- {
- unregister_code (KC_W);
- clear_oneshot_layer_state (ONESHOT_PRESSED);
- }
- gui_timer = timer_read ();
- }
- break;
-
- case APP_SLK:
- return MACRODOWN(T(S), T(L), T(A), T(C), T(K), T(ENT), END);
-
- case APP_EMCS:
- return MACRODOWN(T(E), T(M), T(A), T(C), T(S), T(ENT), END);
-
- case APP_TERM:
- return MACRODOWN(T(T), T(E), T(R), T(M), T(ENT), END);
-
- case APP_CHRM:
- return MACRODOWN(T(C), T(H), T(R), T(O), T(M), T(ENT), END);
-
- case APP_MSIC:
- return MACRODOWN(T(R), T(H), T(Y), T(T), T(H), T(M), T(B), T(O), T(X), T(ENT), END);
-
- /* Function keys */
- case KF_1 ... KF_11:
- ang_handle_kf (record, id);
- break;
-
- /* 1HAND layout */
- case OH_BASE:
- if (record->event.pressed) {
- oh_base_timer = timer_read ();
- } else {
- if (timer_elapsed (oh_base_timer) > TAPPING_TERM) {
- layer_clear ();
- } else {
- return MACRO (T(APP), END);
- }
- }
- break;
-
- case OH_BSSPC:
- if (record->event.pressed) {
- oh_bsspc_timer = timer_read ();
- } else {
- if (timer_elapsed (oh_bsspc_timer) > TAPPING_TERM) {
- return MACRO (T(BSPC), END);
- } else {
- return MACRO (T(SPC), END);
- }
- }
- break;
-
- case OH_ENTSFT:
- if (record->event.pressed) {
- oh_entsft_timer = timer_read ();
- } else {
- if (timer_elapsed (oh_entsft_timer) > TAPPING_TERM) {
- if (keyboard_report->mods & MOD_BIT(KC_LSFT))
- unregister_code (KC_LSFT);
- else
- register_code (KC_LSFT);
- } else {
- return MACRO (T(ENT), END);
- }
- }
- break;
-
- case OH_LEFT:
- if (record->event.pressed) {
- layer_move (OHLFT);
- oh_left_blink = 1;
- oh_left_blink_timer = timer_read ();
- ergodox_right_led_1_on ();
- }
- break;
-
- case OH_RIGHT:
- if (record->event.pressed) {
- layer_move (OHRGT);
- oh_right_blink = 1;
- oh_right_blink_timer = timer_read ();
- ergodox_right_led_3_on ();
- }
- break;
- }
- return MACRO_NONE;
-};
-
-uint8_t is_adore = 0;
-
-// Runs just one time when the keyboard initializes.
-void matrix_init_user(void) {
- uint8_t dl;
-
- ergodox_led_all_on();
- for (int i = LED_BRIGHTNESS_HI; i > LED_BRIGHTNESS_LO; i--) {
- ergodox_led_all_set (i);
- wait_ms (5);
- }
- wait_ms(1000);
- for (int i = LED_BRIGHTNESS_LO; i > 0; i--) {
- ergodox_led_all_set (i);
- wait_ms (10);
- }
- ergodox_led_all_off();
-
- if (!eeconfig_is_enabled())
- eeconfig_init();
- dl = eeconfig_read_default_layer ();
- if (dl == (1UL << ADORE))
- is_adore = 1;
-};
-
-LEADER_EXTERNS();
-
-void ang_do_unicode (void) {
- register_code (KC_RCTL);
- register_code (KC_RSFT);
- register_code (KC_U);
- unregister_code (KC_U);
- unregister_code (KC_RSFT);
- unregister_code (KC_RCTL);
- wait_ms (100);
-}
-
-void ang_tap (uint16_t codes[]) {
- for (int i = 0; codes[i] != 0; i++) {
- register_code (codes[i]);
- unregister_code (codes[i]);
- wait_ms (50);
- }
-}
-
-#define TAP_ONCE(code) \
- register_code (code); \
- unregister_code (code)
-
-void ang_tap_dance_cln_finished (qk_tap_dance_state_t *state, void *user_data) {
- if (state->count == 1) {
- register_code (KC_RSFT);
- register_code (KC_SCLN);
- } else if (state->count == 2) {
- register_code (KC_SCLN);
- }
-}
-
-void ang_tap_dance_cln_reset (qk_tap_dance_state_t *state, void *user_data) {
- if (state->count == 1) {
- unregister_code (KC_SCLN);
- unregister_code (KC_RSFT);
- } else if (state->count == 2) {
- unregister_code (KC_SCLN);
- }
-}
-
-void ang_tap_dance_mns_finished (qk_tap_dance_state_t *state, void *user_data) {
- if (state->count == 1) {
- register_code (KC_MINS);
- } else if (state->count == 2) {
- register_code (KC_RSFT);
- register_code (KC_MINS);
- }
-}
-
-void ang_tap_dance_mns_reset (qk_tap_dance_state_t *state, void *user_data) {
- if (state->count == 1) {
- unregister_code (KC_MINS);
- } else if (state->count == 2) {
- unregister_code (KC_RSFT);
- unregister_code (KC_MINS);
- }
-}
-
-typedef struct {
- bool layer_toggle;
- bool sticky;
- bool finished_once;
-} td_ta_state_t;
-
-void ang_tap_dance_ta_finished (qk_tap_dance_state_t *state, void *user_data) {
- td_ta_state_t *td_ta = (td_ta_state_t *) user_data;
-
- if (td_ta->finished_once) {
- return;
- }
-
- if (td_ta->sticky) {
- td_ta->sticky = false;
- td_ta->layer_toggle = false;
- layer_off (ARRW);
- return;
- }
-
- td_ta->finished_once = true;
- if (state->count == 1 && !state->pressed) {
- register_code (KC_TAB);
- td_ta->sticky = false;
- td_ta->layer_toggle = false;
- } else {
- td_ta->layer_toggle = true;
- layer_on (ARRW);
- td_ta->sticky = (state->count == 2);
- }
-}
-
-void ang_tap_dance_ta_reset (qk_tap_dance_state_t *state, void *user_data) {
- td_ta_state_t *td_ta = (td_ta_state_t *) user_data;
-
- if (!td_ta->layer_toggle)
- unregister_code (KC_TAB);
- if (!td_ta->sticky)
- layer_off (ARRW);
-
- td_ta->finished_once = false;
-}
-
-const qk_tap_dance_action_t tap_dance_actions[] = {
- [CT_CLN] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, ang_tap_dance_cln_finished, ang_tap_dance_cln_reset)
- ,[CT_MNS] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, ang_tap_dance_mns_finished, ang_tap_dance_mns_reset)
- ,[CT_TA] = {
- .fn = { NULL, ang_tap_dance_ta_finished, ang_tap_dance_ta_reset },
- .user_data = (void *)&((td_ta_state_t) { false, false, false })
- }
-};
-
-// Runs constantly in the background, in a loop.
-void matrix_scan_user(void) {
- uint8_t layer = biton32(layer_state);
-
- if (gui_timer && timer_elapsed (gui_timer) > TAPPING_TERM)
- unregister_code (KC_LGUI);
-
- if (layer != OHLFT)
- oh_left_blink = 0;
- if (layer != OHRGT)
- oh_right_blink = 0;
-
- if (layer == HUN) {
- ergodox_right_led_2_on();
- ergodox_right_led_3_on();
- } else if (layer == NMDIA) {
- ergodox_right_led_1_on();
- ergodox_right_led_2_on();
- } else if (layer == PLVR) {
- ergodox_right_led_1_on ();
- ergodox_right_led_2_on ();
- ergodox_right_led_3_on ();
- } else if (layer == ADORE) {
- ergodox_right_led_1_on ();
- ergodox_right_led_2_on ();
- ergodox_right_led_3_on ();
-
- ergodox_right_led_2_set (LED_BRIGHTNESS_HI);
- }
-
- if (layer == OHLFT || layer == OHRGT) {
- ergodox_right_led_2_on();
-
- if (oh_left_blink) {
- if (timer_elapsed (oh_left_blink_timer) > OH_BLINK_INTERVAL) {
- if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) == 0)
- ergodox_right_led_1_off ();
- }
- if (timer_elapsed (oh_left_blink_timer) > OH_BLINK_INTERVAL * 2) {
- ergodox_right_led_1_on ();
- oh_left_blink_timer = timer_read ();
- }
- }
-
- if (oh_right_blink) {
- if (timer_elapsed (oh_right_blink_timer) > OH_BLINK_INTERVAL) {
- if ((keyboard_report->mods & MOD_BIT(KC_LCTRL)) == 0)
- ergodox_right_led_3_off ();
- }
- if (timer_elapsed (oh_right_blink_timer) > OH_BLINK_INTERVAL * 2) {
- ergodox_right_led_3_on ();
- oh_right_blink_timer = timer_read ();
- }
- }
- }
-
- if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
- ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out())) {
- ergodox_right_led_1_set (LED_BRIGHTNESS_HI);
- ergodox_right_led_1_on ();
- } else {
- ergodox_right_led_1_set (LED_BRIGHTNESS_LO);
- if (layer != OHLFT && layer != NMDIA && layer != PLVR && layer != ADORE)
- ergodox_right_led_1_off ();
- }
-
- if (keyboard_report->mods & MOD_BIT(KC_LALT) ||
- ((get_oneshot_mods() & MOD_BIT(KC_LALT)) && !has_oneshot_mods_timed_out())) {
- ergodox_right_led_2_set (LED_BRIGHTNESS_HI);
- ergodox_right_led_2_on ();
- } else {
- ergodox_right_led_2_set (LED_BRIGHTNESS_LO);
- if (layer != OHRGT && layer != HUN && layer != OHLFT && layer != NMDIA && layer != PLVR && layer != ADORE)
- ergodox_right_led_2_off ();
- }
-
- if (keyboard_report->mods & MOD_BIT(KC_LCTRL) ||
- ((get_oneshot_mods() & MOD_BIT(KC_LCTRL)) && !has_oneshot_mods_timed_out())) {
- ergodox_right_led_3_set (LED_BRIGHTNESS_HI);
- ergodox_right_led_3_on ();
- } else {
- ergodox_right_led_3_set (LED_BRIGHTNESS_LO);
- if (layer != OHRGT && layer != HUN && layer != PLVR && layer != ADORE)
- ergodox_right_led_3_off ();
- }
-
- LEADER_DICTIONARY() {
- leading = false;
- leader_end ();
-
-#if KEYLOGGER_ENABLE
- SEQ_ONE_KEY (KC_D) {
- ergodox_led_all_on();
- wait_ms(100);
- ergodox_led_all_off();
- log_enable = !log_enable;
- }
-#endif
-
- SEQ_ONE_KEY (KC_T) {
- time_travel = !time_travel;
- }
-
- SEQ_ONE_KEY (KC_U) {
- ang_do_unicode ();
- }
-
- SEQ_ONE_KEY (KC_V) {
- SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ (" QMK_VERSION "/" KEYMAP_VERSION ")");
- }
-
- SEQ_ONE_KEY (KC_L) {
- /* λ */
- ang_do_unicode ();
-
- uint16_t codes[] = {KC_0, KC_3, KC_B, KC_B, KC_ENT, 0};
- ang_tap (codes);
- }
-
- SEQ_ONE_KEY (KC_Y) {
- uint16_t codes[] = {KC_BSLS, KC_O, KC_SLSH, 0};
- ang_tap (codes);
- }
-
- SEQ_ONE_KEY (KC_S) {
- ang_do_unicode (); TAP_ONCE (KC_A); TAP_ONCE (KC_F); TAP_ONCE (KC_SPC);
- TAP_ONCE (KC_BSLS);
- register_code (KC_RSFT); TAP_ONCE (KC_MINS); TAP_ONCE (KC_9); unregister_code (KC_RSFT);
- ang_do_unicode (); TAP_ONCE (KC_3); TAP_ONCE (KC_0); TAP_ONCE (KC_C); TAP_ONCE (KC_4); TAP_ONCE (KC_SPC);
- register_code (KC_RSFT); TAP_ONCE (KC_0); TAP_ONCE (KC_MINS); unregister_code (KC_RSFT);
- TAP_ONCE (KC_SLSH);
- ang_do_unicode (); TAP_ONCE (KC_A); TAP_ONCE (KC_F); TAP_ONCE (KC_SPC);
- }
-
- SEQ_TWO_KEYS (KC_W, KC_M) {
- register_code (KC_LALT);
- register_code (KC_F2);
- unregister_code (KC_F2);
- unregister_code (KC_LALT);
-
- wait_ms (1000);
-
- uint16_t codes[] = {KC_M, KC_A, KC_X, KC_MINS, KC_F, KC_O, KC_C, KC_U, KC_S, KC_E, KC_D, KC_ENT, 0};
- ang_tap (codes);
- register_code (KC_LGUI);
- register_code (KC_UP);
- unregister_code (KC_UP);
- unregister_code (KC_LGUI);
- }
-
- SEQ_ONE_KEY (KC_A) {
- if (is_adore == 0) {
- default_layer_and (0);
- default_layer_or ((1UL << ADORE));
- eeconfig_update_default_layer ((1UL << ADORE));
- is_adore = 1;
-
- ergodox_led_all_off ();
- ergodox_right_led_3_on ();
- wait_ms (100);
- ergodox_right_led_2_on ();
- wait_ms (100);
- ergodox_right_led_3_off ();
- ergodox_right_led_1_on ();
- wait_ms (100);
- ergodox_right_led_2_off ();
- wait_ms (100);
- ergodox_right_led_1_off ();
- } else {
- is_adore = 0;
- default_layer_and (0);
- default_layer_or (1UL << BASE);
- eeconfig_update_default_layer ((1UL << BASE));
-
- ergodox_led_all_off ();
- ergodox_right_led_1_on ();
- wait_ms (100);
- ergodox_right_led_2_on ();
- wait_ms (100);
- ergodox_right_led_1_off ();
- ergodox_right_led_3_on ();
- wait_ms (100);
- ergodox_right_led_2_off ();
- wait_ms (100);
- ergodox_right_led_3_off ();
- }
- }
- }
-}
-
-static uint16_t last4[4];
-
-bool process_record_user (uint16_t keycode, keyrecord_t *record) {
-#if KEYLOGGER_ENABLE
- uint8_t layer = biton32(layer_state);
-
- if (log_enable && layer == BASE) {
- xprintf ("KL: col=%d, row=%d\n", record->event.key.col,
- record->event.key.row);
- }
-#endif
-
- if (time_travel && !record->event.pressed) {
- uint8_t p;
-
- // shift cache one to the left
- for (p = 0; p < 3; p++) {
- last4[p] = last4[p + 1];
- }
- last4[3] = keycode;
-
- if (last4[0] == KC_D && last4[1] == KC_A && last4[2] == KC_T && last4[3] == KC_E) {
- uint16_t codes[] = {KC_E, KC_SPC, KC_MINS, KC_D, KC_SPC, KC_QUOT, 0};
- ang_tap (codes);
- register_code (KC_RSFT);
- register_code (KC_EQL);
- unregister_code (KC_EQL);
- unregister_code (KC_RSFT);
-
- uint16_t codes2[] = {KC_4, KC_SPC, KC_D, KC_A, KC_Y, KC_S, KC_QUOT, 0};
- ang_tap (codes2);
-
- return false;
- }
- }
-
- return true;
-}
+
+/* Layers */
+
+enum {
+ BASE = 0,
+ ADORE,
+ ARRW,
+ APPSEL,
+ HUN,
+ NMDIA,
+ PLVR,
+};
+
+/* Macros */
+
+enum {
+ NONE = 0,
+ // Buttons that do extra stuff
+ A_GUI,
+ A_PLVR,
+ A_MPN,
+
+ // Function / number keys
+ KF_1, // 1, F1
+ KF_2, // 2, F2
+ KF_3, // ...
+ KF_4,
+ KF_5,
+ KF_6,
+ KF_7,
+ KF_8,
+ KF_9,
+ KF_10,
+
+ // Application select keys
+ APP_SLK, // Slack
+ APP_EMCS, // Emacs
+ APP_TERM, // Terminal
+ APP_CHRM, // Chrome
+ APP_MSIC, // Music
+
+ // Diagonal mouse movement
+ A_MUL,
+ A_MUR,
+ A_MDL,
+ A_MDR,
+
+ // Mouse acceleration
+ A_ACL0,
+ A_ACL1,
+ A_ACL2,
+
+ // Hungarian layer keys
+ HU_AA, // Á
+ HU_OO, // Ó
+ HU_EE, // É
+ HU_UU, // Ú
+ HU_II, // Í
+ HU_OE, // Ö
+ HU_UE, // Ü
+ HU_OEE, // Ő
+ HU_UEE, // Ű
+};
+
+/* Fn keys */
+
+enum {
+ F_BSE = 0,
+ F_HUN,
+ F_GUI,
+ F_SFT,
+ F_ALT,
+ F_CTRL
+};
+
+/* Custom keycodes */
+
+enum {
+ CT_CLN = 0,
+ CT_TA,
+ CT_LBP,
+ CT_RBP
+};
+
+/* States & timers */
+
+uint16_t gui_timer = 0;
+
+uint16_t kf_timers[12];
+
+#if KEYLOGGER_ENABLE
+# ifdef AUTOLOG_ENABLE
+bool log_enable = true;
+# else
+bool log_enable = false;
+# endif
+#endif
+
+bool time_travel = false;
+
+/* The Keymap */
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+/* Keymap 0: Base Layer
+ *
+ * ,-----------------------------------------------------. ,-----------------------------------------------------.
+ * | Next/Prev | 1 F1 | 2 F2 | 3 F3 | 4 F4 | 5 F5 | Plvr | | F12 | 6 F6 | 7 F7 | 8 F8 | 9 F9 | 0 F10| F11 |
+ * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
+ * | ~ | ' | , | . | P | Y | ( | | ) | F | G | C | R | L | \ |
+ * |-----------+------+------+------+------+------| [ | | ] |------+------+------+------+------+-----------|
+ * | Tab/ARROW | A | O | E | U | I |------| |------| D | H | T | N | S | = / Arrow |
+ * |-----------+------+------+------+------+------| : | | - |------+------+------+------+------+-----------|
+ * | Play/Pause| / | Q | J | K | X | | | | B | M | W | V | Z | Stop |
+ * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
+ * | | | | | : | | - | | | | |
+ * `-----------------------------------' `-----------------------------------'
+ * ,-------------. ,-------------.
+ * | LAlt | GUI | | MDIA | Del |
+ * ,------|------|------| |------+------+------.
+ * | | | Ctrl | | LEAD | | |
+ * |Backsp|LShift|------| |------| Enter| Space|
+ * | | | ESC | | HUN | | |
+ * `--------------------' `--------------------'
+ */
+[BASE] = KEYMAP(
+// left hand
+ M(A_MPN) ,M(KF_1) ,M(KF_2) ,M(KF_3),M(KF_4),M(KF_5),M(A_PLVR)
+,KC_GRV ,KC_QUOT ,KC_COMM ,KC_DOT ,KC_P ,KC_Y ,TD(CT_LBP)
+,TD(CT_TA) ,KC_A ,KC_O ,KC_E ,KC_U ,KC_I
+,KC_MPLY ,KC_SLSH ,KC_Q ,KC_J ,KC_K ,KC_X ,TD(CT_CLN)
+,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN)
+
+ ,F(F_ALT),F(F_GUI)
+ ,F(F_CTRL)
+ ,KC_BSPC,F(F_SFT),KC_ESC
+
+ // right hand
+ ,KC_F12 ,M(KF_6),M(KF_7) ,M(KF_8),M(KF_9) ,M(KF_10) ,KC_F11
+ ,TD(CT_RBP),KC_F ,KC_G ,KC_C ,KC_R ,KC_L ,KC_BSLS
+ ,KC_D ,KC_H ,KC_T ,KC_N ,KC_S ,KC_EQL
+ ,KC_MINS ,KC_B ,KC_M ,KC_W ,KC_V ,KC_Z ,KC_MSTP
+ ,KC_MINS ,KC_NO ,KC_NO ,KC_NO ,KC_NO
+
+ ,OSL(NMDIA),KC_DEL
+ ,KC_LEAD
+ ,F(F_HUN) ,KC_ENT ,KC_SPC
+ ),
+
+/* Keymap 1: Adore layer
+ *
+ * ,-----------------------------------------------------. ,-----------------------------------------------------.
+ * | Play/Pause| 1 F1 | 2 F2 | 3 F3 | 4 F4 | 5 F5 | Plvr | | F12 | 6 F6 | 7 F7 | 8 F8 | 9 F9 | 0 F10| F11 |
+ * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
+ * | `~ | Y | W | G | L | M | ( | | ) | F | H | C | P | X | \ |
+ * |-----------+------+------+------+------+------| [ | | ] |------+------+------+------+------+-----------|
+ * | Tab/Arrow | A | O | E | I | U |------| |------| D | R | T | N | S | = |
+ * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
+ * | | Z | Q | ' | , | . | : | | - | B | K | V | J | / | |
+ * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
+ * | | | | | | | | | | | |
+ * `-----------------------------------' `-----------------------------------'
+ * ,-------------. ,-------------.
+ * | LAlt | GUI | | MDIA | Del |
+ * ,------|------|------| |------+------+------.
+ * | | | Ctrl | | HUN | | |
+ * |Backsp|LShift|------| |------| Enter| Space|
+ * | | | ESC | | LEAD | | |
+ * `--------------------' `--------------------'
+ */
+[ADORE] = KEYMAP(
+// left hand
+ KC_MPLY ,M(KF_1) ,M(KF_2) ,M(KF_3),M(KF_4),M(KF_5),M(A_PLVR)
+,KC_GRV ,KC_Y ,KC_W ,KC_G ,KC_L ,KC_M ,TD(CT_LBP)
+,TD(CT_TA) ,KC_A ,KC_O ,KC_E ,KC_I ,KC_U
+,KC_NO ,KC_Z ,KC_Q ,KC_QUOT,KC_COMM,KC_DOT ,TD(CT_CLN)
+,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
+
+ ,F(F_ALT),F(F_GUI)
+ ,F(F_CTRL)
+ ,KC_BSPC,F(F_SFT),KC_ESC
+
+ // right hand
+ ,KC_F12 ,M(KF_6),M(KF_7),M(KF_8),M(KF_9) ,M(KF_10) ,KC_F11
+ ,TD(CT_RBP),KC_F ,KC_H ,KC_C ,KC_P ,KC_X ,KC_BSLS
+ ,KC_D ,KC_R ,KC_T ,KC_N ,KC_S ,KC_EQL
+ ,KC_MINS ,KC_B ,KC_K ,KC_V ,KC_J ,KC_SLSH ,KC_NO
+ ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
+
+ ,OSL(NMDIA),KC_DEL
+ ,F(F_HUN)
+ ,KC_LEAD ,KC_ENT ,KC_SPC
+ ),
+
+/* Keymap 2: Arrow layer
+ *
+ * ,-----------------------------------------------------. ,-----------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
+ * | | | | | | | | | | | Home | Up | End | | |
+ * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
+ * | | | | | | |------| |------| | Left | Down | Rght | | |
+ * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
+ * | | | | | | | | | | | | | | | |
+ * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
+ * | | | | | | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | Enter| |------| |------| PgUp | PgDn |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+
+[ARRW] = KEYMAP(
+// left hand
+ KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+
+ ,KC_TRNS ,KC_TRNS
+ ,KC_TRNS
+ ,KC_ENT ,KC_TRNS ,KC_TRNS
+
+ // right hand
+ ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+ ,KC_TRNS ,KC_TRNS ,KC_HOME ,KC_UP ,KC_END ,KC_TRNS ,KC_TRNS
+ ,KC_TRNS ,KC_LEFT ,KC_DOWN ,KC_RGHT ,KC_TRNS ,KC_TRNS
+ ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+ ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+
+ ,KC_TRNS ,KC_TRNS
+ ,KC_TRNS
+ ,KC_TRNS ,KC_PGUP ,KC_PGDN
+ ),
+
+/* Keymap 3: Application select layer
+ *
+ * ,-----------------------------------------------------. ,-----------------------------------------------------.
+ * | |Music |Slack |Emacs |Term |Chrome| | | | | | | | | |
+ * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
+ * | | | | | | | | | | | | | | | |
+ * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
+ * | | | | | | |------| |------| | | | | | |
+ * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
+ * | | | | | | | | | | | | | | | |
+ * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
+ * | | | | | | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | | |------| |------| | |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+
+[APPSEL] = KEYMAP(
+// left hand
+ KC_TRNS ,M(APP_MSIC),M(APP_SLK),M(APP_EMCS),M(APP_TERM),M(APP_CHRM),KC_TRNS
+,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+
+ ,KC_TRNS ,KC_TRNS
+ ,KC_TRNS
+ ,KC_TRNS ,KC_TRNS ,KC_TRNS
+
+ // right hand
+ ,KC_TRNS ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_TRNS
+ ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+ ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+ ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+ ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
+
+ ,KC_TRNS ,KC_TRNS
+ ,KC_TRNS
+ ,KC_TRNS ,KC_TRNS ,KC_TRNS
+ ),
+
+
+/* Keymap 4: Hungarian Layer
+ *
+ * ,-----------------------------------------------------. ,-----------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
+ * | | | Ő | | Ű | | | | | | | | | | |
+ * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
+ * | | Á | Ó | É | Ú | Í |------| |------| | | | | | |
+ * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
+ * | | | Ö | | Ü | | | | | | | | | | |
+ * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
+ * | | | | | | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | | |------| |------| | |
+ * | | | | | BASE | | |
+ * `--------------------' `--------------------'
+ */
+
+[HUN] = KEYMAP(
+// left hand
+ KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
+,KC_NO ,KC_NO ,M(HU_OEE),KC_NO ,M(HU_UEE),KC_NO ,KC_NO
+,KC_NO ,M(HU_AA),M(HU_OO) ,M(HU_EE),M(HU_UU) ,M(HU_II)
+,KC_NO ,KC_NO ,M(HU_OE) ,KC_NO ,M(HU_UE) ,KC_NO ,KC_NO
+,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
+
+ ,KC_NO ,KC_NO
+ ,KC_NO
+ ,KC_NO ,KC_TRNS ,KC_TRNS
+
+ // right hand
+ ,KC_TRNS ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
+ ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
+ ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
+ ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
+ ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
+
+ ,KC_NO ,KC_NO
+ ,KC_NO
+ ,F(F_BSE),KC_TRNS ,KC_TRNS
+ ),
+
+/* Keymap 5: Navigation & Media layer
+ *
+ * ,-----------------------------------------------------. ,-----------------------------------------------------.
+ * | MS Slow | | | | | |ScrLCK| |ScrLCK| | | | | | |
+ * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
+ * | MS Normal | | Home | Up | PgUp | | | |Scroll| |MsUpL | MsUp |MsUpR | |PrintScreen|
+ * |-----------+------+------+------+------+------| | | Up |------+------+------+------+------+-----------|
+ * | MS Fast | | Left | Down | Right| |------| |------| |MsLeft| MsDn |MsRght| | |
+ * |-----------+------+------+------+------+------| | |Scroll|------+------+------+------+------+-----------|
+ * | Play/Pause| | End | Down | PgDn | | | | Down | |MsDnL | MsDn |MsDnR | | Stop |
+ * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
+ * | | | | | | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | Mute | VlUp | | BASE | MClk |
+ * ,------|------|------| |------+------+------.
+ * | | | VlDn | | Prev |Left |Right |
+ * | SPC | Enter|------| |------| Click| Click|
+ * | | | ESC | | Next | | |
+ * `--------------------' `--------------------'
+ */
+[NMDIA] = KEYMAP(
+// left hand
+ M(A_ACL0) ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,LGUI(KC_L)
+,M(A_ACL1) ,KC_NO ,KC_HOME ,KC_UP ,KC_PGUP ,KC_NO ,KC_NO
+,M(A_ACL2) ,KC_NO ,KC_LEFT ,KC_DOWN ,KC_RIGHT,KC_NO
+,KC_MPLY ,KC_NO ,KC_END ,KC_DOWN ,KC_PGDN ,KC_NO ,KC_NO
+,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
+ ,KC_MUTE ,KC_VOLU
+ ,KC_VOLD
+ ,KC_SPC,KC_ENTER,KC_ESC
+
+ // right hand
+ ,LGUI(KC_L),KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
+ ,KC_WH_U ,KC_NO ,M(A_MUL),KC_MS_U ,M(A_MUR),KC_NO ,KC_PSCR
+ ,KC_NO ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_NO ,KC_NO
+ ,KC_WH_D ,KC_NO ,M(A_MDL),KC_MS_D ,M(A_MDR),KC_NO ,KC_MSTP
+ ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
+
+ ,KC_TRNS ,KC_MS_BTN3
+ ,KC_MPRV
+ ,KC_MNXT ,KC_BTN1 ,KC_BTN2
+ ),
+
+/* Keymap 6: Steno for Plover
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | | | | | | | BASE | | | | | | | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | # | # | # | # | # | # | | # | # | # | # | # | # | # |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | | T | P | H | |------| |------| | F | P | L | T | D |
+ * |--------+ S +------+------+------+ * | * | | * | * +------+------+------+------+--------|
+ * | | | K | W | R | | | | | | R | B | G | S | Z |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | | | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | A | O |------| |------| E | U |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+
+[PLVR] = KEYMAP(
+// left hand
+KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, M(A_PLVR),
+KC_NO, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM,
+KC_NO, PV_LS, PV_LT, PV_LP, PV_LH, PV_STAR,
+KC_NO, PV_LS, PV_LK, PV_LW, PV_LR, PV_STAR, PV_STAR,
+KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO,
+ KC_NO,
+ PV_A, PV_O, KC_NO,
+
+ // right hand
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM, PV_NUM,
+ PV_STAR, PV_RF, PV_RP, PV_RL, PV_RT, PV_RD,
+ PV_STAR, PV_STAR, PV_RR, PV_RB, PV_RG, PV_RS, PV_RZ,
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO,
+ KC_NO,
+ KC_NO,PV_E, PV_U
+ ),
+
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [F_BSE] = ACTION_LAYER_CLEAR(ON_PRESS)
+ ,[F_HUN] = ACTION_LAYER_INVERT(HUN, ON_PRESS)
+ ,[F_GUI] = ACTION_MACRO_TAP(A_GUI)
+ ,[F_SFT] = ACTION_MODS_ONESHOT (MOD_LSFT)
+ ,[F_ALT] = ACTION_MODS_ONESHOT (MOD_LALT)
+ ,[F_CTRL] = ACTION_MODS_ONESHOT (MOD_LCTL)
+};
+
+static void toggle_steno(int pressed)
+{
+ uint8_t layer = biton32(layer_state);
+
+ if (pressed) {
+ if (layer != PLVR) layer_on(PLVR); else layer_off(PLVR);
+
+ register_code(PV_LP);
+ register_code(PV_LH);
+ register_code(PV_LR);
+ register_code(PV_O);
+ register_code(PV_RL);
+ register_code(PV_RG);
+ } else {
+ unregister_code(PV_LP);
+ unregister_code(PV_LH);
+ unregister_code(PV_LR);
+ unregister_code(PV_O);
+ unregister_code(PV_RL);
+ unregister_code(PV_RG);
+ }
+}
+
+static macro_t *ang_do_hun (keyrecord_t *record, uint16_t accent, uint16_t hun_char)
+{
+ uint8_t need_shift = 0;
+ uint8_t hold_shift = 0;
+
+ if (!record->event.pressed)
+ return MACRO_NONE;
+
+ layer_off (HUN);
+
+ if (keyboard_report->mods & MOD_BIT (KC_LSFT)) {
+ hold_shift = 1;
+ need_shift = 1;
+ unregister_code (KC_LSFT);
+ }
+ if ((get_oneshot_mods () & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out ()) {
+ need_shift = 1;
+ hold_shift = 0;
+ unregister_code (KC_LSFT);
+ }
+
+ clear_oneshot_mods ();
+
+ register_code (KC_RALT);
+ unregister_code (KC_RALT);
+ if (accent == (KC_DQT)) {
+ register_code (KC_RSFT);
+ }
+ register_code (accent);
+ unregister_code (accent);
+ if (need_shift && accent != (KC_DQT)) {
+ register_code (KC_RSFT);
+ } else if (accent == (KC_DQT) && !need_shift) {
+ unregister_code (KC_RSFT);
+ }
+ register_code (hun_char);
+ unregister_code (hun_char);
+ if (need_shift || accent == (KC_DQT))
+ unregister_code (KC_RSFT);
+ if (hold_shift)
+ register_code (KC_LSFT);
+
+ return MACRO_NONE;
+}
+
+static bool from_appsel;
+
+static void ang_handle_kf (keyrecord_t *record, uint8_t id)
+{
+ uint8_t code = id - KF_1;
+
+ if (record->event.pressed) {
+ kf_timers[code] = timer_read ();
+ } else {
+ uint8_t kc_base;
+
+ if (from_appsel) {
+ from_appsel = false;
+ return;
+ }
+
+ if (kf_timers[code] && timer_elapsed (kf_timers[code]) > TAPPING_TERM) {
+ // Long press
+ kc_base = KC_F1;
+ } else {
+ kc_base = KC_1;
+ }
+ kf_timers[code] = 0;
+ code += kc_base;
+
+ register_code (code);
+ unregister_code (code);
+ }
+}
+
+static struct {
+ uint8_t idx;
+} m_accel_state;
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ switch(id) {
+ case A_MPN:
+ if (record->event.pressed) {
+ if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
+ ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out())) {
+ int oneshot = ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out());
+
+ if (oneshot)
+ clear_oneshot_mods ();
+ unregister_code (KC_LSFT);
+
+ register_code (KC_MPRV);
+ unregister_code (KC_MPRV);
+
+ if (!oneshot)
+ register_code (KC_LSFT);
+ } else {
+ return MACRO (T(MNXT), END);
+ }
+ }
+ break;
+
+ /* Hungarian layer */
+ case HU_AA:
+ return ang_do_hun (record, KC_QUOT, KC_A);
+ case HU_OO:
+ return ang_do_hun (record, KC_QUOT, KC_O);
+ case HU_EE:
+ return ang_do_hun (record, KC_QUOT, KC_E);
+ case HU_UU:
+ return ang_do_hun (record, KC_QUOT, KC_U);
+ case HU_II:
+ return ang_do_hun (record, KC_QUOT, KC_I);
+ case HU_OE:
+ return ang_do_hun (record, KC_DQT, KC_O);
+ case HU_UE:
+ return ang_do_hun (record, KC_DQT, KC_U);
+ case HU_OEE:
+ return ang_do_hun (record, KC_EQL, KC_O);
+ case HU_UEE:
+ return ang_do_hun (record, KC_EQL, KC_U);
+
+#if MOUSEKEY_ENABLE
+ /* Mouse movement */
+ case A_MUL:
+ if (record->event.pressed) {
+ mousekey_on(KC_MS_UP);
+ mousekey_on(KC_MS_LEFT);
+ } else {
+ mousekey_off(KC_MS_UP);
+ mousekey_off(KC_MS_LEFT);
+ }
+ mousekey_send();
+ break;
+
+ case A_MUR:
+ if (record->event.pressed) {
+ mousekey_on(KC_MS_UP);
+ mousekey_on(KC_MS_RIGHT);
+ } else {
+ mousekey_off(KC_MS_UP);
+ mousekey_off(KC_MS_RIGHT);
+ }
+ mousekey_send();
+ break;
+
+ case A_MDL:
+ if (record->event.pressed) {
+ mousekey_on(KC_MS_DOWN);
+ mousekey_on(KC_MS_LEFT);
+ } else {
+ mousekey_off(KC_MS_DOWN);
+ mousekey_off(KC_MS_LEFT);
+ }
+ mousekey_send();
+ break;
+
+ case A_MDR:
+ if (record->event.pressed) {
+ mousekey_on(KC_MS_DOWN);
+ mousekey_on(KC_MS_RIGHT);
+ } else {
+ mousekey_off(KC_MS_DOWN);
+ mousekey_off(KC_MS_RIGHT);
+ }
+ mousekey_send();
+ break;
+
+ case A_ACL0 ... A_ACL2:
+ if (record->event.pressed) {
+ uint8_t idx = id - A_ACL0;
+ if (m_accel_state.idx == id) {
+ mousekey_off(m_accel_state.idx - A_ACL0 + KC_ACL0);
+ m_accel_state.idx = 0;
+ } else {
+ if (m_accel_state.idx) {
+ mousekey_off(m_accel_state.idx - A_ACL0 + KC_ACL0);
+ m_accel_state.idx = 0;
+ }
+ mousekey_on(KC_ACL0 + idx);
+ m_accel_state.idx = id;
+ }
+ }
+ break;
+#endif
+
+ /* Plover base */
+ case A_PLVR:
+ toggle_steno(record->event.pressed);
+ break;
+
+ /* GUI & AppSel */
+ case A_GUI:
+ if (record->event.pressed) {
+ register_code (KC_LGUI);
+ if (record->tap.count && !record->tap.interrupted) {
+ if (record->tap.count >= 2) {
+ register_code (KC_W);
+ layer_on (APPSEL);
+ set_oneshot_layer (APPSEL, ONESHOT_START);
+ }
+ } else {
+ record->tap.count = 0;
+ }
+ gui_timer = 0;
+ } else {
+ if (record->tap.count >= 2)
+ {
+ unregister_code (KC_W);
+ clear_oneshot_layer_state (ONESHOT_PRESSED);
+ }
+ gui_timer = timer_read ();
+ }
+ break;
+
+ case APP_SLK:
+ from_appsel = true;
+ return MACRODOWN(T(S), T(L), T(A), T(C), T(K), T(ENT), END);
+
+ case APP_EMCS:
+ from_appsel = true;
+ return MACRODOWN(T(G), T(N), T(U), T(SPC), T(E), T(M), T(A), T(C), T(S), T(SPC), T(2), T(4), T(ENT), END);
+
+ case APP_TERM:
+ from_appsel = true;
+ if (!record->event.pressed) {
+ register_code(KC_ESC);
+ unregister_code(KC_ESC);
+ wait_ms(TAPPING_TERM + 25);
+ register_code(KC_DEL);
+ unregister_code(KC_DEL);
+ }
+ break;
+
+ case APP_CHRM:
+ from_appsel = true;
+ return MACRODOWN(T(C), T(H), T(R), T(O), T(M), T(ENT), END);
+
+ case APP_MSIC:
+ from_appsel = true;
+ return MACRODOWN(T(R), T(H), T(Y), T(T), T(H), T(M), T(B), T(O), T(X), T(ENT), END);
+
+ /* Function keys */
+ case KF_1 ... KF_10:
+ ang_handle_kf (record, id);
+ break;
+ }
+
+ return MACRO_NONE;
+};
+
+static uint8_t is_adore = 0;
+
+// Runs just one time when the keyboard initializes.
+void matrix_init_user(void) {
+ uint8_t dl;
+
+ set_unicode_input_mode(UC_LNX);
+
+ ergodox_led_all_on();
+ for (int i = LED_BRIGHTNESS_HI; i > LED_BRIGHTNESS_LO; i--) {
+ ergodox_led_all_set (i);
+ wait_ms (5);
+ }
+ wait_ms(1000);
+ for (int i = LED_BRIGHTNESS_LO; i > 0; i--) {
+ ergodox_led_all_set (i);
+ wait_ms (10);
+ }
+ ergodox_led_all_off();
+
+ if (!eeconfig_is_enabled())
+ eeconfig_init();
+ dl = eeconfig_read_default_layer ();
+ if (dl == (1UL << ADORE)) {
+ is_adore = 1;
+ }
+};
+
+LEADER_EXTERNS();
+
+static void ang_tap (uint8_t code, ...) {
+ uint8_t kc = code;
+ va_list ap;
+
+ va_start(ap, code);
+
+ do {
+ register_code(kc);
+ unregister_code(kc);
+ wait_ms(50);
+ kc = va_arg(ap, int);
+ } while (kc != 0);
+ va_end(ap);
+}
+
+#define TAP_ONCE(code) \
+ register_code (code); \
+ unregister_code (code)
+
+typedef struct {
+ bool layer_toggle;
+ bool sticky;
+} td_ta_state_t;
+
+static void ang_tap_dance_ta_finished (qk_tap_dance_state_t *state, void *user_data) {
+ td_ta_state_t *td_ta = (td_ta_state_t *) user_data;
+
+ if (td_ta->sticky) {
+ td_ta->sticky = false;
+ td_ta->layer_toggle = false;
+ layer_off (ARRW);
+ return;
+ }
+
+ if (state->count == 1 && !state->pressed) {
+ register_code (KC_TAB);
+ td_ta->sticky = false;
+ td_ta->layer_toggle = false;
+ } else {
+ td_ta->layer_toggle = true;
+ layer_on (ARRW);
+ td_ta->sticky = (state->count == 2);
+ }
+}
+
+static void ang_tap_dance_ta_reset (qk_tap_dance_state_t *state, void *user_data) {
+ td_ta_state_t *td_ta = (td_ta_state_t *) user_data;
+
+ if (!td_ta->layer_toggle)
+ unregister_code (KC_TAB);
+ if (!td_ta->sticky)
+ layer_off (ARRW);
+}
+
+qk_tap_dance_action_t tap_dance_actions[] = {
+ [CT_CLN] = ACTION_TAP_DANCE_DOUBLE (KC_COLN, KC_SCLN)
+ ,[CT_TA] = {
+ .fn = { NULL, ang_tap_dance_ta_finished, ang_tap_dance_ta_reset },
+ .user_data = (void *)&((td_ta_state_t) { false, false })
+ }
+ ,[CT_LBP] = ACTION_TAP_DANCE_DOUBLE (KC_LBRC, KC_LPRN)
+ ,[CT_RBP] = ACTION_TAP_DANCE_DOUBLE (KC_RBRC, KC_RPRN)
+};
+
+// Runs constantly in the background, in a loop.
+void matrix_scan_user(void) {
+ uint8_t layer = biton32(layer_state);
+ bool is_arrow = false;
+
+ if (gui_timer && timer_elapsed (gui_timer) > TAPPING_TERM)
+ unregister_code (KC_LGUI);
+
+ if (layer == HUN) {
+ ergodox_right_led_2_on();
+ ergodox_right_led_3_on();
+ } else if (layer == NMDIA) {
+ ergodox_right_led_1_on();
+ ergodox_right_led_2_on();
+ } else if (layer == PLVR) {
+ ergodox_right_led_1_on ();
+ ergodox_right_led_2_on ();
+ ergodox_right_led_3_on ();
+ } else if (layer == ADORE) {
+ ergodox_right_led_1_on ();
+ ergodox_right_led_2_on ();
+ ergodox_right_led_3_on ();
+
+ ergodox_right_led_2_set (LED_BRIGHTNESS_HI);
+ }
+
+ if (layer_state & (1UL << ARRW)) {
+ ergodox_right_led_1_on ();
+ ergodox_right_led_3_on ();
+ is_arrow = true;
+ }
+
+ if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
+ ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out())) {
+ ergodox_right_led_1_set (LED_BRIGHTNESS_HI);
+ ergodox_right_led_1_on ();
+ } else {
+ ergodox_right_led_1_set (LED_BRIGHTNESS_LO);
+ if (layer != NMDIA && layer != PLVR && layer != ADORE && !is_arrow)
+ ergodox_right_led_1_off ();
+ }
+
+ if (keyboard_report->mods & MOD_BIT(KC_LALT) ||
+ ((get_oneshot_mods() & MOD_BIT(KC_LALT)) && !has_oneshot_mods_timed_out())) {
+ ergodox_right_led_2_set (LED_BRIGHTNESS_HI);
+ ergodox_right_led_2_on ();
+ } else {
+ ergodox_right_led_2_set (LED_BRIGHTNESS_LO);
+ if (layer != HUN && layer != NMDIA && layer != PLVR && layer != ADORE)
+ ergodox_right_led_2_off ();
+ }
+
+ if (keyboard_report->mods & MOD_BIT(KC_LCTRL) ||
+ ((get_oneshot_mods() & MOD_BIT(KC_LCTRL)) && !has_oneshot_mods_timed_out())) {
+ ergodox_right_led_3_set (LED_BRIGHTNESS_HI);
+ ergodox_right_led_3_on ();
+ } else {
+ ergodox_right_led_3_set (LED_BRIGHTNESS_LO);
+ if (layer != HUN && layer != PLVR && layer != ADORE && !is_arrow)
+ ergodox_right_led_3_off ();
+ }
+
+ LEADER_DICTIONARY() {
+ leading = false;
+ leader_end ();
+
+#if KEYLOGGER_ENABLE
+ SEQ_ONE_KEY (KC_D) {
+ ergodox_led_all_on();
+ wait_ms(100);
+ ergodox_led_all_off();
+ log_enable = !log_enable;
+ }
+#endif
+
+ SEQ_ONE_KEY (KC_Q) {
+ register_code16 (LCTL(KC_1));
+ unregister_code16 (LCTL(KC_1));
+ }
+
+ SEQ_ONE_KEY (KC_T) {
+ time_travel = !time_travel;
+ }
+
+ SEQ_ONE_KEY (KC_U) {
+ qk_ucis_start();
+ }
+
+ SEQ_ONE_KEY (KC_V) {
+ SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ (" QMK_VERSION "/" KEYMAP_VERSION ")");
+ }
+
+ SEQ_ONE_KEY (KC_L) {
+ /* λ */
+ unicode_input_start();
+ register_hex(0x03bb);
+ unicode_input_finish();
+ }
+
+ SEQ_ONE_KEY (KC_Y) {
+ ang_tap (KC_BSLS, KC_O, KC_SLSH, 0);
+ }
+
+ SEQ_ONE_KEY (KC_S) {
+ unicode_input_start(); register_hex(0xaf); unicode_input_finish();
+ TAP_ONCE (KC_BSLS);
+ register_code (KC_RSFT); TAP_ONCE (KC_MINS); TAP_ONCE (KC_9); unregister_code (KC_RSFT);
+ unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
+ register_code (KC_RSFT); TAP_ONCE (KC_0); TAP_ONCE (KC_MINS); unregister_code (KC_RSFT);
+ TAP_ONCE (KC_SLSH);
+ unicode_input_start (); register_hex(0xaf); unicode_input_finish();
+ }
+
+ SEQ_TWO_KEYS (KC_W, KC_M) {
+ register_code (KC_LALT);
+ register_code (KC_F2);
+ unregister_code (KC_F2);
+ unregister_code (KC_LALT);
+
+ wait_ms (1000);
+
+ ang_tap (KC_M, KC_A, KC_X, KC_MINS, KC_F, KC_O, KC_C, KC_U, KC_S, KC_E, KC_D, KC_ENT, 0);
+ register_code (KC_LGUI);
+ register_code (KC_UP);
+ unregister_code (KC_UP);
+ unregister_code (KC_LGUI);
+ }
+
+ SEQ_ONE_KEY (KC_A) {
+ if (is_adore == 0) {
+ default_layer_and (0);
+ default_layer_or ((1UL << ADORE));
+ eeconfig_update_default_layer ((1UL << ADORE));
+ is_adore = 1;
+
+ ergodox_led_all_off ();
+ ergodox_right_led_3_on ();
+ wait_ms (100);
+ ergodox_right_led_2_on ();
+ wait_ms (100);
+ ergodox_right_led_3_off ();
+ ergodox_right_led_1_on ();
+ wait_ms (100);
+ ergodox_right_led_2_off ();
+ wait_ms (100);
+ ergodox_right_led_1_off ();
+ } else {
+ is_adore = 0;
+ default_layer_and (0);
+ default_layer_or (1UL << BASE);
+ eeconfig_update_default_layer ((1UL << BASE));
+
+ ergodox_led_all_off ();
+ ergodox_right_led_1_on ();
+ wait_ms (100);
+ ergodox_right_led_2_on ();
+ wait_ms (100);
+ ergodox_right_led_1_off ();
+ ergodox_right_led_3_on ();
+ wait_ms (100);
+ ergodox_right_led_2_off ();
+ wait_ms (100);
+ ergodox_right_led_3_off ();
+ }
+ }
+ }
+}
+
+static uint16_t last4[4];
+
+const qk_ucis_symbol_t ucis_symbol_table[] = UCIS_TABLE
+(
+ UCIS_SYM("poop", 0x1f4a9),
+ UCIS_SYM("rofl", 0x1f923),
+ UCIS_SYM("kiss", 0x1f619),
+ UCIS_SYM("snowman", 0x2603),
+ UCIS_SYM("coffee", 0x2615),
+ UCIS_SYM("heart", 0x2764),
+ UCIS_SYM("bolt", 0x26a1)
+);
+
+bool process_record_user (uint16_t keycode, keyrecord_t *record) {
+#if KEYLOGGER_ENABLE
+ if (log_enable) {
+ xprintf ("KL: col=%02d, row=%02d, pressed=%d, layer=%s\n", record->event.key.col,
+ record->event.key.row, record->event.pressed, (is_adore) ? "ADORE" : "Dvorak");
+ }
+#endif
+
+ if (keycode == KC_ESC && record->event.pressed) {
+ bool queue = true;
+
+ if ((get_oneshot_mods ()) && !has_oneshot_mods_timed_out ()) {
+ clear_oneshot_mods ();
+ queue = false;
+ }
+ if (layer_state & (1UL<<HUN)) {
+ layer_off (HUN);
+ queue = false;
+ }
+ return queue;
+ }
+
+ if (time_travel && !record->event.pressed) {
+ uint8_t p;
+
+ // shift cache one to the left
+ for (p = 0; p < 3; p++) {
+ last4[p] = last4[p + 1];
+ }
+ last4[3] = keycode;
+
+ if (last4[0] == KC_D && last4[1] == KC_A && last4[2] == KC_T && last4[3] == KC_E) {
+ ang_tap (KC_E, KC_SPC, KC_MINS, KC_D, KC_SPC, KC_QUOT, 0);
+ register_code (KC_RSFT);
+ register_code (KC_EQL);
+ unregister_code (KC_EQL);
+ unregister_code (KC_RSFT);
+
+ ang_tap (KC_4, KC_SPC, KC_D, KC_A, KC_Y, KC_S, KC_QUOT, 0);
+
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void qk_ucis_symbol_fallback (void) {
+ for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) {
+ uint8_t code;
+
+ if (qk_ucis_state.codes[i] > KF_1)
+ code = qk_ucis_state.codes[i] - KF_1 + KC_1;
+ else
+ code = qk_ucis_state.codes[i];
+ register_code(code);
+ unregister_code(code);
+ wait_ms (10);
+ }
+}
diff --git a/keyboards/ergodox/keymaps/algernon/readme.md b/keyboards/ergodox/keymaps/algernon/readme.md
index 6fe177511..5e7adb332 100644
--- a/keyboards/ergodox/keymaps/algernon/readme.md
+++ b/keyboards/ergodox/keymaps/algernon/readme.md
@@ -3,11 +3,15 @@
algernon's layout
=======================
-This is an unconventional layout for the ErgoDox EZ. For more details about the history of the layout, see my [blog posts about my ErgoDox journey][blog-ergodox].
+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].
+ [ez]: https://ergodox-ez.com/
[blog-ergodox]: https://asylum.madhouse-project.org/blog/tags/ergodox/
-Some of the things in the layout only work when one uses Spacemacs and GNOME under Linux. Your mileage may vary.
+Some of the things in the layout only work when one uses [Spacemacs][spacemacs] and [GNOME][gnome] under Linux. Your mileage may vary.
+
+ [spacemacs]: http://spacemacs.org/
+ [gnome]: https://www.gnome.org/
## Table of Contents
@@ -16,11 +20,12 @@ Some of the things in the layout only work when one uses Spacemacs and GNOME und
- [ADORE layer](#adore-layer)
- [Hungarian layer](#hungarian-layer)
- [Navigation and media layer](#navigation-and-media-layer)
- - [One-handed layer](#one-handed-layer)
- [Steno layer](#steno-layer)
- [LED states](#led-states)
* [Tools](#tools)
- [Heatmap](#heatmap)
+* [Special features](#special-features)
+ - [Unicode Symbol Input](#unicode-symbol-input)
* [Building](#building)
- [Using on Windows](#using-on-windows)
* [Changelog](#changelog)
@@ -38,11 +43,11 @@ At its core, this is a Dvorak layout, with some minor changes. The more interest
* 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.
* The `GUI` key is special, because when I double-tap it, it sends `GUI + w`, which pops up an application selector. It also switches to a one-shot layer, where the number row on the left half turns into app selector macros, for the most common things I usually want to switch to. Otherwise it behaves as on a normal layout.
* 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.
-* The **Media** and **Hun** layer keys are one-shot, the **1Hand** and **STENO** keys are toggles.
-* When holding any of the **Arrow** layer keys, the arrow layer activates while the layer key is held. Tapping the key produces the normal key.
+* The **Media** and **Hun** layer keys are one-shot, the **STENO** key is a toggle.
+* 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.
* Tapping the `:` key once yields `:`, tapping it twice yields `;`.
+* Tapping the `[{(`/`)}]` keys once yields `[` (or `{` when shifted), tapping them twice yields `(`.
* The **Lead** key allows me to type in a sequence of keys, and trigger some actions:
- - `LEAD u` enters unicode input mode, by sending the GTK+ key sequence that does this.
- `LEAD l` uses the unicode input method to enter a `λ`.
- `LEAD s` does a lot of magic to type in a shruggie: `¯\_(ツ)_/¯`
- `LEAD y` types `\o/`.
@@ -51,6 +56,7 @@ At its core, this is a Dvorak layout, with some minor changes. The more interest
- `LEAD v` prints the firmware version, the keyboard and the keymap.
- `LEAD d` toggles logging keypress positions to the HID console.
- `LEAD t` toggles time travel. Figuring out the current `date` is left as an exercise to the reader.
+ - `LEAD u` enters the [Unicode symbol input](#unicode-symbol-input) mode.
## ADORE layer
@@ -74,20 +80,6 @@ On this layer, the accented characters are at the same position as their base va
This layer is primarily for navigating with the cursor or the mouse, and some media things.
-## One-handed layer
-
-[![One-handed layer](images/one-handed-layer.png)](http://www.keyboard-layout-editor.com/#/gists/edff2495135955b8963198dace7f7ece)
-
-The one-handed layer is used in situations where the right hand is occupied, by mousing around, for example. Tapping the `OTHER` key switches which side is active. For the most part, keys remain in their usual position. When the right half is active, keys are mirrored to the left half.
-
-The differences are as follows:
-
-* The `ESC` key has been moved to the bottom row, so the `OTHER` key is easier to tap.
-* Most keys on the thumb cluster now have dual uses, and these do not change when switching sides:
- - The `Space`/`Backspace` key sends `Space` on tap, `Backspace` when held for longer than a normal tap.
- - The `Enter`/`Shift` key sends `Enter` on short-tap, `Shift` on long-tap.
-* The `Apps`/`BASE` key can be used to go back to the base layer, by long-tapping it. A short-tap will send the `App` key, as usual.
-
## Steno layer
[![Steno layer for Plover](images/steno-layer.png)](http://www.keyboard-layout-editor.com/#/gists/401ef9a84369e47c57f9aedcf0a0d667)
@@ -103,18 +95,33 @@ For the layers, the following rules apply:
* 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.
* When the [Hungarian layer](#hungarian-layer) is active, the *green* and *blue* LEDs are on.
* When the [Navigation and media layer](#navigation-and-media-layer) is active, the *red* and *green* ones are on.
-* When the [One-handed layer](#one-handed-layer) is active, the *green* LED is on and bright, and either the *red* or the *blue* one is going to slowly blink, depending on the currently active side.
+* When the **ARROW** layer is active, the *red* and *blue* ones are on.
* For the [Steno layer](#steno-layer), all LEDs will be turned on.
Unless 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.
+# Special features
+
+## Unicode Symbol Input
+
+Once 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.
+
+The currently supported symbols are:
+
+- `snowman`: ☃
+- `kiss`: 😙
+- `rofl`: 🤣
+- `poop`: 💩
+
+This is an experimental feature, and may or may not work reliably.
+
# Tools
## Heatmap
When 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.
-Included 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, simply point `tools/log-to-heatmap.py` to a base layout file (one is included in the `tools/` directory), and the key position log. The latter one can create by running `hid-listen`, and redirecting its output to a file.
+Included 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.
[kle]: http://www.keyboard-layout-editor.com/
@@ -133,14 +140,14 @@ To make my workflow easier, this layout is maintained in [its own repository][al
$ git clone https://github.com/jackhumbert/qmk_firmware.git
$ cd qmk_firmware
$ git clone https://github.com/algernon/ergodox-layout.git \
- keyboards/ergodox_ez/keymaps/algernon-master
-$ make KEYBOARD=ergodox_ez KEYMAP=algernon-master
+ keyboards/ergodox/keymaps/algernon-master
+$ make keyboard=ergodox keymap=algernon-master
```
From 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):
```
-$ make KEYBOARD=ergodox_ez KEYMAP=algernon
+$ make keyboard=ergodox keymap=algernon
```
## Using on Windows
@@ -149,7 +156,47 @@ The keymap default to forcing NKRO, which seems to upset Windows, and except the
# Changelog
-## v1.4 - 2016-07-29
+## v1.6
+
+*2016-08-24*
+
+### Base layer changes
+
+* The parentheses & bracket keys have been merged: tapping them results in `[` or `{` (if it was shifted), double tapping leads to `(`.
+* The `:;` and `-_` keys are now available on the base layer, on their [ADORE](#adore-layer) location, too, just below `[{(`/`]})`.
+* The `Apps` key has been replaced by `F12`.
+* The `-`/`_` is no longer a tap-dance key.
+
+### ADORE layer changes
+
+* Adjustments were made to the [ADORE](#adore-layer) layer, to separate some inconvenient combinations.
+
+### Miscellaneous changes
+
+* `LEAD u` now starts the symbolic unicode input system, instead of the OS-one.
+* The mouse acceleration keys on the [Navigation and Media](#navigation-and-media-layer) 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.
+* When the **ARROW** layer is on, the *red* and *blue* LEDs light up now.
+
+### Heatmap
+
+* 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.
+* The heatmap generator received a lot of updates.
+
+## v1.5
+
+*2016-08-12*
+
+* The **1HAND** layer has been removed.
+* A `Delete` key is now available on the right thumb cluster.
+* The [ADORE](#adore-layer) layer received a major update, see the layout image above.
+* It is now possible to enable automatic logging for the [ADORE](#adore-layer) layer, by setting the `ADORE_AUTOLOG` makefile variable to `yes` when compiling the keymap. It is off by default.
+* The `~` key and the `Media Next/Prev` key have been swapped on the [base layer](#base-layer).
+* On the **ARROW** layer, `Backspace` has been replaced by `Enter`.
+* There is some experimental support for entering Unicode symbols.
+
+## v1.4
+
+*2016-07-29*
* When toggling the key logging on or off, the LEDs will do a little dance.
* The keylogger is now optional, but enabled by default. Use `KEYLOGGER_ENABLE=no` on the `make` command line to disable it.
@@ -157,14 +204,18 @@ The keymap default to forcing NKRO, which seems to upset Windows, and except the
* The `-`/`_` key was turned into a tap-dance key too.
* There is now a way to travel time with the keyboard, toggle the feature on by hitting `LEAD t`.
-## v1.3 - 2016-07-06
+## v1.3
+
+*2016-07-06*
* Added support for logging keys, by pressing `LEAD d`. Also included is a tool to generate a [heatmap](#heatmap) out of the logs.
* The arrow and navigation keys were rearranged again, and now require an additional key being held to activate. See the [base layer](#base-layer) for an image that shows where arrows are.
* The **experimental** layer has been redone, and is now called [ADORE](#adore-layer), and as such, can be enabled by `LEAD a` now.
* Switching between Dvorak and ADORE is now persisted into EEPROM, and survives a reboot.
-## v1.2 - 2016-06-22
+## v1.2
+
+*2016-06-22*
* The forced NKRO mode can be easily toggled off at compile-time, to make the firmware compatible with [certain operating systems](#using-on-windows).
* The `:;` key has changed behaviour: to access the `;` symbol, the key needs to be double-tapped, instead of shifted.
@@ -175,7 +226,9 @@ The keymap default to forcing NKRO, which seems to upset Windows, and except the
* On the **experimental** layer, the `L` and `Q`, and the `K` and `G` keys were swapped.
* The [Steno](#steno-layer) layer gained a few more `#` and `*` keys, to make it easier on my fingers.
-## v1.1 - 2016-06-14
+## v1.1
+
+*2016-06-14*
* The keyboard starts in NKRO mode, bootmagic and other things are disabled.
* A [Steno](#steno-layer) layer was added, to be used with Plover.
@@ -189,7 +242,9 @@ The keymap default to forcing NKRO, which seems to upset Windows, and except the
- `:` now inputs `;` when shifted.
* `ESC` cancels the [Hungarian](#hungarian-layer) layer too, not just modifiers.
-## v1.0 - 2016-05-26
+## v1.0
+
+*2016-05-26*
Initial version.
diff --git a/keyboards/ergodox/keymaps/algernon/tools/heatmap-adore-layout.json b/keyboards/ergodox/keymaps/algernon/tools/heatmap-layout.ADORE.json
index 544f61ce8..4dfa877a7 100644
--- a/keyboards/ergodox/keymaps/algernon/tools/heatmap-adore-layout.json
+++ b/keyboards/ergodox/keymaps/algernon/tools/heatmap-layout.ADORE.json
@@ -75,9 +75,9 @@
"STENO",
{
"x": 4.5,
- "f": 6
+ "f": 3
},
- "<i class='mss mss-Unicode-Option-3'></i>",
+ "F12",
{
"c": "#7adabd",
"a": 4,
@@ -94,12 +94,20 @@
{
"y": -0.875,
"c": "#ffb2d2",
- "f": 3,
+ "f": 9,
+ "a": 6,
"w": 1.5
},
- "\n\n~\n`",
+ "\n\n<i class='kb kb-Multimedia-Play-Pause'></i>",
{
- "t": "#0d0d0b"
+ "t": "#0d0d0b",
+ "f": 3,
+ "a": 4,
+ "fa": [
+ 0,
+ 0,
+ 2
+ ]
},
"!\n1\nF1",
{
@@ -120,7 +128,7 @@
"t": "#000000",
"a": 6
},
- "L",
+ "G",
{
"x": 10.5
},
@@ -132,16 +140,16 @@
"x": 2.5,
"c": "#bfbad1",
"t": "#0d0d0b",
- "a": 4
+ "a": 6
},
- ">\n.",
+ "W",
{
"x": 1,
"c": "#7adabd",
"t": "#000000",
"a": 6
},
- "W",
+ "L",
{
"x": 8.5
},
@@ -164,14 +172,15 @@
{
"c": "#93c9b7",
"a": 4,
+ "fa": [0, 0, 0],
"h": 1.5
},
- "{\n[",
+ "{\n(\n[",
{
"x": 4.5,
"h": 1.5
},
- "}\n]",
+ "}\n)\n]",
{
"c": "#7adabd",
"a": 6
@@ -183,21 +192,22 @@
"y": -0.875,
"c": "#ffb07b",
"t": "#0d0d0b",
- "f": 6,
+ "f": 3,
+ "a": 4,
"w": 1.5
},
- "<i class='fa fa-fast-backward'></i>\n\n<i class='fa fa-fast-forward'></i>",
+ "\n\n~\n`",
{
"c": "#ffb2d2",
- "a": 4,
+ "a": 6,
"f": 3
},
- "<\n,",
+ "Y",
{
"x": 14.5,
"a": 6
},
- "Y",
+ "X",
{
"a": 4,
"w": 1.5
@@ -300,15 +310,14 @@
"x": 6.5,
"c": "#93c9b7",
"t": "#000000",
- "a": 7,
"h": 1.5
},
- "(",
+ ";\n:",
{
"x": 4.5,
"h": 1.5
},
- ")"
+ "_\n-"
],
[
{
@@ -320,7 +329,9 @@
},
"\"\n'",
{
- "x": 10.5
+ "x": 10.5,
+ "a": 6,
+ "f": 3
},
"V"
],
@@ -329,19 +340,22 @@
"y": -0.875,
"x": 2.5,
"c": "#bfbad1",
- "t": "#0d0d0b"
+ "t": "#0d0d0b",
+ "a": 6
},
- "Z",
+ "Q",
{
"x": 1,
"c": "#7adabd",
- "t": "#000000"
+ "t": "#000000",
+ "a": 4
},
- "K",
+ "<\n,",
{
- "x": 8.5
+ "x": 8.5,
+ "a": 6
},
- "G",
+ "K",
{
"x": 1,
"c": "#bfbad1",
@@ -354,11 +368,13 @@
"y": -0.875,
"x": 5.5,
"c": "#7adabd",
- "t": "#000000"
+ "t": "#000000",
+ "a": 4
},
- "X",
+ ">\n.",
{
- "x": 6.5
+ "x": 6.5,
+ "a": 6
},
"B"
],
@@ -367,28 +383,32 @@
"y": -0.875,
"c": "#ffb07b",
"f": 9,
- "w": 1.5
+ "w": 1.5,
+ "g": true
},
- "\n\n<i class='kb kb-Multimedia-Play-Pause'></i>",
+ "",
{
"c": "#ffb2d2",
"t": "#0d0d0b",
- "a": 4,
- "f": 3
+ "a": 6,
+ "f": 3,
+ "g": false
},
- "?\n/",
+ "Z",
{
"x": 14.5,
- "a": 6
+ "a": 4
},
- "Q",
+ "?\n/",
{
"c": "#ffb07b",
"t": "#000000",
"f": 9,
- "w": 1.5
+ "g": true,
+ "w": 1.5,
+ "a": 4
},
- "<i class='kb kb-Multimedia-Stop'></i>"
+ ""
],
[
{
@@ -414,14 +434,14 @@
{
"x": 1,
"c": "#d4872a",
- "g": false,
+ "g": true,
"a": 5
},
- ";\n:",
+ "",
{
"x": 8.5
},
- "_\n-",
+ "",
{
"x": 1,
"c": "#d9dae0",
@@ -503,13 +523,13 @@
},
"MEDIA",
{},
- "1HAND"
+ "DEL"
],
[
{
"x": -3
},
- "LEAD",
+ "HUN",
{
"c": "#d4872a",
"f": 9,
@@ -528,6 +548,6 @@
"c": "#f9cd31",
"f": 2
},
- "HUN"
+ "LEAD"
]
]
diff --git a/keyboards/ergodox/keymaps/algernon/tools/heatmap-base-layout.json b/keyboards/ergodox/keymaps/algernon/tools/heatmap-layout.Dvorak.json
index 148bb1f23..1248d36af 100644
--- a/keyboards/ergodox/keymaps/algernon/tools/heatmap-base-layout.json
+++ b/keyboards/ergodox/keymaps/algernon/tools/heatmap-layout.Dvorak.json
@@ -75,9 +75,9 @@
"STENO",
{
"x": 4.5,
- "f": 6
+ "f": 3
},
- "<i class='mss mss-Unicode-Option-3'></i>",
+ "F12",
{
"c": "#7adabd",
"a": 4,
@@ -94,12 +94,21 @@
{
"y": -0.875,
"c": "#ffb2d2",
- "f": 3,
+ "f": 6,
+ "a": 6,
"w": 1.5
},
- "\n\n~\n`",
+ "<i class='fa fa-fast-backward'></i>\n\n<i class='fa fa-fast-forward'></i>",
{
- "t": "#0d0d0b"
+ "f": 3,
+ "t": "#0d0d0b",
+ "a": 4,
+ "fa": [
+ 0,
+ 0,
+ 2
+ ]
+
},
"!\n1\nF1",
{
@@ -167,12 +176,12 @@
"a": 4,
"h": 1.5
},
- "{\n[",
+ "{\n(\n[",
{
"x": 4.5,
"h": 1.5
},
- "}\n]",
+ "}\n)\n]",
{
"c": "#7adabd",
"a": 6
@@ -184,10 +193,10 @@
"y": -0.875,
"c": "#ffb07b",
"t": "#0d0d0b",
- "f": 6,
+ "f": 3,
"w": 1.5
},
- "<i class='fa fa-fast-backward'></i>\n\n<i class='fa fa-fast-forward'></i>",
+ "\n\n~\n`",
{
"c": "#ffb2d2",
"a": 4,
@@ -503,7 +512,7 @@
},
"MEDIA",
{},
- "1HAND"
+ "DEL"
],
[
{
diff --git a/keyboards/ergodox/keymaps/algernon/tools/log-to-heatmap.py b/keyboards/ergodox/keymaps/algernon/tools/log-to-heatmap.py
index a13d12e81..68585843b 100755
--- a/keyboards/ergodox/keymaps/algernon/tools/log-to-heatmap.py
+++ b/keyboards/ergodox/keymaps/algernon/tools/log-to-heatmap.py
@@ -3,143 +3,247 @@ import json
import os
import sys
import re
+import argparse
from math import floor
+from os.path import dirname
+
+class Heatmap(object):
+ coords = [
+ [
+ # Row 0
+ [ 4, 0], [ 4, 2], [ 2, 0], [ 1, 0], [ 2, 2], [ 3, 0], [ 3, 2],
+ [ 3, 4], [ 3, 6], [ 2, 4], [ 1, 2], [ 2, 6], [ 4, 4], [ 4, 6],
+ ],
+ [
+ # Row 1
+ [ 8, 0], [ 8, 2], [ 6, 0], [ 5, 0], [ 6, 2], [ 7, 0], [ 7, 2],
+ [ 7, 4], [ 7, 6], [ 6, 4], [ 5, 2], [ 6, 6], [ 8, 4], [ 8, 6],
+ ],
+ [
+ # Row 2
+ [12, 0], [12, 2], [10, 0], [ 9, 0], [10, 2], [11, 0], [ ],
+ [ ], [11, 2], [10, 4], [ 9, 2], [10, 6], [12, 4], [12, 6],
+ ],
+ [
+ # Row 3
+ [17, 0], [17, 2], [15, 0], [14, 0], [15, 2], [16, 0], [13, 0],
+ [13, 2], [16, 2], [15, 4], [14, 2], [15, 6], [17, 4], [17, 6],
+ ],
+ [
+ # Row 4
+ [20, 0], [20, 2], [19, 0], [18, 0], [19, 2], [], [], [], [],
+ [19, 4], [18, 2], [19, 6], [20, 4], [20, 6],
+ ],
+ [
+ # Row 5
+ [ ], [23, 0], [22, 2], [22, 0], [22, 4], [21, 0], [21, 2],
+ [24, 0], [24, 2], [25, 0], [25, 4], [25, 2], [26, 0], [ ],
+ ],
+ ]
+
+ def set_attr_at(self, block, n, attr, fn, val):
+ blk = self.heatmap[block][n]
+ if attr in blk:
+ blk[attr] = fn(blk[attr], val)
+ else:
+ blk[attr] = fn(None, val)
+
+ def coord(self, col, row):
+ return self.coords[row][col]
+
+ @staticmethod
+ def set_attr(orig, new):
+ return new
+
+ def set_bg(self, (block, n), color):
+ self.set_attr_at(block, n, "c", self.set_attr, color)
+ #self.set_attr_at(block, n, "g", self.set_attr, False)
+
+ def set_tap_info(self, (block, n), count, cap):
+ def _set_tap_info(o, _count, _cap):
+ ns = 4 - o.count ("\n")
+ return o + "\n" * ns + "%.02f%%" % (float(_count) / float(_cap) * 100)
+
+ if not cap:
+ cap = 1
+ self.heatmap[block][n + 1] = _set_tap_info (self.heatmap[block][n + 1], count, cap)
+
+ @staticmethod
+ def heatmap_color (v):
+ colors = [ [0.3, 0.3, 1], [0.3, 1, 0.3], [1, 1, 0.3], [1, 0.3, 0.3]]
+ fb = 0
+ if v <= 0:
+ idx1, idx2 = 0, 0
+ elif v >= 1:
+ idx1, idx2 = len(colors) - 1, len(colors) - 1
+ else:
+ val = v * (len(colors) - 1)
+ idx1 = int(floor(val))
+ idx2 = idx1 + 1
+ fb = val - float(idx1)
+
+ r = (colors[idx2][0] - colors[idx1][0]) * fb + colors[idx1][0]
+ g = (colors[idx2][1] - colors[idx1][1]) * fb + colors[idx1][1]
+ b = (colors[idx2][2] - colors[idx1][2]) * fb + colors[idx1][2]
+
+ r, g, b = [x * 255 for x in r, g, b]
+ return "#%02x%02x%02x" % (r, g, b)
+
+ def __init__(self, layout):
+ self.log = {}
+ self.total = 0
+ self.max_cnt = 0
+ self.layout = layout
+
+ def update_log(self, (c, r)):
+ if not (c, r) in self.log:
+ self.log[(c, r)] = 0
+ self.log[(c, r)] = self.log[(c, r)] + 1
+ self.total = self.total + 1
+ if self.max_cnt < self.log[(c, r)]:
+ self.max_cnt = self.log[(c, r)]
+
+ def get_heatmap(self):
+ with open("%s/heatmap-layout.%s.json" % (dirname(sys.argv[0]), self.layout), "r") as f:
+ self.heatmap = json.load (f)
+
+ ## Reset colors
+ for row in self.coords:
+ for coord in row:
+ if coord != []:
+ self.set_bg (coord, "#d9dae0")
+
+ for (c, r) in self.log:
+ coords = self.coord(c, r)
+ b, n = coords
+ cap = self.max_cnt
+ if cap == 0:
+ cap = 1
+ v = float(self.log[(c, r)]) / cap
+ self.set_bg (coords, self.heatmap_color (v))
+ self.set_tap_info (coords, self.log[(c, r)], self.total)
+ return self.heatmap
+
+ def get_stats(self):
+ usage = [
+ # left hand
+ [0, 0, 0, 0, 0],
+ # right hand
+ [0, 0, 0, 0, 0]
+ ]
+ finger_map = [0, 0, 1, 2, 3, 4, 4]
+ for (c, r) in self.log:
+ if r == 5: # thumb cluster
+ if c <= 6: # left side
+ usage[0][4] = usage[0][4] + self.log[(c, r)]
+ else:
+ usage[1][4] = usage[1][4] + self.log[(c, r)]
+ else:
+ fc = c
+ hand = 0
+ if fc >= 7:
+ fc = fc - 7
+ hand = 1
+ fm = finger_map[fc]
+ usage[hand][fm] = usage[hand][fm] + self.log[(c, r)]
+ hand_usage = [0, 0]
+ for f in usage[0]:
+ hand_usage[0] = hand_usage[0] + f
+ for f in usage[1]:
+ hand_usage[1] = hand_usage[1] + f
+
+ total = self.total
+ if total == 0:
+ total = 1
+ stats = {
+ "hands": {
+ "left": {
+ "usage": float(hand_usage[0]) / total * 100,
+ "fingers": {
+ "0 - pinky": 0,
+ "1 - ring": 0,
+ "2 - middle": 0,
+ "3 - index": 0,
+ "4 - thumb": 0,
+ }
+ },
+ "right": {
+ "usage": float(hand_usage[1]) / total * 100,
+ "fingers": {
+ "0 - thumb": 0,
+ "1 - index": 0,
+ "2 - middle": 0,
+ "3 - ring": 0,
+ "4 - pinky": 0,
+ }
+ },
+ }
+ }
+
+ hmap = ['left', 'right']
+ fmap = ['0 - pinky', '1 - ring', '2 - middle', '3 - index', '4 - thumb',
+ '0 - thumb', '1 - index', '2 - middle', '3 - ring', '4 - pinky']
+ for hand_idx in range(len(usage)):
+ hand = usage[hand_idx]
+ for finger_idx in range(len(hand)):
+ stats['hands'][hmap[hand_idx]]['fingers'][fmap[finger_idx + hand_idx * 5]] = float(hand[finger_idx]) / total * 100
+ return stats
+
+def dump_all(out_dir, heatmaps):
+ for layer in heatmaps.keys():
+ if len(heatmaps[layer].log) == 0:
+ continue
-cr_coord_map = [
- [
- # Row 0
- [ 4, 0], [ 4, 2], [ 2, 0], [ 1, 0], [ 2, 2], [ 3, 0], [ 3, 2],
- [ 3, 4], [ 3, 6], [ 2, 4], [ 1, 2], [ 2, 6], [ 4, 4], [ 4, 6],
- ],
- [
- # Row 1
- [ 8, 0], [ 8, 2], [ 6, 0], [ 5, 0], [ 6, 2], [ 7, 0], [ 7, 2],
- [ 7, 4], [ 7, 6], [ 6, 4], [ 5, 2], [ 6, 6], [ 8, 4], [ 8, 6],
- ],
- [
- # Row 2
- [12, 0], [12, 2], [10, 0], [ 9, 0], [10, 2], [11, 0], [ ],
- [ ], [11, 2], [10, 4], [ 9, 2], [10, 6], [12, 4], [12, 6],
- ],
- [
- # Row 3
- [17, 0], [17, 2], [15, 0], [14, 0], [15, 2], [16, 0], [13, 0],
- [13, 2], [16, 2], [15, 4], [14, 2], [15, 6], [17, 4], [17, 6],
- ],
- [
- # Row 4
- [20, 0], [20, 2], [19, 0], [18, 0], [19, 2], [], [], [], [],
- [19, 4], [18, 2], [19, 6], [20, 4], [20, 6],
- ],
- [
- # Row 5
- [ ], [23, 0], [22, 2], [22, 0], [22, 4], [21, 0], [21, 2],
- [24, 0], [24, 2], [25, 0], [25, 4], [25, 2], [26, 0], [ ],
- ],
-]
-
-def set_attr_at(j, b, n, attr, fn, val):
- blk = j[b][n]
- if attr in blk:
- blk[attr] = fn(blk[attr], val)
- else:
- blk[attr] = fn(None, val)
-
-def coord(col, row):
- return cr_coord_map[row][col]
-
-def set_attr(orig, new):
- return new
-
-def set_bg(j, (b, n), color):
- set_attr_at(j, b, n, "c", set_attr, color)
- #set_attr_at(j, b, n, "g", set_attr, False)
-
-def _set_tap_info(o, count, cap):
- ns = 4 - o.count ("\n")
- return o + "\n" * ns + "%.02f%%" % (float(count) / float(cap) * 100)
-
-def set_tap_info(j, (b, n), count, cap):
- j[b][n + 1] = _set_tap_info (j[b][n + 1], count, cap)
-
-def heatmap_color (v):
- colors = [ [0.3, 0.3, 1], [0.3, 1, 0.3], [1, 1, 0.3], [1, 0.3, 0.3]]
- fb = 0
- if v <= 0:
- idx1, idx2 = 0, 0
- elif v >= 1:
- idx1, idx2 = len(colors) - 1, len(colors) - 1
- else:
- val = v * (len(colors) - 1)
- idx1 = int(floor(val))
- idx2 = idx1 + 1
- fb = val - float(idx1)
-
- r = (colors[idx2][0] - colors[idx1][0]) * fb + colors[idx1][0]
- g = (colors[idx2][1] - colors[idx1][1]) * fb + colors[idx1][1]
- b = (colors[idx2][2] - colors[idx1][2]) * fb + colors[idx1][2]
-
- r, g, b = [x * 255 for x in r, g, b]
- return "#%02x%02x%02x" % (r, g, b)
-
-# Load the keylog
-def load_keylog(fname, restrict_row):
- keylog = {}
- total = 0
- with open(fname, "r") as f:
- lines = f.readlines()
- for line in lines:
- m = re.search ('KL: col=(\d+), row=(\d+)', line)
+ with open ("%s/%s.json" % (out_dir, layer), "w") as f:
+ json.dump(heatmaps[layer].get_heatmap(), f)
+ print >>sys.stderr, "%s stats:" % (layer)
+ json.dump (heatmaps[layer].get_stats(), sys.stderr,
+ indent = 4, sort_keys = True)
+ print >>sys.stderr, ""
+ print >>sys.stderr, ""
+
+def main(opts):
+
+ heatmaps = {"Dvorak": Heatmap("Dvorak"),
+ "ADORE": Heatmap("ADORE")
+ }
+ cnt = 0
+ restrict_row = opts.restrict_row
+ out_dir = opts.outdir
+
+ while True:
+ line = sys.stdin.readline()
+ if not line:
+ break
+ m = re.search ('KL: col=(\d+), row=(\d+), pressed=(\d+), layer=(.*)', line)
if not m:
continue
- (c, r) = (int(m.group (2)), int(m.group (1)))
- if restrict_row != None and r != int(restrict_row):
+
+ cnt = cnt + 1
+ (c, r, l) = (int(m.group (2)), int(m.group (1)), m.group (4))
+ if restrict_row != -1 and r != restrict_row:
+ continue
+ if c in opts.ignore_columns:
continue
- if (c, r) in keylog:
- keylog[(c, r)] = keylog[(c, r)] + 1
- else:
- keylog[(c, r)] = 1
- total = total + 1
- return total / 2, keylog
-
-def l_flat(s):
- f = s.split("\n")
- return ", ".join (f)
-
-def main(base_fn, log_fn, restrict_row = None):
-
- with open(base_fn, "r") as f:
- layout = json.load (f)
-
- ## Reset colors
- for row in cr_coord_map:
- for col in row:
- if col != []:
- set_bg (layout, col, "#d9dae0")
- #set_attr_at (layout, col[0], col[1], "g", set_attr, True)
-
- total, log = load_keylog (log_fn, restrict_row)
- max_cnt = 0
- for (c, r) in log:
- max_cnt = max(max_cnt, log[(c, r)])
-
- # Create the heatmap
- for (c, r) in log:
- coords = coord(c, r)
- b, n = coords
- cap = max_cnt
- v = float(log[(c, r)]) / cap
- print >> sys.stderr, "%s => %d/%d => %f = %s" % (l_flat(layout[b][n+1]), log[(c,r)], cap, v, heatmap_color(v))
- set_bg (layout, coord(c, r), heatmap_color (v))
- set_tap_info (layout, coord (c, r), log[(c, r)], total)
-
- print json.dumps(layout)
-if __name__ == "__main__":
- if len(sys.argv) < 3:
- print """Log to Heatmap -- creates a heatmap out of keyboard logs
+ heatmaps[l].update_log ((c, r))
+
+ if opts.dump_interval != -1 and cnt >= opts.dump_interval:
+ cnt = 0
+ dump_all(out_dir, heatmaps)
-Usage: log-to-heatmap.py base-layout.json logfile [row] >layout.json"""
- sys.exit (1)
- main(*sys.argv[1:])
+ dump_all (out_dir, heatmaps)
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser (description = "keylog to heatmap processor")
+ parser.add_argument ('outdir', action = 'store',
+ help = 'Output directory')
+ parser.add_argument ('--row', dest = 'restrict_row', action = 'store', type = int,
+ default = -1, help = 'Restrict processing to this row only')
+ parser.add_argument ('--dump-interval', dest = 'dump_interval', action = 'store', type = int,
+ default = 100, help = 'Dump stats and heatmap at every Nth event, -1 for dumping at EOF only')
+ parser.add_argument ('--ignore-column', dest = 'ignore_columns', action = 'append', type = int,
+ default = [], help = 'Ignore the specified columns')
+ args = parser.parse_args()
+ main(args)