Refactor Leader key feature (#19632)
Co-authored-by: Drashna Jaelre <drashna@live.com>
This commit is contained in:
		
							parent
							
								
									d10350cd2c
								
							
						
					
					
						commit
						bbf7a20b33
					
				
					 77 changed files with 2457 additions and 1968 deletions
				
			
		| 
						 | 
				
			
			@ -1,24 +0,0 @@
 | 
			
		|||
#include "curry.h"
 | 
			
		||||
#include "leader.h"
 | 
			
		||||
 | 
			
		||||
LEADER_EXTERNS();
 | 
			
		||||
 | 
			
		||||
void matrix_scan_user(void) {
 | 
			
		||||
    static bool has_ran_yet;
 | 
			
		||||
    if (!has_ran_yet) {
 | 
			
		||||
        has_ran_yet = true;
 | 
			
		||||
        startup_user();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
 | 
			
		||||
    matrix_scan_rgb();
 | 
			
		||||
#endif  // RGBLIGHT_ENABLE
 | 
			
		||||
    LEADER_DICTIONARY() {
 | 
			
		||||
        leading = false;
 | 
			
		||||
        leader_end();
 | 
			
		||||
        SEQ_ONE_KEY(KC_F) { SEND_STRING(SS_LCTL("akf")); } // Select all and format
 | 
			
		||||
        SEQ_ONE_KEY(KC_P) { SEND_STRING(SS_LCTL(SS_LSFT("4"))); } // Screenshot region
 | 
			
		||||
        SEQ_TWO_KEYS(KC_D, KC_D) { SEND_STRING(SS_LCTL("ac")); } // Copy all
 | 
			
		||||
    }
 | 
			
		||||
    matrix_scan_keymap();
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										31
									
								
								users/curry/leader_user.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								users/curry/leader_user.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
#include "curry.h"
 | 
			
		||||
#include "leader_user.h"
 | 
			
		||||
 | 
			
		||||
void leader_end_user(void) {
 | 
			
		||||
    if (leader_sequence_one_key(KC_F)) {
 | 
			
		||||
        // Select all and format
 | 
			
		||||
        SEND_STRING(SS_LCTL("akf"));
 | 
			
		||||
    }
 | 
			
		||||
    if (leader_sequence_one_key(KC_P)) {
 | 
			
		||||
        // Screenshot region
 | 
			
		||||
        SEND_STRING(SS_LCTL(SS_LSFT("4")));
 | 
			
		||||
    }
 | 
			
		||||
    if (leader_sequence_two_keys(KC_D, KC_D)) {
 | 
			
		||||
        // Copy all
 | 
			
		||||
        SEND_STRING(SS_LCTL("ac"));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void matrix_scan_user(void) {
 | 
			
		||||
    static bool has_ran_yet;
 | 
			
		||||
    if (!has_ran_yet) {
 | 
			
		||||
        has_ran_yet = true;
 | 
			
		||||
        startup_user();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
 | 
			
		||||
    matrix_scan_rgb();
 | 
			
		||||
#endif  // RGBLIGHT_ENABLE
 | 
			
		||||
 | 
			
		||||
    matrix_scan_keymap();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +29,7 @@ ifeq ($(strip $(OLED_ENABLE)), yes)
 | 
			
		|||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(strip $(LEADER_ENABLE)), yes)
 | 
			
		||||
    SRC += leader.c
 | 
			
		||||
    SRC += leader_user.c
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue