diff options
author | Olivierko <olivier@alldiksson.se> | 2019-10-10 23:52:16 +0200 |
---|---|---|
committer | fauxpark <fauxpark@gmail.com> | 2019-10-11 08:52:16 +1100 |
commit | 094aa7c24b1d7d8fbea8404c93c2a3e99106d65b (patch) | |
tree | 9ec9d31b0ed53f7f3d86906bc0f0411cd8a6929e /keyboards/dz60/keymaps/olivierko/keymap.c | |
parent | 918f13a4ac7cc71f266fa294d093b9c46f61ae77 (diff) | |
download | firmware-094aa7c24b1d7d8fbea8404c93c2a3e99106d65b.tar.gz firmware-094aa7c24b1d7d8fbea8404c93c2a3e99106d65b.tar.bz2 firmware-094aa7c24b1d7d8fbea8404c93c2a3e99106d65b.zip |
added new layout and Olivierko keymap for dz60 (#6996)
* - added new layout for dz60
- created personal keymap using new layout
* - changes based on pr feedback from @noroadsleft
* - further readme formatting
* Apply suggestions from code review
applied changes based on review feedback
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* - readme formatting
* Apply suggestions from code review
Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
Diffstat (limited to 'keyboards/dz60/keymaps/olivierko/keymap.c')
-rw-r--r-- | keyboards/dz60/keymaps/olivierko/keymap.c | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/keyboards/dz60/keymaps/olivierko/keymap.c b/keyboards/dz60/keymaps/olivierko/keymap.c new file mode 100644 index 000000000..38d12d4d4 --- /dev/null +++ b/keyboards/dz60/keymaps/olivierko/keymap.c @@ -0,0 +1,87 @@ +#include QMK_KEYBOARD_H + +enum keyboard_layers { + _BL, + _SL, + _FL, + _CL, +}; + +enum custom_keycodes { + SWE_AA = SAFE_RANGE, + SWE_AE, + SWE_OE, +}; + +char *alt_codes[][2] = { + { + SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_2)SS_TAP(X_KP_2)SS_TAP(X_KP_9)), // Alt+0229 → å + SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_1)SS_TAP(X_KP_9)SS_TAP(X_KP_7)), // Alt+0197 → Å + }, + { + SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_2)SS_TAP(X_KP_2)SS_TAP(X_KP_8)), // Alt+0228 → ä + SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_1)SS_TAP(X_KP_9)SS_TAP(X_KP_6)), // Alt+0196 → Ä + }, + { + SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_2)SS_TAP(X_KP_4)SS_TAP(X_KP_6)), // Alt+0246 → ö + SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_2)SS_TAP(X_KP_1)SS_TAP(X_KP_4)), // Alt+0214 → Ö + }, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_BL] = LAYOUT_olivierko( + 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, + MO(_FL), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, KC_RSFT, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_LEFT, KC_DOWN, KC_RIGHT, KC_RCTL), + + [_SL] = LAYOUT_olivierko( + 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, SWE_AA, KC_NO, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, SWE_OE, SWE_AE, 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), + + [_FL] = LAYOUT_olivierko( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_PAUSE, + 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_DELETE, + KC_NO, DF(_BL), DF(_SL), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_INS, + KC_LSFT, KC_NO, KC_NO, KC_CAPS, KC_NO, KC_NO, KC_NO, KC_MUTE, KC_NO, KC_NO, KC_NO, KC_PGUP, KC_RSFT, + KC_LCTL, MO(_CL), KC_LALT, KC_MPLY, KC_HOME, KC_PGDOWN, KC_END, KC_RCTL), + + [_CL] = LAYOUT_olivierko( + RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_NO, KC_NO, KC_NO, KC_NO, RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_NO, KC_NO, KC_NO, DEBUG, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_LSFT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_RSFT, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) +{ + if (!record->event.pressed) + return true; + + switch (keycode) { + case SWE_AA: + case SWE_AE: + case SWE_OE: { + uint16_t index = keycode - SWE_AA; + uint8_t shift = get_mods() & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)); + + unregister_code(KC_LSFT); + unregister_code(KC_RSFT); + + send_string(alt_codes[index][(bool)shift]); + + if (shift & MOD_BIT(KC_LSFT)) register_code(KC_LSFT); + if (shift & MOD_BIT(KC_RSFT)) register_code(KC_RSFT); + + return false; + } + default: + return true; + } +}
\ No newline at end of file |