summaryrefslogtreecommitdiffstats
path: root/layouts/community/ergodox/algernon/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/community/ergodox/algernon/keymap.c')
-rw-r--r--layouts/community/ergodox/algernon/keymap.c1194
1 files changed, 0 insertions, 1194 deletions
diff --git a/layouts/community/ergodox/algernon/keymap.c b/layouts/community/ergodox/algernon/keymap.c
deleted file mode 100644
index 0680870954..0000000000
--- a/layouts/community/ergodox/algernon/keymap.c
+++ /dev/null
@@ -1,1194 +0,0 @@
-/*
- * algernon's ErgoDox EZ layout, please see the readme.md file!
- */
-
-#include <stdarg.h>
-#include QMK_KEYBOARD_H
-#include "led.h"
-#include "debug.h"
-#include "action_layer.h"
-#include "action_util.h"
-#include "timer.h"
-#include "keymap_plover.h"
-#include "eeconfig.h"
-#include "wait.h"
-#include "version.h"
-#include "print.h"
-
-/* 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,
-
- // Application select keys
- APP_SLK, // Slack
- APP_EMCS, // Emacs
- APP_TERM, // Terminal
- APP_CHRM, // Chrome
- APP_MSIC, // Music
- APP_SOCL, // Social
- APP_PMGR, // Password manager
- APP_SCL2, // Social #2
-
- // Hungarian layer keys
- HU_AACU, // Á
- HU_OACU, // Ó
- HU_EACU, // É
- HU_UACU, // Ú
- HU_IACU, // Í
- HU_ODIA, // Ö
- HU_UDIA, // Ü
- HU_ODAC, // Ő
- HU_UDAC, // Ű
-
- // number/symbol keys
- A_1, // 1
- A_2, // 2
- A_3, // ...
- A_4,
- A_5,
- A_6,
- A_7,
- A_8,
- A_9,
- A_0,
-
- // Fx
- Fx,
-};
-
-/* Fn keys */
-
-enum {
- F_BSE = 0,
- F_HUN,
- F_GUI,
-};
-
-/* Custom keycodes */
-
-enum {
- CT_CLN = 0,
- CT_TA,
- CT_LBP,
- CT_RBP,
- CT_TMUX,
- CT_TPS,
- CT_SR,
-};
-
-/* States & timers */
-
-uint16_t gui_timer = 0;
-
-#if KEYLOGGER_ENABLE
-# ifdef AUTOLOG_ENABLE
-bool log_enable = true;
-# else
-bool log_enable = false;
-# endif
-#endif
-
-bool time_travel = false;
-bool skip_leds = false;
-
-static uint8_t is_adore = 0;
-
-/* The Keymap */
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-
-/* Keymap 0: Base Layer
- *
- * ,-----------------------------------------------------. ,-----------------------------------------------------.
- * | Next/Prev | 9 | 7 @ | 5 * | 3 ^ | 1 $ | F11 | | Fx | 0 % | 2 ! | 4 # | 6 & | 8 | Plover |
- * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
- * | ~ | ' | , | . | P | Y | ( | | ) | F | G | C | R | L | \ |
- * |-----------+------+------+------+------+------| [ | | ] |------+------+------+------+------+-----------|
- * | Tab/ARROW | A | O | E | U | I |------| |------| D | H | T | N | S | = / Arrow |
- * |-----------+------+------+------+------+------| tmux | | tmux |------+------+------+------+------+-----------|
- * | Play/Pause| / | Q | J | K | X | | | Pane | B | M | W | V | Z | Stop/Reset|
- * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
- * | | | | | : | | - | | | | |
- * `-----------------------------------' `-----------------------------------'
- * ,-------------. ,-------------.
- * | LAlt | GUI | | MDIA | Del |
- * ,------|------|------| |------+------+------.
- * | | | Ctrl | | LEAD | | |
- * |Backsp|LShift|------| |------| Enter| Space|
- * | | | ESC | | HUN | | |
- * `--------------------' `--------------------'
- */
-[BASE] = LAYOUT_ergodox(
-// left hand
- M(A_MPN) ,M(A_9) ,M(A_7) ,M(A_5) ,M(A_3) ,M(A_1) ,KC_F11
-,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_TMUX)
-,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN)
-
- ,OSM(MOD_LALT),F(F_GUI)
- ,OSM(MOD_LCTL)
- ,KC_BSPC,OSM(MOD_LSFT),KC_ESC
-
- // right hand
- ,M(Fx) ,M(A_0) ,M(A_2) ,M(A_4) ,M(A_6) ,M(A_8) ,M(A_PLVR)
- ,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
- ,TD(CT_TPS),KC_B ,KC_M ,KC_W ,KC_V ,KC_Z ,TD(CT_SR)
- ,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| 9 | 7 @ | 5 * | 3 ^ | 1 $ | F11 | | Fx | 0 % | 2 ! | 4 # | 6 & | 8 | Plover |
- * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
- * | \ | X | W | C | H | F | ( | | ) | M | G | L | P | / | `~ |
- * |-----------+------+------+------+------+------| [ | | ] |------+------+------+------+------+-----------|
- * | Tab/Arrow | A | O | E | I | U |------| |------| D | R | T | N | S | = |
- * |-----------+------+------+------+------+------| tmux | | tmux |------+------+------+------+------+-----------|
- * | | Z | Q | ' | , | . | | | pane | B | K | V | Y | J | |
- * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
- * | | | | | : | | - | | | | |
- * `-----------------------------------' `-----------------------------------'
- * ,-------------. ,-------------.
- * | LAlt | GUI | | MDIA | Del |
- * ,------|------|------| |------+------+------.
- * | | | Ctrl | | HUN | | |
- * |Backsp|LShift|------| |------| Enter| Space|
- * | | | ESC | | LEAD | | |
- * `--------------------' `--------------------'
- */
-[ADORE] = LAYOUT_ergodox(
-// left hand
- KC_MPLY ,M(A_9) ,M(A_7) ,M(A_5) ,M(A_3) ,M(A_1) ,KC_F11
-,KC_BSLS ,KC_X ,KC_W ,KC_C ,KC_H ,KC_F ,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_TMUX)
-,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN)
-
- ,OSM(MOD_LALT),F(F_GUI)
- ,OSM(MOD_LCTL)
- ,KC_BSPC,OSM(F_LSFT),KC_ESC
-
- // right hand
- ,M(Fx) ,M(A_0) ,M(A_2) ,M(A_4) ,M(A_6) ,M(A_8) ,M(A_PLVR)
- ,TD(CT_RBP),KC_M ,KC_G ,KC_L ,KC_P ,KC_SLSH ,KC_GRV
- ,KC_D ,KC_R ,KC_T ,KC_N ,KC_S ,KC_EQL
- ,TD(CT_TPS),KC_B ,KC_K ,KC_V ,KC_Y ,KC_J ,KC_NO
- ,KC_MINS ,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] = LAYOUT_ergodox(
-// 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| | | |Social|PWMgr |Scl2 | | | |
- * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
- * | | | | | | | | | | | | | | | |
- * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
- * | | | | | | |------| |------| | | | | | |
- * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
- * | | | | | | | | | | | | | | | |
- * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
- * | | | | | | | | | | | |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | | | | | |
- * ,------|------|------| |------+------+------.
- * | | | | | | | |
- * | | |------| |------| | |
- * | | | | | | | |
- * `--------------------' `--------------------'
- */
-
-[APPSEL] = LAYOUT_ergodox(
-// 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 ,M(APP_SOCL) ,M(APP_PMGR) ,M(APP_SCL2) ,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] = LAYOUT_ergodox(
-// left hand
- KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
-,KC_NO ,KC_NO ,M(HU_ODAC),KC_NO ,M(HU_UDAC),KC_NO ,KC_NO
-,KC_NO ,M(HU_AACU),M(HU_OACU) ,M(HU_EACU),M(HU_UACU) ,M(HU_IACU)
-,KC_NO ,KC_NO ,M(HU_ODIA) ,KC_NO ,M(HU_UDIA) ,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
- *
- * ,-----------------------------------------------------. ,-----------------------------------------------------.
- * | | F9 | F7 | F5 | F3 | F1 |ScrLCK| | | F10 | F2 | F4 | F6 | F8 | |
- * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
- * | | | | | | | | | | | | | | | |
- * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
- * | | | | | | |------| |------| | | | | | |
- * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
- * | | | | | | | | | | | | | | | |
- * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
- * | | | | | | | | | | | |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | Mute | VlUp | | BASE | |
- * ,------|------|------| |------+------+------.
- * | | | VlDn | | | | |
- * | | |------| |------| | |
- * | | | | | | | |
- * `--------------------' `--------------------'
- */
-[NMDIA] = LAYOUT_ergodox(
-// left hand
- KC_NO ,KC_F9 ,KC_F7 ,KC_F5 ,KC_F3 ,KC_F1 ,LGUI(KC_L)
-,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_MUTE ,KC_VOLU
- ,KC_VOLD
- ,KC_NO ,KC_NO ,KC_TRNS
-
- // right hand
- ,KC_TRNS ,KC_F10 ,KC_F2 ,KC_F4 ,KC_F6 ,KC_F8 ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO ,KC_UP ,KC_NO ,KC_NO ,KC_NO
- ,KC_NO ,KC_LEFT ,KC_DOWN ,KC_RGHT ,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_TRNS ,KC_NO
- ,KC_NO
- ,KC_NO ,KC_NO ,KC_NO
- ),
-
-/* 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] = LAYOUT_ergodox(
-// left hand
-KC_NO, 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,
-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, M(A_PLVR),
- 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)
-};
-
-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 void ang_handle_num_row(uint8_t id, keyrecord_t *record) {
- uint8_t idx = id - A_1;
- uint8_t kc;
- static bool shifted[10];
-
- if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
- ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out())) {
- if (record->event.pressed)
- shifted[idx] = true;
- }
-
- if (!shifted[idx]) {
- kc = idx + KC_1;
- } else {
- switch (id) {
- case A_8:
- case A_9:
- shifted[idx] = false;
- return;
-
- case A_7:
- kc = KC_2;
- break;
- case A_5:
- kc = KC_8;
- break;
- case A_3:
- kc = KC_4;
- break;
- case A_1:
- kc = KC_6;
- break;
-
- case A_0:
- kc = KC_5;
- break;
- case A_2:
- kc = KC_1;
- break;
- case A_4:
- kc = KC_3;
- break;
- case A_6:
- kc = KC_7;
- break;
- }
- }
-
- if (record->event.pressed) {
- register_code (kc);
- } else {
- unregister_code (kc);
- shifted[idx] = false;
- }
-}
-
-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_AACU:
- return ang_do_hun (record, KC_QUOT, KC_A);
- case HU_OACU:
- return ang_do_hun (record, KC_QUOT, KC_O);
- case HU_EACU:
- return ang_do_hun (record, KC_QUOT, KC_E);
- case HU_UACU:
- return ang_do_hun (record, KC_QUOT, KC_U);
- case HU_IACU:
- return ang_do_hun (record, KC_QUOT, KC_I);
- case HU_ODIA:
- return ang_do_hun (record, KC_DQT, KC_O);
- case HU_UDIA:
- return ang_do_hun (record, KC_DQT, KC_U);
- case HU_ODAC:
- return ang_do_hun (record, KC_EQL, KC_O);
- case HU_UDAC:
- return ang_do_hun (record, KC_EQL, KC_U);
-
- /* Plover base */
- case A_PLVR:
- toggle_steno(record->event.pressed);
- break;
-
- /* Fx */
- case Fx:
- if (record->event.pressed) {
- set_oneshot_mods (MOD_LALT);
- layer_on (NMDIA);
- set_oneshot_layer (NMDIA, ONESHOT_START);
- } else {
- clear_oneshot_layer_state (ONESHOT_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) {
- uprintf("CMD:appsel_start\n");
- layer_on (APPSEL);
- set_oneshot_layer (APPSEL, ONESHOT_START);
- } else if (record->tap.count >= 3) {
- uprintf("CMD:appsel_helper\n");
- layer_off (APPSEL);
- clear_oneshot_layer_state (ONESHOT_PRESSED);
- }
- } else {
- record->tap.count = 0;
- }
- gui_timer = 0;
- } else {
- if (record->tap.count >= 2)
- {
- clear_oneshot_layer_state (ONESHOT_PRESSED);
- }
- gui_timer = timer_read ();
- }
- break;
-
- case APP_SLK:
- if (record->event.pressed)
- uprintf("CMD:appsel_slack\n");
- break;
-
- case APP_EMCS:
- if (record->event.pressed)
- uprintf("CMD:appsel_emacs\n");
- break;
-
- case APP_TERM:
- if (record->event.pressed)
- uprintf("CMD:appsel_term\n");
- break;
-
- case APP_CHRM:
- if (record->event.pressed)
- uprintf("CMD:appsel_chrome\n");
- break;
-
- case APP_MSIC:
- if (record->event.pressed)
- uprintf("CMD:appsel_music\n");
- break;
-
- case APP_SOCL:
- if (record->event.pressed)
- uprintf("CMD:appsel_social\n");
- break;
-
- case APP_PMGR:
- if (record->event.pressed)
- uprintf("CMD:appsel_pwmgr\n");
- break;
-
- case APP_SCL2:
- if (record->event.pressed)
- uprintf("CMD:appsel_social2\n");
- break;
-
- // number row and symbols
- case A_1 ... A_0:
- ang_handle_num_row(id, record);
- break;
- }
-
- return MACRO_NONE;
-};
-
-// 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 (uint16_t code, ...) {
- uint16_t kc = code;
- va_list ap;
-
- va_start(ap, code);
-
- do {
- register_code16(kc);
- unregister_code16(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);
-}
-
-static void ang_tap_dance_tmux_finished (qk_tap_dance_state_t *state, void *user_data) {
- if (state->count == 1) {
- register_code(KC_LALT);
- register_code(KC_SPC);
- unregister_code(KC_SPC);
- unregister_code(KC_LALT);
- } else {
- register_code(KC_LCTL);
- register_code(KC_A);
- unregister_code(KC_A);
- unregister_code(KC_LCTL);
- }
-}
-
-static void ang_tap_dance_tmux_pane_select (qk_tap_dance_state_t *state, void *user_data) {
- uint8_t kc = KC_P;
-
- if (state->count >= 2) {
- kc = KC_Z;
- }
-
- register_code(KC_LALT);
- register_code(KC_SPC);
- unregister_code(KC_SPC);
- unregister_code(KC_LALT);
-
- register_code(kc);
- unregister_code(kc);
-}
-
-static void
-_td_sr_each (qk_tap_dance_state_t *state, void *user_data) {
- skip_leds = true;
-
- switch (state->count) {
- case 1:
- ergodox_right_led_3_on ();
- break;
- case 2:
- ergodox_right_led_2_on ();
- break;
- case 3:
- ergodox_right_led_1_on ();
- break;
- case 4:
- ergodox_right_led_3_off ();
- wait_ms (50);
- ergodox_right_led_2_off ();
- wait_ms (50);
- ergodox_right_led_1_off ();
- break;
- }
-}
-
-static void
-_td_sr_finished (qk_tap_dance_state_t *state, void *user_data) {
- if (state->count == 1) {
- register_code (KC_MSTP);
- }
- if (state->count >= 4) {
- uprintf("CMD:reflash\n");
- wait_ms (1000);
- reset_keyboard ();
- reset_tap_dance (state);
- }
-}
-
-static void
-_td_sr_reset (qk_tap_dance_state_t *state, void *user_data) {
- ergodox_right_led_1_off ();
- wait_ms (50);
- ergodox_right_led_2_off ();
- wait_ms (50);
- ergodox_right_led_3_off ();
-
- if (state->count == 1) {
- unregister_code (KC_MSTP);
- }
-}
-
-static void
-_td_brackets_finished (qk_tap_dance_state_t *state, void *user_data) {
- if (state->count == 1) {
- if (state->keycode == TD(CT_LBP))
- register_code16 (KC_LBRC);
- else
- register_code16 (KC_RBRC);
- } else if (state->count == 2) {
- if (state->keycode == TD(CT_LBP))
- register_code16 (KC_LPRN);
- else
- register_code16 (KC_RPRN);
- } else if (state->count == 3) {
- unicode_input_start();
-
- if (state->keycode == TD(CT_LBP))
- register_hex (0x300c);
- else
- register_hex (0x300d);
-
- unicode_input_finish();
- }
-}
-
-static void
-_td_brackets_reset (qk_tap_dance_state_t *state, void *user_data) {
- if (state->count == 1) {
- if (state->keycode == TD(CT_LBP))
- unregister_code16 (KC_LBRC);
- else
- unregister_code16 (KC_RBRC);
- } else if (state->count == 2) {
- if (state->keycode == TD(CT_LBP))
- unregister_code16 (KC_LPRN);
- else
- unregister_code16 (KC_RPRN);
- }
-}
-
-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_FN_ADVANCED (NULL, _td_brackets_finished, _td_brackets_reset)
- ,[CT_RBP] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, _td_brackets_finished, _td_brackets_reset)
- ,[CT_TMUX]= ACTION_TAP_DANCE_FN (an