Skip to content

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

fix: treat Fn hotkey as equivalent to GLOBE (#338)

Gabriel Stein2f8dab4be339
diff --git a/main.js b/main.js
index ad90157d5..27cd0245c 100644
--- a/main.js
+++ b/main.js
@@ -534,6 +534,7 @@ async function startApp() {
updateManager.checkForUpdatesOnStartup();
if (process.platform === "darwin") {
+ const { isGlobeLikeHotkey } = require("./src/helpers/hotkeyManager");
let globeKeyDownTime = 0;
let globeKeyIsRecording = false;
let globeLastStopTime = 0;
@@ -554,8 +555,8 @@ async function startApp() {
windowManager.controlPanelWindow.webContents.send("globe-key-pressed");
}
- // Handle dictation if Globe is the current hotkey
- if (currentHotkey === "GLOBE") {
+ // Handle dictation if Globe/Fn is the current hotkey
+ if (isGlobeLikeHotkey(currentHotkey)) {
if (mainWindowLive) {
// Capture target app PID BEFORE showing the overlay
if (textEditMonitor) textEditMonitor.captureTargetPid();
@@ -597,8 +598,7 @@ async function startApp() {
windowManager.controlPanelWindow.webContents.send("globe-key-released");
}
- // Handle push-to-talk release if Globe is the current hotkey
- if (hotkeyManager.getCurrentHotkey && hotkeyManager.getCurrentHotkey() === "GLOBE") {
+ if (hotkeyManager.getCurrentHotkey && isGlobeLikeHotkey(hotkeyManager.getCurrentHotkey())) {
const activationMode = windowManager.getActivationMode();
if (activationMode === "push") {
globeKeyDownTime = 0;
@@ -700,13 +700,15 @@ async function startApp() {
if (process.platform === "win32") {
debugLogger.debug("[Push-to-Talk] Windows Push-to-Talk setup starting");
- const isValidHotkey = (hotkey) => hotkey && hotkey !== "GLOBE";
+ const {
+ isGlobeLikeHotkey: isGlobeLike,
+ isModifierOnlyHotkey,
+ } = require("./src/helpers/hotkeyManager");
+ const isValidHotkey = (hotkey) => hotkey && !isGlobeLike(hotkey);
const isRightSideMod = (hotkey) =>
/^Right(Control|Ctrl|Alt|Option|Shift|Super|Win|Meta|Command|Cmd)$/i.test(hotkey);
- const { isModifierOnlyHotkey } = require("./src/helpers/hotkeyManager");
-
const needsNativeListener = (hotkey, mode) => {
if (!isValidHotkey(hotkey)) return false;
if (mode === "push") return true;
diff --git a/src/components/OnboardingFlow.tsx b/src/components/OnboardingFlow.tsx
index 5e896ff29..2fe63b397 100644
--- a/src/components/OnboardingFlow.tsx
+++ b/src/components/OnboardingFlow.tsx
@@ -30,7 +30,7 @@ import LanguageSelector from "./ui/LanguageSelector";
import AuthenticationStep from "./AuthenticationStep";
import EmailVerificationStep from "./EmailVerificationStep";
import { setAgentName as saveAgentName } from "../utils/agentName";
-import { formatHotkeyLabel, getDefaultHotkey } from "../utils/hotkeys";
+import { formatHotkeyLabel, getDefaultHotkey, isGlobeLikeHotkey } from "../utils/hotkeys";
import { useAuth } from "../hooks/useAuth";
import { HotkeyInput } from "./ui/HotkeyInput";
import { useHotkeyRegistration } from "../hooks/useHotkeyRegistration";
@@ -207,7 +207,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
// Only auto-register if no hotkey is currently set
const shouldAutoRegister =
- !hotkey || hotkey.trim() === "" || (platform !== "darwin" && hotkey === "GLOBE");
+ !hotkey || hotkey.trim() === "" || (platform !== "darwin" && isGlobeLikeHotkey(hotkey));
if (shouldAutoRegister) {
// Try to register the default hotkey silently
diff --git a/src/components/ui/HotkeyInput.tsx b/src/components/ui/HotkeyInput.tsx
index c772ea6b7..d6df8c5ec 100644
--- a/src/components/ui/HotkeyInput.tsx
+++ b/src/components/ui/HotkeyInput.tsx
@@ -1,7 +1,7 @@
import React, { useState, useCallback, useRef, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { AlertTriangle } from "lucide-react";
-import { formatHotkeyLabel } from "../../utils/hotkeys";
+import { formatHotkeyLabel, isGlobeLikeHotkey } from "../../utils/hotkeys";
import { getPlatform } from "../../utils/platform";
const CODE_TO_KEY: Record<string, string> = {
@@ -455,7 +455,7 @@ export function HotkeyInput({
}, [isCapturing, isMac, finalizeCapture]);
const displayValue = formatHotkeyLabel(value);
- const isGlobe = value === "GLOBE";
+ const isGlobe = isGlobeLikeHotkey(value);
const hotkeyParts = value?.includes("+") ? displayValue.split("+") : [];
// Hero variant: large centered key display for onboarding
diff --git a/src/helpers/hotkeyManager.js b/src/helpers/hotkeyManager.js
index 8dae7984b..f19db216f 100644
--- a/src/helpers/hotkeyManager.js
+++ b/src/helpers/hotkeyManager.js
@@ -36,6 +36,10 @@ function isModifierOnlyHotkey(hotkey) {
return hotkey.split("+").every((part) => MODIFIER_NAMES.has(part.toLowerCase()));
}
+function isGlobeLikeHotkey(hotkey) {
+ return hotkey === "GLOBE" || hotkey === "Fn";
+}
+
function normalizeToAccelerator(hotkey) {
let accelerator = hotkey.startsWith("Fn+") ? hotkey.slice(3) : hotkey;
accelerator = accelerator
@@ -128,7 +132,7 @@ class HotkeyManager {
const checkAccelerator = normalizeToAccelerator(hotkey);
if (
hotkey === this.currentHotkey &&
- hotkey !== "GLOBE" &&
+ !isGlobeLikeHotkey(hotkey) &&
!isRightSideModifier(hotkey) &&
!isModifierOnlyHotkey(hotkey) &&
globalShortcut.isRegistered(checkAccelerator)
@@ -144,7 +148,7 @@ class HotkeyManager {
// Unregister the previous hotkey (skip native-listener-only hotkeys)
if (
this.currentHotkey &&
- this.currentHotkey !== "GLOBE" &&
+ !isGlobeLikeHotkey(this.currentHotkey) &&
!isRightSideModifier(this.currentHotkey) &&
!isModifierOnlyHotkey(this.currentHotkey)
) {
@@ -160,7 +164,7 @@ class HotkeyManager {
}
try {
- if (hotkey === "GLOBE") {
+ if (isGlobeLikeHotkey(hotkey)) {
if (process.platform !== "darwin") {
debugLogger.log("[HotkeyManager] GLOBE key rejected - not on macOS");
return {
@@ -169,7 +173,7 @@ class HotkeyManager {
};
}
this.currentHotkey = hotkey;
- debugLogger.log("[HotkeyManager] GLOBE key set successfully");
+ debugLogger.log(`[HotkeyManager] GLOBE/Fn key "${hotkey}" set successfully`);
return { success: true, hotkey };
}
@@ -241,7 +245,7 @@ class HotkeyManager {
_restorePreviousHotkey(previousHotkey, callback) {
if (
!previousHotkey ||
- previousHotkey === "GLOBE" ||
+ isGlobeLikeHotkey(previousHotkey) ||
isRightSideModifier(previousHotkey) ||
isModifierOnlyHotkey(previousHotkey)
) {
@@ -551,5 +555,6 @@ class HotkeyManager {
}
module.exports = HotkeyManager;
+module.exports.isGlobeLikeHotkey = isGlobeLikeHotkey;
module.exports.isModifierOnlyHotkey = isModifierOnlyHotkey;
module.exports.isRightSideModifier = isRightSideModifier;
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index 01cc2e063..b6f4a95d3 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -990,10 +990,14 @@ class IPCHandlers {
// When exiting capture mode with a new hotkey, use that to avoid reading stale state
const effectiveHotkey = !enabled && newHotkey ? newHotkey : hotkeyManager.getCurrentHotkey();
- const { isModifierOnlyHotkey, isRightSideModifier } = require("./hotkeyManager");
+ const {
+ isGlobeLikeHotkey,
+ isModifierOnlyHotkey,
+ isRightSideModifier,
+ } = require("./hotkeyManager");
const usesNativeListener = (hotkey) =>
!hotkey ||
- hotkey === "GLOBE" ||
+ isGlobeLikeHotkey(hotkey) ||
isModifierOnlyHotkey(hotkey) ||
isRightSideModifier(hotkey);
@@ -1049,7 +1053,7 @@ class IPCHandlers {
);
const needsListener =
effectiveHotkey &&
- effectiveHotkey !== "GLOBE" &&
+ !isGlobeLikeHotkey(effectiveHotkey) &&
(activationMode === "push" || isModifierOnlyHotkey(effectiveHotkey));
if (needsListener) {
debugLogger.log(`[IPC] Restarting Windows key listener for hotkey: ${effectiveHotkey}`);
diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.js
index 8df7b87c5..9dd234773 100644
--- a/src/helpers/windowManager.js
+++ b/src/helpers/windowManager.js
@@ -1,6 +1,7 @@
const { app, screen, BrowserWindow, shell, dialog } = require("electron");
const debugLogger = require("./debugLogger");
const HotkeyManager = require("./hotkeyManager");
+const { isGlobeLikeHotkey } = HotkeyManager;
const DragManager = require("./dragManager");
const MenuManager = require("./menuManager");
const DevServerManager = require("./devServerManager");
@@ -164,7 +165,7 @@ class WindowManager {
process.platform === "darwin" &&
activationMode === "push" &&
currentHotkey &&
- currentHotkey !== "GLOBE" &&
+ !isGlobeLikeHotkey(currentHotkey) &&
currentHotkey.includes("+")
) {
this.startMacCompoundPushToTalk(currentHotkey);
diff --git a/src/utils/hotkeyValidator.ts b/src/utils/hotkeyValidator.ts
index e02d19e80..238596445 100644
--- a/src/utils/hotkeyValidator.ts
+++ b/src/utils/hotkeyValidator.ts
@@ -1,4 +1,4 @@
-import { formatHotkeyLabelForPlatform } from "./hotkeys";
+import { formatHotkeyLabelForPlatform, isGlobeLikeHotkey } from "./hotkeys";
export type Platform = "darwin" | "win32" | "linux";
@@ -517,7 +517,7 @@ export function validateHotkey(
return { valid: false, error: "Please enter a valid shortcut." };
}
- if (hotkey === "GLOBE" || hotkey === "Fn") {
+ if (isGlobeLikeHotkey(hotkey)) {
if (platform !== "darwin") {
return {
valid: false,
diff --git a/src/utils/hotkeys.ts b/src/utils/hotkeys.ts
index 667f02c0d..7b869ce9b 100644
--- a/src/utils/hotkeys.ts
+++ b/src/utils/hotkeys.ts
@@ -5,10 +5,10 @@
import { getPlatform, type Platform } from "./platform";
-/**
- * Maps Electron accelerator parts to user-friendly labels.
- * Automatically adapts to the current platform (macOS vs Windows/Linux).
- */
+export function isGlobeLikeHotkey(hotkey: string): boolean {
+ return hotkey === "GLOBE" || hotkey === "Fn";
+}
+
function formatModifierPart(part: string, platform: Platform): string {
switch (part) {
case "CommandOrControl":
@@ -60,7 +60,7 @@ export function formatHotkeyLabelForPlatform(hotkey: string, platform: Platform)
return "";
}
- if (hotkey === "GLOBE") {
+ if (isGlobeLikeHotkey(hotkey)) {
return "Globe/Fn";
}
@@ -148,8 +148,7 @@ export function isValidHotkeyFormat(hotkey: string): boolean {
return false;
}
- // Special keys are always valid
- if (hotkey === "GLOBE") {
+ if (isGlobeLikeHotkey(hotkey)) {
return true;
}