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 hotkey support and error messaging on windows/linux
Gabriel Stein405fde9ad1fd
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ec44057e3..72013b303 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,16 +9,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Added- **Dictation Panel Command Menu**: Clicking the floating panel reveals quick actions, including a one-click "Hide this for now" option.+- **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.### 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.- **Dictation Overlay Canvas**: Enlarged the floating window so tooltips, menus, and error states render without being clipped while keeping click-through behaviour outside interactive elements.+- **Keyboard UX**: Virtual keyboard hides macOS-exclusive keys on Windows/Linux and standardises hotkey labels.### Fixed- **macOS Window Lifecycle**: Ensured the dictation panel keeps the app visible in Dock and Command-Tab while retaining floating behaviour across spaces.- **Control Panel Stability**: Reworked close/minimize handling so the panel stays interactive when switching apps and reopens cleanly without spawning duplicate windows.- **Always-On-Top Enforcement**: Centralised the logic that reapplies floating window levels, eliminating redundant timers and focus quirks.- **Menu Labelling**: macOS application menu items now display the correct OpenWhispr casing instead of "open-whispr".+- **Non-mac Hotkey Guard**: Prevented the mac-only Globe shortcut from being saved on Windows/Linux.## [1.0.5] - 2025-09-10diff --git a/README.md b/README.mdindex e3976ea68..073d5362b 100644--- a/README.md+++ b/README.md@@ -26,11 +26,13 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file- ⚡ **Automatic Pasting**: Transcribed text automatically pastes at your cursor location- 🖱️ **Draggable Interface**: Move the dictation panel anywhere on your screen- 🔄 **OpenAI Responses API**: Using the latest Responses API for improved performance+- 🌐 **Globe Key Toggle (macOS)**: Optional Fn/Globe key listener for a hardware-level dictation trigger## Prerequisites- **Node.js 18+** and npm (Download from [nodejs.org](https://nodejs.org/))- **macOS 10.15+**, **Windows 10+**, or **Linux**+- On macOS, Globe key support requires the Xcode Command Line Tools (`xcode-select --install`) so the bundled Swift helper can run- **Python 3.7+** (Optional - the app can install it automatically for local Whisper processing)## Quick Startdiff --git a/electron-builder.json b/electron-builder.jsonindex 90c643f46..78cb8f41c 100644--- a/electron-builder.json+++ b/electron-builder.json@@ -29,7 +29,8 @@"**/node_modules/better-sqlite3/**/*"],"extraResources": [- "src/assets/**/*"+ "src/assets/**/*",+ "resources/macos-globe-listener.swift"],"mac": {"category": "public.app-category.productivity",diff --git a/main.js b/main.jsindex 905461c96..b4759c85e 100644--- a/main.js+++ b/main.js@@ -30,6 +30,7 @@ const WhisperManager = require("./src/helpers/whisper");const TrayManager = require("./src/helpers/tray");const IPCHandlers = require("./src/helpers/ipcHandlers");const UpdateManager = require("./src/updater");+const GlobeKeyManager = require("./src/helpers/globeKeyManager");// Set up PATH for production builds to find system Pythonfunction setupProductionPath() {@@ -61,11 +62,13 @@ setupProductionPath();// Initialize managersconst environmentManager = new EnvironmentManager();const windowManager = new WindowManager();+const hotkeyManager = windowManager.hotkeyManager;const databaseManager = new DatabaseManager();const clipboardManager = new ClipboardManager();const whisperManager = new WhisperManager();const trayManager = new TrayManager();const updateManager = new UpdateManager();+const globeKeyManager = new GlobeKeyManager();// Initialize IPC handlers with all managersconst ipcHandlers = new IPCHandlers({@@ -125,6 +128,21 @@ async function startApp() {windowManager.controlPanelWindow);updateManager.checkForUpdatesOnStartup();++ if (process.platform === "darwin") {+ globeKeyManager.on("globe-down", () => {+ if (hotkeyManager.getCurrentHotkey && hotkeyManager.getCurrentHotkey() === "GLOBE") {+ if (+ windowManager.mainWindow &&+ !windowManager.mainWindow.isDestroyed()+ ) {+ windowManager.mainWindow.webContents.send("toggle-dictation");+ }+ }+ });++ globeKeyManager.start();+ }}// App event handlers@@ -188,4 +206,5 @@ app.on("activate", () => {app.on("will-quit", () => {globalShortcut.unregisterAll();+ globeKeyManager.stop();});diff --git a/resources/macos-globe-listener.swift b/resources/macos-globe-listener.swiftnew file mode 100644index 000000000..fe550d74f--- /dev/null+++ b/resources/macos-globe-listener.swift@@ -0,0 +1,56 @@+import Cocoa+import Foundation+import Darwin++let mask = CGEventMask(1 << CGEventType.flagsChanged.rawValue)+var fnIsDown = false+var eventTap: CFMachPort?++func eventTapCallback(proxy: CGEventTapProxy, type: CGEventType, event: CGEvent, refcon: UnsafeMutableRawPointer?) -> Unmanaged<CGEvent>? {+ if type == .tapDisabledByTimeout || type == .tapDisabledByUserInput {+ if let tap = eventTap {+ CGEvent.tapEnable(tap: tap, enable: true)+ }+ return Unmanaged.passUnretained(event)+ }++ let flags = event.flags+ let containsFn = flags.contains(.maskSecondaryFn)++ if containsFn && !fnIsDown {+ fnIsDown = true+ FileHandle.standardOutput.write("FN_DOWN\n".data(using: .utf8)!)+ fflush(stdout)+ } else if !containsFn && fnIsDown {+ fnIsDown = false+ FileHandle.standardOutput.write("FN_UP\n".data(using: .utf8)!)+ fflush(stdout)+ }++ return Unmanaged.passUnretained(event)+}++guard let createdTap = CGEvent.tapCreate(tap: .cgSessionEventTap,+ place: .headInsertEventTap,+ options: .listenOnly,+ eventsOfInterest: mask,+ callback: eventTapCallback,+ userInfo: nil) else {+ FileHandle.standardError.write("Failed to create event tap\n".data(using: .utf8)!)+ exit(1)+}++eventTap = createdTap++let runLoopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, createdTap, 0)+CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, .commonModes)+CGEvent.tapEnable(tap: createdTap, enable: true)++let signalSource = DispatchSource.makeSignalSource(signal: SIGTERM, queue: .main)+signal(SIGTERM, SIG_IGN)+signalSource.setEventHandler {+ CFRunLoopStop(CFRunLoopGetCurrent())+}+signalSource.resume()++CFRunLoopRun()diff --git a/src/components/OnboardingFlow.tsx b/src/components/OnboardingFlow.tsxindex e386cd817..249180ed4 100644--- a/src/components/OnboardingFlow.tsx+++ b/src/components/OnboardingFlow.tsx@@ -37,6 +37,7 @@ import { getLanguageLabel, getReasoningModelLabel } from "../utils/languages";import LanguageSelector from "./ui/LanguageSelector";const InteractiveKeyboard = React.lazy(() => import("./ui/Keyboard"));import { setAgentName as saveAgentName } from "../utils/agentName";+import { formatHotkeyLabel } from "../utils/hotkeys";interface OnboardingFlowProps {onComplete: () => void;@@ -73,6 +74,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {const [apiKey, setApiKey] = useState(openaiApiKey);const [hotkey, setHotkey] = useState(dictationKey || "`");const [agentName, setAgentName] = useState("Agent");+ const readableHotkey = formatHotkeyLabel(hotkey);const { alertDialog, showAlertDialog, hideAlertDialog } = useDialogs();const practiceTextareaRef = useRef<HTMLInputElement>(null);@@ -115,6 +117,23 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {const saveSettings = useCallback(async () => {updateTranscriptionSettings({ whisperModel, preferredLanguage });setDictationKey(hotkey);+ try {+ const result = await window.electronAPI?.updateHotkey?.(hotkey);+ if (result && !result.success) {+ showAlertDialog({+ title: "Hotkey Not Registered",+ description:+ result.message ||+ "We couldn't register that key. Please choose another hotkey.",+ });+ }+ } catch (error) {+ console.error("Failed to register onboarding hotkey", error);+ showAlertDialog({+ title: "Hotkey Error",+ description: "We couldn't register that key. Please choose another hotkey.",+ });+ }saveAgentName(agentName);localStorage.setItem(@@ -551,13 +570,13 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {<br /><strong>Step 2:</strong> Press{" "}<kbd className="bg-white px-2 py-1 rounded text-xs font-mono border border-blue-200">- {hotkey}+ {readableHotkey}</kbd>{" "}to start recording, then speak something.<br /><strong>Step 3:</strong> Press{" "}<kbd className="bg-white px-2 py-1 rounded text-xs font-mono border border-blue-200">- {hotkey}+ {readableHotkey}</kbd>{" "}again to stop and see your transcribed text appear where yourcursor is!@@ -570,7 +589,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {<span style={{ fontFamily: "Noto Sans, sans-serif" }}>Click in the text area below, then press{" "}<kbd className="bg-white px-1 py-0.5 rounded text-xs font-mono border">- {hotkey}+ {readableHotkey}</kbd>{" "}to start dictation</span>@@ -608,7 +627,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {<li>2. Press{" "}<kbd className="bg-white px-2 py-1 rounded text-xs font-mono border border-green-200">- {hotkey}+ {readableHotkey}</kbd>{" "}to start recording</li>@@ -616,7 +635,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {<li>4. Press{" "}<kbd className="bg-white px-2 py-1 rounded text-xs font-mono border border-green-200">- {hotkey}+ {readableHotkey}</kbd>{" "}again to stop</li>diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex 21022564e..c1b238d20 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -13,6 +13,8 @@ import { useWhisper } from "../hooks/useWhisper";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";@@ -315,10 +317,21 @@ export default function SettingsPage({const saveKey = async () => {try {- await window.electronAPI?.updateHotkey(dictationKey);+ const result = await window.electronAPI?.updateHotkey(dictationKey);++ if (!result?.success) {+ showAlertDialog({+ title: "Hotkey Not Saved",+ description:+ result?.message ||+ "This key could not be registered. Please choose a different key.",+ });+ return;+ }+showAlertDialog({title: "Key Saved",- description: `Dictation key saved: ${dictationKey}`,+ description: `Dictation key saved: ${formatHotkeyLabel(dictationKey)}`,});} catch (error) {console.error("Failed to update hotkey:", error);@@ -614,7 +627,7 @@ export default function SettingsPage({Default Hotkey</p><p className="text-gray-600 font-mono text-xs">- {dictationKey || "` (backtick)"}+ {formatHotkeyLabel(dictationKey)}</p></div><div className="text-center p-4 border border-gray-200 rounded-xl bg-white">@@ -946,4 +959,3 @@ export default function SettingsPage({</>);}-diff --git a/src/components/ui/Keyboard.tsx b/src/components/ui/Keyboard.tsxindex a217c0891..144ded230 100644--- a/src/components/ui/Keyboard.tsx+++ b/src/components/ui/Keyboard.tsx@@ -1,4 +1,5 @@-import React, { useState } from "react";+import React, { useState, useEffect } from "react";+import { formatHotkeyLabel } from "../../utils/hotkeys";interface KeyboardProps {selectedKey?: string;@@ -11,9 +12,10 @@ interface KeyProps {onClick: () => void;width?: string;disabled?: boolean;+ displayValue?: React.ReactNode;}-const Key: React.FC<KeyProps> = ({ keyValue, isSelected, onClick, width = "w-12", disabled = false }) => {+const Key: React.FC<KeyProps> = ({ keyValue, isSelected, onClick, width = "w-12", disabled = false, displayValue }) => {const [isPressed, setIsPressed] = useState(false);const handleClick = () => {@@ -44,12 +46,14 @@ const Key: React.FC<KeyProps> = ({ keyValue, isSelected, onClick, width = "w-12"${isPressed ? 'bg-gray-100' : ''}`}>- {keyValue === 'Space' ? '' : keyValue}+ {displayValue ?? (keyValue === 'Space' ? '' : keyValue)}</button>);};export default function Keyboard({ selectedKey, setSelectedKey }: KeyboardProps) {+ const isMac = typeof navigator !== "undefined" && /Mac|Darwin/.test(navigator.platform);+ const canUseGlobe = isMac;const functionKeys = ['Esc', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12'];const numberRow = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '='];@@ -64,6 +68,12 @@ export default function Keyboard({ selectedKey, setSelectedKey }: KeyboardProps)setSelectedKey(key);};+ useEffect(() => {+ if (!canUseGlobe && selectedKey === "GLOBE") {+ setSelectedKey('`');+ }+ }, [canUseGlobe, selectedKey, setSelectedKey]);+return (<div className="p-6 bg-gradient-to-b from-gray-100 to-gray-200 rounded-2xl shadow-2xl border border-gray-300">{/* Function Keys Row */}@@ -178,6 +188,24 @@ export default function Keyboard({ selectedKey, setSelectedKey }: KeyboardProps)width="w-16"disabled/>+ {canUseGlobe ? (+ <Key+ keyValue="GLOBE"+ displayValue={<span role="img" aria-label="Globe">🌐</span>}+ isSelected={selectedKey === 'GLOBE'}+ onClick={() => handleKeyClick('GLOBE')}+ width="w-16"+ />+ ) : (+ <Key+ keyValue="Globe"+ displayValue={<span role="img" aria-label="Globe">🌐</span>}+ isSelected={false}+ onClick={() => {}}+ width="w-16"+ disabled+ />+ )}<KeykeyValue="Alt"isSelected={selectedKey === 'Alt'}@@ -213,7 +241,7 @@ export default function Keyboard({ selectedKey, setSelectedKey }: KeyboardProps)<div className="inline-flex items-center px-4 py-2 bg-indigo-100 border-2 border-indigo-300 rounded-lg"><span className="text-sm text-indigo-700 mr-2">Selected:</span><kbd className="px-3 py-1 bg-white border border-indigo-200 rounded font-mono text-lg font-semibold text-indigo-900">- {selectedKey}+ {formatHotkeyLabel(selectedKey)}</kbd></div></div>diff --git a/src/helpers/globeKeyManager.js b/src/helpers/globeKeyManager.jsnew file mode 100644index 000000000..66dda7a16--- /dev/null+++ b/src/helpers/globeKeyManager.js@@ -0,0 +1,80 @@+const { spawn } = require("child_process");+const path = require("path");+const EventEmitter = require("events");+const fs = require("fs");++class GlobeKeyManager extends EventEmitter {+ constructor() {+ super();+ this.process = null;+ this.isSupported = process.platform === "darwin";+ }++ start() {+ if (!this.isSupported || this.process) {+ return;+ }++ const scriptPath = this.resolveScriptPath();+ if (!scriptPath) {+ console.error("GlobeKeyManager: Swift listener script not found");+ return;+ }++ this.process = spawn("swift", [scriptPath]);++ this.process.stdout.setEncoding("utf8");+ this.process.stdout.on("data", (chunk) => {+ chunk+ .split(/\r?\n/)+ .map((line) => line.trim())+ .filter(Boolean)+ .forEach((line) => {+ if (line === "FN_DOWN") {+ this.emit("globe-down");+ } else if (line === "FN_UP") {+ this.emit("globe-up");+ }+ });+ });++ this.process.stderr.setEncoding("utf8");+ this.process.stderr.on("data", (data) => {+ console.error("GlobeKeyManager error:", data.trim());+ });++ this.process.on("exit", (code, signal) => {+ this.process = null;+ if (code !== 0) {+ console.error(+ `GlobeKeyManager exited with code ${code ?? "null"} signal ${signal ?? "null"}`+ );+ }+ });+ }++ stop() {+ if (this.process) {+ this.process.kill();+ this.process = null;+ }+ }++ resolveScriptPath() {+ const candidatePaths = [+ path.join(__dirname, "..", "..", "resources", "macos-globe-listener.swift"),+ path.join(process.resourcesPath, "macos-globe-listener.swift"),+ path.join(process.resourcesPath, "app.asar.unpacked", "resources", "macos-globe-listener.swift"),+ ];++ for (const candidate of candidatePaths) {+ if (fs.existsSync(candidate)) {+ return candidate;+ }+ }++ return null;+ }+}++module.exports = GlobeKeyManager;diff --git a/src/helpers/hotkeyManager.js b/src/helpers/hotkeyManager.jsindex e6c6e88de..271326d1d 100644--- a/src/helpers/hotkeyManager.js+++ b/src/helpers/hotkeyManager.js@@ -11,10 +11,22 @@ class HotkeyManager {throw new Error("Callback function is required for hotkey setup");}- // Unregister all existing shortcuts- globalShortcut.unregisterAll();+ if (this.currentHotkey && this.currentHotkey !== "GLOBE") {+ globalShortcut.unregister(this.currentHotkey);+ }try {+ if (hotkey === "GLOBE") {+ if (process.platform !== "darwin") {+ return {+ success: false,+ error: "The Globe key is only available on macOS.",+ };+ }+ this.currentHotkey = hotkey;+ return { success: true, hotkey };+ }+// Register the new hotkeyconst success = globalShortcut.register(hotkey, callback);diff --git a/src/utils/hotkeys.ts b/src/utils/hotkeys.tsnew file mode 100644index 000000000..f5fa575a2--- /dev/null+++ b/src/utils/hotkeys.ts@@ -0,0 +1,11 @@+export function formatHotkeyLabel(hotkey?: string | null): string {+ if (!hotkey || hotkey.trim() === "") {+ return "`";+ }++ if (hotkey === "GLOBE") {+ return "🌐 Globe";+ }++ return hotkey;+}