Last active
December 7, 2024 12:54
-
-
Save 10bn/7ac5e9f0a0e74360e4b4b032d00364a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Custom Combos for Miryoku QMK | |
* | |
* Description: | |
* These custom combos are primarily designed for use with the Miryoku QMK firmware, enabling German umlauts typing | |
* in the EuroKey Layout on a (US) keyboard. | |
* | |
* Miryoku QMK: https://github.com/manna-harbour/miryoku | |
* EuroKey Layout: https://eurkey.steffen.bruentjen.eu/layout.html | |
* | |
* Note: | |
* - If using the US International layout, adjust the AltGr + XX combos to match the desired umlaut | |
* or special character mappings. | |
* | |
* HOWTO: | |
* 1. Add `miryoku_qmk_my_custom_combos.c` to `user/manna-harbour_miryoku/miryoku_qmk_my_custom_combos.c` | |
* 2. Add `COMBO_ENABLE = yes` to `rules.mk` | |
* 3. At the top of `manna-harbour_miryoku.c`, add the following include: | |
* | |
* #include QMK_KEYBOARD_H | |
* #include "manna-harbour_miryoku.h" | |
* #include "miryoku_qmk_my_custom_combos.c" // <---- Add this line!!! | |
* | |
* Secrets Example: | |
* Create a `secrets.h` file with the following content: | |
* Add `secrets.h` to `user/manna-harbour_miryoku/secrets.h` | |
* | |
* #ifndef SECRETS_H | |
* #define SECRETS_H | |
* | |
* // Replace the placeholder text with your actual secrets | |
* #define SECRET_EMAIL "[email protected]" | |
* #define SECRET_ALT_EMAIL "[email protected]" | |
* #define SECRET_PHONE "+1234567890" | |
* #define SECRET_PASSWORD "your_password" | |
* #define SECRET_ALT_PASSWORD "your_alt_password" | |
* | |
* #endif // SECRETS_H | |
*/ | |
// Define custom keycodes | |
enum custom_keycodes { | |
KC_AE = SAFE_RANGE, // Keycode for "Ä" or "ä" (depending on shift state) | |
KC_SS, // Keycode for "ß" (Eszett or sharp S) | |
KC_UE, // Keycode for "Ü" or "ü" (depending on shift state) | |
KC_OE, // Keycode for "Ö" or "ö" (depending on shift state) | |
KC_FULL_DELETE, // Custom keycode for full line delete | |
KC_EMAIL, // Custom keycode for email | |
KC_ALT_EMAIL, // Custom keycode for alternate email | |
KC_PHONE, // Custom keycode for phone number | |
KC_PASSWORD, // Custom keycode for password | |
KC_ALT_PASSWORD // Custom keycode for alternate password | |
}; | |
enum combos { | |
AS_AE, | |
SD_SS, | |
UI_UE, | |
IO_OE, | |
IOP_FULL_DELETE, | |
QWE_EMAIL, | |
WER_ALT_EMAIL, | |
ERT_PHONE, | |
YUI_PASSWORD, | |
UIO_ALT_PASSWORD, | |
VB_BROWSER_BACK, | |
NM_BROWSER_FWD, | |
CV_TAB_LEFT, | |
M_COMMA_TAB_RIGHT | |
}; | |
uint16_t COMBO_LEN = 14; | |
// Define combo arrays | |
const uint16_t PROGMEM as_combo[] = {LGUI_T(KC_A), LALT_T(KC_S), COMBO_END}; // Adjusted for Mod-Tap | |
const uint16_t PROGMEM sd_combo[] = {LALT_T(KC_S), LCTL_T(KC_D), COMBO_END}; // Adjusted for Mod-Tap | |
const uint16_t PROGMEM ui_combo[] = {KC_U, KC_I, COMBO_END}; | |
const uint16_t PROGMEM io_combo[] = {KC_I, KC_O, COMBO_END}; | |
const uint16_t PROGMEM iop_combo[] = {KC_I, KC_O, KC_P, COMBO_END}; // New combo for full line delete | |
const uint16_t PROGMEM qwe_combo[] = {KC_Q, KC_W, KC_E, COMBO_END}; // New combo for email | |
const uint16_t PROGMEM wer_combo[] = {KC_W, KC_E, KC_R, COMBO_END}; // New combo for alternate email | |
const uint16_t PROGMEM ert_combo[] = {KC_E, KC_R, KC_T, COMBO_END}; // New combo for phone number | |
const uint16_t PROGMEM yui_combo[] = {KC_Y, KC_U, KC_I, COMBO_END}; // New combo for password | |
const uint16_t PROGMEM uio_combo[] = {KC_U, KC_I, KC_O, COMBO_END}; // New combo for alternate password | |
const uint16_t PROGMEM vb_combo[] = {KC_V, KC_B, COMBO_END}; // New combo for browser back | |
const uint16_t PROGMEM nm_combo[] = {KC_N, KC_M, COMBO_END}; // New combo for browser forward | |
const uint16_t PROGMEM cv_combo[] = {KC_C, KC_V, COMBO_END}; // New combo for tab left | |
const uint16_t PROGMEM m_comma_combo[] = {KC_M, KC_COMMA, COMBO_END}; // New combo for tab right | |
// Define combo actions | |
combo_t key_combos[] = { | |
[AS_AE] = COMBO(as_combo, KC_AE), | |
[SD_SS] = COMBO(sd_combo, KC_SS), | |
[UI_UE] = COMBO(ui_combo, KC_UE), | |
[IO_OE] = COMBO(io_combo, KC_OE), | |
[IOP_FULL_DELETE] = COMBO(iop_combo, KC_FULL_DELETE), // Full line delete | |
[QWE_EMAIL] = COMBO(qwe_combo, KC_EMAIL), // Email | |
[WER_ALT_EMAIL] = COMBO(wer_combo, KC_ALT_EMAIL), // Alternate email | |
[ERT_PHONE] = COMBO(ert_combo, KC_PHONE), // Phone number | |
[YUI_PASSWORD] = COMBO(yui_combo, KC_PASSWORD), // Password | |
[UIO_ALT_PASSWORD] = COMBO(uio_combo, KC_ALT_PASSWORD), // Alternate password | |
[VB_BROWSER_BACK] = COMBO(vb_combo, LGUI(KC_LBRC)), // Browser back | |
[NM_BROWSER_FWD] = COMBO(nm_combo, LGUI(KC_RBRC)), // Browser forward | |
[CV_TAB_LEFT] = COMBO(cv_combo, LCTL(KC_PGUP)), // Tab left | |
[M_COMMA_TAB_RIGHT] = COMBO(m_comma_combo, LCTL(KC_PGDN)) // Tab right | |
}; | |
// Ensure combos only work on tap | |
bool get_combo_must_tap(uint16_t index, combo_t *combo) { | |
return true; | |
} | |
// Handle custom keycodes | |
bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |
switch (keycode) { | |
case KC_AE: | |
if (record->event.pressed) { | |
SEND_STRING(SS_DOWN(X_RALT) SS_TAP(X_A) SS_UP(X_RALT)); // AltGr+a for 'ä' | |
} | |
return false; | |
case KC_SS: | |
if (record->event.pressed) { | |
SEND_STRING(SS_DOWN(X_RALT) SS_TAP(X_S) SS_UP(X_RALT)); // AltGr+s for 'ß' | |
} | |
return false; | |
case KC_UE: | |
if (record->event.pressed) { | |
SEND_STRING(SS_DOWN(X_RALT) SS_TAP(X_U) SS_UP(X_RALT)); // AltGr+u for 'ü' | |
} | |
return false; | |
case KC_OE: | |
if (record->event.pressed) { | |
SEND_STRING(SS_DOWN(X_RALT) SS_TAP(X_O) SS_UP(X_RALT)); // AltGr+o for 'ö' | |
} | |
return false; | |
case KC_FULL_DELETE: | |
if (record->event.pressed) { | |
tap_code16(KC_END); | |
tap_code16(S(KC_HOME)); | |
tap_code16(KC_BSPC); // Delete the full line | |
} | |
return false; | |
case KC_EMAIL: | |
if (record->event.pressed) { | |
SEND_STRING(SECRET_EMAIL); | |
} | |
return false; | |
case KC_ALT_EMAIL: | |
if (record->event.pressed) { | |
SEND_STRING(SECRET_ALT_EMAIL); | |
} | |
return false; | |
case KC_PHONE: | |
if (record->event.pressed) { | |
SEND_STRING(SECRET_PHONE); | |
} | |
return false; | |
case KC_PASSWORD: | |
if (record->event.pressed) { | |
SEND_STRING(SECRET_PASSWORD); | |
} | |
return false; | |
case KC_ALT_PASSWORD: | |
if (record->event.pressed) { | |
SEND_STRING(SECRET_ALT_PASSWORD); | |
} | |
return false; | |
case LGUI(KC_LBRC): | |
if (record->event.pressed) { | |
tap_code16(LGUI(KC_LBRC)); // Browser back | |
} | |
return false; | |
case LGUI(KC_RBRC): | |
if (record->event.pressed) { | |
tap_code16(LGUI(KC_RBRC)); // Browser forward | |
} | |
return false; | |
case LCTL(KC_PGUP): | |
if (record->event.pressed) { | |
tap_code16(LCTL(KC_PGUP)); // Tab left | |
} | |
return false; | |
case LCTL(KC_PGDN): | |
if (record->event.pressed) { | |
tap_code16(LCTL(KC_PGDN)); // Tab right | |
} | |
return false; | |
} | |
return true; | |
} | |
void matrix_scan_user(void) { | |
// Custom matrix scan code if needed | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment