Skip to content

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

Fix meeting hotkey overwriting dictation key

Gabriel Steina9a422277f6a
diff --git a/main.js b/main.js
index d96790465..442029b34 100644
--- a/main.js
+++ b/main.js
@@ -617,21 +617,28 @@ async function startApp() {
// Set up meeting mode hotkey
const meetingHotkeyCallback = () => {
if (hotkeyManager.isInListeningMode()) return;
+ debugLogger.info("Meeting hotkey triggered", {}, "meeting");
meetingDetectionEngine?.startManualMeeting();
};
const savedMeetingKey = environmentManager.getMeetingKey?.() || "";
if (savedMeetingKey) {
- hotkeyManager.registerSlot("meeting", savedMeetingKey, meetingHotkeyCallback);
+ const result = hotkeyManager.registerSlot("meeting", savedMeetingKey, meetingHotkeyCallback);
+ debugLogger.info("Meeting hotkey startup registration", { savedMeetingKey, ...result }, "meeting");
}
- ipcMain.on("meeting-hotkey-changed", (_event, hotkey) => {
+ ipcMain.handle("register-meeting-hotkey", (_event, hotkey) => {
if (hotkey) {
- hotkeyManager.registerSlot("meeting", hotkey, meetingHotkeyCallback);
- environmentManager.saveMeetingKey(hotkey);
+ const result = hotkeyManager.registerSlot("meeting", hotkey, meetingHotkeyCallback);
+ if (result.success) {
+ environmentManager.saveMeetingKey(hotkey);
+ return { success: true };
+ }
+ return { success: false, message: result.error };
} else {
hotkeyManager.unregisterSlot("meeting");
environmentManager.saveMeetingKey("");
+ return { success: true };
}
});
diff --git a/preload.js b/preload.js
index 8db1799cf..5575aec20 100644
--- a/preload.js
+++ b/preload.js
@@ -538,7 +538,7 @@ contextBridge.exposeInMainWorld("electronAPI", {
// Notify main process of activation mode changes (for Windows Push-to-Talk)
notifyActivationModeChanged: (mode) => ipcRenderer.send("activation-mode-changed", mode),
notifyHotkeyChanged: (hotkey) => ipcRenderer.send("hotkey-changed", hotkey),
- notifyMeetingHotkeyChanged: (hotkey) => ipcRenderer.send("meeting-hotkey-changed", hotkey),
+ registerMeetingHotkey: (hotkey) => ipcRenderer.invoke("register-meeting-hotkey", hotkey),
// Floating icon auto-hide
notifyFloatingIconAutoHideChanged: (enabled) =>
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index 059b94e11..f58791451 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -865,6 +865,11 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
showAlert: showAlertDialog,
});
+ const meetingRegisterFn = useCallback(async (hotkey: string) => {
+ const result = await window.electronAPI?.registerMeetingHotkey?.(hotkey);
+ return result ?? { success: false, message: "Electron API unavailable" };
+ }, []);
+
const { registerHotkey: registerMeetingHotkey, isRegistering: isMeetingHotkeyRegistering } =
useHotkeyRegistration({
onSuccess: (registeredHotkey) => {
@@ -873,6 +878,7 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
showSuccessToast: false,
showErrorToast: true,
showAlert: showAlertDialog,
+ registerFn: meetingRegisterFn,
});
const validateHotkeyForInput = useCallback(
@@ -2770,7 +2776,8 @@ EOF`,
/>
{meetingKey && (
<button
- onClick={() => {
+ onClick={async () => {
+ await window.electronAPI?.registerMeetingHotkey?.("");
setMeetingKey("");
}}
disabled={isMeetingHotkeyRegistering}
diff --git a/src/helpers/hotkeyManager.js b/src/helpers/hotkeyManager.js
index 4e999a093..cdaae34a0 100644
--- a/src/helpers/hotkeyManager.js
+++ b/src/helpers/hotkeyManager.js
@@ -221,6 +221,9 @@ class HotkeyManager {
}
try {
+ const conflict = this._findSlotConflict(slotName, hotkey);
+ if (conflict) return conflict;
+
if (isGlobeLikeHotkey(hotkey)) {
if (process.platform !== "darwin") {
debugLogger.log("[HotkeyManager] GLOBE key rejected - not on macOS");
@@ -301,6 +304,34 @@ class HotkeyManager {
}
}
+ _findSlotConflict(slotName, hotkey) {
+ const accelerator =
+ isGlobeLikeHotkey(hotkey) || isRightSideModifier(hotkey) || isModifierOnlyHotkey(hotkey)
+ ? null
+ : normalizeToAccelerator(hotkey);
+
+ for (const [otherSlotName, otherSlot] of this.slots) {
+ if (otherSlotName === slotName) continue;
+ const match =
+ otherSlot.hotkey === hotkey || (accelerator && otherSlot.accelerator === accelerator);
+ if (match) {
+ debugLogger.warn(
+ `[HotkeyManager] Hotkey "${hotkey}" conflicts with slot "${otherSlotName}"`
+ );
+ return {
+ success: false,
+ error: i18nMain.t("hotkey.errors.slotConflict", {
+ slot: otherSlotName,
+ defaultValue: `This hotkey is already used for ${otherSlotName}`,
+ }),
+ reason: "slot_conflict",
+ conflictSlot: otherSlotName,
+ };
+ }
+ }
+ return null;
+ }
+
_restorePreviousHotkey(previousHotkey, callback) {
if (
!previousHotkey ||
diff --git a/src/helpers/meetingDetectionEngine.js b/src/helpers/meetingDetectionEngine.js
index 6ee8624bc..f2d75c5dc 100644
--- a/src/helpers/meetingDetectionEngine.js
+++ b/src/helpers/meetingDetectionEngine.js
@@ -195,6 +195,8 @@ class MeetingDetectionEngine {
}
async startManualMeeting() {
+ debugLogger.info("Starting manual meeting", {}, "meeting");
+
const event = {
id: `manual-${Date.now()}`,
calendar_id: "__manual__",
@@ -212,16 +214,23 @@ class MeetingDetectionEngine {
const noteResult = this.databaseManager.saveNote(event.summary, "", "meeting");
const meetingsFolder = this.databaseManager.getMeetingsFolder();
- if (noteResult?.note?.id && meetingsFolder?.id) {
- await this.windowManager.createControlPanelWindow();
- await new Promise((resolve) => setTimeout(resolve, 50));
- this.windowManager.snapControlPanelToMeetingMode();
- this.windowManager.sendToControlPanel("navigate-to-meeting-note", {
- noteId: noteResult.note.id,
- folderId: meetingsFolder.id,
- event,
- });
+ if (!noteResult?.note?.id || !meetingsFolder?.id) {
+ debugLogger.error(
+ "Manual meeting failed — missing note or folder",
+ { noteId: noteResult?.note?.id, folderId: meetingsFolder?.id },
+ "meeting"
+ );
+ return;
}
+
+ await this.windowManager.createControlPanelWindow();
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ this.windowManager.snapControlPanelToMeetingMode();
+ this.windowManager.sendToControlPanel("navigate-to-meeting-note", {
+ noteId: noteResult.note.id,
+ folderId: meetingsFolder.id,
+ event,
+ });
}
handleNotificationTimeout() {
diff --git a/src/hooks/useHotkeyRegistration.ts b/src/hooks/useHotkeyRegistration.ts
index c3ab1d703..342b2f5ee 100644
--- a/src/hooks/useHotkeyRegistration.ts
+++ b/src/hooks/useHotkeyRegistration.ts
@@ -29,6 +29,8 @@ export interface UseHotkeyRegistrationOptions {
* Custom toast/alert function for showing messages
*/
showAlert?: (options: { title: string; description: string }) => void;
+
+ registerFn?: (hotkey: string) => Promise<{ success: boolean; message?: string }>;
}
export interface UseHotkeyRegistrationResult {
@@ -70,7 +72,14 @@ export function useHotkeyRegistration(
options: UseHotkeyRegistrationOptions = {}
): UseHotkeyRegistrationResult {
const { t } = useTranslation();
- const { onSuccess, onError, showSuccessToast = true, showErrorToast = true, showAlert } = options;
+ const {
+ onSuccess,
+ onError,
+ showSuccessToast = true,
+ showErrorToast = true,
+ showAlert,
+ registerFn,
+ } = options;
const [isRegistering, setIsRegistering] = useState(false);
const [lastError, setLastError] = useState<string | null>(null);
@@ -120,7 +129,8 @@ export function useHotkeyRegistration(
}
// Check if Electron API is available
- if (!window.electronAPI?.updateHotkey) {
+ const effectiveRegisterFn = registerFn ?? window.electronAPI?.updateHotkey;
+ if (!effectiveRegisterFn) {
// In non-Electron environment, just succeed silently
onSuccess?.(hotkey);
return true;
@@ -131,7 +141,7 @@ export function useHotkeyRegistration(
setIsRegistering(true);
setLastError(null);
- const result = await window.electronAPI.updateHotkey(hotkey);
+ const result = await effectiveRegisterFn(hotkey);
if (!result?.success) {
// Use the detailed error message from the manager, which includes suggestions
@@ -181,7 +191,7 @@ export function useHotkeyRegistration(
registrationInFlightRef.current = false;
}
},
- [onSuccess, onError, showSuccessToast, showErrorToast, showAlert, t]
+ [onSuccess, onError, showSuccessToast, showErrorToast, showAlert, registerFn, t]
);
return {
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index 1ad91a433..fd681edec 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -418,9 +418,6 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
setMeetingKey: (key: string) => {
if (isBrowser) localStorage.setItem("meetingKey", key);
set({ meetingKey: key });
- if (isBrowser) {
- window.electronAPI?.notifyMeetingHotkeyChanged?.(key);
- }
},
setActivationMode: (mode: "tap" | "push") => {
diff --git a/src/types/electron.ts b/src/types/electron.ts
index e6fdb45eb..663f423d7 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -744,7 +744,7 @@ declare global {
// Windows Push-to-Talk notifications
notifyActivationModeChanged?: (mode: "tap" | "push") => void;
notifyHotkeyChanged?: (hotkey: string) => void;
- notifyMeetingHotkeyChanged?: (hotkey: string) => void;
+ registerMeetingHotkey?: (hotkey: string) => Promise<{ success: boolean; message?: string }>;
notifyFloatingIconAutoHideChanged?: (enabled: boolean) => void;
onFloatingIconAutoHideChanged?: (callback: (enabled: boolean) => void) => () => void;
notifyStartMinimizedChanged?: (enabled: boolean) => void;