From 8f11df460a247dfcaafd84ce3046605724d11998 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Mon, 18 May 2026 17:20:11 +0800
Subject: [PATCH] feat: add hotkey input mode setting

---
 VoiceSnapGo/internal/config/config.go |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/VoiceSnapGo/internal/config/config.go b/VoiceSnapGo/internal/config/config.go
index a0b131d..04b54c6 100755
--- a/VoiceSnapGo/internal/config/config.go
+++ b/VoiceSnapGo/internal/config/config.go
@@ -7,9 +7,15 @@
 	"voicesnap/internal/paths"
 )
 
+const (
+	HotkeyModeTap  = "tap"
+	HotkeyModeHold = "hold"
+)
+
 // Config holds the application configuration, compatible with the WPF version's config.json.
 type Config struct {
 	HotkeyVK                 int    `json:"HotkeyVK"`
+	HotkeyMode               string `json:"HotkeyMode"`
 	AutoHide                 bool   `json:"AutoHide"`
 	SoundFeedback            bool   `json:"SoundFeedback"`
 	HideDockIcon             bool   `json:"HideDockIcon"`
@@ -25,6 +31,7 @@
 func Default() *Config {
 	return &Config{
 		HotkeyVK:                 0xA5, // Right Alt
+		HotkeyMode:               HotkeyModeHold,
 		AutoHide:                 true,
 		SoundFeedback:            true,
 		HideDockIcon:             true,
@@ -55,9 +62,19 @@
 	if err := json.Unmarshal(data, cfg); err != nil {
 		return nil, err
 	}
+	cfg.HotkeyMode = NormalizeHotkeyMode(cfg.HotkeyMode)
 	return cfg, nil
 }
 
+func NormalizeHotkeyMode(mode string) string {
+	switch mode {
+	case HotkeyModeTap, HotkeyModeHold:
+		return mode
+	default:
+		return HotkeyModeHold
+	}
+}
+
 // Save writes the config to disk.
 func Save(cfg *Config) {
 	if err := paths.Ensure(); err != nil {

--
Gitblit v1.9.3