diff options
author | Ismael Venegas Castelló <ismael.vc1337@gmail.com> | 2018-12-19 18:49:56 -0600 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-12-19 16:49:56 -0800 |
commit | 5eb8f3f6b51cecc067aaedfb8b2f08cb626381bb (patch) | |
tree | b9e1b89d43ec3be60d03daa052556f90a7190dd6 /keyboards/ergodox_ez/keymaps/hacker_dvorak/user | |
parent | b13162f7fd5a4c09dff15ff6f9713526622925a7 (diff) |
Keymap: Refactor Hacker Dvorak (#4688)
Programmer Dvorak based layout for the Ergodox EZ.
Diffstat (limited to 'keyboards/ergodox_ez/keymaps/hacker_dvorak/user')
4 files changed, 211 insertions, 0 deletions
diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/eeconfig_init_user.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/eeconfig_init_user.c new file mode 100644 index 0000000000..41b7b66941 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/eeconfig_init_user.c @@ -0,0 +1,3 @@ +// void eeconfig_init_user(void) { +// +// }; diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c new file mode 100644 index 0000000000..e2eeed6fa9 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c @@ -0,0 +1,121 @@ + +uint32_t layer_state_set_user(uint32_t state) { + uint8_t layer = biton32(state); + + switch (layer) { + case DVORAK: + rgblight_sethsv_noeeprom_green(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + + if (PLOVER_MODE) { + plover_toggle(); + PLOVER_MODE = false; + } + + break; + + case PLOVER: + rgblight_sethsv_noeeprom_red(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); + + if (!(PLOVER_MODE)) { + plover_toggle(); + PLOVER_MODE = true; + } + + break; + + case GAMING: + rgblight_sethsv_noeeprom_red(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 2); + + if (PLOVER_MODE) { + plover_toggle(); + PLOVER_MODE = false; + } + + break; + + case ARROWS: + rgblight_sethsv_noeeprom_blue(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 2); + + if (PLOVER_MODE) { + plover_toggle(); + PLOVER_MODE = false; + } + + break; + + case MOUSE: + rgblight_sethsv_noeeprom_blue(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 2); + + if (PLOVER_MODE) { + plover_toggle(); + PLOVER_MODE = false; + } + + break; + + case NUMPAD: + rgblight_sethsv_noeeprom_blue(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 2); + + if (PLOVER_MODE) { + plover_toggle(); + PLOVER_MODE = false; + } + + break; + + case LAYERS: + rgblight_sethsv_noeeprom_cyan(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 2); + + if (PLOVER_MODE) { + plover_toggle(); + PLOVER_MODE = false; + } + + break; + + case MEDIA_FN: + rgblight_sethsv_noeeprom_yellow(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 2); + + if (PLOVER_MODE) { + plover_toggle(); + PLOVER_MODE = false; + } + + break; + + case HYPER: + rgblight_sethsv_noeeprom_magenta(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 2); + + if (PLOVER_MODE) { + plover_toggle(); + PLOVER_MODE = false; + } + + break; + + case FIRMWARE: + rgblight_sethsv_noeeprom_magenta(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 2); + + if (PLOVER_MODE) { + plover_toggle(); + PLOVER_MODE = false; + } + + break; + + default: + break; + } + + return state; +} diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/matrix_scan_user.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/matrix_scan_user.c new file mode 100644 index 0000000000..3b78079cca --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/matrix_scan_user.c @@ -0,0 +1,12 @@ +#include "../leader/leader_setup.c" + +bool MATRIX_SCANNED = false; + +void matrix_scan_user(void) { + if (!(MATRIX_SCANNED)) { + rgblight_sethsv_noeeprom_green(); + MATRIX_SCANNED = true; + } + + #include "../leader/leader_dictionary.c" +}; diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/process_record_user.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/process_record_user.c new file mode 100644 index 0000000000..7644635824 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/process_record_user.c @@ -0,0 +1,75 @@ +// TODO: Improve this currently there is no feedback if activated by other means. +bool CAPS_LOCK = false; +bool NUM_LOCK = false; +bool SCROLL_LOCK = false; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_dynamic_macro(keycode, record)) { + return false; + } + + switch (keycode) { + case KC_CLCK: + if (record->event.pressed) { + if (!(CAPS_LOCK)) { + ergodox_right_led_1_on(); + CAPS_LOCK = true; + } else { + ergodox_right_led_1_off(); + CAPS_LOCK = false; + } + } + + return true; + + case KC_NLCK: + if (record->event.pressed) { + if (!(NUM_LOCK)) { + ergodox_right_led_2_on(); + NUM_LOCK = true; + } else { + ergodox_right_led_2_off(); + NUM_LOCK = false; + } + } + + return true; + + case KC_SLCK: + if (record->event.pressed) { + if (!(SCROLL_LOCK)) { + ergodox_right_led_3_on(); + SCROLL_LOCK = true; + } else { + ergodox_right_led_3_off(); + SCROLL_LOCK = false; + } + } + + return true; + + case KC_MS_WH_UP ... KC_MS_WH_RIGHT: + if (record->event.pressed) { + if (SCROLL_LOCK) { + return false; + } else { + return true; + } + } + + case MY_CUSTOM_MACRO: + if (record->event.pressed) { + SEND_STRING("QMK is the best thing ever!"); // this is our macro! + return false; + } + + case MY_OTHER_MACRO: + if (record->event.pressed) { + SEND_STRING(SS_LCTRL("ac")); // selects all and copies + return false; + } + + default: + return true; + } +} |