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
feat: improved cleanup of models on uninstall
Gabriel Stein52077bb2e92a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 72013b303..023c54f2f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- **macOS Globe Key Support**: Added a lightweight Swift listener so the Globe/Fn key can toggle dictation across the system.- **Globe Key Selection UI**: Settings and onboarding keyboards now include a dedicated Globe key option.- **Hotkey Validation**: Settings and onboarding now verify shortcut registration immediately, alerting users when a key can’t be bound.+- **Model Cache Cleanup**: Added an in-app command (and installer/uninstaller hooks) to delete all cached Whisper models.+- **Tray Controls**: macOS tray menu gained quick actions to show or hide the dictation panel.### Changed- **Dictation Overlay Placement**: Window now anchors to the active workspace's bottom-right corner with a safety margin, preventing it from sliding off-screen on multi-monitor setups.diff --git a/README.md b/README.mdindex 073d5362b..fbd9ffd41 100644--- a/README.md+++ b/README.md@@ -22,6 +22,7 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file- 📱 **Control Panel**: Manage settings, view history, and configure API keys- 🗄️ **Transcription History**: SQLite database stores all your transcriptions locally- 🔧 **Model Management**: Download and manage local Whisper models (tiny, base, small, medium, large, turbo)+- 🧹 **Model Cleanup**: One-click removal of cached Whisper models with uninstall hooks to keep disks tidy- 🌐 **Cross-Platform**: Works on macOS, Windows, and Linux- ⚡ **Automatic Pasting**: Transcribed text automatically pastes at your cursor location- 🖱️ **Draggable Interface**: Move the dictation panel anywhere on your screen@@ -129,8 +130,15 @@ npm run build:linux # Linux- **Configure**: Choose between local and cloud processing- **History**: View, copy, and delete past transcriptions- **Models**: Download and manage local Whisper models+- **Storage Cleanup**: Remove downloaded Whisper models from cache to reclaim space- **Settings**: Configure API keys, customize hotkeys, and manage permissions+### Uninstall & Cache Cleanup+- **In-App**: Use *Settings → Speech to Text Processing → Local Model Storage → Remove Downloaded Models* to clear `~/.cache/openwhispr/models` (or `%USERPROFILE%\.cache\openwhispr\models` on Windows).+- **Windows Uninstall**: The NSIS uninstaller automatically deletes the same cache directory.+- **Linux Packages**: `deb`/`rpm` post-uninstall scripts also remove cached models.+- **macOS**: If you uninstall manually, remove `~/Library/Caches` or `~/.cache/openwhispr/models` if desired.+### Agent Naming & AI ProcessingOnce you've named your agent during setup, you can interact with it using multiple AI providers:diff --git a/electron-builder.json b/electron-builder.jsonindex 78cb8f41c..f10407c8f 100644--- a/electron-builder.json+++ b/electron-builder.json@@ -63,13 +63,15 @@"deb"],"icon": "src/assets/icon.png",- "category": "Utility"+ "category": "Utility",+ "afterInstall": "resources/linux/after-install.sh"},"nsis": {"oneClick": false,"allowToChangeInstallationDirectory": true,"createDesktopShortcut": true,- "createStartMenuShortcut": true+ "createStartMenuShortcut": true,+ "include": "resources/nsis/cleanup-models.nsh"},"dmg": {"title": "OpenWhispr",diff --git a/main.js b/main.jsindex b4759c85e..5ddb3c79a 100644--- a/main.js+++ b/main.js@@ -113,10 +113,11 @@ async function startApp() {}// Set up tray- trayManager.setWindows(- windowManager.mainWindow,- windowManager.controlPanelWindow- );+trayManager.setWindows(+ windowManager.mainWindow,+ windowManager.controlPanelWindow+);+trayManager.setWindowManager(windowManager);trayManager.setCreateControlPanelCallback(() =>windowManager.createControlPanelWindow());diff --git a/preload.js b/preload.jsindex 3db1d3d34..023c6f9f6 100644--- a/preload.js+++ b/preload.js@@ -99,6 +99,7 @@ contextBridge.exposeInMainWorld("electronAPI", {modelCheck: (modelId) => ipcRenderer.invoke("model-check", modelId),modelDownload: (modelId) => ipcRenderer.invoke("model-download", modelId),modelDelete: (modelId) => ipcRenderer.invoke("model-delete", modelId),+ modelDeleteAll: () => ipcRenderer.invoke("model-delete-all"),modelCheckRuntime: () => ipcRenderer.invoke("model-check-runtime"),onModelDownloadProgress: (callback) => ipcRenderer.on("model-download-progress", callback),diff --git a/resources/linux/after-install.sh b/resources/linux/after-install.shnew file mode 100755index 000000000..7aa2b623e--- /dev/null+++ b/resources/linux/after-install.sh@@ -0,0 +1,16 @@+#!/bin/bash+set -euo pipefail++CACHE_DIR="${HOME}/.cache/openwhispr"+MODELS_DIR="${CACHE_DIR}/models"++if [[ "${1-}" == "--remove" ]]; then+ if [[ -d "${MODELS_DIR}" ]]; then+ rm -rf "${MODELS_DIR}"+ echo "Removed OpenWhispr cached models"+ fi+ # Attempt to remove parent cache directory if empty+ if [[ -d "${CACHE_DIR}" ]]; then+ rmdir "${CACHE_DIR}" 2>/dev/null || true+ fi+fidiff --git a/resources/nsis/cleanup-models.nsh b/resources/nsis/cleanup-models.nshnew file mode 100644index 000000000..fbf7ef285--- /dev/null+++ b/resources/nsis/cleanup-models.nsh@@ -0,0 +1,8 @@+!macro customUnInstall+ StrCpy $0 "$PROFILE\.cache\openwhispr\models"+ IfFileExists "$0\*.*" 0 +3+ RMDir /r "$0"+ DetailPrint "Removed OpenWhispr cached models"+ StrCpy $1 "$PROFILE\.cache\openwhispr"+ RMDir "$1"+!macroenddiff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex c1b238d20..dce7dff1e 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -14,7 +14,6 @@ import { usePermissions } from "../hooks/usePermissions";import { useClipboard } from "../hooks/useClipboard";import { REASONING_PROVIDERS } from "../utils/languages";import { formatHotkeyLabel } from "../utils/hotkeys";-import { formatHotkeyLabel } from "../utils/hotkeys";import LanguageSelector from "./ui/LanguageSelector";import PromptStudio from "./ui/PromptStudio";import AIModelSelectorEnhanced from "./AIModelSelectorEnhanced";@@ -91,6 +90,11 @@ export default function SettingsPage({releaseDate?: string;releaseNotes?: string;}>({});+ const [isRemovingModels, setIsRemovingModels] = useState(false);+ const cachePathHint =+ typeof navigator !== "undefined" && /Windows/i.test(navigator.userAgent)+ ? "%USERPROFILE%\\.cache\\openwhispr\\models"+ : "~/.cache/openwhispr/models";const whisperHook = useWhisper(showAlertDialog);const permissionsHook = usePermissions(showAlertDialog);@@ -342,6 +346,51 @@ export default function SettingsPage({}};+ const handleRemoveModels = useCallback(() => {+ if (isRemovingModels) return;++ showConfirmDialog({+ title: "Remove downloaded models?",+ description:+ `This deletes all locally cached Whisper models (${cachePathHint}) and frees disk space. You can download them again from the model picker.`,+ confirmText: "Delete Models",+ variant: "destructive",+ onConfirm: () => {+ setIsRemovingModels(true);+ window.electronAPI+ ?.modelDeleteAll?.()+ .then((result) => {+ if (!result?.success) {+ showAlertDialog({+ title: "Unable to Remove Models",+ description:+ result?.error ||+ "Something went wrong while deleting the cached models.",+ });+ return;+ }++ window.dispatchEvent(new Event("openwhispr-models-cleared"));++ showAlertDialog({+ title: "Models Removed",+ description:+ "All downloaded Whisper models were deleted. You can re-download any model from the picker when needed.",+ });+ })+ .catch((error) => {+ showAlertDialog({+ title: "Unable to Remove Models",+ description: error?.message || "An unknown error occurred.",+ });+ })+ .finally(() => {+ setIsRemovingModels(false);+ });+ },+ });+ }, [isRemovingModels, cachePathHint, showConfirmDialog, showAlertDialog]);+const renderSectionContent = () => {switch (activeSection) {case "general":@@ -705,6 +754,24 @@ export default function SettingsPage({Clean Up All App Data</Button></div>++ <div className="space-y-3 mt-6 p-4 bg-rose-50 border border-rose-200 rounded-xl">+ <h4 className="font-medium text-rose-900">Local Model Storage</h4>+ <p className="text-sm text-rose-800">+ Remove all downloaded Whisper models from your cache directory to reclaim disk space. You can re-download any model later.+ </p>+ <Button+ variant="destructive"+ onClick={handleRemoveModels}+ disabled={isRemovingModels}+ className="w-full"+ >+ {isRemovingModels ? "Removing models..." : "Remove Downloaded Models"}+ </Button>+ <p className="text-xs text-rose-700">+ Current cache location: <code>{cachePathHint}</code>+ </p>+ </div></div></div>);@@ -737,55 +804,55 @@ export default function SettingsPage({)}{useLocalWhisper && whisperHook.whisperInstalled && (- <div className="space-y-4 p-4 bg-purple-50 border border-purple-200 rounded-xl">- <h4 className="font-medium text-purple-900">- Local Whisper Model- </h4>- <WhisperModelPicker- selectedModel={whisperModel}- onModelSelect={setWhisperModel}- variant="settings"- />- </div>- )}-- <div className="space-y-4 p-4 bg-gray-50 border border-gray-200 rounded-xl">- <h4 className="font-medium text-gray-900">Preferred Language</h4>- <LanguageSelector- value={preferredLanguage}- onChange={(value) => {- setPreferredLanguage(value);- updateTranscriptionSettings({ preferredLanguage: value });- }}- className="w-full"+ <div className="space-y-4 p-4 bg-purple-50 border border-purple-200 rounded-xl">+ <h4 className="font-medium text-purple-900">+ Local Whisper Model+ </h4>+ <WhisperModelPicker+ selectedModel={whisperModel}+ onModelSelect={setWhisperModel}+ variant="settings"/></div>+ )}- <Button- onClick={() => {- updateTranscriptionSettings({- useLocalWhisper,- whisperModel,- preferredLanguage,- });-- if (!useLocalWhisper && openaiApiKey.trim()) {- updateApiKeys({ openaiApiKey });- }-- showAlertDialog({- title: "Settings Saved",- description: `Transcription mode: ${- useLocalWhisper ? "Local Whisper" : "OpenAI API"- }. Language: ${preferredLanguage}.`,- });+ <div className="space-y-4 p-4 bg-gray-50 border border-gray-200 rounded-xl">+ <h4 className="font-medium text-gray-900">Preferred Language</h4>+ <LanguageSelector+ value={preferredLanguage}+ onChange={(value) => {+ setPreferredLanguage(value);+ updateTranscriptionSettings({ preferredLanguage: value });}}className="w-full"- >- Save Transcription Settings- </Button>+ /></div>- );++ <Button+ onClick={() => {+ updateTranscriptionSettings({+ useLocalWhisper,+ whisperModel,+ preferredLanguage,+ });++ if (!useLocalWhisper && openaiApiKey.trim()) {+ updateApiKeys({ openaiApiKey });+ }++ showAlertDialog({+ title: "Settings Saved",+ description: `Transcription mode: ${+ useLocalWhisper ? "Local Whisper" : "OpenAI API"+ }. Language: ${preferredLanguage}.`,+ });+ }}+ className="w-full"+ >+ Save Transcription Settings+ </Button>+ </div>+ );case "aiModels":return (@@ -945,6 +1012,8 @@ export default function SettingsPage({description={confirmDialog.description}onConfirm={confirmDialog.onConfirm}variant={confirmDialog.variant}+ confirmText={confirmDialog.confirmText}+ cancelText={confirmDialog.cancelText}/><AlertDialogdiff --git a/src/components/UnifiedModelPicker.tsx b/src/components/UnifiedModelPicker.tsxindex 401e7fd92..62acbcc4a 100644--- a/src/components/UnifiedModelPicker.tsx+++ b/src/components/UnifiedModelPicker.tsx@@ -248,6 +248,17 @@ export default function UnifiedModelPicker({loadModels();}, [loadModels]);+ useEffect(() => {+ const handleModelsCleared = () => {+ loadModels();+ };++ window.addEventListener("openwhispr-models-cleared", handleModelsCleared);+ return () => {+ window.removeEventListener("openwhispr-models-cleared", handleModelsCleared);+ };+ }, [loadModels]);+const handleDownloadProgress = useCallback((_event: any, data: any) => {if (modelType === 'whisper') {// Whisper progress format@@ -537,4 +548,4 @@ export default function UnifiedModelPicker({</div></div>);-}\ No newline at end of file+}diff --git a/src/helpers/ModelManager.ts b/src/helpers/ModelManager.tsindex 5234dd0e1..4dc74ab53 100644--- a/src/helpers/ModelManager.ts+++ b/src/helpers/ModelManager.ts@@ -151,6 +151,20 @@ class ModelManager {}}+ async deleteAllModels(): Promise<void> {+ try {+ await fsPromises.rm(this.modelsDir, { recursive: true, force: true });+ } catch (error: any) {+ throw new ModelError(+ `Failed to delete models directory: ${error.message}`,+ "DELETE_ALL_ERROR",+ { error: error.message }+ );+ } finally {+ await this.ensureModelsDir();+ }+ }+getDownloadProgress(modelId: string): DownloadProgress | undefined {return this.downloadProgress.get(modelId);}@@ -327,4 +341,4 @@ class ModelManager {}}-export default new ModelManager();\ No newline at end of file+export default new ModelManager();diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex 4d0fd2743..be2c0fbb7 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -46,10 +46,10 @@ class IPCHandlers {ipcMain.handle("hide-window", () => {if (process.platform === "darwin") {- this.windowManager.mainWindow.minimize();+ this.windowManager.hideDictationPanel();if (app.dock) app.dock.show();} else {- this.windowManager.mainWindow.hide();+ this.windowManager.hideDictationPanel();}});@@ -350,6 +350,21 @@ class IPCHandlers {}});+ ipcMain.handle("model-delete-all", async () => {+ try {+ const modelManager = require("./modelManagerBridge").default;+ await modelManager.deleteAllModels();+ return { success: true };+ } catch (error) {+ return {+ success: false,+ error: error.message,+ code: error.code,+ details: error.details,+ };+ }+ });+ipcMain.handle("model-check-runtime", async (event) => {try {const modelManager = require("./modelManagerBridge").default;diff --git a/src/helpers/modelManagerBridge.js b/src/helpers/modelManagerBridge.jsindex 07406f54c..b13a07e30 100644--- a/src/helpers/modelManagerBridge.js+++ b/src/helpers/modelManagerBridge.js@@ -312,6 +312,32 @@ class ModelManager {}}+ async deleteAllModels() {+ try {+ if (fsPromises.rm) {+ await fsPromises.rm(this.modelsDir, { recursive: true, force: true });+ } else {+ const entries = await fsPromises.readdir(this.modelsDir, { withFileTypes: true }).catch(() => []);+ for (const entry of entries) {+ const fullPath = path.join(this.modelsDir, entry.name);+ if (entry.isDirectory()) {+ await fsPromises.rmdir(fullPath, { recursive: true }).catch(() => {});+ } else {+ await fsPromises.unlink(fullPath).catch(() => {});+ }+ }+ }+ } catch (error) {+ throw new ModelError(+ `Failed to delete models directory: ${error.message}`,+ "DELETE_ALL_ERROR",+ { error: error.message }+ );+ } finally {+ await this.ensureModelsDirExists();+ }+ }+async ensureLlamaCpp() {// Simplify - isInstalled already checks system installationconst llamaCppInstaller = require("./llamaCppInstaller").default;@@ -409,4 +435,4 @@ module.exports = {default: new ModelManager(),ModelError,ModelNotFoundError-};\ No newline at end of file+};diff --git a/src/helpers/tray.js b/src/helpers/tray.jsindex 3a7c62800..5145a0294 100644--- a/src/helpers/tray.js+++ b/src/helpers/tray.js@@ -7,11 +7,25 @@ class TrayManager {this.tray = null;this.mainWindow = null;this.controlPanelWindow = null;+ this.windowManager = null;}setWindows(mainWindow, controlPanelWindow) {this.mainWindow = mainWindow;this.controlPanelWindow = controlPanelWindow;++ if (this.mainWindow) {+ this.mainWindow.on("show", () => this.updateTrayMenu?.());+ this.mainWindow.on("hide", () => this.updateTrayMenu?.());+ this.mainWindow.on("minimize", () => this.updateTrayMenu?.());+ this.mainWindow.on("restore", () => this.updateTrayMenu?.());+ }++ this.updateTrayMenu?.();+ }++ setWindowManager(windowManager) {+ this.windowManager = windowManager;}setCreateControlPanelCallback(callback) {@@ -31,7 +45,7 @@ class TrayManager {this.tray = new Tray(trayIcon);this.tray.setIgnoreDoubleClickEvents(true);- this.setupTrayMenu();+ this.updateTrayMenu();this.setupTrayEventHandlers();} catch (error) {console.error("Error creating tray icon:", error.message);@@ -127,15 +141,20 @@ class TrayManager {}}- setupTrayMenu() {- const contextMenu = Menu.buildFromTemplate([+ buildContextMenuTemplate() {+ const dictationVisible = this.windowManager?.isDictationPanelVisible?.() ?? false;++ return [{- label: "Show Dictation Panel",+ label: dictationVisible ? "Hide Dictation Panel" : "Show Dictation Panel",click: () => {- if (!this.mainWindow.isVisible()) {- this.mainWindow.show();+ if (!this.windowManager) return;+ if (this.windowManager.isDictationPanelVisible()) {+ this.windowManager.hideDictationPanel();+ } else {+ this.windowManager.showDictationPanel();}- this.mainWindow.focus();+ this.updateTrayMenu();},},{@@ -185,18 +204,20 @@ class TrayManager {app.quit();},},- ]);+ ];+ }+ updateTrayMenu() {+ if (!this.tray) return;++ const contextMenu = Menu.buildFromTemplate(this.buildContextMenuTemplate());this.tray.setToolTip("OpenWhispr - Voice Dictation");this.tray.setContextMenu(contextMenu);}setupTrayEventHandlers() {this.tray.on("click", () => {- if (!this.mainWindow.isVisible()) {- this.mainWindow.show();- }- this.mainWindow.focus();+ this.tray?.popUpContextMenu();});this.tray.on("destroyed", () => {diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.jsindex a06a05fc0..e89cc9db5 100644--- a/src/helpers/windowManager.js+++ b/src/helpers/windowManager.js@@ -200,6 +200,28 @@ class WindowManager {}}+ hideDictationPanel() {+ if (this.mainWindow && !this.mainWindow.isDestroyed()) {+ if (process.platform === "darwin") {+ this.mainWindow.hide();+ } else {+ this.mainWindow.minimize();+ }+ }+ }++ isDictationPanelVisible() {+ if (!this.mainWindow || this.mainWindow.isDestroyed()) {+ return false;+ }++ if (this.mainWindow.isMinimized && this.mainWindow.isMinimized()) {+ return false;+ }++ return this.mainWindow.isVisible();+ }+registerMainWindowEvents() {if (!this.mainWindow) {return;diff --git a/src/hooks/useDialogs.ts b/src/hooks/useDialogs.tsindex 662dd315e..8a72667ff 100644--- a/src/hooks/useDialogs.ts+++ b/src/hooks/useDialogs.ts@@ -6,6 +6,8 @@ export interface ConfirmDialogState {description?: string;onConfirm: () => void;variant?: "default" | "destructive";+ confirmText?: string;+ cancelText?: string;}export interface AlertDialogState {diff --git a/src/types/electron.ts b/src/types/electron.tsindex bb25cb7e1..1c2c77647 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -183,6 +183,7 @@ declare global {modelCheck: (modelId: string) => Promise<boolean>;modelDownload: (modelId: string) => Promise<void>;modelDelete: (modelId: string) => Promise<void>;+ modelDeleteAll: () => Promise<{ success: boolean; error?: string; code?: string }>;modelCheckRuntime: () => Promise<boolean>;onModelDownloadProgress: (callback: (event: any, data: any) => void) => void;