fix(keymap): force ACTION_VOICE_HOLD for Voice key to prevent Web UI tap override

This commit is contained in:
cuicuiV5 committed 2026-08-30 00:19:50 +08:00
1 parent 418f8e2320
commit edde9d854b
2 files changed
+7 -1

No files matched your search

+5
View File
@@ -83,6 +83,11 @@ bool key_config_from_json(key_mapper_engine_t *engine, const String &json_str) {
b.click_action.key_code = obj["click_key"] | 0;
b.click_action.consumer_code = obj["click_cons"] | 0;
// FORCE ACTION_VOICE_HOLD for the Voice key so the mic always works
if (b.source_vk == MI_KEY_VOICE) {
b.click_action.type = ACTION_VOICE_HOLD;
}
b.has_long = obj["has_long"] | false;
b.long_ms = obj["long_ms"] | 500;
b.long_action.type = (key_action_type_t)(obj["long_type"] | 0);
+2 -1
View File
@@ -1,4 +1,5 @@
#include "key_state_machine.h"
#include "app_config.h"
#include <string.h>
static int find_binding_index(const key_mapper_engine_t *engine, uint8_t raw_key) {
@@ -57,7 +58,7 @@ void key_engine_load_defaults(key_mapper_engine_t *engine) {
memset(&b, 0, sizeof(b));
b.source_vk = MI_KEY_VOICE;
b.has_click = true;
b.click_action = (key_action_t){ ACTION_VOICE_HOLD, USB_MOD_LGUI, USB_KEY_H, 0 };
b.click_action = (key_action_t){ ACTION_VOICE_HOLD, DEFAULT_VOICE_MODIFIER, DEFAULT_VOICE_KEY, 0 };
engine->bindings[engine->binding_count++] = b;
}