diff options
| author | Kamel Makhloufi <742898+melka@users.noreply.github.com> | 2020-05-19 23:42:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-19 22:42:09 +0100 |
| commit | 1044519f3666667d576fc448be0d7569c1969db7 (patch) | |
| tree | f517aab157c8a67ee0072331dc90529342331ae5 | |
| parent | 209942366b7da264d349c37ac6f4f69a3484b526 (diff) | |
| download | qmk_firmware-1044519f3666667d576fc448be0d7569c1969db7.tar.gz qmk_firmware-1044519f3666667d576fc448be0d7569c1969db7.zip | |
Added custom keymap with french mac layout. (#9115)
* Added custom keymap with french mac layout.
* Update keyboards/xd60/keymaps/melka/config.h
Tested on my branch, seems to work well, thanks @drashna !
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Update keyboards/xd60/keymaps/melka/keymap.c
Co-authored-by: Ryan <fauxpark@gmail.com>
* Update keyboards/xd60/keymaps/melka/keymap.c
Co-authored-by: Ryan <fauxpark@gmail.com>
* Update keyboards/xd60/keymaps/melka/keymap.c
Co-authored-by: Ryan <fauxpark@gmail.com>
* Comitted changes from merge request
- Removed rules.mk
Co-authored-by: Kamel Makhloufi <fabmanager@esaaa.fr>
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
| -rw-r--r-- | keyboards/xd60/keymaps/melka/.gitignore | 1 | ||||
| -rw-r--r-- | keyboards/xd60/keymaps/melka/config.h | 20 | ||||
| -rw-r--r-- | keyboards/xd60/keymaps/melka/keymap.c | 165 | ||||
| -rw-r--r-- | keyboards/xd60/keymaps/melka/passwd_template.h | 10 | ||||
| -rw-r--r-- | keyboards/xd60/keymaps/melka/readme.md | 21 |
5 files changed, 217 insertions, 0 deletions
diff --git a/keyboards/xd60/keymaps/melka/.gitignore b/keyboards/xd60/keymaps/melka/.gitignore new file mode 100644 index 000000000..c79982f2e --- /dev/null +++ b/keyboards/xd60/keymaps/melka/.gitignore | |||
| @@ -0,0 +1 @@ | |||
| passwd.h | |||
diff --git a/keyboards/xd60/keymaps/melka/config.h b/keyboards/xd60/keymaps/melka/config.h new file mode 100644 index 000000000..37581d12e --- /dev/null +++ b/keyboards/xd60/keymaps/melka/config.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #if __GNUC__ > 5 | ||
| 4 | # if __has_include("passwd.h") | ||
| 5 | # include "passwd.h" | ||
| 6 | # endif // if file exists | ||
| 7 | #endif // __GNUC__ | ||
| 8 | |||
| 9 | #ifndef PASSWORD_A | ||
| 10 | #define PASSWORD_A "1234567890" | ||
| 11 | #endif | ||
| 12 | |||
| 13 | #ifndef PASSWORD_B | ||
| 14 | #define PASSWORD_B "pass123" | ||
| 15 | #endif | ||
| 16 | |||
| 17 | #define RGBLIGHT_LAYERS | ||
| 18 | |||
| 19 | #define LSPO_KEYS KC_LSFT, KC_TRNS, KC_5 | ||
| 20 | #define RSPC_KEYS KC_RSFT, KC_TRNS, KC_MINS | ||
diff --git a/keyboards/xd60/keymaps/melka/keymap.c b/keyboards/xd60/keymaps/melka/keymap.c new file mode 100644 index 000000000..bb3159981 --- /dev/null +++ b/keyboards/xd60/keymaps/melka/keymap.c | |||
| @@ -0,0 +1,165 @@ | |||
| 1 | #include QMK_KEYBOARD_H | ||
| 2 | |||
| 3 | /* | ||
| 4 | Security Note: While it is possible to use macros to send passwords, credit card numbers, | ||
| 5 | and other sensitive information it is a supremely bad idea to do so. Anyone who gets a hold | ||
| 6 | of your keyboard will be able to access that information by opening a text editor. | ||
| 7 | */ | ||
| 8 | enum custom_keycodes | ||
| 9 | { | ||
| 10 | PASS_A = SAFE_RANGE, | ||
| 11 | PASS_B | ||
| 12 | }; | ||
| 13 | |||
| 14 | #define ___ KC_NO | ||
| 15 | |||
| 16 | #define LAYOUT_melka( \ | ||
| 17 | K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ | ||
| 18 | K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ | ||
| 19 | K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ | ||
| 20 | K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \ | ||
| 21 | K40, K41, K42, K43, K44, K45, K46, K47, K48) \ | ||
| 22 | { \ | ||
| 23 | {K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D}, \ | ||
| 24 | {K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, ___}, \ | ||
| 25 | {K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K1D}, \ | ||
| 26 | {K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3E, K3D}, \ | ||
| 27 | {K40, K41, K42, ___, ___, K43, ___, K3C, K46, K0E, K44, K45, K47, K48} \ | ||
| 28 | } | ||
| 29 | |||
| 30 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 31 | // 0: Base Layer | ||
| 32 | LAYOUT_melka( | ||
| 33 | KC_NUBS, 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_DEL, KC_BSPC, | ||
| 34 | 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_ENT, | ||
| 35 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, | ||
| 36 | MT(KC_LSFT, KC_5), KC_GRV, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, MT(KC_RSFT, KC_MINS), KC_UP, MO(1), | ||
| 37 | KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, KC_LEFT, KC_DOWN, KC_RIGHT), | ||
| 38 | |||
| 39 | // 1: Function Layer | ||
| 40 | LAYOUT_melka( | ||
| 41 | 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, _______, _______, | ||
| 42 | _______, KC_WH_U, KC_UP, KC_WH_D, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 43 | _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, _______, | ||
| 44 | TO(2), TO(3), _______, KC_APP, BL_STEP, _______, _______, _______, _______, _______, _______, KC_END, KC_PGDN, KC_VOLU, _______, | ||
| 45 | _______, _______, _______, _______, _______, _______, _______, KC_VOLD, KC_MUTE), | ||
| 46 | |||
| 47 | // 2: RGB Layer | ||
| 48 | LAYOUT_melka( | ||
| 49 | RGB_TOG, RGB_M_P, RGB_RMOD, RGB_MOD, RGB_M_B, RGB_M_R, RGB_M_SW, RGB_M_SN, RGB_M_K, RGB_M_X, RGB_M_G, RGB_M_T, _______, _______, RESET, | ||
| 50 | _______, RGB_HUD, RGB_HUI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 51 | _______, RGB_SAD, RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 52 | TO(0), _______, RGB_VAD, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, PASS_A, PASS_B, _______, _______, | ||
| 53 | _______, _______, _______, _______, _______, _______, _______, _______, _______), | ||
| 54 | |||
| 55 | // 3: Keypad Layer | ||
| 56 | LAYOUT_melka( | ||
| 57 | KC_ESC, _______, _______, _______, _______, _______, _______, _______, _______, KC_NLCK, KC_PEQL, KC_PSLS, KC_PAST, _______, _______, | ||
| 58 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PMNS, _______, | ||
| 59 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, KC_PPLS, | ||
| 60 | TO(0), _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, KC_PENT, TO(0), | ||
| 61 | _______, _______, _______, _______, KC_P0, KC_P0, KC_PDOT, KC_PENT, _______) | ||
| 62 | }; | ||
| 63 | |||
| 64 | // Light LEDs 6 to 9 and 12 to 15 red when caps lock is active. Hard to ignore! | ||
| 65 | const rgblight_segment_t PROGMEM rgb_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 66 | {2, 4, HSV_RED}, // Light 4 LEDs, starting with LED 6 | ||
| 67 | {6, 4, HSV_RED} // Light 4 LEDs, starting with LED 12 | ||
| 68 | ); | ||
| 69 | // Light LEDs 9 & 10 in cyan when keyboard layer 1 is active | ||
| 70 | const rgblight_segment_t PROGMEM rgb_function_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 71 | {9, 2, HSV_CYAN} | ||
| 72 | ); | ||
| 73 | // Light LEDs 11 & 12 in purple when keyboard layer 2 is active | ||
| 74 | const rgblight_segment_t PROGMEM rgb_backlight_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 75 | {10, 2, HSV_PURPLE} | ||
| 76 | ); | ||
| 77 | const rgblight_segment_t PROGMEM rgb_keypad_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 78 | {4, 4, HSV_RED} | ||
| 79 | ); | ||
| 80 | // Now define the array of layers. Later layers take precedence | ||
| 81 | const rgblight_segment_t* const PROGMEM rgb_layers[] = RGBLIGHT_LAYERS_LIST( | ||
| 82 | rgb_capslock_layer, | ||
| 83 | rgb_function_layer, | ||
| 84 | rgb_backlight_layer, // Overrides caps lock layer | ||
| 85 | rgb_keypad_layer // Overrides other layers | ||
| 86 | ); | ||
| 87 | |||
| 88 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
| 89 | // Both layers will light up if both kb layers are active | ||
| 90 | rgblight_set_layer_state(1, layer_state_cmp(state, 1)); | ||
| 91 | rgblight_set_layer_state(2, layer_state_cmp(state, 2)); | ||
| 92 | return state; | ||
| 93 | } | ||
| 94 | |||
| 95 | bool led_update_user(led_t led_state) { | ||
| 96 | rgblight_set_layer_state(0, led_state.caps_lock); | ||
| 97 | return true; | ||
| 98 | } | ||
| 99 | |||
| 100 | void keyboard_post_init_user(void) { | ||
| 101 | // Enable the LED layers | ||
| 102 | rgblight_layers = rgb_layers; | ||
| 103 | } | ||
| 104 | // Loop | ||
| 105 | void matrix_scan_user(void) { | ||
| 106 | // Empty | ||
| 107 | }; | ||
| 108 | |||
| 109 | static bool control_disabled = false; | ||
| 110 | static bool delete_pressed = false; | ||
| 111 | |||
| 112 | bool process_record_user(uint16_t keycode, keyrecord_t *record) | ||
| 113 | { | ||
| 114 | if (keycode == KC_BSPC) | ||
| 115 | { | ||
| 116 | if (record->event.pressed) | ||
| 117 | { | ||
| 118 | if (keyboard_report->mods & MOD_BIT(KC_LCTL)) | ||
| 119 | { | ||
| 120 | delete_pressed = true; | ||
| 121 | control_disabled = true; | ||
| 122 | unregister_code(KC_LCTL); | ||
| 123 | register_code(KC_DEL); | ||
| 124 | return false; | ||
| 125 | } | ||
| 126 | } | ||
| 127 | else if (delete_pressed) | ||
| 128 | { | ||
| 129 | delete_pressed = false; | ||
| 130 | unregister_code(KC_DEL); | ||
| 131 | |||
| 132 | if (control_disabled) | ||
| 133 | { | ||
| 134 | control_disabled = false; | ||
| 135 | register_code(KC_LCTL); | ||
| 136 | } | ||
| 137 | return false; | ||
| 138 | } | ||
| 139 | } | ||
| 140 | else if (keycode == KC_LCTL && !record->event.pressed && delete_pressed) | ||
| 141 | { | ||
| 142 | delete_pressed = false; | ||
| 143 | control_disabled = false; | ||
| 144 | unregister_code(KC_DEL); | ||
| 145 | register_code(KC_BSPC); | ||
| 146 | return false; | ||
| 147 | } | ||
| 148 | |||
| 149 | switch (keycode) | ||
| 150 | { | ||
| 151 | case PASS_A: | ||
| 152 | if (record->event.pressed) | ||
| 153 | { | ||
| 154 | SEND_STRING(PASSWORD_A "\n"); | ||
| 155 | } | ||
| 156 | break; | ||
| 157 | case PASS_B: | ||
| 158 | if (record->event.pressed) | ||
| 159 | { | ||
| 160 | SEND_STRING(PASSWORD_B "\n"); | ||
| 161 | } | ||
| 162 | break; | ||
| 163 | } | ||
| 164 | return true; | ||
| 165 | } | ||
diff --git a/keyboards/xd60/keymaps/melka/passwd_template.h b/keyboards/xd60/keymaps/melka/passwd_template.h new file mode 100644 index 000000000..a78de6d40 --- /dev/null +++ b/keyboards/xd60/keymaps/melka/passwd_template.h | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | /* | ||
| 2 | To define your password, rename this file to passwd.h and edit the defines below. | ||
| 3 | |||
| 4 | Security Note: While it is possible to use macros to send passwords, credit card numbers, | ||
| 5 | and other sensitive information it is a supremely bad idea to do so. Anyone who gets a hold | ||
| 6 | of your keyboard will be able to access that information by opening a text editor. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #define PASSWORD_A "enter your first password here" | ||
| 10 | #define PASSWORD_B "second password if you need" | ||
diff --git a/keyboards/xd60/keymaps/melka/readme.md b/keyboards/xd60/keymaps/melka/readme.md new file mode 100644 index 000000000..b9d9065da --- /dev/null +++ b/keyboards/xd60/keymaps/melka/readme.md | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | # melka's keymap for XIUDI's 60% XD60 rev3 PCB | ||
| 2 | |||
| 3 | ## Additional Notes | ||
| 4 | Custom Keymap for XD60 rev3. French Mac layout. | ||
| 5 | |||
| 6 | ## Security Note | ||
| 7 | This keymap includes macros for entering passwords. | ||
| 8 | |||
| 9 | While it is possible to use macros to send passwords, credit card numbers, | ||
| 10 | and other sensitive information it is a supremely bad idea to do so. Anyone who gets a hold | ||
| 11 | of your keyboard will be able to access that information by opening a text editor. | ||
| 12 | |||
| 13 | Use this functionnality at your own risk. | ||
| 14 | |||
| 15 | To define your password, rename passwd_template.h file to passwd.h and edit the defines inside. | ||
| 16 | |||
| 17 | ## Build | ||
| 18 | |||
| 19 | To build this keymap, simply run: | ||
| 20 | |||
| 21 | make xd60/rev3:melka # XD60 rev3 | ||
