Skip to content

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

fix: hotkey fixes

Gabriel Steind7d213914659
diff --git a/src/components/OnboardingFlow.tsx b/src/components/OnboardingFlow.tsx
index 2c03b811e..f0a01eaea 100644
--- a/src/components/OnboardingFlow.tsx
+++ b/src/components/OnboardingFlow.tsx
@@ -794,7 +794,10 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
/>
)}
- {!isMacOS && (
+ {/* Only show PasteToolsInfo on Linux when tools are NOT available (to show install instructions) */}
+ {platform === "linux" &&
+ permissionsHook.pasteToolsInfo &&
+ !permissionsHook.pasteToolsInfo.available && (
<PasteToolsInfo
pasteToolsInfo={permissionsHook.pasteToolsInfo}
isChecking={permissionsHook.isCheckingPasteTools}
diff --git a/src/components/ui/HotkeyInput.tsx b/src/components/ui/HotkeyInput.tsx
index 91aa9d2d2..06c5e8cd9 100644
--- a/src/components/ui/HotkeyInput.tsx
+++ b/src/components/ui/HotkeyInput.tsx
@@ -83,6 +83,33 @@ const CODE_TO_KEY: Record<string, string> = {
End: "End",
PageUp: "PageUp",
PageDown: "PageDown",
+ // Additional keys (useful on Windows/Linux)
+ Pause: "Pause",
+ ScrollLock: "Scrolllock",
+ PrintScreen: "PrintScreen",
+ NumLock: "Numlock",
+ // Numpad keys
+ Numpad0: "num0",
+ Numpad1: "num1",
+ Numpad2: "num2",
+ Numpad3: "num3",
+ Numpad4: "num4",
+ Numpad5: "num5",
+ Numpad6: "num6",
+ Numpad7: "num7",
+ Numpad8: "num8",
+ Numpad9: "num9",
+ NumpadAdd: "numadd",
+ NumpadSubtract: "numsub",
+ NumpadMultiply: "nummult",
+ NumpadDivide: "numdiv",
+ NumpadDecimal: "numdec",
+ NumpadEnter: "Enter",
+ // Media keys (may work on some systems)
+ MediaPlayPause: "MediaPlayPause",
+ MediaStop: "MediaStop",
+ MediaTrackNext: "MediaNextTrack",
+ MediaTrackPrevious: "MediaPreviousTrack",
};
const MODIFIER_CODES = new Set([
diff --git a/src/helpers/hotkeyManager.js b/src/helpers/hotkeyManager.js
index 271326d1d..07d352c0d 100644
--- a/src/helpers/hotkeyManager.js
+++ b/src/helpers/hotkeyManager.js
@@ -1,4 +1,16 @@
const { globalShortcut } = require("electron");
+const debugLogger = require("./debugLogger");
+
+// Suggested alternative hotkeys when registration fails
+const SUGGESTED_HOTKEYS = {
+ single: ["F8", "F9", "F10", "Pause", "ScrollLock"],
+ compound: [
+ "CommandOrControl+Shift+Space",
+ "CommandOrControl+Shift+D",
+ "Alt+Space",
+ "CommandOrControl+`",
+ ],
+};
class HotkeyManager {
constructor() {
@@ -6,42 +18,122 @@ class HotkeyManager {
this.isInitialized = false;
}
+ /**
+ * Get a helpful error message based on the failure reason
+ */
+ getFailureReason(hotkey) {
+ // Check if the hotkey is already registered by us
+ if (globalShortcut.isRegistered(hotkey)) {
+ return {
+ reason: "already_registered",
+ message: `"${hotkey}" is already registered by another application.`,
+ suggestions: this.getSuggestions(hotkey),
+ };
+ }
+
+ // Platform-specific checks
+ if (process.platform === "win32") {
+ // Windows reserves certain keys
+ const winReserved = ["PrintScreen", "Win", "Super"];
+ if (winReserved.some((k) => hotkey.includes(k))) {
+ return {
+ reason: "os_reserved",
+ message: `"${hotkey}" is reserved by Windows.`,
+ suggestions: this.getSuggestions(hotkey),
+ };
+ }
+ }
+
+ if (process.platform === "linux") {
+ // Linux DE's often reserve Super/Meta combinations
+ if (hotkey.includes("Super") || hotkey.includes("Meta")) {
+ return {
+ reason: "os_reserved",
+ message: `"${hotkey}" may be reserved by your desktop environment.`,
+ suggestions: this.getSuggestions(hotkey),
+ };
+ }
+ }
+
+ // Generic failure - could be another app holding it
+ return {
+ reason: "registration_failed",
+ message: `Could not register "${hotkey}". It may be in use by another application.`,
+ suggestions: this.getSuggestions(hotkey),
+ };
+ }
+
+ /**
+ * Get alternative hotkey suggestions based on what the user tried
+ */
+ getSuggestions(failedHotkey) {
+ const isCompound = failedHotkey.includes("+");
+ const suggestions = isCompound ? [...SUGGESTED_HOTKEYS.compound] : [...SUGGESTED_HOTKEYS.single];
+
+ // Filter out the failed hotkey if it's in the suggestions
+ return suggestions.filter((s) => s !== failedHotkey).slice(0, 3);
+ }
+
setupShortcuts(hotkey = "`", callback) {
if (!callback) {
throw new Error("Callback function is required for hotkey setup");
}
+ debugLogger.log(`[HotkeyManager] Setting up hotkey: "${hotkey}"`);
+ debugLogger.log(`[HotkeyManager] Platform: ${process.platform}, Arch: ${process.arch}`);
+
if (this.currentHotkey && this.currentHotkey !== "GLOBE") {
+ debugLogger.log(`[HotkeyManager] Unregistering previous hotkey: "${this.currentHotkey}"`);
globalShortcut.unregister(this.currentHotkey);
}
try {
if (hotkey === "GLOBE") {
if (process.platform !== "darwin") {
+ debugLogger.log("[HotkeyManager] GLOBE key rejected - not on macOS");
return {
success: false,
error: "The Globe key is only available on macOS.",
};
}
this.currentHotkey = hotkey;
+ debugLogger.log("[HotkeyManager] GLOBE key set successfully");
return { success: true, hotkey };
}
+ // Check if already registered before attempting
+ const alreadyRegistered = globalShortcut.isRegistered(hotkey);
+ debugLogger.log(`[HotkeyManager] Is "${hotkey}" already registered? ${alreadyRegistered}`);
+
// Register the new hotkey
const success = globalShortcut.register(hotkey, callback);
+ debugLogger.log(`[HotkeyManager] Registration result for "${hotkey}": ${success}`);
if (success) {
this.currentHotkey = hotkey;
+ debugLogger.log(`[HotkeyManager] Hotkey "${hotkey}" registered successfully`);
return { success: true, hotkey };
} else {
- console.error(`Failed to register hotkey: ${hotkey}`);
+ const failureInfo = this.getFailureReason(hotkey);
+ console.error(`[HotkeyManager] Failed to register hotkey: ${hotkey}`, failureInfo);
+ debugLogger.log(`[HotkeyManager] Registration failed:`, failureInfo);
+
+ // Build user-friendly error message with suggestions
+ let errorMessage = failureInfo.message;
+ if (failureInfo.suggestions.length > 0) {
+ errorMessage += ` Try: ${failureInfo.suggestions.join(", ")}`;
+ }
+
return {
success: false,
- error: `Failed to register hotkey: ${hotkey}`,
+ error: errorMessage,
+ reason: failureInfo.reason,
+ suggestions: failureInfo.suggestions,
};
}
} catch (error) {
- console.error("Error setting up shortcuts:", error);
+ console.error("[HotkeyManager] Error setting up shortcuts:", error);
+ debugLogger.log(`[HotkeyManager] Exception during registration:`, error.message);
return { success: false, error: error.message };
}
}
@@ -91,7 +183,11 @@ class HotkeyManager {
if (result.success) {
return { success: true, message: `Hotkey updated to: ${hotkey}` };
} else {
- return { success: false, message: result.error };
+ return {
+ success: false,
+ message: result.error,
+ suggestions: result.suggestions,
+ };
}
} catch (error) {
console.error("Failed to update hotkey:", error);
diff --git a/src/hooks/useHotkeyRegistration.ts b/src/hooks/useHotkeyRegistration.ts
index bd9aca388..34e6e0549 100644
--- a/src/hooks/useHotkeyRegistration.ts
+++ b/src/hooks/useHotkeyRegistration.ts
@@ -114,6 +114,7 @@ export function useHotkeyRegistration(
const result = await window.electronAPI.updateHotkey(hotkey);
if (!result?.success) {
+ // Use the detailed error message from the manager, which includes suggestions
const errorMsg =
result?.message || "This key could not be registered. Please choose a different key.";
setLastError(errorMsg);