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
fix(linux): add GNOME meeting hotkey, capture mode all-slot unregister, and cancel safety
Haz3bc82e76d0ba
diff --git a/src/helpers/gnomeShortcut.js b/src/helpers/gnomeShortcut.jsindex 1c69840a5..8c0fec843 100644--- a/src/helpers/gnomeShortcut.js+++ b/src/helpers/gnomeShortcut.js@@ -15,6 +15,10 @@ const SLOT_CONFIG = {path: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/openwhispr-agent/",name: "OpenWhispr Agent",},+ meeting: {+ path: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/openwhispr-meeting/",+ name: "OpenWhispr Meeting",+ },};const KEYBINDING_SCHEMA = "org.gnome.settings-daemon.plugins.media-keys.custom-keybinding";@@ -79,6 +83,7 @@ class GnomeShortcutManager {this.bus = null;this.dictationCallback = null;this.agentCallback = null;+ this.meetingCallback = null;// Track which slots have been registered in gsettingsthis.registeredSlots = new Set();}@@ -109,6 +114,14 @@ class GnomeShortcutManager {debugLogger.log("[GnomeShortcut] Agent callback registered");}+ setMeetingCallback(callback) {+ this.meetingCallback = callback;+ if (this._ifaceRef) {+ this._ifaceRef._meetingCallback = callback;+ }+ debugLogger.log("[GnomeShortcut] Meeting callback registered");+ }+async initDBusService(dictationCallback) {this.dictationCallback = dictationCallback;@@ -122,7 +135,7 @@ class GnomeShortcutManager {await this.bus.requestName(DBUS_SERVICE_NAME, 0);const InterfaceClass = this._createInterfaceClass(dbusModule);- const iface = new InterfaceClass(dictationCallback, this.agentCallback);+ const iface = new InterfaceClass(dictationCallback, this.agentCallback, this.meetingCallback);// Keep a reference so setAgentCallback() can update it laterthis._ifaceRef = iface;this.bus.export(DBUS_OBJECT_PATH, iface);@@ -141,10 +154,11 @@ class GnomeShortcutManager {_createInterfaceClass(dbusModule) {class OpenWhisprInterface extends dbusModule.interface.Interface {- constructor(dictationCallback, agentCallback) {+ constructor(dictationCallback, agentCallback, meetingCallback) {super(DBUS_INTERFACE);this._dictationCallback = dictationCallback;this._agentCallback = agentCallback || null;+ this._meetingCallback = meetingCallback || null;}Toggle() {@@ -158,12 +172,19 @@ class GnomeShortcutManager {this._agentCallback();}}++ ToggleMeeting() {+ if (this._meetingCallback) {+ this._meetingCallback();+ }+ }}OpenWhisprInterface.configureMembers({methods: {Toggle: { inSignature: "", outSignature: "" },ToggleAgent: { inSignature: "", outSignature: "" },+ ToggleMeeting: { inSignature: "", outSignature: "" },},});@@ -192,8 +213,8 @@ class GnomeShortcutManager {const { path: keybindingPath, name: keybindingName } = getSlotConfig(slotName);- // The dbus-send command for agent uses ToggleAgent, dictation uses Toggle- const dbusMethod = slotName === "agent" ? "ToggleAgent" : "Toggle";+ const SLOT_DBUS_METHOD = { dictation: "Toggle", agent: "ToggleAgent", meeting: "ToggleMeeting" };+ const dbusMethod = SLOT_DBUS_METHOD[slotName] || "Toggle";const command = `dbus-send --session --type=method_call --dest=${DBUS_SERVICE_NAME} ${DBUS_OBJECT_PATH} ${DBUS_INTERFACE}.${dbusMethod}`;try {diff --git a/src/helpers/hotkeyManager.js b/src/helpers/hotkeyManager.jsindex e4a4e9166..d8b19abee 100644--- a/src/helpers/hotkeyManager.js+++ b/src/helpers/hotkeyManager.js@@ -14,6 +14,10 @@ const FALLBACK_HOTKEYS = ["F8", "F9", "Control+Shift+Space"];// Default hotkey for dictation if no saved value existsconst DEFAULT_HOTKEY = "Control+Super";+// Slots routed through GNOME native gsettings (not globalShortcut).+// Temporary slots like "cancel" stay on globalShortcut.+const GNOME_NATIVE_SLOTS = new Set(["agent", "meeting"]);+// KDE registration failure reasons — reuse existing i18n keysconst KDE_FAILURE_REASONS = {"conflict": (hotkey) => i18nMain.t("hotkey.errors.alreadyRegistered", { hotkey }),@@ -160,21 +164,20 @@ class HotkeyManager {async registerSlot(slotName, hotkey, callback) {this.unregisterSlot(slotName);- // On GNOME Wayland, route "agent" slot through the native GNOME keybinding- // system instead of Electron's globalShortcut. Temporary slots like "cancel"- // stay on globalShortcut (they don't need native registration).- if (this.useGnome && this.gnomeManager && slotName === "agent") {+ // On GNOME (X11 or Wayland), route named slots through native gsettings+ if (this.useGnome && this.gnomeManager && GNOME_NATIVE_SLOTS.has(slotName)) {const gnomeHotkey = GnomeShortcutManager.convertToGnomeFormat(hotkey);if (!gnomeHotkey) {debugLogger.log(`[HotkeyManager] Could not convert hotkey "${hotkey}" to GNOME format for slot "${slotName}"`);- return { success: false, error: `Invalid hotkey format for GNOME: "${hotkey}"` };+ return { success: false, error: i18nMain.t("hotkey.errors.registrationFailed", { hotkey }) };}- // Register (or update) the agent callback on the shared D-Bus interfaceif (slotName === "agent") {this.gnomeManager.setAgentCallback(callback);+ } else if (slotName === "meeting") {+ this.gnomeManager.setMeetingCallback(callback);}const success = await this.gnomeManager.registerKeybinding(gnomeHotkey, slotName);@@ -200,8 +203,10 @@ class HotkeyManager {return { success: true, hotkey };}- // On KDE (X11 or Wayland), route all slots through KGlobalAccel D-Bus- if (this.useKDE && this.kdeManager) {+ // On KDE (X11 or Wayland), route persistent slots through KGlobalAccel D-Bus.+ // Temporary slots like "cancel" stay on globalShortcut to avoid stale+ // KGlobalAccel registrations after crash (Escape would stop working system-wide).+ if (this.useKDE && this.kdeManager && slotName !== "cancel") {if (slotName === "agent") {this.kdeManager.setAgentCallback(callback);}@@ -239,8 +244,8 @@ class HotkeyManager {const slot = this.slots.get(slotName);if (!slot || !slot.hotkey) return;- // On KDE (X11 or Wayland), all slots are managed via KGlobalAccel- if (this.useKDE && this.kdeManager) {+ // On KDE (X11 or Wayland), persistent slots are managed via KGlobalAccel+ if (this.useKDE && this.kdeManager && slotName !== "cancel") {this.kdeManager.unregisterKeybinding(slotName).catch((err) => {debugLogger.warn(`[HotkeyManager] Error unregistering KDE keybinding for slot "${slotName}":`,@@ -252,8 +257,8 @@ class HotkeyManager {return;}- // On GNOME Wayland, "agent" slot is managed via gsettings, not globalShortcut- if (this.useGnome && this.gnomeManager && slotName === "agent") {+ // On GNOME, native slots are managed via gsettings, not globalShortcut+ if (this.useGnome && this.gnomeManager && GNOME_NATIVE_SLOTS.has(slotName)) {this.gnomeManager.unregisterKeybinding(slotName).catch((err) => {debugLogger.warn(`[HotkeyManager] Error unregistering GNOME keybinding for slot "${slotName}":`,diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex 6663e35ad..6a0c2a0c4 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -1592,14 +1592,17 @@ class IPCHandlers {isRightSideModifier(hotkey);if (enabled) {- // Entering capture mode - unregister globalShortcut so it doesn't consume key events- const currentHotkey = hotkeyManager.getCurrentHotkey();- if (currentHotkey && !usesNativeListener(currentHotkey)) {- debugLogger.log(- `[IPC] Unregistering globalShortcut "${currentHotkey}" for hotkey capture mode`- );- const { globalShortcut } = require("electron");- globalShortcut.unregister(currentHotkey);+ // Entering capture mode — unregister ALL slots so none intercept keypresses.+ // Dictation is always active; meeting and agent may or may not be set.+ const allSlots = hotkeyManager.slots;+ for (const [slot, info] of allSlots) {+ if (!info?.hotkey) continue;++ if (!usesNativeListener(info.hotkey)) {+ debugLogger.log(`[IPC] Unregistering globalShortcut "${info.hotkey}" (slot "${slot}") for capture mode`);+ const { globalShortcut } = require("electron");+ try { globalShortcut.unregister(info.hotkey); } catch {}+ }}// On Windows, stop the Windows key listener@@ -1608,15 +1611,17 @@ class IPCHandlers {this.windowsKeyManager.stop();}- // On GNOME Wayland, unregister the keybinding during capture+ // On GNOME, unregister all native keybindings during captureif (hotkeyManager.isUsingGnome() && hotkeyManager.gnomeManager) {- debugLogger.log("[IPC] Unregistering GNOME keybinding for hotkey capture mode");- await hotkeyManager.gnomeManager.unregisterKeybinding().catch((err) => {- debugLogger.warn("[IPC] Failed to unregister GNOME keybinding:", err.message);- });+ for (const slot of [...hotkeyManager.gnomeManager.registeredSlots]) {+ debugLogger.log(`[IPC] Unregistering GNOME keybinding (slot "${slot}") for capture mode`);+ await hotkeyManager.gnomeManager.unregisterKeybinding(slot).catch((err) => {+ debugLogger.warn(`[IPC] Failed to unregister GNOME slot "${slot}":`, err.message);+ });+ }}- // On Hyprland Wayland, unregister the keybinding during capture+ // On Hyprland, unregister the keybinding during captureif (hotkeyManager.isUsingHyprland() && hotkeyManager.hyprlandManager) {debugLogger.log("[IPC] Unregistering Hyprland keybinding for hotkey capture mode");await hotkeyManager.hyprlandManager.unregisterKeybinding().catch((err) => {@@ -1624,12 +1629,14 @@ class IPCHandlers {});}- // On KDE (X11 or Wayland), unregister the keybinding during capture+ // On KDE, unregister all native keybindings during captureif (hotkeyManager.isUsingKDE() && hotkeyManager.kdeManager) {- debugLogger.log("[IPC] Unregistering KDE keybinding for hotkey capture mode");- await hotkeyManager.kdeManager.unregisterKeybinding().catch((err) => {- debugLogger.warn("[IPC] Failed to unregister KDE keybinding:", err.message);- });+ for (const slot of [...hotkeyManager.kdeManager.registeredSlots]) {+ debugLogger.log(`[IPC] Unregistering KDE keybinding (slot "${slot}") for capture mode`);+ await hotkeyManager.kdeManager.unregisterKeybinding(slot).catch((err) => {+ debugLogger.warn(`[IPC] Failed to unregister KDE slot "${slot}":`, err.message);+ });+ }}} else {// Exiting capture mode - re-register globalShortcut if not already registered@@ -1709,6 +1716,15 @@ class IPCHandlers {debugLogger.warn(`[IPC] Failed to re-register KDE keybinding "${effectiveHotkey}" after capture mode`, { result });}}++ // Re-register non-dictation slots (meeting, agent) that were unregistered on capture enter+ for (const [slot, info] of hotkeyManager.slots) {+ if (slot === "dictation" || slot === "cancel" || !info?.hotkey || !info?.callback) continue;+ debugLogger.log(`[IPC] Re-registering slot "${slot}" ("${info.hotkey}") after capture mode`);+ await hotkeyManager.registerSlot(slot, info.hotkey, info.callback).catch((err) => {+ debugLogger.warn(`[IPC] Failed to re-register slot "${slot}":`, err.message);+ });+ }}return { success: true };