Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix: fix open mic settings
Gabriel Steinf17e67aae818
diff --git a/CLAUDE.md b/CLAUDE.mdindex 6291cdc22..5ca6c3363 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -72,7 +72,9 @@ OpenWhispr is an Electron-based desktop dictation application that uses whisper.- **useDialogs.ts**: Electron dialog integration- **useHotkey.js**: Hotkey state management- **useLocalStorage.ts**: Type-safe localStorage wrapper-- **usePermissions.ts**: System permission checks+- **usePermissions.ts**: System permission checks and settings access+ - `openMicPrivacySettings()`: Opens OS microphone privacy settings+ - `openSoundInputSettings()`: Opens OS sound input device settings- **useSettings.ts**: Application settings management- **useWhisper.ts**: Whisper binary availability check@@ -231,7 +233,27 @@ All AI model definitions are centralized in `src/models/modelRegistryData.json`- Keys stored in environment variables and reloaded on app start- Centralized `saveAllKeysToEnvFile()` method ensures consistency-### 10. Debug Mode+### 10. System Settings Integration++The app can open OS-level settings for microphone permissions and sound input selection:++**IPC Handlers** (in `ipcHandlers.js`):+- `open-microphone-settings`: Opens microphone privacy settings+- `open-sound-input-settings`: Opens sound/audio input device settings++**Platform-specific URLs**:+| Platform | Microphone Privacy | Sound Input |+|----------|-------------------|-------------|+| macOS | `x-apple.systempreferences:com.apple.preference.security?Privacy_Microphone` | `x-apple.systempreferences:com.apple.preference.sound?input` |+| Windows | `ms-settings:privacy-microphone` | `ms-settings:sound` |+| Linux | Manual (no URL scheme) | Manual (e.g., pavucontrol) |++**UI Component** (`MicPermissionWarning.tsx`):+- Shows platform-appropriate buttons and messages+- Linux only shows "Open Sound Settings" (no separate privacy settings)+- macOS/Windows show both sound and privacy buttons++### 11. Debug ModeEnable with `--log-level=debug` or `OPENWHISPR_LOG_LEVEL=debug` (can be set in `.env`):- Logs saved to platform-specific app data directory@@ -286,14 +308,18 @@ Enable with `--log-level=debug` or `OPENWHISPR_LOG_LEVEL=debug` (can be set in `### Platform-Specific Notes**macOS**:-- Requires accessibility permissions for clipboard+- Requires accessibility permissions for clipboard (auto-paste)+- Requires microphone permission (prompted by system)- Uses AppleScript for reliable pasting- Notarization needed for distribution- Shows in dock with indicator dot when running (LSUIElement: false)- whisper.cpp bundled for both arm64 and x64+- System settings accessible via `x-apple.systempreferences:` URL scheme**Windows**:-- No special permissions needed+- No special accessibility permissions needed+- Microphone privacy settings at `ms-settings:privacy-microphone`+- Sound settings at `ms-settings:sound`- NSIS installer for distribution- whisper.cpp bundled for x64@@ -302,6 +328,9 @@ Enable with `--log-level=debug` or `OPENWHISPR_LOG_LEVEL=debug` (can be set in `- Standard XDG directories- AppImage for distribution- whisper.cpp bundled for x64+- No standardized URL scheme for system settings (user must open manually)+- Privacy settings button hidden in UI (not applicable on Linux)+- Recommend `pavucontrol` for audio device management## Code Style and Conventionsdiff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.mdindex 293627b65..2fae01aca 100644--- a/TROUBLESHOOTING.md+++ b/TROUBLESHOOTING.md@@ -21,6 +21,29 @@3. Run `rm -rf node_modules package-lock.json && npm ci`4. Rebuild the app+### Microphone Permission Issues++**Symptoms:** "Permission denied", microphone prompt doesn't appear, or "No microphones detected"++**Platform-specific fixes:**++**macOS:**+1. Open System Settings → Privacy & Security → Microphone+2. Ensure OpenWhispr is listed and enabled+3. If not listed, click "Grant Access" in the app to trigger the permission prompt+4. You can also click "Open Microphone Privacy" button in the app++**Windows:**+1. Open Settings → Privacy → Microphone+2. Ensure "Allow apps to access your microphone" is ON+3. Ensure OpenWhispr is listed and enabled+4. You can also click "Open Privacy Settings" button in the app++**Linux:**+1. Check your audio settings (e.g., `pavucontrol`)+2. Ensure the correct input device is selected+3. Linux doesn't have app-level microphone permissions like macOS/Windows+### Empty Transcriptions**Symptoms:** History shows "you" or empty entries@@ -29,12 +52,14 @@- Microphone permission revoked mid-session- Stale Whisper cache with corrupted clips- Hotkey triggering without audio input+- Wrong audio input device selected**Fix:**-1. Check microphone permissions in System Settings-2. Clear caches: `rm -rf ~/.cache/whisper`-3. Try a different hotkey-4. Re-run onboarding+1. Check microphone permissions (see above)+2. Open sound settings and verify the correct input device is selected+3. Clear caches: `rm -rf ~/.cache/whisper`+4. Try a different hotkey+5. Re-run onboarding### FFmpeg Not Founddiff --git a/preload.js b/preload.jsindex 0590ea6d9..9e4707c46 100644--- a/preload.js+++ b/preload.js@@ -170,6 +170,10 @@ contextBridge.exposeInMainWorld("electronAPI", {getLogLevel: () => ipcRenderer.invoke("get-log-level"),log: (entry) => ipcRenderer.invoke("app-log", entry),+ // System settings helpers for microphone/audio permissions+ openMicrophoneSettings: () => ipcRenderer.invoke("open-microphone-settings"),+ openSoundInputSettings: () => ipcRenderer.invoke("open-sound-input-settings"),+// Globe key listener for hotkey capture (macOS only)onGlobeKeyPressed: (callback) => {const listener = () => callback?.();diff --git a/src/components/ui/MicPermissionWarning.tsx b/src/components/ui/MicPermissionWarning.tsxindex 28d6af733..6b20ff843 100644--- a/src/components/ui/MicPermissionWarning.tsx+++ b/src/components/ui/MicPermissionWarning.tsx@@ -7,16 +7,47 @@ interface MicPermissionWarningProps {onOpenPrivacySettings: () => void;}-const getPlatformInfo = () => {- if (typeof navigator === "undefined") {- return { isMac: true, isWindows: false, isLinux: false };+type Platform = "darwin" | "win32" | "linux";++const getPlatform = (): Platform => {+ if (typeof window !== "undefined" && window.electronAPI?.getPlatform) {+ const p = window.electronAPI.getPlatform();+ if (p === "darwin" || p === "win32" || p === "linux") return p;+ }+ // Fallback to user agent+ if (typeof navigator !== "undefined") {+ const ua = navigator.userAgent.toLowerCase();+ if (ua.includes("mac")) return "darwin";+ if (ua.includes("linux")) return "linux";}- const ua = navigator.userAgent.toLowerCase();- return {- isMac: ua.includes("mac"),- isWindows: ua.includes("win"),- isLinux: ua.includes("linux"),- };+ return "win32";+};++const PLATFORM_CONFIG: Record<+ Platform,+ { message: string; soundLabel: string; privacyLabel: string; showPrivacyButton: boolean }+> = {+ darwin: {+ message:+ "If the microphone prompt doesn't appear, open Sound settings to select your input device, then try again.",+ soundLabel: "Open Sound Input",+ privacyLabel: "Open Microphone Privacy",+ showPrivacyButton: true, // macOS has separate privacy settings+ },+ win32: {+ message:+ "If the microphone prompt doesn't appear, open Windows Settings to select your input device, then try again.",+ soundLabel: "Open Sound Settings",+ privacyLabel: "Open Privacy Settings",+ showPrivacyButton: true, // Windows has privacy settings for microphone+ },+ linux: {+ message:+ "If the microphone prompt doesn't appear, open your system sound settings to select your input device, then try again.",+ soundLabel: "Open Sound Settings",+ privacyLabel: "",+ showPrivacyButton: false, // Linux typically doesn't have app-level mic privacy settings+ },};export default function MicPermissionWarning({@@ -24,36 +55,20 @@ export default function MicPermissionWarning({onOpenSoundSettings,onOpenPrivacySettings,}: MicPermissionWarningProps) {- const { isMac, isWindows, isLinux } = useMemo(() => getPlatformInfo(), []);-- const defaultMessage = isWindows- ? "If the microphone prompt doesn't appear, open Windows Settings to select your input device, then try again."- : isLinux- ? "If the microphone prompt doesn't appear, open your system sound settings to select your input device, then try again."- : "If the microphone prompt doesn't appear, open Sound settings to select your input device, then try again.";-- const soundButtonLabel = isWindows- ? "Open Sound Settings"- : isLinux- ? "Open Sound Settings"- : "Open Sound Input Settings";-- const privacyButtonLabel = isWindows- ? "Open Privacy Settings"- : isLinux- ? "Open Privacy Settings"- : "Open Microphone Privacy";+ const config = useMemo(() => PLATFORM_CONFIG[getPlatform()], []);return (<div className="rounded-lg border border-amber-200 bg-amber-50 p-4 space-y-3">- <p className="text-sm text-amber-900">{error || defaultMessage}</p>+ <p className="text-sm text-amber-900">{error || config.message}</p><div className="flex flex-wrap gap-2"><Button variant="outline" size="sm" onClick={onOpenSoundSettings}>- {soundButtonLabel}- </Button>- <Button variant="outline" size="sm" onClick={onOpenPrivacySettings}>- {privacyButtonLabel}+ {config.soundLabel}</Button>+ {config.showPrivacyButton && (+ <Button variant="outline" size="sm" onClick={onOpenPrivacySettings}>+ {config.privacyLabel}+ </Button>+ )}</div></div>);diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex 2cad0fdc6..e4588ba88 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -514,6 +514,44 @@ class IPCHandlers {debugLogger.logEntry(entry);return { success: true };});++ const SYSTEM_SETTINGS_URLS = {+ darwin: {+ microphone: "x-apple.systempreferences:com.apple.preference.security?Privacy_Microphone",+ sound: "x-apple.systempreferences:com.apple.preference.sound?input",+ },+ win32: {+ microphone: "ms-settings:privacy-microphone",+ sound: "ms-settings:sound",+ },+ };++ const openSystemSettings = async (settingType) => {+ const platform = process.platform;+ const urls = SYSTEM_SETTINGS_URLS[platform];++ if (!urls) {+ // Linux doesn't have standardized URL schemes for system settings+ return {+ success: false,+ error:+ settingType === "microphone"+ ? "Please open your system settings to configure microphone permissions."+ : "Please open your system sound settings (e.g., pavucontrol).",+ };+ }++ try {+ await shell.openExternal(urls[settingType]);+ return { success: true };+ } catch (error) {+ debugLogger.error(`Failed to open ${settingType} settings:`, error);+ return { success: false, error: error.message };+ }+ };++ ipcMain.handle("open-microphone-settings", () => openSystemSettings("microphone"));+ ipcMain.handle("open-sound-input-settings", () => openSystemSettings("sound"));}broadcastToWindows(channel, payload) {diff --git a/src/hooks/usePermissions.ts b/src/hooks/usePermissions.tsindex b6b291b69..41a113c18 100644--- a/src/hooks/usePermissions.ts+++ b/src/hooks/usePermissions.ts@@ -104,21 +104,40 @@ export const usePermissions = (const [pasteToolsInfo, setPasteToolsInfo] = useState<PasteToolsResult | null>(null);const [isCheckingPasteTools, setIsCheckingPasteTools] = useState(false);- const openMicPrivacySettings = useCallback(async () => {- try {- await window.electronAPI?.openMicrophoneSettings?.();- } catch (error) {- console.error("Failed to open microphone privacy settings:", error);- }- }, []);+ const openSystemSettings = useCallback(+ async (+ settingType: "microphone" | "sound",+ apiMethod: () => Promise<{ success: boolean; error?: string } | undefined> | undefined+ ) => {+ const titles = {+ microphone: "Microphone Settings",+ sound: "Sound Settings",+ };+ try {+ const result = await apiMethod?.();+ if (result && !result.success && result.error) {+ showAlertDialog?.({ title: titles[settingType], description: result.error });+ }+ } catch (error) {+ console.error(`Failed to open ${settingType} settings:`, error);+ showAlertDialog?.({+ title: titles[settingType],+ description: `Unable to open ${settingType} settings. Please open your system settings manually.`,+ });+ }+ },+ [showAlertDialog]+ );- const openSoundInputSettings = useCallback(async () => {- try {- await window.electronAPI?.openSoundInputSettings?.();- } catch (error) {- console.error("Failed to open sound input settings:", error);- }- }, []);+ const openMicPrivacySettings = useCallback(+ () => openSystemSettings("microphone", window.electronAPI?.openMicrophoneSettings),+ [openSystemSettings]+ );++ const openSoundInputSettings = useCallback(+ () => openSystemSettings("sound", window.electronAPI?.openSoundInputSettings),+ [openSystemSettings]+ );const requestMicPermission = useCallback(async () => {if (!navigator?.mediaDevices || typeof navigator.mediaDevices.getUserMedia !== "function") {