mirror of
				https://github.com/qmk/qmk_userspace.git
				synced 2025-11-03 18:30:07 -05:00 
			
		
		
		
	mod_odk
This commit is contained in:
		
					parent
					
						
							
								fd3b08829d
							
						
					
				
			
			
				commit
				
					
						98abb13bd0
					
				
			
		
					 3 changed files with 31 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -178,7 +178,7 @@ void get_clever_keycode(uint16_t* next_keycode, keyrecord_t* record) {
 | 
			
		|||
        
 | 
			
		||||
        default:
 | 
			
		||||
          // "à"
 | 
			
		||||
          process_key(PG_ODK,record);
 | 
			
		||||
          process_key(MOD_ODK, record);
 | 
			
		||||
          return replace_ongoing_key(PG_A, next_keycode, record);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,6 +21,7 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
    if (record->event.pressed) {    // On press
 | 
			
		||||
 | 
			
		||||
        const uint8_t mods = get_mods() | get_weak_mods() | get_oneshot_mods();
 | 
			
		||||
        bool mod_odk = false;
 | 
			
		||||
        //const uint8_t mods = get_mods() | get_oneshot_mods();
 | 
			
		||||
 | 
			
		||||
        if (keycode == OS_ODK) {
 | 
			
		||||
| 
						 | 
				
			
			@ -29,21 +30,11 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
                tap_code16(ALGR(PG_ODK));
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            return true;
 | 
			
		||||
 | 
			
		||||
        } else if (keycode == PG_ODK) {
 | 
			
		||||
            // Special behaviour of PG_ODK when shifted
 | 
			
		||||
            // Shift must apply to the next keycode
 | 
			
		||||
            if (mods & MOD_MASK_SHIFT) {
 | 
			
		||||
                del_weak_mods(MOD_MASK_SHIFT);
 | 
			
		||||
                del_oneshot_mods(MOD_MASK_SHIFT);
 | 
			
		||||
                unregister_mods(MOD_MASK_SHIFT);
 | 
			
		||||
        } else if (keycode == MOD_ODK) {
 | 
			
		||||
            mod_odk = true;
 | 
			
		||||
 | 
			
		||||
                tap_code(PG_ODK);
 | 
			
		||||
 | 
			
		||||
                set_oneshot_mods(MOD_BIT(KC_LSFT));     // Don't use weak mods !
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
        } else if (IS_LAYER_ON(_ODK)) {
 | 
			
		||||
            switch (keycode) {
 | 
			
		||||
                //case PG_3PTS:   // For Clever Keys
 | 
			
		||||
| 
						 | 
				
			
			@ -55,14 +46,37 @@ bool process_odk_layer(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
                case OU_GRV:
 | 
			
		||||
                case KC_SPC:    // When space is added by Clever Keys
 | 
			
		||||
                case CNL_ODK:
 | 
			
		||||
                    break;
 | 
			
		||||
                    return true;
 | 
			
		||||
        
 | 
			
		||||
                default:
 | 
			
		||||
                    mod_odk = true;
 | 
			
		||||
                    //process_odk_layer(MOD_ODK, record);
 | 
			
		||||
                    // Don't use tap_code, it doesn't go through process_record.
 | 
			
		||||
                    // therefore it doesn't trigger the special behaviour of PG_ODK described above
 | 
			
		||||
                    invoke_key(PG_ODK, record);
 | 
			
		||||
                    //invoke_key(PG_ODK, record);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (mod_odk) {
 | 
			
		||||
            // Special behaviour of PG_ODK when shifted
 | 
			
		||||
            // Shift must apply to the next keycode
 | 
			
		||||
            mod_odk = false;
 | 
			
		||||
            bool is_shifted = false;
 | 
			
		||||
 | 
			
		||||
            if (mods & MOD_MASK_SHIFT) {
 | 
			
		||||
                del_weak_mods(MOD_MASK_SHIFT);
 | 
			
		||||
                del_oneshot_mods(MOD_MASK_SHIFT);
 | 
			
		||||
                unregister_mods(MOD_MASK_SHIFT);
 | 
			
		||||
                is_shifted = true;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            tap_code(PG_ODK);
 | 
			
		||||
 | 
			
		||||
            if (is_shifted) {
 | 
			
		||||
                set_oneshot_mods(MOD_BIT(KC_LSFT));     // Don't use weak mods !
 | 
			
		||||
            }
 | 
			
		||||
            if (keycode == MOD_ODK) { return false; }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -52,6 +52,7 @@ enum custom_keycodes {
 | 
			
		|||
  OS4A,
 | 
			
		||||
  RAZ,
 | 
			
		||||
  CAPSWORD,
 | 
			
		||||
  MOD_ODK,
 | 
			
		||||
  OU_GRV,
 | 
			
		||||
  MAGIC,
 | 
			
		||||
  OS_SHFT,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue