Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix: persist agent hotkey to .env file across restarts

Gabriel Stein30f07b4370f9
diff --git a/src/helpers/environment.js b/src/helpers/environment.js
index 32b8d4110..484fcf3e9 100644
--- a/src/helpers/environment.js
+++ b/src/helpers/environment.js
@@ -20,6 +20,7 @@ const PERSISTED_KEYS = [
"LLAMA_GPU_BACKEND",
"LLAMA_VULKAN_ENABLED",
"DICTATION_KEY",
+ "AGENT_KEY",
"ACTIVATION_MODE",
"FLOATING_ICON_AUTO_HIDE",
"UI_LANGUAGE",
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index 65119c1b3..e8d488008 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -397,6 +397,7 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
useSettingsStore.setState({ agentKey: key });
if (isBrowser) {
window.electronAPI?.notifyAgentHotkeyChanged?.(key);
+ window.electronAPI?.saveAgentKey?.(key);
}
},
setAgentSystemPrompt: createStringSetter("agentSystemPrompt"),
@@ -559,6 +560,20 @@ export async function initializeSettings(): Promise<void> {
);
}
+ // Sync agent key from main process
+ try {
+ const envKey = await window.electronAPI.getAgentKey?.();
+ if (envKey && envKey !== state.agentKey) {
+ createStringSetter("agentKey")(envKey);
+ }
+ } catch (err) {
+ logger.warn(
+ "Failed to sync agent key on startup",
+ { error: (err as Error).message },
+ "settings"
+ );
+ }
+
// Sync activation mode from main process
try {
const envMode = await window.electronAPI.getActivationMode?.();