summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Đorđević <vomindoraan@gmail.com>2019-01-14 18:09:47 +0100
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-01-14 09:09:47 -0800
commit9105bf2434c54c40362173e1734a24485cfbe702 (patch)
tree5a31a50767ad464b5d3d75341f6f0d9686a116f4
parentee96b7a89dd2de78b9372d3b8ce899757e3190c4 (diff)
Add personal userspace, update keymaps (#4845)
* Add kbd6x:konstantin keymap * Prevent tap dance from sending LShift as a weak mod in KBD6X * Move config.h and rules.mk definitions into userspace * Add UC_WIN to UNICODE_SELECTED_MODES * Temporarily use Bootmagic until Command is fixed * Move common behavior from keyboards into userspace * Update kbd6x:konstantin keymap and userspace * Make a RCTRL layer in kbd6x:konstantin * Make KC_ESC turn off layers * KC_ESC turns L_FN off only if it was locked on * Add missing record->event.pressed checks * Move numpad toggling logic into function * Disable Bootmagic, enable KEYBOARD_SHARED_EP with Command
-rw-r--r--keyboards/kbd6x/keymaps/konstantin/config.h3
-rw-r--r--keyboards/kbd6x/keymaps/konstantin/keymap.c92
-rw-r--r--keyboards/kbd6x/keymaps/konstantin/rules.mk2
-rw-r--r--keyboards/whitefox/keymaps/konstantin/config.h24
-rw-r--r--keyboards/whitefox/keymaps/konstantin/keymap.c141
-rw-r--r--keyboards/whitefox/keymaps/konstantin/rules.mk11
-rw-r--r--users/konstantin/config.h24
-rw-r--r--users/konstantin/konstantin.c77
-rw-r--r--users/konstantin/konstantin.h50
-rw-r--r--users/konstantin/rules.mk16
-rw-r--r--users/konstantin/tap_dance.c93
-rw-r--r--users/konstantin/tap_dance.h25
-rw-r--r--users/konstantin/unicode.h11
13 files changed, 400 insertions, 169 deletions
diff --git a/keyboards/kbd6x/keymaps/konstantin/config.h b/keyboards/kbd6x/keymaps/konstantin/config.h
new file mode 100644
index 0000000000..4b511eb848
--- /dev/null
+++ b/keyboards/kbd6x/keymaps/konstantin/config.h
@@ -0,0 +1,3 @@
+#pragma once
+
+#define LAYER_FN
diff --git a/keyboards/kbd6x/keymaps/konstantin/keymap.c b/keyboards/kbd6x/keymaps/konstantin/keymap.c
new file mode 100644
index 0000000000..b400b06810
--- /dev/null
+++ b/keyboards/kbd6x/keymaps/konstantin/keymap.c
@@ -0,0 +1,92 @@
+#include QMK_KEYBOARD_H
+#include "konstantin.h"
+
+enum keycodes_keymap {
+ RCTRL = RANGE_KEYMAP,
+};
+
+enum layers_keymap {
+ L_RCTRL = L_RANGE_KEYMAP,
+};
+
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case RCTRL:
+ if (record->event.pressed) {
+ layer_on(L_RCTRL);
+ register_code(KC_RCTRL);
+ } else {
+ layer_off(L_RCTRL);
+ unregister_code(KC_RCTRL);
+ }
+ return false;
+
+ default:
+ return true;
+ }
+}
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Base layer
+ * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
+ * │Esc│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ \ │ ` │
+ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┤
+ * │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │Bspc │
+ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤
+ * │LCtCps│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │
+ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤
+ * │LShiftFn│ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │RShift│FnL│
+ * └─────┬──┴┬──┴──┬┴───┴───┴───┴───┴───┴───┴──┬┴───┴┬───┬─┴───┘
+ * │LGu│LAlt │ Space │RAlGu│RCt│
+ * └───┴─────┴───────────────────────────┴─────┴───┘
+ */
+ [L_BASE] = LAYOUT(
+ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC,
+ LCT_CPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
+ LSFT_FN, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_FNLK,
+ XXXXXXX, KC_LGUI, KC_LALT, KC_SPC, RAL_RGU, RCTRL, XXXXXXX
+ ),
+
+ /* Function layer
+ * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
+ * │ │F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│PSc│Ins│
+ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┤
+ * │ │Hom│ ↑ │End│PgU│ │ │ │ │M1 │M↑ │M2 │M3 │ Del │
+ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤
+ * │ │ ← │ ↓ │ → │PgD│ │ │ │MW↑│M← │M↓ │M→ │ │
+ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤
+ * │ │Mut│VoD│VoU│Ply│Prv│Nxt│MW←│MW→│M4 │M5 │ │ │
+ * └─────┬──┴┬──┴──┬┴───┴───┴───┴───┴───┴───┴──┬┴───┴┬───┬─┴───┘
+ * │ │ │ MW↓ │ │ │
+ * └───┴─────┴───────────────────────────┴─────┴───┘
+ */
+ [L_FN] = LAYOUT(
+ _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_INS,
+ _______, KC_HOME, KC_UP, KC_END, KC_PGUP, _______, _______, _______, _______, KC_BTN1, KC_MS_U, KC_BTN2, KC_BTN3, KC_DEL,
+ _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, _______, _______, _______, KC_WH_U, KC_MS_L, KC_MS_D, KC_MS_R, _______,
+ _______, KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY, KC_MPRV, KC_MNXT, KC_WH_L, KC_WH_R, KC_BTN4, KC_BTN5, _______, _______,
+ XXXXXXX, _______, _______, KC_WH_D, _______, _______, XXXXXXX
+ ),
+
+ /* RCtrl layer
+ * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
+ * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
+ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┤
+ * │ │Top│Mv↑│Btm│PrT│ │ │ │ │ │ │ │ │Clear│
+ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤
+ * │ │Mv←│Mv↓│Mv→│NxT│ │ │ │ │ │ │ │ │
+ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤
+ * │ │ │ │ │ │ │ │ │ │ │ │ │ │
+ * └─────┬──┴┬──┴──┬┴───┴───┴───┴───┴───┴───┴──┬┴───┴┬───┬─┴───┘
+ * │Dst│Dstp←│ │Dstp→│ │
+ * └───┴─────┴───────────────────────────┴─────┴───┘
+ */
+ [L_RCTRL] = LAYOUT(
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, TOP, MV_UP, BOTTOM, PRV_TAB, _______, _______, _______, _______, _______, _______, _______, _______, CLEAR,
+ _______, MV_LEFT, MV_DOWN, MV_RGHT, NXT_TAB, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ XXXXXXX, DESKTOP, DSKTP_L, _______, DSKTP_R, _______, XXXXXXX
+ ),
+};
diff --git a/keyboards/kbd6x/keymaps/konstantin/rules.mk b/keyboards/kbd6x/keymaps/konstantin/rules.mk
new file mode 100644
index 0000000000..a45a631dc0
--- /dev/null
+++ b/keyboards/kbd6x/keymaps/konstantin/rules.mk
@@ -0,0 +1,2 @@
+BACKLIGHT_ENABLE = no
+RGBLIGHT_ENABLE = no
diff --git a/keyboards/whitefox/keymaps/konstantin/config.h b/keyboards/whitefox/keymaps/konstantin/config.h
index ab920a50ba..d7a072b06f 100644
--- a/keyboards/whitefox/keymaps/konstantin/config.h
+++ b/keyboards/whitefox/keymaps/konstantin/config.h
@@ -1,27 +1,7 @@
#pragma once
-#define FORCE_NKRO
+#define LAYER_FN
+#define LAYER_NUMPAD
#undef IS_COMMAND
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RCTL)))
-
-#define MAGIC_KEY_LAYER0_ALT1 BSLS
-#define MAGIC_KEY_BOOTLOADER ESC
-
-#define MOUSEKEY_DELAY 50
-#define MOUSEKEY_INTERVAL 15
-#define MOUSEKEY_MAX_SPEED 4
-#define MOUSEKEY_TIME_TO_MAX 50
-#define MOUSEKEY_WHEEL_MAX_SPEED 1
-#define MOUSEKEY_WHEEL_TIME_TO_MAX 50
-
-#define NO_ACTION_FUNCTION
-#define NO_ACTION_MACRO
-
-#define PERMISSIVE_HOLD
-#define TAPPING_TERM 200
-#define TAPPING_TOGGLE 2
-
-#define UNICODE_CYCLE_PERSIST false
-#define UNICODE_SELECTED_MODES UC_WINC, UC_LNX
-#define UNICODE_WINC_KEY KC_RGUI
diff --git a/keyboards/whitefox/keymaps/konstantin/keymap.c b/keyboards/whitefox/keymaps/konstantin/keymap.c
index 54777cfe08..e37097361a 100644
--- a/keyboards/whitefox/keymaps/konstantin/keymap.c
+++ b/keyboards/whitefox/keymaps/konstantin/keymap.c
@@ -1,136 +1,5 @@
#include QMK_KEYBOARD_H
-
-#define TOP LCTL(KC_HOME)
-#define BOTTOM LCTL(KC_END)
-#define DSKTP_L LCTL(LGUI(KC_LEFT))
-#define DSKTP_R LCTL(LGUI(KC_RGHT))
-
-#define FN MO(L_FN)
-#define FN_CAPS LT(L_FN, KC_CAPS)
-#define FN_FNLK TT(L_FN)
-
-#define DESKTOP TD(TD_DESKTOP)
-#define FN_RCTL TD(TD_FN_RCTL)
-#define RAL_LAL TD(TD_RAL_LAL)
-#define RAL_RGU TD(TD_RAL_RGU)
-#define RCT_RSF TD(TD_RCT_RSF)
-
-#define COMMA UC(0x002C)
-#define L_PAREN UC(0x0028)
-#define R_PAREN UC(0x0029)
-#define EQUALS UC(0x003D)
-#define TIMES UC(0x00D7)
-#define DIVIDE UC(0x00F7)
-#define MINUS UC(0x2212)
-
-enum layers {
- L_BASE,
- L_FN,
- L_NUMPAD,
-};
-
-enum custom_keycodes {
- CLEAR = SAFE_RANGE,
- NUMPAD,
-};
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- switch (keycode) {
- case CLEAR:
- if (record->event.pressed) {
- SEND_STRING(SS_LCTRL("a") SS_TAP(X_DELETE));
- }
- return false;
-
- case NUMPAD:
- if (record->event.pressed) {
- layer_invert(L_NUMPAD);
- bool num_lock = host_keyboard_leds() & 1<<USB_LED_NUM_LOCK;
- if (num_lock != (bool)IS_LAYER_ON(L_NUMPAD)) {
- tap_code(KC_NLCK); // Toggle Num Lock to match layer state.
- }
- }
- return false;
-
- default:
- return true;
- }
-}
-
-struct {
- bool fn_on; // Layer state when tap dance started
- bool started;
-} td_fn_rctrl_data;
-
-void td_fn_rctrl_each(qk_tap_dance_state_t *state, void *user_data) {
- if (!td_fn_rctrl_data.started) {
- td_fn_rctrl_data.fn_on = IS_LAYER_ON(L_FN);
- td_fn_rctrl_data.started = true;
- }
- // Single tap → Fn, double tap → RCtrl, triple tap etc. → Fn+RCtrl
- if (state->count == 1 || state->count == 3) {
- layer_on(L_FN);
- } else if (state->count == 2) {
- if (!td_fn_rctrl_data.fn_on) {
- layer_off(L_FN);
- }
- register_code(KC_RCTL);
- }
-}
-
-void td_fn_rctrl_reset(qk_tap_dance_state_t *state, void *user_data) {
- if ((state->count == 1 || state->count > 2) && !td_fn_rctrl_data.fn_on) {
- layer_off(L_FN);
- }
- if (state->count >= 2) {
- unregister_code(KC_RCTL);
- }
- td_fn_rctrl_data.started = false;
-}
-
-#define ACTION_TAP_DANCE_DOUBLE_MODS(mod1, mod2) { \
- .fn = { td_double_mods_each, NULL, td_double_mods_reset }, \
- .user_data = &(qk_tap_dance_pair_t){ mod1, mod2 }, \
- }
-
-void td_double_mods_each(qk_tap_dance_state_t *state, void *user_data) {
- qk_tap_dance_pair_t *mods = (qk_tap_dance_pair_t *)user_data;
- // Single tap → mod1, double tap → mod2, triple tap etc. → mod1+mod2
- if (state->count == 1 || state->count == 3) {
- register_code(mods->kc1);
- } else if (state->count == 2) {
- unregister_code(mods->kc1);
- register_code(mods->kc2);
- }
- // Prevent tap dance from sending kc1 and kc2 as weak mods
- state->weak_mods &= ~(MOD_BIT(mods->kc1) | MOD_BIT(mods->kc2));
-}
-
-void td_double_mods_reset(qk_tap_dance_state_t *state, void *user_data) {
- qk_tap_dance_pair_t *mods = (qk_tap_dance_pair_t *)user_data;
- if (state->count == 1 || state->count > 2) {
- unregister_code(mods->kc1);
- }
- if (state->count >= 2) {
- unregister_code(mods->kc2);
- }
-}
-
-enum tap_dance {
- TD_DESKTOP,
- TD_FN_RCTL,
- TD_RAL_LAL,
- TD_RAL_RGU,
- TD_RCT_RSF,
-};
-
-qk_tap_dance_action_t tap_dance_actions[] = {
- [TD_DESKTOP] = ACTION_TAP_DANCE_DOUBLE(LCTL(LGUI(KC_D)), LCTL(LGUI(KC_F4))), // Add/close virtual desktop
- [TD_FN_RCTL] = ACTION_TAP_DANCE_FN_ADVANCED(td_fn_rctrl_each, NULL, td_fn_rctrl_reset),
- [TD_RAL_LAL] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_LALT),
- [TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_RGUI),
- [TD_RCT_RSF] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RCTL, KC_RSFT),
-};
+#include "konstantin.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Base layer
@@ -141,9 +10,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤
* │FnCaps│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │PgU│
* ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤
- * │ LShift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │CtlSft│ ↑ │PgD│
+ * │ LShift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │RCtRSf│ ↑ │PgD│
* ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬─┬───┼───┼───┤
- * │LCtl│LGui│LAlt│ Space │AlGu│FnLk│ │ ← │ ↓ │ → │
+ * │LCtl│LGui│LAlt│ Space │RAlG│FnLk│ │ ← │ ↓ │ → │
* └────┴────┴────┴────────────────────────┴────┴────┘ └───┴───┴───┘
*/
[L_BASE] = LAYOUT_truefox( \
@@ -177,7 +46,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Numpad layer
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
- * │Num│ │ │ │ │ │ │P7 │P8 │P9 │P- │ − │ = │Num│ │ │
+ * │ │ │ │ │ │ │ │P7 │P8 │P9 │P- │ − │ = │Num│ │ │
* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┼───┤
* │ │ │ │ │ │ │ │P4 │P5 │P6 │P+ │ ( │ ) │ │ │
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤
@@ -189,7 +58,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* └────┴────┴────┴────────────────────────┴────┴────┘ └───┴───┴───┘
*/
[L_NUMPAD] = LAYOUT_truefox( \
- NUMPAD, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PMNS, MINUS, EQUALS, NUMPAD, _______, _______, \
+ _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PMNS, MINUS, EQUALS, NUMPAD, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, KC_PPLS, L_PAREN, R_PAREN, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, KC_PAST, TIMES, KC_PENT, _______, \
_______, _______, _______, _______, _______, _______, KC_P0, KC_P0, COMMA, KC_PDOT, KC_PSLS, DIVIDE, _______, _______, \
diff --git a/keyboards/whitefox/keymaps/konstantin/rules.mk b/keyboards/whitefox/keymaps/konstantin/rules.mk
index 96722d1d5b..1302f14ca8 100644
--- a/keyboards/whitefox/keymaps/konstantin/rules.mk
+++ b/keyboards/whitefox/keymaps/konstantin/rules.mk
@@ -1,13 +1,2 @@
BACKLIGHT_ENABLE = no
-BOOTMAGIC_ENABLE = no
-COMMAND_ENABLE = yes
-CONSOLE_ENABLE = yes
-EXTRAKEY_ENABLE = yes
-MOUSEKEY_ENABLE = yes
-NKRO_ENABLE = yes
-SLEEP_LED_ENABLE = no
-TAP_DANCE_ENABLE = yes
-UNICODE_ENABLE = yes
VISUALIZER_ENABLE = no
-
-EXTRAFLAGS += -flto
diff --git a/users/konstantin/config.h b/users/konstantin/config.h
new file mode 100644
index 0000000000..d03333f05d
--- /dev/null
+++ b/users/konstantin/config.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#define FORCE_NKRO
+
+#define MAGIC_KEY_LAYER0_ALT1 BSLS
+#define MAGIC_KEY_BOOTLOADER ESC
+
+#define MOUSEKEY_DELAY 50
+#define MOUSEKEY_INTERVAL 15
+#define MOUSEKEY_MAX_SPEED 4
+#define MOUSEKEY_TIME_TO_MAX 50
+#define MOUSEKEY_WHEEL_MAX_SPEED 1
+#define MOUSEKEY_WHEEL_TIME_TO_MAX 50
+
+#define NO_ACTION_FUNCTION
+#define NO_ACTION_MACRO
+
+#define PERMISSIVE_HOLD
+#define TAPPING_TERM 200
+#define TAPPING_TOGGLE 2
+
+#define UNICODE_CYCLE_PERSIST false
+#define UNICODE_SELECTED_MODES UC_WINC, UC_WIN, UC_LNX
+#define UNICODE_WINC_KEY KC_RGUI
diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c
new file mode 100644
index 0000000000..977111c1f9
--- /dev/null
+++ b/users/konstantin/konstantin.c
@@ -0,0 +1,77 @@
+#include "konstantin.h"
+
+#ifdef LAYER_NUMPAD
+static void toggle_numpad(void) {
+ layer_invert(L_NUMPAD);
+ bool num_lock = host_keyboard_leds() & 1<<USB_LED_NUM_LOCK;
+ if (num_lock != (bool)IS_LAYER_ON(L_NUMPAD)) {
+ tap_code(KC_NLCK); // Toggle Num Lock to match layer state
+ }
+}
+#endif
+
+__attribute__((weak))
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
+ return true;
+}
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ if (!process_record_keymap(keycode, record)) {
+ return false;
+ }
+
+ switch (keycode) {
+ case CLEAR:
+ if (record->event.pressed) {
+ SEND_STRING(SS_LCTRL("a") SS_TAP(X_DELETE));
+ }
+ return false;
+
+#ifdef LAYER_FN
+ static bool fn_lock;
+
+ case FN_FNLK:
+ if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
+ fn_lock = !IS_LAYER_ON(L_FN); // Fn layer will be toggled after this
+ }
+ return true;
+#endif
+
+#ifdef LAYER_NUMPAD
+ case NUMPAD:
+ if (record->event.pressed) {
+ toggle_numpad();
+ }
+ return false;
+#endif
+
+ case KC_ESC:
+ if (record->event.pressed) {
+#ifdef LAYER_NUMPAD
+ if (IS_LAYER_ON(L_NUMPAD)) {
+ toggle_numpad();
+ return false;
+ }
+#endif
+#ifdef LAYER_FN
+ if (IS_LAYER_ON(L_FN) && fn_lock) {
+ layer_off(L_FN);
+ return fn_lock = false;
+ }
+#endif
+ }
+ return true;
+
+ default:
+ return true;
+ }
+}
+
+__attribute__((weak))
+uint32_t layer_state_set_keymap(uint32_t state) {
+ return state;
+}
+
+uint32_t layer_state_set_user(uint32_t state) {
+ return layer_state_set_keymap(state);
+}
diff --git a/users/konstantin/konstantin.h b/users/konstantin/konstantin.h
new file mode 100644
index 0000000000..06081496b6
--- /dev/null
+++ b/users/konstantin/konstantin.h
@@ -0,0 +1,50 @@
+#pragma once
+
+#include "quantum.h"
+#ifdef TAP_DANCE_ENABLE
+ #include "tap_dance.h"
+#endif
+#ifdef UNICODE_ENABLE
+ #include "unicode.h"
+#endif
+
+#ifdef LAYER_FN
+ #define FN MO(L_FN)
+ #define FN_CAPS LT(L_FN, KC_CAPS)
+ #define FN_FNLK TT(L_FN)
+#endif
+
+#define MV_UP LCTL(KC_UP)
+#define MV_DOWN LCTL(KC_DOWN)
+#define MV_LEFT LCTL(KC_LEFT)
+#define MV_RGHT LCTL(KC_RGHT)
+#define TOP LCTL(KC_HOME)
+#define BOTTOM LCTL(KC_END)
+#define PRV_TAB LCTL(KC_PGUP)
+#define NXT_TAB LCTL(KC_PGDN)
+
+#define LCT_CPS LCTL_T(KC_CAPS)
+
+enum keycodes_user {
+ CLEAR = SAFE_RANGE,
+#ifdef LAYER_NUMPAD
+ NUMPAD,
+#endif
+
+ RANGE_KEYMAP,
+};
+
+enum layers_user {
+ L_BASE,
+#ifdef LAYER_FN
+ L_FN,
+#endif
+#ifdef LAYER_NUMPAD
+ L_NUMPAD,
+#endif
+
+ L_RANGE_KEYMAP,
+};
+
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
+uint32_t layer_state_set_keymap(uint32_t state);
diff --git a/users/konstantin/rules.mk b/users/konstantin/rules.mk
new file mode 100644
index 0000000000..7f25a8107a
--- /dev/null
+++ b/users/konstantin/rules.mk
@@ -0,0 +1,16 @@
+BOOTMAGIC_ENABLE = no
+COMMAND_ENABLE = yes
+CONSOLE_ENABLE = yes
+EXTRAKEY_ENABLE = yes
+KEYBOARD_SHARED_EP = yes # TODO: Disable once Command is fixed
+MOUSEKEY_ENABLE = yes
+NKRO_ENABLE = yes
+TAP_DANCE_ENABLE = yes
+UNICODE_ENABLE = yes
+
+SRC += konstantin.c
+ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
+ SRC += tap_dance.c
+endif
+
+EXTRAFLAGS += -flto
diff --git a/users/konstantin/tap_dance.c b/users/konstantin/tap_dance.c
new file mode 100644
index 0000000000..b13f33c024
--- /dev/null
+++ b/users/konstantin/tap_dance.c
@@ -0,0 +1,93 @@
+#include "tap_dance.h"
+#include "konstantin.h"
+
+#define ACTION_TAP_DANCE_DOUBLE_MODS(mod1, mod2) { \
+ .fn = { td_double_mods_each, NULL, td_double_mods_reset }, \
+ .user_data = &(qk_tap_dance_pair_t){ mod1, mod2 }, \
+ }
+
+void td_double_mods_each(qk_tap_dance_state_t *state, void *user_data) {
+ qk_tap_dance_pair_t *mods = (qk_tap_dance_pair_t *)user_data;
+ // Single tap → mod1, double tap → mod2, triple tap etc. → mod1+mod2
+ if (state->count == 1 || state->count == 3) {
+ register_code(mods->kc1);
+ } else if (state->count == 2) {
+ unregister_code(mods->kc1);
+ register_code(mods->kc2);
+ }
+ // Prevent tap dance from sending kc1 and kc2 as weak mods
+ state->weak_mods &= ~(MOD_BIT(mods->kc1) | MOD_BIT(mods->kc2));
+}
+
+void td_double_mods_reset(qk_tap_dance_state_t *state, void *user_data) {
+ qk_tap_dance_pair_t *mods = (qk_tap_dance_pair_t *)user_data;
+ if (state->count == 1 || state->count >= 3) {
+ unregister_code(mods->kc1);
+ }
+ if (state->count >= 2) {
+ unregister_code(mods->kc2);
+ }
+}
+
+struct {
+ bool fn_on; // Layer state when tap dance started
+ bool started;
+} td_fn_rctrl_data;
+
+void td_fn_rctrl_each(qk_tap_dance_state_t *state, void *user_data) {
+ if (!td_fn_rctrl_data.started) {
+ td_fn_rctrl_data.fn_on = IS_LAYER_ON(L_FN);
+ td_fn_rctrl_data.started = true;
+ }
+ // Single tap → Fn, double tap → RCtrl, triple tap etc. → Fn+RCtrl
+ if (state->count == 1 || state->count == 3) {
+ layer_on(L_FN);
+ } else if (state->count == 2) {
+ if (!td_fn_rctrl_data.fn_on) {
+ layer_off(L_FN);
+ }
+ register_code(KC_RCTL);
+ }
+}
+
+void td_fn_rctrl_reset(qk_tap_dance_state_t *state, void *user_data) {
+ if ((state->count == 1 || state->count >= 3) && !td_fn_rctrl_data.fn_on) {
+ layer_off(L_FN);
+ }
+ if (state->count >= 2) {
+ unregister_code(KC_RCTL);
+ }
+ td_fn_rctrl_data.started = false;
+}
+
+void td_lsft_fn_each(qk_tap_dance_state_t *state, void *user_data) {
+ // Single tap → LShift, double tap → Fn, triple tap etc. → Fn+LShift
+ if (state->count == 1 || state->count == 3) {
+ register_code(KC_LSFT);
+ } else if (state->count == 2) {
+ unregister_code(KC_LSFT);
+ // Prevent tap dance from sending LShift as a weak mod
+ state->weak_mods &= ~MOD_BIT(KC_LSFT);
+ layer_on(L_FN);
+ }
+}
+
+void td_lsft_fn_reset(qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1 || state->count >= 3) {
+ unregister_code(KC_LSFT);
+ }
+ if (state->count >= 2) {
+ layer_off(L_FN);
+ }
+}
+
+qk_tap_dance_action_t tap_dance_actions[] = {
+ [TD_DESKTOP] = ACTION_TAP_DANCE_DOUBLE(LCTL(LGUI(KC_D)), LCTL(LGUI(KC_F4))), // Add/close virtual desktop
+
+ [TD_RAL_LAL] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_LALT),
+ [TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_RGUI),
+ [TD_RCT_RSF] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RCTL, KC_RSFT),
+
+ [TD_FN_RCTL] = ACTION_TAP_DANCE_FN_ADVANCED(td_fn_rctrl_each, NULL, td_fn_rctrl_reset),
+ [TD_LSFT_FN] = ACTION_TAP_DANCE_FN_ADVANCED(td_lsft_fn_each, NULL, td_lsft_fn_reset),
+};
diff --git a/users/konstantin/tap_dance.h b/users/konstantin/tap_dance.h
new file mode 100644
index 0000000000..922a635141
--- /dev/null
+++ b/users/konstantin/tap_dance.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include "quantum.h"
+
+#define DESKTOP TD(TD_DESKTOP)
+#define DSKTP_L LCTL(LGUI(KC_LEFT))
+#define DSKTP_R LCTL(LGUI(KC_RGHT))
+
+#define RAL_LAL TD(TD_RAL_LAL)
+#define RAL_RGU TD(TD_RAL_RGU)
+#define RCT_RSF TD(TD_RCT_RSF)
+
+#define FN_RCTL TD(TD_FN_RCTL)
+#define LSFT_FN TD(TD_LSFT_FN)
+
+enum tap_dance {
+ TD_DESKTOP,
+
+ TD_RAL_LAL,
+ TD_RAL_RGU,
+ TD_RCT_RSF,
+
+ TD_FN_RCTL,
+ TD_LSFT_FN,
+};
diff --git a/users/konstantin/unicode.h b/users/konstantin/unicode.h
new file mode 100644
index 0000000000..09af7e1c7f
--- /dev/null
+++ b/users/konstantin/unicode.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "quantum.h"
+
+#define COMMA UC(0x002C)
+#define L_PAREN UC(0x0028)
+#define R_PAREN UC(0x0029)
+#define EQUALS UC(0x003D)
+#define TIMES UC(0x00D7)
+#define DIVIDE UC(0x00F7)
+#define MINUS UC(0x2212)