taphold.h (783B)
1 #pragma once 2 3 #include <stdint.h> 4 #include <stdbool.h> 5 #include "action.h" 6 7 typedef enum taphold_mode_t { 8 TAPHOLD_LAYER, 9 TAPHOLD_MOD 10 } taphold_mode_t; 11 12 typedef struct taphold_t { 13 uint16_t key; 14 uint32_t time; 15 taphold_mode_t mode; 16 uint16_t shortAction; 17 uint16_t longAction; 18 keypos_t keypos; 19 // We store key pos to properly release the key 20 // even when a different layer is active and the key has a different action now 21 } taphold_t; 22 23 extern taphold_t taphold_config[]; 24 extern uint16_t taphold_config_size; 25 // Dual keys tap/hold timeout. 26 // If key is tapped for less than this value, send key in addition to primary action after completing the action. 27 extern uint32_t taphold_timeout; 28 29 bool taphold_process(uint16_t keycode, keyrecord_t *record);