Skip to content

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

feat: refine Linux push-to-talk support

Alcahest62a70b7a71f3
diff --git a/electron-builder.json b/electron-builder.json
index 4502e751f..e6f00595c 100644
--- a/electron-builder.json
+++ b/electron-builder.json
@@ -83,7 +83,11 @@
"!**/node_modules/**/CHANGELOG*",
"!**/node_modules/**/.github/**"
],
- "asarUnpack": ["**/node_modules/ffmpeg-static/**/*", "**/node_modules/better-sqlite3/**/*", "**/node_modules/onnxruntime-node/**/*"],
+ "asarUnpack": [
+ "**/node_modules/ffmpeg-static/**/*",
+ "**/node_modules/better-sqlite3/**/*",
+ "**/node_modules/onnxruntime-node/**/*"
+ ],
"extraResources": [
".env",
"src/assets/**/*",
@@ -104,6 +108,7 @@
"llama-server-*",
"sherpa-onnx-*",
"qdrant-*",
+ "linux-key-listener*",
"windows-key-listener*",
"windows-mic-listener*",
"windows-text-monitor*",
diff --git a/src/components/OnboardingFlow.tsx b/src/components/OnboardingFlow.tsx
index f9e64cbc9..aa73d851a 100644
--- a/src/components/OnboardingFlow.tsx
+++ b/src/components/OnboardingFlow.tsx
@@ -33,7 +33,7 @@ import { useAuth } from "../hooks/useAuth";
import { HotkeyInput } from "./ui/HotkeyInput";
import { useHotkeyRegistration } from "../hooks/useHotkeyRegistration";
import { getValidationMessage } from "../utils/hotkeyValidator";
-import { getPlatform } from "../utils/platform";
+import { getCachedPlatform, getPlatform } from "../utils/platform";
import logger from "../utils/logger";
import { ActivationModeSelector } from "./ui/ActivationModeSelector";
import TranscriptionModelPicker from "./TranscriptionModelPicker";
@@ -146,7 +146,9 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
const info = await window.electronAPI?.getHotkeyModeInfo();
if (info?.isUsingNativeShortcut) {
setIsUsingNativeShortcut(true);
- setActivationMode("tap");
+ if (!info.supportsPushToTalk) {
+ setActivationMode("tap");
+ }
}
} catch (error) {
logger.error("Failed to check hotkey mode", { error }, "onboarding");
@@ -221,7 +223,8 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
// Get platform-appropriate default hotkey from backend (accounts for
// X11 modifier-only and GNOME gsettings limitations)
- const defaultHotkey = await window.electronAPI?.getEffectiveDefaultHotkey?.() || getDefaultHotkey();
+ const defaultHotkey =
+ (await window.electronAPI?.getEffectiveDefaultHotkey?.()) || getDefaultHotkey();
const platform = window.electronAPI?.getPlatform?.() ?? "darwin";
// Only auto-register if no hotkey is currently set
@@ -554,7 +557,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
</div>
{/* Mode section - inline with hotkey */}
- {!isUsingNativeShortcut && (
+ {(!isUsingNativeShortcut || getCachedPlatform() === "linux") && (
<div className="p-4 flex items-center justify-between gap-4">
<div className="flex-1 min-w-0">
<span className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
@@ -582,7 +585,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
{t("onboarding.activation.test")}
</span>
<span className="text-xs text-muted-foreground/60">
- {activationMode === "tap" || isUsingNativeShortcut
+ {activationMode === "tap" || (isUsingNativeShortcut && getCachedPlatform() !== "linux")
? t("onboarding.activation.hotkeyToStartStop", { hotkey: readableHotkey })
: t("onboarding.activation.holdHotkey", { hotkey: readableHotkey })}
</span>
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index 4c8293b0d..ad9f2f5da 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -1112,7 +1112,9 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
const info = await window.electronAPI?.getHotkeyModeInfo();
if (info?.isUsingNativeShortcut) {
setIsUsingNativeShortcut(true);
- setActivationMode("tap");
+ if (!info.supportsPushToTalk) {
+ setActivationMode("tap");
+ }
}
} catch (error) {
logger.error("Failed to check hotkey mode", error, "settings");
@@ -2997,20 +2999,22 @@ EOF`,
disabled={isHotkeyRegistering}
validate={validateDictationHotkey}
/>
- {effectiveDefaultHotkey && dictationKey && dictationKey !== effectiveDefaultHotkey && (
- <button
- onClick={() => registerHotkey(effectiveDefaultHotkey)}
- disabled={isHotkeyRegistering}
- className="mt-2 text-xs text-muted-foreground/70 hover:text-foreground transition-colors disabled:opacity-50"
- >
- {t("settingsPage.general.hotkey.resetToDefault", {
- hotkey: formatHotkeyLabel(effectiveDefaultHotkey),
- })}
- </button>
- )}
+ {effectiveDefaultHotkey &&
+ dictationKey &&
+ dictationKey !== effectiveDefaultHotkey && (
+ <button
+ onClick={() => registerHotkey(effectiveDefaultHotkey)}
+ disabled={isHotkeyRegistering}
+ className="mt-2 text-xs text-muted-foreground/70 hover:text-foreground transition-colors disabled:opacity-50"
+ >
+ {t("settingsPage.general.hotkey.resetToDefault", {
+ hotkey: formatHotkeyLabel(effectiveDefaultHotkey),
+ })}
+ </button>
+ )}
</SettingsPanelRow>
- {!isUsingNativeShortcut && (
+ {(!isUsingNativeShortcut || getCachedPlatform() === "linux") && (
<SettingsPanelRow>
<p className="text-xs font-medium text-muted-foreground/80 mb-2">
{t("settingsPage.general.hotkey.activationMode")}
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index b5e121eb3..e30913475 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -1600,9 +1600,13 @@ class IPCHandlers {
if (!info?.hotkey) continue;
if (!usesNativeListener(info.hotkey)) {
- debugLogger.log(`[IPC] Unregistering globalShortcut "${info.hotkey}" (slot "${slot}") for capture mode`);
+ debugLogger.log(
+ `[IPC] Unregistering globalShortcut "${info.hotkey}" (slot "${slot}") for capture mode`
+ );
const { globalShortcut } = require("electron");
- try { globalShortcut.unregister(info.hotkey); } catch {}
+ try {
+ globalShortcut.unregister(info.hotkey);
+ } catch {}
}
}
@@ -1621,7 +1625,9 @@ class IPCHandlers {
// On GNOME, unregister all native keybindings during capture
if (hotkeyManager.isUsingGnome() && hotkeyManager.gnomeManager) {
for (const slot of [...hotkeyManager.gnomeManager.registeredSlots]) {
- debugLogger.log(`[IPC] Unregistering GNOME keybinding (slot "${slot}") for capture mode`);
+ debugLogger.log(
+ `[IPC] Unregistering GNOME keybinding (slot "${slot}") for capture mode`
+ );
await hotkeyManager.gnomeManager.unregisterKeybinding(slot).catch((err) => {
debugLogger.warn(`[IPC] Failed to unregister GNOME slot "${slot}":`, err.message);
});
@@ -1648,7 +1654,10 @@ class IPCHandlers {
} else {
// Exiting capture mode - re-register globalShortcut if not already registered
// Skip for KDE/GNOME/Hyprland — updateHotkey handles re-registration via native path
- const usesNativePath = hotkeyManager.isUsingKDE() || hotkeyManager.isUsingGnome() || hotkeyManager.isUsingHyprland();
+ const usesNativePath =
+ hotkeyManager.isUsingKDE() ||
+ hotkeyManager.isUsingGnome() ||
+ hotkeyManager.isUsingHyprland();
if (effectiveHotkey && !usesNativeListener(effectiveHotkey) && !usesNativePath) {
const { globalShortcut } = require("electron");
const accelerator = effectiveHotkey.startsWith("Fn+")
@@ -1732,18 +1741,28 @@ class IPCHandlers {
`[IPC] Re-registering KDE keybinding "${effectiveHotkey}" after capture mode`
);
const callback = this.windowManager.createHotkeyCallback();
- const result = await hotkeyManager.kdeManager.registerKeybinding(effectiveHotkey, "dictation", callback);
+ const result = await hotkeyManager.kdeManager.registerKeybinding(
+ effectiveHotkey,
+ "dictation",
+ callback
+ );
if (result === true) {
hotkeyManager.currentHotkey = effectiveHotkey;
} else {
- debugLogger.warn(`[IPC] Failed to re-register KDE keybinding "${effectiveHotkey}" after capture mode`, { result });
+ debugLogger.warn(
+ `[IPC] Failed to re-register KDE keybinding "${effectiveHotkey}" after capture mode`,
+ { result }
+ );
}
}
// Re-register non-dictation slots (meeting, agent) that were unregistered on capture enter
for (const [slot, info] of hotkeyManager.slots) {
- if (slot === "dictation" || slot === "cancel" || !info?.hotkey || !info?.callback) continue;
- debugLogger.log(`[IPC] Re-registering slot "${slot}" ("${info.hotkey}") after capture mode`);
+ if (slot === "dictation" || slot === "cancel" || !info?.hotkey || !info?.callback)
+ continue;
+ debugLogger.log(
+ `[IPC] Re-registering slot "${slot}" ("${info.hotkey}") after capture mode`
+ );
await hotkeyManager.registerSlot(slot, info.hotkey, info.callback).catch((err) => {
debugLogger.warn(`[IPC] Failed to re-register slot "${slot}":`, err.message);
});
@@ -1762,11 +1781,18 @@ class IPCHandlers {
});
ipcMain.handle("get-hotkey-mode-info", async () => {
+ const isUsingNativeShortcut = this.windowManager.isUsingNativeShortcutHotkeys();
+ const supportsPushToTalk =
+ process.platform === "linux"
+ ? this.linuxKeyManager?.isAvailable?.() === true
+ : !isUsingNativeShortcut;
+
return {
isUsingGnome: this.windowManager.isUsingGnomeHotkeys(),
isUsingHyprland: this.windowManager.isUsingHyprlandHotkeys(),
isUsingKDE: this.windowManager.isUsingKDEHotkeys(),
- isUsingNativeShortcut: this.windowManager.isUsingNativeShortcutHotkeys(),
+ isUsingNativeShortcut,
+ supportsPushToTalk,
};
});
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index 2c35029eb..22b09a672 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -438,7 +438,7 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
if (isBrowser) localStorage.setItem("activationMode", mode);
set({ activationMode: mode });
if (isBrowser) {
- window.electronAPI?.notifyActivationModeChanged?.(effective);
+ window.electronAPI?.notifyActivationModeChanged?.(mode);
}
},
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 8d3051e85..0d00ceace 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -699,6 +699,7 @@ declare global {
isUsingGnome: boolean;
isUsingHyprland: boolean;
isUsingNativeShortcut: boolean;
+ supportsPushToTalk: boolean;
}>;
// Wayland paste diagnostics
@@ -728,6 +729,7 @@ declare global {
) => () => void;
onSettingUpdated?: (callback: (data: { key: string; value: unknown }) => void) => () => void;
onDictationKeyActive?: (callback: (key: string) => void) => () => void;
+ onLinuxPttPermissionDenied?: (callback: () => void) => () => void;
// Settings shortcut (Cmd+, / Ctrl+,)
onShowSettings?: (callback: () => void) => () => void;