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: add configurable start position for voice recorder panel
Gabriel Stein3d51f5d66120
diff --git a/main.js b/main.jsindex 7b8c24bc6..d5d7f910a 100644--- a/main.js+++ b/main.js@@ -483,6 +483,10 @@ async function startApp() {}});+ ipcMain.on("panel-start-position-changed", (_event, position) => {+ windowManager.setPanelStartPosition(position);+ });+if (process.platform === "darwin") {app.setActivationPolicy("regular");}diff --git a/preload.js b/preload.jsindex 7a49960f9..b55e2851d 100644--- a/preload.js+++ b/preload.js@@ -471,6 +471,10 @@ contextBridge.exposeInMainWorld("electronAPI", {(callback) => (_event, enabled) => callback(enabled)),+ // Panel start position+ notifyPanelStartPositionChanged: (position) =>+ ipcRenderer.send("panel-start-position-changed", position),+// Auto-start managementgetAutoStartEnabled: () => ipcRenderer.invoke("get-auto-start-enabled"),setAutoStartEnabled: (enabled) => ipcRenderer.invoke("set-auto-start-enabled", enabled),diff --git a/src/App.jsx b/src/App.jsxindex 1777a0e07..f8bf7db04 100644--- a/src/App.jsx+++ b/src/App.jsx@@ -84,6 +84,7 @@ export default function App() {// Floating icon auto-hide setting (read from store, synced via IPC)const floatingIconAutoHide = useSettingsStore((s) => s.floatingIconAutoHide);+ const panelStartPosition = useSettingsStore((s) => s.panelStartPosition);const prevAutoHideRef = useRef(floatingIconAutoHide);const setWindowInteractivity = React.useCallback((shouldCapture) => {@@ -294,8 +295,16 @@ export default function App() {return (<div className="dictation-window">- {/* Bottom-right voice button - window expands upward/leftward */}- <div className="fixed bottom-6 right-6 z-50">+ {/* Voice button - position determined by panelStartPosition setting */}+ <div+ className={`fixed bottom-1 z-50 ${+ panelStartPosition === "bottom-left"+ ? "left-1"+ : panelStartPosition === "center"+ ? "left-1/2 -translate-x-1/2"+ : "right-1"+ }`}+ ><divclassName="relative flex items-center gap-2"onMouseEnter={() => {diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex b3f1a040b..826e79763 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -679,6 +679,8 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPagesetPauseMediaOnDictation,floatingIconAutoHide,setFloatingIconAutoHide,+ panelStartPosition,+ setPanelStartPosition,cloudBackupEnabled,setCloudBackupEnabled,telemetryEnabled,@@ -1739,6 +1741,32 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage<Toggle checked={floatingIconAutoHide} onChange={setFloatingIconAutoHide} /></SettingsRow></SettingsPanelRow>+ <SettingsPanelRow>+ <SettingsRow+ label={t("settingsPage.general.floatingIcon.startPosition")}+ description={t("settingsPage.general.floatingIcon.startPositionDescription")}+ >+ <select+ value={panelStartPosition}+ onChange={(e) =>+ setPanelStartPosition(+ e.target.value as "bottom-right" | "center" | "bottom-left"+ )+ }+ className="h-7 rounded border border-border/70 bg-surface-1/80 px-2.5 text-xs font-medium text-foreground shadow-sm backdrop-blur-sm hover:border-border-hover hover:bg-surface-2/70 focus:outline-none focus:ring-2 focus:ring-ring/30 focus:ring-offset-1 transition-colors duration-200"+ >+ <option value="bottom-right">+ {t("settingsPage.general.floatingIcon.bottomRight")}+ </option>+ <option value="center">+ {t("settingsPage.general.floatingIcon.center")}+ </option>+ <option value="bottom-left">+ {t("settingsPage.general.floatingIcon.bottomLeft")}+ </option>+ </select>+ </SettingsRow>+ </SettingsPanelRow></SettingsPanel></div>diff --git a/src/helpers/mediaPlayer.js b/src/helpers/mediaPlayer.jsindex 595effad3..dd8095ff4 100644--- a/src/helpers/mediaPlayer.js+++ b/src/helpers/mediaPlayer.js@@ -186,11 +186,17 @@ class MediaPlayer {const status = this._getMprisPlaybackStatus(dest);if (status !== "Playing") continue;- const result = spawnSync("dbus-send", [- "--session", "--type=method_call", `--dest=${dest}`,- "/org/mpris/MediaPlayer2",- "org.mpris.MediaPlayer2.Player.Pause",- ], { stdio: "pipe", timeout: 2000 });+ const result = spawnSync(+ "dbus-send",+ [+ "--session",+ "--type=method_call",+ `--dest=${dest}`,+ "/org/mpris/MediaPlayer2",+ "org.mpris.MediaPlayer2.Player.Pause",+ ],+ { stdio: "pipe", timeout: 2000 }+ );if (result.status === 0) {debugLogger.debug("Media paused via MPRIS", { player: dest }, "media");@@ -204,11 +210,17 @@ class MediaPlayer {let resumed = false;for (const dest of this._pausedPlayers) {if (dest === "playerctl") continue;- const result = spawnSync("dbus-send", [- "--session", "--type=method_call", `--dest=${dest}`,- "/org/mpris/MediaPlayer2",- "org.mpris.MediaPlayer2.Player.Play",- ], { stdio: "pipe", timeout: 2000 });+ const result = spawnSync(+ "dbus-send",+ [+ "--session",+ "--type=method_call",+ `--dest=${dest}`,+ "/org/mpris/MediaPlayer2",+ "org.mpris.MediaPlayer2.Player.Play",+ ],+ { stdio: "pipe", timeout: 2000 }+ );if (result.status === 0) {debugLogger.debug("Media resumed via MPRIS", { player: dest }, "media");@@ -219,13 +231,19 @@ class MediaPlayer {}_getMprisPlaybackStatus(dest) {- const result = spawnSync("dbus-send", [- "--session", "--print-reply", `--dest=${dest}`,- "/org/mpris/MediaPlayer2",- "org.freedesktop.DBus.Properties.Get",- "string:org.mpris.MediaPlayer2.Player",- "string:PlaybackStatus",- ], { stdio: "pipe", timeout: 2000 });+ const result = spawnSync(+ "dbus-send",+ [+ "--session",+ "--print-reply",+ `--dest=${dest}`,+ "/org/mpris/MediaPlayer2",+ "org.freedesktop.DBus.Properties.Get",+ "string:org.mpris.MediaPlayer2.Player",+ "string:PlaybackStatus",+ ],+ { stdio: "pipe", timeout: 2000 }+ );if (result.status !== 0) return null;@@ -235,11 +253,18 @@ class MediaPlayer {}_listMprisPlayers() {- const listResult = spawnSync("dbus-send", [- "--session", "--dest=org.freedesktop.DBus", "--type=method_call",- "--print-reply", "/org/freedesktop/DBus",- "org.freedesktop.DBus.ListNames",- ], { stdio: "pipe", timeout: 2000 });+ const listResult = spawnSync(+ "dbus-send",+ [+ "--session",+ "--dest=org.freedesktop.DBus",+ "--type=method_call",+ "--print-reply",+ "/org/freedesktop/DBus",+ "org.freedesktop.DBus.ListNames",+ ],+ { stdio: "pipe", timeout: 2000 }+ );if (listResult.status !== 0) return [];@@ -247,7 +272,7 @@ class MediaPlayer {const matches = output.match(/string "org\.mpris\.MediaPlayer2\.[A-Za-z0-9_.\-]+"/g);if (!matches || matches.length === 0) return [];- return matches.map(m => m.replace(/^string "/, "").replace(/"$/, ""));+ return matches.map((m) => m.replace(/^string "/, "").replace(/"$/, ""));}// --- Linux toggle (legacy, used by toggleMedia) ---@@ -286,11 +311,17 @@ class MediaPlayer {let toggled = false;for (const dest of players) {- const result = spawnSync("dbus-send", [- "--session", "--type=method_call", `--dest=${dest}`,- "/org/mpris/MediaPlayer2",- "org.mpris.MediaPlayer2.Player.PlayPause",- ], { stdio: "pipe", timeout: 2000 });+ const result = spawnSync(+ "dbus-send",+ [+ "--session",+ "--type=method_call",+ `--dest=${dest}`,+ "/org/mpris/MediaPlayer2",+ "org.mpris.MediaPlayer2.Player.PlayPause",+ ],+ { stdio: "pipe", timeout: 2000 }+ );if (result.status === 0) {debugLogger.debug("Media toggled via MPRIS", { player: dest }, "media");@@ -352,13 +383,14 @@ class MediaPlayer {}_sendMacMediaKey() {- const result = spawnSync("osascript", [- "-e",- 'tell application "System Events" to key code 100',- ], {- stdio: "pipe",- timeout: 3000,- });+ const result = spawnSync(+ "osascript",+ ["-e", 'tell application "System Events" to key code 100'],+ {+ stdio: "pipe",+ timeout: 3000,+ }+ );if (result.status === 0) {debugLogger.debug("Media key sent via osascript", {}, "media");return true;@@ -367,13 +399,14 @@ class MediaPlayer {}_toggleMacOS() {- const result = spawnSync("osascript", [- "-e",- 'tell application "System Events" to key code 100',- ], {- stdio: "pipe",- timeout: 3000,- });+ const result = spawnSync(+ "osascript",+ ["-e", 'tell application "System Events" to key code 100'],+ {+ stdio: "pipe",+ timeout: 3000,+ }+ );if (result.status === 0) {debugLogger.debug("Media toggled via osascript", {}, "media");return true;@@ -403,7 +436,7 @@ try {}_gsmtcResumeScript(appIds) {- const idList = appIds.map(id => `'${id.replace(/'/g, "''")}'`).join(",");+ const idList = appIds.map((id) => `'${id.replace(/'/g, "''")}'`).join(",");return `try {$ids = @(${idList})@@ -430,13 +463,19 @@ try {if (result.status === 0) return true;}- const result = spawnSync("powershell", [- "-NoProfile", "-NonInteractive", "-Command",- "Add-Type -TypeDefinition 'using System.Runtime.InteropServices; public class KB { [DllImport(\"user32.dll\")] public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo); }'; [KB]::keybd_event(0xB3, 0, 1, 0); [KB]::keybd_event(0xB3, 0, 3, 0)",- ], {- stdio: "pipe",- timeout: 5000,- });+ const result = spawnSync(+ "powershell",+ [+ "-NoProfile",+ "-NonInteractive",+ "-Command",+ "Add-Type -TypeDefinition 'using System.Runtime.InteropServices; public class KB { [DllImport(\"user32.dll\")] public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo); }'; [KB]::keybd_event(0xB3, 0, 1, 0); [KB]::keybd_event(0xB3, 0, 3, 0)",+ ],+ {+ stdio: "pipe",+ timeout: 5000,+ }+ );return result.status === 0;}@@ -444,10 +483,11 @@ try {this._pausedWinApps = [];// Try GSMTC first (Windows 10 1809+)- const result = spawnSync("powershell", [- "-NoProfile", "-NonInteractive", "-Command",- this._gsmtcPauseScript(),- ], { stdio: "pipe", timeout: 5000 });+ const result = spawnSync(+ "powershell",+ ["-NoProfile", "-NonInteractive", "-Command", this._gsmtcPauseScript()],+ { stdio: "pipe", timeout: 5000 }+ );if (result.status === 0) {const output = (result.stdout?.toString() || "").trim();@@ -479,10 +519,11 @@ try {const apps = this._pausedWinApps;this._pausedWinApps = [];- const result = spawnSync("powershell", [- "-NoProfile", "-NonInteractive", "-Command",- this._gsmtcResumeScript(apps),- ], { stdio: "pipe", timeout: 5000 });+ const result = spawnSync(+ "powershell",+ ["-NoProfile", "-NonInteractive", "-Command", this._gsmtcResumeScript(apps)],+ { stdio: "pipe", timeout: 5000 }+ );if (result.status === 0) {debugLogger.debug("Media resumed via GSMTC", { apps }, "media");diff --git a/src/helpers/windowConfig.js b/src/helpers/windowConfig.jsindex 82f1cb0f1..899922cca 100644--- a/src/helpers/windowConfig.js+++ b/src/helpers/windowConfig.js@@ -84,12 +84,24 @@ const CONTROL_PANEL_CONFIG = {};class WindowPositionUtil {- static getMainWindowPosition(display, customSize = null) {+ static getMainWindowPosition(display, customSize = null, position = "bottom-right") {const { width, height } = customSize || WINDOW_SIZES.BASE;- const MARGIN = 24;+ const MARGIN = 4;const workArea = display.workArea || display.bounds;- const x = Math.max(0, workArea.x + workArea.width - width - MARGIN);- const y = Math.max(0, workArea.y + workArea.height - height - MARGIN);++ let x, y;+ if (position === "bottom-left") {+ x = workArea.x + MARGIN;+ y = Math.max(0, workArea.y + workArea.height - height - MARGIN);+ } else if (position === "center") {+ x = Math.round(workArea.x + (workArea.width - width) / 2);+ y = Math.max(0, workArea.y + workArea.height - height - MARGIN);+ } else {+ // bottom-right (default)+ x = Math.max(0, workArea.x + workArea.width - width - MARGIN);+ y = Math.max(0, workArea.y + workArea.height - height - MARGIN);+ }+return { x, y, width, height };}diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.jsindex 9dd234773..6e3f7d1d4 100644--- a/src/helpers/windowManager.js+++ b/src/helpers/windowManager.js@@ -28,6 +28,7 @@ class WindowManager {this.winPushState = null;this._cachedActivationMode = "tap";this._floatingIconAutoHide = false;+ this._panelStartPosition = "bottom-right";app.on("before-quit", () => {this.isQuitting = true;@@ -36,7 +37,11 @@ class WindowManager {async createMainWindow() {const display = screen.getPrimaryDisplay();- const position = WindowPositionUtil.getMainWindowPosition(display);+ const position = WindowPositionUtil.getMainWindowPosition(+ display,+ null,+ this._panelStartPosition+ );this.mainWindow = new BrowserWindow({...MAIN_WINDOW_CONFIG,@@ -101,16 +106,33 @@ class WindowManager {const newSize = WINDOW_SIZES[sizeKey] || WINDOW_SIZES.BASE;const currentBounds = this.mainWindow.getBounds();+ const position = this._panelStartPosition;- const bottomRightX = currentBounds.x + currentBounds.width;- const bottomRightY = currentBounds.y + currentBounds.height;-- const display = screen.getDisplayNearestPoint({ x: bottomRightX, y: bottomRightY });+ const display = screen.getDisplayNearestPoint({+ x: currentBounds.x + currentBounds.width / 2,+ y: currentBounds.y + currentBounds.height,+ });const workArea = display.workArea || display.bounds;- let newX = bottomRightX - newSize.width;- let newY = bottomRightY - newSize.height;+ let newX, newY;++ if (position === "bottom-left") {+ // Anchor bottom-left corner: keep x, expand rightward and upward+ newX = currentBounds.x;+ newY = currentBounds.y + currentBounds.height - newSize.height;+ } else if (position === "center") {+ // Anchor bottom-center: expand symmetrically and upward+ const centerX = currentBounds.x + currentBounds.width / 2;+ newX = centerX - newSize.width / 2;+ newY = currentBounds.y + currentBounds.height - newSize.height;+ } else {+ // bottom-right (default): anchor bottom-right corner, expand leftward and upward+ const bottomRightX = currentBounds.x + currentBounds.width;+ newX = bottomRightX - newSize.width;+ newY = currentBounds.y + currentBounds.height - newSize.height;+ }+ // Clamp to work areanewX = Math.max(workArea.x, Math.min(newX, workArea.x + workArea.width - newSize.width));newY = Math.max(workArea.y, Math.min(newY, workArea.y + workArea.height - newSize.height));@@ -400,6 +422,24 @@ class WindowManager {this._floatingIconAutoHide = Boolean(enabled);}+ setPanelStartPosition(position) {+ this._panelStartPosition = position || "bottom-right";+ // Reposition the window immediately+ if (this.mainWindow && !this.mainWindow.isDestroyed()) {+ const currentBounds = this.mainWindow.getBounds();+ const display = screen.getDisplayNearestPoint({+ x: currentBounds.x + currentBounds.width / 2,+ y: currentBounds.y + currentBounds.height / 2,+ });+ const newPos = WindowPositionUtil.getMainWindowPosition(+ display,+ { width: currentBounds.width, height: currentBounds.height },+ this._panelStartPosition+ );+ this.mainWindow.setBounds(newPos);+ }+ }+setHotkeyListeningMode(enabled) {this.hotkeyManager.setListeningMode(enabled);}diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.tsindex d1ac81849..eee4548bb 100644--- a/src/hooks/useSettings.ts+++ b/src/hooks/useSettings.ts@@ -218,6 +218,8 @@ function useSettingsInternal() {setPauseMediaOnDictation: store.setPauseMediaOnDictation,floatingIconAutoHide: store.floatingIconAutoHide,setFloatingIconAutoHide: store.setFloatingIconAutoHide,+ panelStartPosition: store.panelStartPosition,+ setPanelStartPosition: store.setPanelStartPosition,preferBuiltInMic: store.preferBuiltInMic,selectedMicDeviceId: store.selectedMicDeviceId,setPreferBuiltInMic: store.setPreferBuiltInMic,diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex b49369a5f..6428596fc 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -1071,6 +1071,11 @@"floatingIcon": {"autoHide": "Auto-hide when idle","autoHideDescription": "Keep the icon hidden until you start dictating",+ "startPosition": "Start position",+ "startPositionDescription": "Where the voice recorder panel appears on screen",+ "bottomRight": "Bottom Right",+ "center": "Bottom Center",+ "bottomLeft": "Bottom Left","description": "Control when the dictation icon is visible on your screen","title": "Floating Icon"},diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.tsindex bc6a5e474..d884d1e5b 100644--- a/src/stores/settingsStore.ts+++ b/src/stores/settingsStore.ts@@ -88,6 +88,7 @@ export interface SettingsStateaudioCuesEnabled: boolean;pauseMediaOnDictation: boolean;floatingIconAutoHide: boolean;+ panelStartPosition: "bottom-right" | "center" | "bottom-left";setUseLocalWhisper: (value: boolean) => void;setWhisperModel: (value: string) => void;@@ -129,7 +130,9 @@ export interface SettingsStatesetTelemetryEnabled: (value: boolean) => void;setAudioRetentionDays: (days: number) => void;setAudioCuesEnabled: (value: boolean) => void;+ setPauseMediaOnDictation: (value: boolean) => void;setFloatingIconAutoHide: (enabled: boolean) => void;+ setPanelStartPosition: (position: "bottom-right" | "center" | "bottom-left") => void;setIsSignedIn: (value: boolean) => void;updateTranscriptionSettings: (settings: Partial<TranscriptionSettings>) => void;@@ -249,6 +252,11 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({audioCuesEnabled: readBoolean("audioCuesEnabled", true),pauseMediaOnDictation: readBoolean("pauseMediaOnDictation", false),floatingIconAutoHide: readBoolean("floatingIconAutoHide", false),+ panelStartPosition: (() => {+ const v = readString("panelStartPosition", "bottom-right");+ if (v === "bottom-right" || v === "center" || v === "bottom-left") return v;+ return "bottom-right" as const;+ })(),isSignedIn: readBoolean("isSignedIn", false),setUseLocalWhisper: createBooleanSetter("useLocalWhisper"),@@ -387,6 +395,15 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({}},+ setPanelStartPosition: (position: "bottom-right" | "center" | "bottom-left") => {+ if (get().panelStartPosition === position) return;+ if (isBrowser) localStorage.setItem("panelStartPosition", position);+ set({ panelStartPosition: position });+ if (isBrowser) {+ window.electronAPI?.notifyPanelStartPositionChanged?.(position);+ }+ },+setIsSignedIn: (value: boolean) => {if (isBrowser) localStorage.setItem("isSignedIn", String(value));set({ isSignedIn: value });diff --git a/src/types/electron.ts b/src/types/electron.tsindex b72bdbd37..3a5ad9aca 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -707,6 +707,7 @@ declare global {notifyHotkeyChanged?: (hotkey: string) => void;notifyFloatingIconAutoHideChanged?: (enabled: boolean) => void;onFloatingIconAutoHideChanged?: (callback: (enabled: boolean) => void) => () => void;+ notifyPanelStartPositionChanged?: (position: string) => void;// Auto-start at logingetAutoStartEnabled?: () => Promise<boolean>;