Skip to content

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

feat: add platform detection and close window functionality for Windows

ayalda56940cb5b361
diff --git a/preload.js b/preload.js
index 023c6f9f6..6eec28a04 100644
--- a/preload.js
+++ b/preload.js
@@ -61,6 +61,7 @@ contextBridge.exposeInMainWorld("electronAPI", {
windowMaximize: () => ipcRenderer.invoke("window-maximize"),
windowClose: () => ipcRenderer.invoke("window-close"),
windowIsMaximized: () => ipcRenderer.invoke("window-is-maximized"),
+ getPlatform: () => process.platform,
// Cleanup function
cleanupApp: () => ipcRenderer.invoke("cleanup-app"),
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsx
index d0263a7ec..dfd292140 100644
--- a/src/components/ControlPanel.tsx
+++ b/src/components/ControlPanel.tsx
@@ -1,7 +1,7 @@
import { useState, useEffect } from "react";
import { Card, CardContent, CardHeader, CardTitle } from "./ui/card";
import { Button } from "./ui/button";
-import { Trash2, RefreshCw, Settings, FileText, Mic } from "lucide-react";
+import { Trash2, RefreshCw, Settings, FileText, Mic, X } from "lucide-react";
import SettingsModal from "./SettingsModal";
import TitleBar from "./TitleBar";
import SupportDropdown from "./ui/SupportDropdown";
@@ -23,6 +23,7 @@ export default function ControlPanel() {
updateDownloaded: false,
isDevelopment: false,
});
+ const isWindows = typeof window !== "undefined" && window.electronAPI?.getPlatform?.() === "win32";
const {
confirmDialog,
@@ -33,6 +34,10 @@ export default function ControlPanel() {
hideAlertDialog,
} = useDialogs();
+ const handleClose = () => {
+ void window.electronAPI.windowClose();
+ };
+
useEffect(() => {
// Load transcription history from database
loadTranscriptions();
@@ -198,6 +203,19 @@ export default function ControlPanel() {
>
<Settings size={16} />
</Button>
+ {isWindows && (
+ <div className="flex items-center gap-1 ml-2">
+ <Button
+ variant="ghost"
+ size="icon"
+ className="text-red-600 hover:text-red-700 hover:bg-red-50"
+ onClick={handleClose}
+ aria-label="Close window"
+ >
+ <X size={14} />
+ </Button>
+ </div>
+ )}
</>
}
/>
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 1c2c77647..ec2239ae9 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -204,6 +204,7 @@ declare global {
windowMaximize: () => Promise<void>;
windowClose: () => Promise<void>;
windowIsMaximized: () => Promise<boolean>;
+ getPlatform: () => string;
startWindowDrag: () => Promise<void>;
stopWindowDrag: () => Promise<void>;
setMainWindowInteractivity: (interactive: boolean) => Promise<void>;