From 1044519f3666667d576fc448be0d7569c1969db7 Mon Sep 17 00:00:00 2001 From: Kamel Makhloufi <742898+melka@users.noreply.github.com> Date: Tue, 19 May 2020 23:42:09 +0200 Subject: 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 * Update keyboards/xd60/keymaps/melka/keymap.c Co-authored-by: Ryan * Update keyboards/xd60/keymaps/melka/keymap.c Co-authored-by: Ryan * Update keyboards/xd60/keymaps/melka/keymap.c Co-authored-by: Ryan * Comitted changes from merge request - Removed rules.mk Co-authored-by: Kamel Makhloufi Co-authored-by: Drashna Jaelre Co-authored-by: Ryan --- keyboards/xd60/keymaps/melka/.gitignore | 1 + keyboards/xd60/keymaps/melka/config.h | 20 +++ keyboards/xd60/keymaps/melka/keymap.c | 165 +++++++++++++++++++++++++ keyboards/xd60/keymaps/melka/passwd_template.h | 10 ++ keyboards/xd60/keymaps/melka/readme.md | 21 ++++ 5 files changed, 217 insertions(+) create mode 100644 keyboards/xd60/keymaps/melka/.gitignore create mode 100644 keyboards/xd60/keymaps/melka/config.h create mode 100644 keyboards/xd60/keymaps/melka/keymap.c create mode 100644 keyboards/xd60/keymaps/melka/passwd_template.h create mode 100644 keyboards/xd60/keymaps/melka/readme.md (limited to 'keyboards/xd60/keymaps/melka') diff --git a/keyboards/xd60/keymaps/melka/.gitignore b/keyboards/xd60/keymaps/melka/.gitignore new file mode 100644 index 0000000000..c79982f2ea --- /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 0000000000..37581d12ea --- /dev/null +++ b/keyboards/xd60/keymaps/melka/config.h @@ -0,0 +1,20 @@ +#pragma once + +#if __GNUC__ > 5 +# if __has_include("passwd.h") +# include "passwd.h" +# endif // if file exists +#endif // __GNUC__ + +#ifndef PASSWORD_A + #define PASSWORD_A "1234567890" +#endif + +#ifndef PASSWORD_B + #define PASSWORD_B "pass123" +#endif + +#define RGBLIGHT_LAYERS + +#define LSPO_KEYS KC_LSFT, KC_TRNS, KC_5 +#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 0000000000..bb3159981f --- /dev/null +++ b/keyboards/xd60/keymaps/melka/keymap.c @@ -0,0 +1,165 @@ +#include QMK_KEYBOARD_H + +/* +Security Note: While it is possible to use macros to send passwords, credit card numbers, +and other sensitive information it is a supremely bad idea to do so. Anyone who gets a hold +of your keyboard will be able to access that information by opening a text editor. +*/ +enum custom_keycodes +{ + PASS_A = SAFE_RANGE, + PASS_B +}; + +#define ___ KC_NO + +#define LAYOUT_melka( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \ + K40, K41, K42, K43, K44, K45, K46, K47, K48) \ + { \ + {K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D}, \ + {K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, ___}, \ + {K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K1D}, \ + {K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3E, K3D}, \ + {K40, K41, K42, ___, ___, K43, ___, K3C, K46, K0E, K44, K45, K47, K48} \ + } + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + // 0: Base Layer + LAYOUT_melka( + 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, + 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, + 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, + 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), + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, KC_LEFT, KC_DOWN, KC_RIGHT), + + // 1: Function Layer + LAYOUT_melka( + 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_WH_U, KC_UP, KC_WH_D, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, _______, + TO(2), TO(3), _______, KC_APP, BL_STEP, _______, _______, _______, _______, _______, _______, KC_END, KC_PGDN, KC_VOLU, _______, + _______, _______, _______, _______, _______, _______, _______, KC_VOLD, KC_MUTE), + + // 2: RGB Layer + LAYOUT_melka( + 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, + _______, RGB_HUD, RGB_HUI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_SAD, RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + TO(0), _______, RGB_VAD, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, PASS_A, PASS_B, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______), + + // 3: Keypad Layer + LAYOUT_melka( + KC_ESC, _______, _______, _______, _______, _______, _______, _______, _______, KC_NLCK, KC_PEQL, KC_PSLS, KC_PAST, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PMNS, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, KC_PPLS, + TO(0), _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, KC_PENT, TO(0), + _______, _______, _______, _______, KC_P0, KC_P0, KC_PDOT, KC_PENT, _______) +}; + +// Light LEDs 6 to 9 and 12 to 15 red when caps lock is active. Hard to ignore! +const rgblight_segment_t PROGMEM rgb_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {2, 4, HSV_RED}, // Light 4 LEDs, starting with LED 6 + {6, 4, HSV_RED} // Light 4 LEDs, starting with LED 12 +); +// Light LEDs 9 & 10 in cyan when keyboard layer 1 is active +const rgblight_segment_t PROGMEM rgb_function_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {9, 2, HSV_CYAN} +); +// Light LEDs 11 & 12 in purple when keyboard layer 2 is active +const rgblight_segment_t PROGMEM rgb_backlight_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {10, 2, HSV_PURPLE} +); +const rgblight_segment_t PROGMEM rgb_keypad_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {4, 4, HSV_RED} +); +// Now define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM rgb_layers[] = RGBLIGHT_LAYERS_LIST( + rgb_capslock_layer, + rgb_function_layer, + rgb_backlight_layer, // Overrides caps lock layer + rgb_keypad_layer // Overrides other layers +); + +layer_state_t layer_state_set_user(layer_state_t state) { + // Both layers will light up if both kb layers are active + rgblight_set_layer_state(1, layer_state_cmp(state, 1)); + rgblight_set_layer_state(2, layer_state_cmp(state, 2)); + return state; +} + +bool led_update_user(led_t led_state) { + rgblight_set_layer_state(0, led_state.caps_lock); + return true; +} + +void keyboard_post_init_user(void) { + // Enable the LED layers + rgblight_layers = rgb_layers; +} +// Loop +void matrix_scan_user(void) { + // Empty +}; + +static bool control_disabled = false; +static bool delete_pressed = false; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) +{ + if (keycode == KC_BSPC) + { + if (record->event.pressed) + { + if (keyboard_report->mods & MOD_BIT(KC_LCTL)) + { + delete_pressed = true; + control_disabled = true; + unregister_code(KC_LCTL); + register_code(KC_DEL); + return false; + } + } + else if (delete_pressed) + { + delete_pressed = false; + unregister_code(KC_DEL); + + if (control_disabled) + { + control_disabled = false; + register_code(KC_LCTL); + } + return false; + } + } + else if (keycode == KC_LCTL && !record->event.pressed && delete_pressed) + { + delete_pressed = false; + control_disabled = false; + unregister_code(KC_DEL); + register_code(KC_BSPC); + return false; + } + + switch (keycode) + { + case PASS_A: + if (record->event.pressed) + { + SEND_STRING(PASSWORD_A "\n"); + } + break; + case PASS_B: + if (record->event.pressed) + { + SEND_STRING(PASSWORD_B "\n"); + } + break; + } + return true; +} diff --git a/keyboards/xd60/keymaps/melka/passwd_template.h b/keyboards/xd60/keymaps/melka/passwd_template.h new file mode 100644 index 0000000000..a78de6d40d --- /dev/null +++ b/keyboards/xd60/keymaps/melka/passwd_template.h @@ -0,0 +1,10 @@ +/* +To define your password, rename this file to passwd.h and edit the defines below. + +Security Note: While it is possible to use macros to send passwords, credit card numbers, +and other sensitive information it is a supremely bad idea to do so. Anyone who gets a hold +of your keyboard will be able to access that information by opening a text editor. +*/ + +#define PASSWORD_A "enter your first password here" +#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 0000000000..b9d9065da7 --- /dev/null +++ b/keyboards/xd60/keymaps/melka/readme.md @@ -0,0 +1,21 @@ +# melka's keymap for XIUDI's 60% XD60 rev3 PCB + +## Additional Notes +Custom Keymap for XD60 rev3. French Mac layout. + +## Security Note +This keymap includes macros for entering passwords. + +While it is possible to use macros to send passwords, credit card numbers, +and other sensitive information it is a supremely bad idea to do so. Anyone who gets a hold +of your keyboard will be able to access that information by opening a text editor. + +Use this functionnality at your own risk. + +To define your password, rename passwd_template.h file to passwd.h and edit the defines inside. + +## Build + +To build this keymap, simply run: + + make xd60/rev3:melka # XD60 rev3 -- cgit v1.2.3