From e44c30f2030dd4c481a6e38e9392f147be7b0ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Bo=CC=88sebeck?= Date: Fri, 15 Jan 2016 15:55:00 +0100 Subject: [PATCH] using keymap_german_osx.h more, adding macros for CTRL/CMD-V combination --- keyboard/ergodox_ez/keymaps/keymap_osx_de.c | 89 ++++++++++++----- quantum/keymap_extras/keymap_german_osx.h | 100 ++++++++++++++++++++ 2 files changed, 164 insertions(+), 25 deletions(-) create mode 100644 quantum/keymap_extras/keymap_german_osx.h diff --git a/keyboard/ergodox_ez/keymaps/keymap_osx_de.c b/keyboard/ergodox_ez/keymaps/keymap_osx_de.c index 91f2c33f31..cc9076eec8 100644 --- a/keyboard/ergodox_ez/keymaps/keymap_osx_de.c +++ b/keyboard/ergodox_ez/keymaps/keymap_osx_de.c @@ -1,7 +1,7 @@ #include "ergodox_ez.h" #include "debug.h" #include "action_layer.h" -#include "keymap_extras/keymap_german.h" +#include "keymap_extras/keymap_german_osx.h" #define BASE 0 // default layer #define SYMB 1 // symbols @@ -9,7 +9,9 @@ #define CRSR 3 // media keys #define NUMB 4 // number keys - +#define M_CTRL_CMDV 1 +#define M_CTRL_CMDC 2 +#define M_MEH_SH_ACUT 3 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap 0: Basic layer @@ -37,21 +39,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Otherwise, it needs KC_* [BASE] = KEYMAP( // layer 0 : default // left hand - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, LGUI(KC_V), - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LGUI, - TG(3), KC_A, KC_S, KC_D, KC_F, KC_G, - KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_LALT, + KC_ESC, DE_1, DE_2, DE_3, DE_4, DE_5, M(M_CTRL_CMDV), + KC_TAB, DE_Q, DE_W, DE_E, DE_R, DE_T, KC_LGUI, + TG(3), DE_A, DE_S, DE_D, DE_F, DE_G, + KC_LSFT, CTL_T(DE_Y), DE_X, DE_C, DE_V, DE_B, KC_LALT, LT(SYMB,KC_GRV), DE_LESS, LALT(KC_LSFT), KC_LEFT,KC_RGHT, - TG(2), MEH_T(LSFT(DE_ACUT)), - KC_HOME, - KC_BSPC,KC_DEL,KC_END, + TG(2), M(M_MEH_SH_ACUT), //MEH_T(LSFT(DE_ACUT)), //need to create macro for that + KC_HOME, + KC_BSPC,KC_DEL, KC_END, // right hand - LGUI(KC_C), KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, - KC_RGUI, KC_Y, KC_U, KC_I, KC_O, KC_P, DE_UE, - KC_H, KC_J, KC_K, KC_L, KC_SCLN,LT(MDIA,DE_AE), - KC_RALT,KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, - KC_UP, KC_DOWN,LGUI(KC_LSFT),KC_RBRC, LT(SYMB,KC_BSLS), - ALL_T(DE_ACUT), TG(4), + M(M_CTRL_CMDC), DE_6, DE_7, DE_8, DE_9, DE_0, DE_SS, + KC_RGUI, DE_Z, DE_U, DE_I, DE_O, DE_P, DE_UE, + DE_H, DE_J, DE_K, DE_L, DE_OE,LT(MDIA,DE_AE), + KC_RALT, DE_N, DE_M, DE_COMM,DE_DOT, CTL_T(DE_MINS), KC_RSFT, + KC_UP, KC_DOWN,LGUI(KC_LSFT),DE_PLUS, LT(SYMB,DE_HASH), + ALL_T(DE_ACUT), TG(4), KC_PGUP, KC_PGDN,KC_ENT, KC_SPC ), @@ -60,7 +62,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ,--------------------------------------------------. ,--------------------------------------------------. * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | | | | ! | ? | | | | | \ | [ | ] | | | # | F12 | + * | | < | > | ! | ? | | | | | \ | [ | ] | | | # | F12 | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * | | # | $ | \ | / | . |------| |------| / | ( | ) | { | } | | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| @@ -80,9 +82,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [SYMB] = KEYMAP( // left hand KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, - KC_TRNS,KC_GRV,LSFT(KC_GRV),DE_EXLM,DE_QST,KC_TRNS,KC_TRNS, - KC_TRNS,DE_HASH,DE_DLR, LALT(LSFT(KC_7)),DE_SLSH,KC_DOT, - KC_TRNS,KC_TRNS,DE_LESS,DE_PERC,LALT(KC_7),LALT(KC_N),KC_TRNS, + KC_TRNS,DE_LESS,DE_MORE,DE_EXLM,DE_QST, KC_TRNS,KC_TRNS, + KC_TRNS,DE_HASH,DE_DLR, DE_BSLS,DE_SLSH,KC_DOT, + KC_TRNS,KC_TRNS,DE_LESS,DE_PERC,DE_PIPE,DE_TILD,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS, @@ -187,15 +189,52 @@ const uint16_t PROGMEM fn_actions[] = { const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + static uint16_t start; // MACRODOWN only works in this function switch(id) { case 0: - if (record->event.pressed) { - register_code(KC_RSFT); - } else { - unregister_code(KC_RSFT); - } - break; + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + case 1: + if (record->event.pressed) { + start = timer_read(); + return MACRO(D(LCTRL), END); + } else { + if (timer_elapsed(start) > 150) { + return MACRO(U(LCTRL), END); + } else { + return MACRO(U(LCTRL), D(LGUI), T(V), U(LGUI), END); + } + } + break; + case 2: + if (record->event.pressed) { + start = timer_read(); + return MACRO(D(LCTRL),END); + } else { + if (timer_elapsed(start) > 150){ + return MACRO(U(LCTRL),END); + } else { + return MACRO(U(LCTRL),D(LGUI),T(C),U(LGUI),END); + } + } + break; + case 3: + if (record->event.pressed) { + start = timer_read(); + return MACRO(D(LCTRL),D(LSFT),D(LALT),END); + } else { + if (timer_elapsed(start) > 150){ + return MACRO(U(LCTRL),U(LSFT),U(LALT),END); + } else { + return MACRO(U(LCTRL),U(LALT),T(EQL),U(LSFT),END); //cannot use DE_ACUT here, as macro needs KC_ prefix + } + } + break; } return MACRO_NONE; }; diff --git a/quantum/keymap_extras/keymap_german_osx.h b/quantum/keymap_extras/keymap_german_osx.h new file mode 100644 index 0000000000..b011561e2f --- /dev/null +++ b/quantum/keymap_extras/keymap_german_osx.h @@ -0,0 +1,100 @@ +#ifndef KEYMAP_GERMAN_OSX +#define KEYMAP_GERMAN_OSX + +#ifdef KEYMAP_GERMAN + #warning redefining german keys +#endif +#include "keymap_common.h" + +// Alt gr + +// normal characters +#define DE_Z KC_Y +#define DE_Y KC_Z + +#define DE_A KC_A +#define DE_B KC_B +#define DE_C KC_C +#define DE_D KC_D +#define DE_E KC_E +#define DE_F KC_F +#define DE_G KC_G +#define DE_H KC_H +#define DE_I KC_I +#define DE_J KC_J +#define DE_K KC_K +#define DE_L KC_L +#define DE_M KC_M +#define DE_N KC_N +#define DE_O KC_O +#define DE_P KC_P +#define DE_Q KC_Q +#define DE_R KC_R +#define DE_S KC_S +#define DE_T KC_T +#define DE_U KC_U +#define DE_V KC_V +#define DE_W KC_W +#define DE_X KC_X + +#define DE_0 KC_0 +#define DE_1 KC_1 +#define DE_2 KC_2 +#define DE_3 KC_3 +#define DE_4 KC_4 +#define DE_5 KC_5 +#define DE_6 KC_6 +#define DE_7 KC_7 +#define DE_8 KC_8 +#define DE_9 KC_9 + +#define DE_DOT KC_DOT +#define DE_COMM KC_COMM + +#define DE_SS KC_MINS +#define DE_AE KC_QUOT +#define DE_UE KC_LBRC +#define DE_OE KC_SCLN + +#define DE_CIRC KC_NUBS // accent circumflex ^ and ring ° +#define DE_ACUT KC_EQL // accent acute ´ and grave ` +#define DE_PLUS KC_RBRC // + and * and ~ +#define DE_HASH KC_BSLS // # and ' +#define DE_LESS KC_GRV // < and > and | +#define DE_MINS KC_SLSH // - and _ + +// shifted characters +#define DE_RING LSFT(DE_CIRC) // ° +#define DE_EXLM LSFT(KC_1) // ! +#define DE_DQOT LSFT(KC_2) // " +#define DE_PARA LSFT(KC_3) // § +#define DE_DLR LSFT(KC_4) // $ +#define DE_PERC LSFT(KC_5) // % +#define DE_AMPR LSFT(KC_6) // & +#define DE_SLSH LSFT(KC_7) // / +#define DE_LPRN LSFT(KC_8) // ( +#define DE_RPRN LSFT(KC_9) // ) +#define DE_EQL LSFT(KC_0) // = +#define DE_QST LSFT(DE_SS) // ? +#define DE_GRV LSFT(DE_ACUT) // ` +#define DE_ASTR LSFT(DE_PLUS) // * +#define DE_QUOT LSFT(DE_HASH) // ' +#define DE_MORE LSFT(DE_LESS) // > +#define DE_COLN LSFT(KC_DOT) // : +#define DE_SCLN LSFT(KC_COMM) // ; +#define DE_UNDS LSFT(DE_MINS) // _ + +// Alt-ed characters +#define DE_SQ2 LALT(KC_2) // ² +#define DE_SQ3 LALT(KC_3) // ³ +#define DE_LCBR LALT(KC_7) // { +#define DE_LBRC LALT(KC_5) // [ +#define DE_RBRC LALT(KC_6) // ] +#define DE_RCBR LALT(KC_9) // } +#define DE_BSLS LALT(LSFT(KC_7)) // backslash +#define DE_AT LALT(DE_L) // @ +#define DE_EURO LALT(KC_E) // € +#define DE_TILD LALT(DE_N) // ~ +#define DE_PIPE LALT(DE_7) // | + +#endif