mirror of
				https://github.com/mfulz/qmk_firmware.git
				synced 2025-10-31 05:12:33 +01:00 
			
		
		
		
	 3d4f0028d6
			
		
	
	
		3d4f0028d6
		
			
		
	
	
	
	
		
			
			* experiment with userspace * reorganise * readme * missing oneshot shift from ignored keys * recombine hands in layout macro
		
			
				
	
	
		
			28 lines
		
	
	
		
			627 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			627 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #include "swapper.h"
 | |
| 
 | |
| void update_swapper(
 | |
|     bool *active,
 | |
|     uint16_t cmdish,
 | |
|     uint16_t tabish,
 | |
|     uint16_t trigger,
 | |
|     uint16_t keycode,
 | |
|     keyrecord_t *record
 | |
| ) {
 | |
|     if (keycode == trigger) {
 | |
|         if (record->event.pressed) {
 | |
|             if (!*active) {
 | |
|                 *active = true;
 | |
|                 register_code(cmdish);
 | |
|             }
 | |
|             register_code(tabish);
 | |
|         } else {
 | |
|             unregister_code(tabish);
 | |
|             // Don't unregister cmdish until some other key is hit or released.
 | |
|         }
 | |
|     } else if (*active) {
 | |
|         unregister_code(cmdish);
 | |
|         *active = false;
 | |
|     }
 | |
| }
 | |
| 
 |