From 24f551a39eae849d891da26cc91f90d354e3a2db Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Sun, 12 Jul 2026 02:44:05 +0800
Subject: [PATCH] chore(mas): refresh codebase memory after split

---
 C1.source/privatevoice.src/internal/config/config.go |   40 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/C1.source/privatevoice.src/internal/config/config.go b/C1.source/privatevoice.src/internal/config/config.go
index e3e15c8..4693a58 100755
--- a/C1.source/privatevoice.src/internal/config/config.go
+++ b/C1.source/privatevoice.src/internal/config/config.go
@@ -3,12 +3,16 @@
 import (
 	"encoding/json"
 	"os"
+	"runtime"
 	"voicesnap/internal/logger"
 	"voicesnap/internal/model"
 	"voicesnap/internal/paths"
 )
 
 const (
+	UnsetHotkeyVK            = 0
+	LegacyDefaultHotkeyVK    = 0xA5
+	RightModifierDefaultVK   = 0x5C
 	HotkeyModeTap            = "tap"
 	HotkeyModeHold           = "hold"
 	LanguageModeAuto         = "auto"
@@ -25,6 +29,7 @@
 	SoundFeedback            bool   `json:"SoundFeedback"`
 	HideDockIcon             bool   `json:"HideDockIcon"`
 	CopyToClipboard          bool   `json:"CopyToClipboard"`
+	AutoPasteExperiment      bool   `json:"AutoPasteExperiment"`
 	DeviceName               string `json:"DeviceName,omitempty"`
 	IndicatorX               int    `json:"IndicatorX,omitempty"`
 	IndicatorY               int    `json:"IndicatorY,omitempty"`
@@ -38,13 +43,28 @@
 
 // Default returns a default configuration.
 func Default() *Config {
+	return defaultWithHotkey(defaultHotkeyVKForNewConfig(runtime.GOOS))
+}
+
+func legacyDefaultForExistingConfig() *Config {
+	return defaultWithHotkey(LegacyDefaultHotkeyVK)
+}
+
+// ExistingConfigFallback returns a legacy-safe fallback for cases where a
+// config file exists but cannot be read or parsed.
+func ExistingConfigFallback() *Config {
+	return legacyDefaultForExistingConfig()
+}
+
+func defaultWithHotkey(hotkeyVK int) *Config {
 	return &Config{
-		HotkeyVK:                 0xA5, // Right Alt
+		HotkeyVK:                 hotkeyVK,
 		HotkeyMode:               HotkeyModeHold,
 		AutoHide:                 true,
 		SoundFeedback:            true,
 		HideDockIcon:             true,
 		CopyToClipboard:          true,
+		AutoPasteExperiment:      false,
 		SelectedModelID:          model.DefaultModelID,
 		ModelSelectionMode:       ModelSelectionModeAuto,
 		LanguageMode:             LanguageModeAuto,
@@ -52,6 +72,22 @@
 		ModelDownloadUrl:         "http://www.maikami.com/voicesnap/sensevoice.zip",
 		FallbackModelDownloadUrl: "https://modelscope.cn/models/sherpa-onnx/sherpa-onnx-sense-voice-zh-en-ja-ko-yue/resolve/master/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-int8-2024-07-17.tar.bz2",
 	}
+}
+
+func defaultHotkeyVKForNewConfig(goos string) int {
+	if defaultHotkeyUnsetForNewConfig(goos) {
+		return UnsetHotkeyVK
+	}
+	switch goos {
+	case "darwin", "windows":
+		return RightModifierDefaultVK
+	default:
+		return LegacyDefaultHotkeyVK
+	}
+}
+
+func IsHotkeyUnset(vk int) bool {
+	return vk == UnsetHotkeyVK
 }
 
 func configPath() string {
@@ -71,7 +107,7 @@
 		return nil, err
 	}
 
-	cfg := Default()
+	cfg := legacyDefaultForExistingConfig()
 	if err := json.Unmarshal(data, cfg); err != nil {
 		return nil, err
 	}

--
Gitblit v1.9.3