summaryrefslogtreecommitdiff
path: root/keyboard/planck
diff options
context:
space:
mode:
authorKjetil Orbekk <kjetil.orbekk@gmail.com>2016-04-20 18:55:40 -0400
committerKjetil Orbekk <kj@orbekk.com>2022-04-23 17:37:01 -0400
commitac8d117f367b713131cd502c7592bb1870687298 (patch)
treef4fcc8bba87800d6a5c3d2d932a9e11575cdb1ea /keyboard/planck
parent857178e779f8215e0aec0e1eb40cb86e735092de (diff)
Add new custom dvorak keymap.
Diffstat (limited to 'keyboard/planck')
-rw-r--r--keyboard/planck/keymaps/kj.c113
1 files changed, 113 insertions, 0 deletions
diff --git a/keyboard/planck/keymaps/kj.c b/keyboard/planck/keymaps/kj.c
new file mode 100644
index 0000000000..2bc7186c8f
--- /dev/null
+++ b/keyboard/planck/keymaps/kj.c
@@ -0,0 +1,113 @@
+// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
+// this is the style you want to emulate.
+
+#include "planck.h"
+#ifdef BACKLIGHT_ENABLE
+ #include "backlight.h"
+#endif
+
+// Each layer gets a name for readability, which is then used in the keymap matrix below.
+// The underscores don't mean anything - you can have a layer called STUFF or any other name.
+// Layer names don't all need to be of the same length, obviously, and you can also skip them
+// entirely and just use numbers.
+#define _DV 0
+#define _QW 1
+#define _LW 2
+#define _RS 3
+
+#define _SHIFT 1
+#define _AA 2
+#define _OE 3
+#define _AE 4
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+[_DV] = {
+ {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
+ {KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENT},
+ {M(_SHIFT), KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_SLSH },
+ {KC_ESC, KC_LCTL, KC_LGUI, KC_LALT, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
+},
+
+[_QW] = {
+ {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
+ {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
+ {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
+ {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
+},
+
+[_LW] = {
+ {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
+ {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_TRNS},
+ {KC_TRNS, KC_VOLD, KC_VOLU, KC_PAUSE, KC_INSERT, KC_DELT, KC_ESC, KC_ENT, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS},
+ {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END}
+},
+
+[_RS] = {
+ {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
+ {KC_TRNS, M(_AA), M(_OE), M(_AE), KC_TRNS, KC_TRNS, KC_TRNS, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_TRNS},
+ {KC_TRNS, KC_RALT, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_PGDN, KC_END, KC_PIPE},
+ {DF(_DV), DF(_QW), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET}
+},
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+
+};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ static uint16_t shift_pressed = 0;
+
+ // MACRODOWN only works in this function
+ switch(id) {
+ case 0:
+ if (record->event.pressed) {
+ register_code(KC_RSFT);
+ #ifdef BACKLIGHT_ENABLE
+ backlight_step();
+ #endif
+ } else {
+ unregister_code(KC_RSFT);
+ }
+ break;
+ case _SHIFT:
+ if (record->event.pressed) {
+ register_code(KC_RSFT);
+ shift_pressed = 1;
+ } else {
+ unregister_code(KC_RSFT);
+ shift_pressed = 0;
+ }
+ break;
+ case _AA:
+ if (record->event.pressed) {
+ if (shift_pressed) {
+ return MACRO(I(10), U(RSFT), T(RALT), D(RSFT), T(A), T(A), END);
+ } else {
+ return MACRO(I(10), T(RALT), T(A), T(A), END);
+ }
+ }
+ break;
+ case _OE:
+ if (record->event.pressed) {
+ if (shift_pressed) {
+ return MACRO(I(10), U(RSFT), T(RALT), T(SLSH), D(RSFT), T(O), END);
+ } else {
+ return MACRO(I(10), T(RALT), T(SLSH), T(O), END);
+ }
+ }
+ break;
+ case _AE:
+ if (record->event.pressed) {
+ if (shift_pressed) {
+ return MACRO(I(10), U(RSFT), T(RALT), D(RSFT), T(A), T(E), END);
+ } else {
+ return MACRO(I(10), T(RALT), T(A), T(E), END);
+ }
+ }
+ break;
+ }
+ return MACRO_NONE;
+};
+