Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* https://www.reddit.com/r/olkb/comments/x1ju6n/help_for_a_double_space_macro_on_qmk/
- * Code to create a toggleable mode where pressing space sends two spaces instead.
- * It also sets the color of the space bar to blue when this mode is active.
- * This can go into keymap.c
- */
- bool double_space_mode = false; // variable to track status of double space mode
- bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- switch(keycode) {
- case TOG_2SPC:
- if (record->event.pressed) // when TOG_2SPC is pressed
- double_space_mode ^= 1; // toggle double_space_mode
- return false;
- case KC_SPACE:
- if (record->event.pressed && double_space_mode) { // if double space mode is active
- SEND_STRING(" "); // send two spaces
- return false; // do nothing else
- }
- return true; // otherwise, act as a normal space key
- }
- return true;
- }
- // LED Index for SPACE key. Look in the rev_010x.c file for your keyboard version to find this
- // https://github.com/qmk/qmk_firmware/blob/master/keyboards/keychron/q1/rev_0100/rev_0100.c#L124
- #define SPACE_LED_IDX 75
- void rgb_matrix_indicators_user(void) {
- if (double_space_mode) // if double space mode is active
- rgb_matrix_set_color(SPACE_LED_IDX, RGB_BLUE); // set color of SPACE key's LED to blue
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement