Skip to content

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

cleanups: build cleanups

Gabriel Stein7315b695a634
diff --git a/electron-builder.json b/electron-builder.json
index 55aa6aba7..dcef0cf7b 100644
--- a/electron-builder.json
+++ b/electron-builder.json
@@ -11,11 +11,18 @@
"package.json",
"node_modules/**/*",
"src/dist/**/*",
+ "src/helpers/**/*",
+ "src/hooks/**/*",
+ "src/types/**/*",
+ "src/utils.js",
+ "src/updater.js",
+ "src/components.json",
"!node_modules/.cache/**/*",
"!src/node_modules/**/*"
],
"asarUnpack": [
- "assets/**/*"
+ "assets/**/*",
+ "whisper_bridge.py"
],
"extraResources": [
"assets/**/*"
diff --git a/package.json b/package.json
index b4d5f5041..a73de1119 100644
--- a/package.json
+++ b/package.json
@@ -10,6 +10,7 @@
"dev:main": "NODE_ENV=development electron . --dev",
"dev:renderer": "cd src && vite",
"build": "cd src && vite build && cd .. && electron-builder",
+ "postinstall": "electron-builder install-app-deps",
"build:renderer": "cd src && vite build",
"build:mac": "npm run build:renderer && electron-builder --mac",
"build:win": "npm run build:renderer && electron-builder --win",
@@ -31,7 +32,6 @@
"author": "OpenWispr Team",
"license": "MIT",
"devDependencies": {
- "@electron/rebuild": "^4.0.1",
"@esbuild/darwin-arm64": "^0.25.5",
"@eslint/js": "^9.25.0",
"@tailwindcss/vite": "^4.1.10",
diff --git a/src/helpers/tray.js b/src/helpers/tray.js
index 592a9b93c..275f8a670 100644
--- a/src/helpers/tray.js
+++ b/src/helpers/tray.js
@@ -22,12 +22,14 @@ class TrayManager {
if (process.platform !== "darwin") return;
try {
+ console.log("πŸ”„ Creating tray icon...");
const trayIcon = await this.loadTrayIcon();
if (!trayIcon || trayIcon.isEmpty()) {
- console.error("Failed to load tray icon");
+ console.error("❌ Failed to load tray icon - icon is empty or null");
return;
}
+ console.log("πŸ”§ Setting up tray icon...");
trayIcon.setTemplateImage(true);
this.tray = new Tray(trayIcon);
@@ -37,7 +39,11 @@ class TrayManager {
console.log("βœ… Tray icon created successfully");
} catch (error) {
- console.error("Error creating tray icon:", error);
+ console.error("❌ Error creating tray icon:", error);
+ console.error("Error details:", {
+ message: error.message,
+ stack: error.stack,
+ });
}
}
@@ -50,7 +56,14 @@ class TrayManager {
"assets",
);
- return nativeImage.createFromPath(iconPath);
+ console.log("πŸ” Looking for tray icon at:", iconPath);
+ if (fs.existsSync(iconPath)) {
+ console.log("βœ… Found tray icon at:", iconPath);
+ return nativeImage.createFromPath(iconPath);
+ } else {
+ console.error("❌ Tray icon not found at:", iconPath);
+ return this.createFallbackIcon();
+ }
} else {
const possiblePaths = [
path.join(process.resourcesPath, "assets", "[email protected]"),
diff --git a/src/helpers/whisper.js b/src/helpers/whisper.js
index c3db8a9aa..4c8528bdb 100644
--- a/src/helpers/whisper.js
+++ b/src/helpers/whisper.js
@@ -12,6 +12,20 @@ class WhisperManager {
this.currentDownloadProcess = null; // Track current download process for cancellation
}
+ getWhisperScriptPath() {
+ // In production, the file is unpacked from ASAR
+ if (process.env.NODE_ENV === "development") {
+ return path.join(__dirname, "..", "..", "whisper_bridge.py");
+ } else {
+ // In production, use the unpacked path
+ return path.join(
+ process.resourcesPath,
+ "app.asar.unpacked",
+ "whisper_bridge.py"
+ );
+ }
+ }
+
async initializeAtStartup() {
try {
// Initialize Python path and Whisper installation status
@@ -69,12 +83,7 @@ class WhisperManager {
async runWhisperProcess(tempAudioPath, model, language) {
const pythonCmd = await this.findPythonExecutable();
- const whisperScriptPath = path.join(
- __dirname,
- "..",
- "..",
- "whisper_bridge.py"
- );
+ const whisperScriptPath = this.getWhisperScriptPath();
const args = [whisperScriptPath, tempAudioPath, "--model", model];
if (language) {
args.push("--language", language);
@@ -336,12 +345,7 @@ class WhisperManager {
console.log(`πŸ“₯ Starting download of Whisper model: ${modelName}`);
const pythonCmd = await this.findPythonExecutable();
- const whisperScriptPath = path.join(
- __dirname,
- "..",
- "..",
- "whisper_bridge.py"
- );
+ const whisperScriptPath = this.getWhisperScriptPath();
const args = [
whisperScriptPath,
@@ -481,12 +485,7 @@ class WhisperManager {
console.log(`πŸ” Checking status of Whisper model: ${modelName}`);
const pythonCmd = await this.findPythonExecutable();
- const whisperScriptPath = path.join(
- __dirname,
- "..",
- "..",
- "whisper_bridge.py"
- );
+ const whisperScriptPath = this.getWhisperScriptPath();
const args = [whisperScriptPath, "--mode", "check", "--model", modelName];
@@ -540,12 +539,7 @@ class WhisperManager {
console.log("πŸ“‹ Listing all Whisper models...");
const pythonCmd = await this.findPythonExecutable();
- const whisperScriptPath = path.join(
- __dirname,
- "..",
- "..",
- "whisper_bridge.py"
- );
+ const whisperScriptPath = this.getWhisperScriptPath();
const args = [whisperScriptPath, "--mode", "list"];
@@ -597,12 +591,7 @@ class WhisperManager {
console.log(`πŸ—‘οΈ Deleting Whisper model: ${modelName}`);
const pythonCmd = await this.findPythonExecutable();
- const whisperScriptPath = path.join(
- __dirname,
- "..",
- "..",
- "whisper_bridge.py"
- );
+ const whisperScriptPath = this.getWhisperScriptPath();
const args = [
whisperScriptPath,
diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.js
index 995583a82..925b88932 100644
--- a/src/helpers/windowManager.js
+++ b/src/helpers/windowManager.js
@@ -15,11 +15,21 @@ class WindowManager {
}
async createMainWindow() {
+ console.log("πŸ”„ Creating main window...");
const display = screen.getPrimaryDisplay();
const width = 100;
const height = 100;
- const x = display.bounds.x + display.workArea.width - width;
- const y = display.bounds.y + display.workArea.height;
+ // Position window in bottom-right corner, but ensure it's visible
+ const x = Math.max(
+ 0,
+ display.bounds.x + display.workArea.width - width - 20
+ );
+ const y = Math.max(
+ 0,
+ display.bounds.y + display.workArea.height - height - 20
+ );
+
+ console.log("πŸ“ Window dimensions:", { width, height, x, y });
this.mainWindow = new BrowserWindow({
width,
@@ -38,11 +48,17 @@ class WindowManager {
resizable: false,
transparent: true,
show: true,
+ skipTaskbar: false,
+ focusable: true,
});
+ console.log("πŸ“± Loading main window content...");
await this.loadMainWindow();
+ console.log("⌨️ Setting up shortcuts...");
this.setupShortcuts();
+ console.log("🍎 Setting up menu...");
this.setupMenu();
+ console.log("βœ… Main window created successfully");
this.mainWindow.webContents.on(
"did-fail-load",
@@ -70,15 +86,26 @@ class WindowManager {
);
this.mainWindow.webContents.on("did-finish-load", () => {
+ console.log("πŸ“± Main window content loaded");
setTimeout(() => {
if (!this.mainWindow.isVisible()) {
- console.log("Window not visible, forcing show...");
+ console.log("⚠️ Window not visible, forcing show...");
this.mainWindow.show();
this.mainWindow.focus();
+ } else {
+ console.log("βœ… Main window is visible");
}
}, 1000);
});
+ this.mainWindow.on("show", () => {
+ console.log("🎯 Main window shown");
+ });
+
+ this.mainWindow.on("focus", () => {
+ console.log("🎯 Main window focused");
+ });
+
// Ensure window is always on top, even above fullscreen apps
this.mainWindow.setAlwaysOnTop(true, "screen-saver");
this.mainWindow.setVisibleOnAllWorkspaces(true, {
@@ -131,7 +158,9 @@ class WindowManager {
}
async createControlPanelWindow() {
+ console.log("πŸ”„ Creating control panel window...");
if (this.controlPanelWindow) {
+ console.log("πŸ“‹ Control panel already exists, focusing...");
this.controlPanelWindow.focus();
return;
}
@@ -158,10 +187,13 @@ class WindowManager {
closable: true,
fullscreenable: true,
});
+ console.log("πŸ“± Loading control panel content...");
await this.loadControlPanel();
this.controlPanelWindow.on("closed", () => {
+ console.log("πŸ“‹ Control panel window closed");
this.controlPanelWindow = null;
});
+ console.log("βœ… Control panel window created successfully");
}
async loadControlPanel() {
@@ -236,9 +268,10 @@ class WindowManager {
"dist",
"index.html"
);
- return isControlPanel
+ const url = isControlPanel
? `file://${htmlPath}?panel=true`
: `file://${htmlPath}`;
+ return url;
}
}
}