Skip to content

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

fix(hotkeys): explain why Hold is unavailable for modifier-only hotkeys (#2493)

voide43f47362b46
diff --git a/src/components/OnboardingFlow.tsx b/src/components/OnboardingFlow.tsx
index 583bca2c2..4cf5f4d8d 100644
--- a/src/components/OnboardingFlow.tsx
+++ b/src/components/OnboardingFlow.tsx
@@ -1092,15 +1092,17 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
variant="onboarding"
value={activationMode}
onChange={setActivationMode}
- pushDisabledReason={
- !supportsPushToTalk
- ? pushToTalkUnavailableReason || t("windows.pttUnavailable")
- : undefined
- }
+ pushDisabledReason={pushToTalkUnavailableReason ?? undefined}
/>
</div>
+ {/* Denied input access gets the setup box below instead. */}
+ {pushToTalkUnavailableReason && !linuxInputAccessDenied && (
+ <p className="mt-2 text-start text-xs leading-[1.4] text-[var(--onboarding-text-secondary)]">
+ {pushToTalkUnavailableReason}
+ </p>
+ )}
{platform === "linux" && (activationMode === "push" || linuxInputAccessDenied) && (
- <LinuxPttSetupInfo isAvailable={!linuxInputAccessDenied && supportsPushToTalk} />
+ <LinuxPttSetupInfo isAvailable={!linuxInputAccessDenied} />
)}
</div>
)}
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index 2f5cc57bf..6f431cf2a 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -1581,7 +1581,6 @@ export default function SettingsPage({
isUsingNativeShortcut,
isUsingHyprland,
hyprlandConfigStatus,
- supportsPushToTalk,
pushToTalkUnavailableReason,
linuxInputAccessDenied,
} = useHotkeyModeInfo("settings", dictationKey);
@@ -4037,13 +4036,15 @@ EOF`,
<ActivationModeSelector
value={activationMode}
onChange={setActivationMode}
- pushDisabledReason={
- !supportsPushToTalk
- ? pushToTalkUnavailableReason || t("windows.pttUnavailable")
- : undefined
- }
+ pushDisabledReason={pushToTalkUnavailableReason ?? undefined}
/>
</div>
+ {/* Denied input access gets the setup box below instead. */}
+ {pushToTalkUnavailableReason && !linuxInputAccessDenied && (
+ <p className="mt-2 text-xs text-muted-foreground">
+ {pushToTalkUnavailableReason}
+ </p>
+ )}
{getCachedPlatform() === "linux" &&
(activationMode === "push" || linuxInputAccessDenied) && (
<LinuxPttSetupInfo
diff --git a/src/components/ui/ActivationModeSelector.tsx b/src/components/ui/ActivationModeSelector.tsx
index febf480bf..3b8d94114 100644
--- a/src/components/ui/ActivationModeSelector.tsx
+++ b/src/components/ui/ActivationModeSelector.tsx
@@ -23,7 +23,7 @@ const STYLES = {
button: "gap-1.5 rounded px-3.5 py-1.5 text-xs",
icon: "size-3.5",
selected: "text-foreground",
- unselected: "text-muted-foreground hover:text-foreground",
+ unselected: "text-muted-foreground enabled:hover:text-foreground",
},
onboarding: {
track: "rounded-full p-1 bg-[var(--onboarding-surface-tertiary)]",
@@ -32,7 +32,7 @@ const STYLES = {
icon: "size-4",
selected: "text-[var(--onboarding-text-primary)]",
unselected:
- "text-[var(--onboarding-text-secondary)] hover:text-[var(--onboarding-text-primary)]",
+ "text-[var(--onboarding-text-secondary)] enabled:hover:text-[var(--onboarding-text-primary)]",
},
} as const;
diff --git a/src/helpers/hotkeyManager.js b/src/helpers/hotkeyManager.js
index a5f445581..c09f946fc 100644
--- a/src/helpers/hotkeyManager.js
+++ b/src/helpers/hotkeyManager.js
@@ -537,8 +537,12 @@ class HotkeyManager extends EventEmitter {
if (process.platform === "darwin" && hotkey && lacksMacReleaseSignal(hotkey)) {
return i18nMain.t("hotkey.errors.holdNeedsReleaseKey", { hotkey });
}
+ // Without the portal no key can hold, so a regular key would not help.
+ if (this.useGnome && this.gnomeManager?.supportsPushToTalk?.() === false) {
+ return i18nMain.t("hotkey.errors.holdNeedsGnomePortal");
+ }
if (this.isUsingNativeShortcut() && isModifierOnlyHotkey(hotkey)) {
- return i18nMain.t("hotkey.errors.osReserved", { hotkey });
+ return i18nMain.t("hotkey.errors.holdNeedsRegularKey");
}
return this._pushToTalkListenerBlockReason() ?? i18nMain.t("windows.pttUnavailable");
}
diff --git a/src/locales/ar/translation.json b/src/locales/ar/translation.json
index 34987be0e..0968f28b6 100644
--- a/src/locales/ar/translation.json
+++ b/src/locales/ar/translation.json
@@ -4146,6 +4146,8 @@
"osReserved": "قد يكون \"{{hotkey}}\" محجوزًا بواسطة بيئة سطح المكتب لديك.",
"rightModifierNeedsListener": "لا يمكن استخدام \"{{hotkey}}\" على سطح المكتب هذا، إذ تحتاج اختصاراته إلى مفتاح عادي. أضف مفتاحًا، مثل Control+Alt+Space.",
"holdNeedsReleaseKey": "يحتاج الضغط المستمر للتحدث إلى مفتاح يمكن لـ macOS أن يرصد تحريره: Globe، أو مفتاح جانبي أيمن مثل Option الأيمن، أو اختصار مع مفتاح تعديل. أما النقر فيعمل مع أي مفتاح.",
+ "holdNeedsRegularKey": "لاستخدام «استمرار الضغط»، أضف مفتاحًا عاديًا إلى الاختصار، مثل Control+Alt+Space. لا يستطيع سطح المكتب لديك رصد الضغط المستمر على مفاتيح التعديل وحدها.",
+ "holdNeedsGnomePortal": "لاستخدام «استمرار الضغط»، يحتاج GNOME إلى بوابة الاختصارات العامة المتوفرة في GNOME 48 والإصدارات الأحدث. أما «نقر» فيعمل بدونها.",
"registrationFailed": "تعذر تسجيل \"{{hotkey}}\". قد يكون قيد الاستخدام بواسطة تطبيق آخر.",
"windowsKeyListenerMissing": "يحتاج \"{{hotkey}}\" إلى مستمع مفاتيح Windows، وهو غير موجود في هذا التثبيت. اختر اختصارًا يتضمن مفتاحًا عاديًا.",
"updateFailedCheckFormat": "فشل تحديث الاختصار إلى \"{{hotkey}}\". تأكد من أن التنسيق صالح.",
@@ -4183,7 +4185,7 @@
"close": "إغلاق"
},
"windows": {
- "pttUnavailable": "المستمع الأصلي لميزة «اضغط للتحدث» غير متوفر"
+ "pttUnavailable": "مستمع مفاتيح OpenWhispr غير متوفر."
},
"common": {
"continue": "متابعة",
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index ecb0f42c8..2acf0d27a 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -123,6 +123,8 @@
"osReserved": "\"{{hotkey}}\" ist möglicherweise von Ihrer Desktop-Umgebung reserviert.",
"rightModifierNeedsListener": "„{{hotkey}}“ kann auf diesem Desktop nicht verwendet werden, da seine Tastenkürzel eine normale Taste benötigen. Fügen Sie eine Taste hinzu, z. B. Control+Alt+Space.",
"holdNeedsReleaseKey": "Halten zum Sprechen braucht eine Taste, deren Loslassen macOS erkennt: Globe, eine rechte Taste wie Rechte Option oder ein Kürzel mit Modifikator. Tippen funktioniert mit jeder Taste.",
+ "holdNeedsRegularKey": "Um Halten zu nutzen, fügen Sie dem Kürzel eine normale Taste hinzu, z. B. Control+Alt+Space. Ihr Desktop kann das Halten reiner Modifikatortasten nicht melden.",
+ "holdNeedsGnomePortal": "Um Halten zu nutzen, braucht GNOME das Portal für globale Tastenkürzel, das ab GNOME 48 enthalten ist. Tippen funktioniert auch ohne.",
"registrationFailed": "\"{{hotkey}}\" konnte nicht registriert werden. Möglicherweise wird es von einer anderen Anwendung verwendet.",
"windowsKeyListenerMissing": "\"{{hotkey}}\" benötigt den Windows-Tasten-Listener, der in dieser Installation fehlt. Wählen Sie ein Tastenkürzel mit einer normalen Taste.",
"updateFailedCheckFormat": "Hotkey konnte nicht auf \"{{hotkey}}\" aktualisiert werden. Prüfen Sie, ob das Format gültig ist.",
@@ -160,7 +162,7 @@
"close": "Schließen"
},
"windows": {
- "pttUnavailable": "Der native Push-to-Talk-Listener ist nicht verfügbar"
+ "pttUnavailable": "Der OpenWhispr-Tasten-Listener ist nicht verfügbar."
},
"common": {
"continue": "Weiter",
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index f3a65ae63..69a1b3b34 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -123,6 +123,8 @@
"osReserved": "\"{{hotkey}}\" may be reserved by your desktop environment.",
"rightModifierNeedsListener": "\"{{hotkey}}\" can't be used on this desktop, whose shortcuts need a regular key. Add a key, such as Control+Alt+Space.",
"holdNeedsReleaseKey": "Hold-to-talk needs a key macOS can see you release: Globe, a right-side key like Right Option, or a shortcut with a modifier. Tap works with any key.",
+ "holdNeedsRegularKey": "To use Hold, add a regular key to the shortcut, such as Control+Alt+Space. Your desktop can't report holding modifier keys alone.",
+ "holdNeedsGnomePortal": "To use Hold, GNOME needs its global shortcuts portal, which comes with GNOME 48 and newer. Tap works without it.",
"registrationFailed": "Could not register \"{{hotkey}}\". It may be in use by another application.",
"windowsKeyListenerMissing": "\"{{hotkey}}\" needs the Windows key listener, which this install is missing. Choose a shortcut with a regular key.",
"updateFailedCheckFormat": "Failed to update hotkey to \"{{hotkey}}\". Check the format is valid.",
@@ -160,7 +162,7 @@
"close": "Close"
},
"windows": {
- "pttUnavailable": "Push-to-Talk native listener not available"
+ "pttUnavailable": "OpenWhispr's key listener isn't available."
},
"common": {
"continue": "Continue",
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index 5fc8a0ce2..23123202d 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -123,6 +123,8 @@
"osReserved": "\"{{hotkey}}\" puede estar reservada por tu entorno de escritorio.",
"rightModifierNeedsListener": "\"{{hotkey}}\" no se puede usar en este escritorio, cuyos atajos necesitan una tecla normal. Añade una tecla, como Control+Alt+Space.",
"holdNeedsReleaseKey": "Mantener para hablar necesita una tecla cuya liberación macOS pueda detectar: Globo, una tecla derecha como Opción derecha o un atajo con modificador. Pulsar funciona con cualquier tecla.",
+ "holdNeedsRegularKey": "Para usar Mantener, añade una tecla normal al atajo, como Control+Alt+Space. Tu escritorio no puede detectar cuándo mantienes pulsadas solo teclas modificadoras.",
+ "holdNeedsGnomePortal": "Para usar Mantener, GNOME necesita su portal de atajos globales, incluido desde GNOME 48. Pulsar funciona sin él.",
"registrationFailed": "No se pudo registrar \"{{hotkey}}\". Puede estar en uso por otra aplicación.",
"windowsKeyListenerMissing": "\"{{hotkey}}\" necesita el detector de teclas de Windows, que falta en esta instalación. Elige un atajo con una tecla normal.",
"updateFailedCheckFormat": "No se pudo actualizar el atajo a \"{{hotkey}}\". Comprueba que el formato sea válido.",
@@ -160,7 +162,7 @@
"close": "Cerrar"
},
"windows": {
- "pttUnavailable": "El módulo nativo de Push-to-Talk no está disponible"
+ "pttUnavailable": "El detector de teclas de OpenWhispr no está disponible."
},
"common": {
"continue": "Continuar",
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index 36c7e89c2..06f465a51 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -123,6 +123,8 @@
"osReserved": "\"{{hotkey}}\" peut être réservé par votre environnement de bureau.",
"rightModifierNeedsListener": "« {{hotkey}} » ne peut pas être utilisé sur ce bureau, dont les raccourcis exigent une touche normale. Ajoutez une touche, par exemple Control+Alt+Space.",
"holdNeedsReleaseKey": "Maintenir pour parler nécessite une touche dont macOS détecte le relâchement : Globe, une touche droite comme Option droite, ou un raccourci avec modificateur. Appuyer fonctionne avec n’importe quelle touche.",
+ "holdNeedsRegularKey": "Pour utiliser le mode Maintenir, ajoutez une touche normale au raccourci, par exemple Control+Alt+Space. Votre bureau ne peut pas signaler le maintien de touches de modification seules.",
+ "holdNeedsGnomePortal": "Pour utiliser le mode Maintenir, GNOME a besoin de son portail de raccourcis globaux, inclus à partir de GNOME 48. Le mode Appui fonctionne sans lui.",
"registrationFailed": "Impossible d'enregistrer \"{{hotkey}}\". Il est peut-être utilisé par une autre application.",
"windowsKeyListenerMissing": "\"{{hotkey}}\" nécessite l'écouteur de touches Windows, absent de cette installation. Choisissez un raccourci avec une touche classique.",
"updateFailedCheckFormat": "Impossible de mettre à jour le raccourci vers \"{{hotkey}}\". Vérifiez que le format est valide.",
@@ -160,7 +162,7 @@
"close": "Fermer"
},
"windows": {
- "pttUnavailable": "L'écouteur natif Push-to-Talk n'est pas disponible"
+ "pttUnavailable": "L'écouteur de touches d'OpenWhispr n'est pas disponible."
},
"common": {
"continue": "Continuer",
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index 1a70ef3bb..1aaa40234 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -123,6 +123,8 @@
"osReserved": "\"{{hotkey}}\" potrebbe essere riservata dal sistema operativo.",
"rightModifierNeedsListener": "\"{{hotkey}}\" non può essere usato su questo desktop, le cui scorciatoie richiedono un tasto normale. Aggiungi un tasto, ad esempio Control+Alt+Space.",
"holdNeedsReleaseKey": "Tieni premuto per parlare richiede un tasto di cui macOS rilevi il rilascio: Globo, un tasto destro come Opzione destra o una scorciatoia con modificatore. Tocca funziona con qualsiasi tasto.",
+ "holdNeedsRegularKey": "Per usare Tieni premuto, aggiungi un tasto normale alla scorciatoia, ad esempio Control+Alt+Space. Il desktop non può rilevare la pressione prolungata dei soli tasti modificatori.",
+ "holdNeedsGnomePortal": "Per usare Tieni premuto, GNOME ha bisogno del portale delle scorciatoie globali, incluso da GNOME 48 in poi. Tocca funziona anche senza.",
"registrationFailed": "Impossibile registrare \"{{hotkey}}\". Potrebbe essere in uso da un'altra applicazione.",
"windowsKeyListenerMissing": "\"{{hotkey}}\" richiede il listener di tasti di Windows, che manca in questa installazione. Scegli una scorciatoia con un tasto normale.",
"updateFailedCheckFormat": "Impossibile aggiornare la scorciatoia a \"{{hotkey}}\". Verifica che il formato sia valido.",
@@ -160,7 +162,7 @@
"close": "Chiudi"
},
"windows": {
- "pttUnavailable": "Il listener nativo Push-to-Talk non è disponibile"
+ "pttUnavailable": "Il listener di tasti di OpenWhispr non è disponibile."
},
"common": {
"continue": "Continua",
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index 99445054b..1587add62 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -123,6 +123,8 @@
"osReserved": "\"{{hotkey}}\" はデスクトップ環境で予約されている可能性があります。",
"rightModifierNeedsListener": "\"{{hotkey}}\" はこのデスクトップでは使用できません。ショートカットには通常のキーが必要です。Control+Alt+Space のようにキーを追加してください。",
"holdNeedsReleaseKey": "ホールドして話すには、macOS が離したことを検知できるキーが必要です。Globe、右 Option のような右側のキー、または修飾キー付きのショートカットです。タップならどのキーでも使えます。",
+ "holdNeedsRegularKey": "ホールドを使うには、Control+Alt+Space のようにショートカットに通常のキーを追加してください。デスクトップは修飾キーだけを押し続けていることを検知できません。",
+ "holdNeedsGnomePortal": "ホールドを使うには、GNOME 48 以降に含まれるグローバルショートカットポータルが必要です。タップはポータルがなくても使えます。",
"registrationFailed": "\"{{hotkey}}\" を登録できませんでした。別のアプリケーションで使用されている可能性があります。",
"windowsKeyListenerMissing": "\"{{hotkey}}\" には Windows のキーリスナーが必要ですが、このインストールにはありません。通常のキーを使うショートカットを選んでください。",
"updateFailedCheckFormat": "「{{hotkey}}」へのホットキーの更新に失敗しました。形式が正しいか確認してください。",
@@ -160,7 +162,7 @@
"close": "閉じる"
},
"windows": {
- "pttUnavailable": "プッシュトゥトークのネイティブリスナーが利用できません"
+ "pttUnavailable": "OpenWhispr のキーリスナーを利用できません。"
},
"common": {
"continue": "続ける",
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index 80d8d5822..0684d88af 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -123,6 +123,8 @@
"osReserved": "\"{{hotkey}}\" pode estar reservada pelo seu ambiente de desktop.",
"rightModifierNeedsListener": "\"{{hotkey}}\" não pode ser usada neste ambiente de trabalho, cujos atalhos precisam de uma tecla normal. Adicione uma tecla, como Control+Alt+Space.",
"holdNeedsReleaseKey": "Segurar para falar precisa de uma tecla cuja soltura o macOS detecte: Globo, uma tecla direita como Option direita ou um atalho com modificador. Tocar funciona com qualquer tecla.",
+ "holdNeedsRegularKey": "Para usar Segurar, adicione uma tecla normal ao atalho, como Control+Alt+Space. O ambiente de desktop não consegue detectar quando você segura apenas teclas modificadoras.",
+ "holdNeedsGnomePortal": "Para usar Segurar, o GNOME precisa do portal de atalhos globais, incluído a partir do GNOME 48. Toque funciona sem ele.",
"registrationFailed": "Não foi possível registrar \"{{hotkey}}\". Pode estar em uso por outro aplicativo.",
"windowsKeyListenerMissing": "\"{{hotkey}}\" precisa do listener de teclas do Windows, que está faltando nesta instalação. Escolha um atalho com uma tecla comum.",
"updateFailedCheckFormat": "Não foi possível atualizar o atalho para \"{{hotkey}}\". Verifique se o formato é válido.",
@@ -139,7 +141,7 @@
"loginItems": "As configurações de itens de início não estão disponíveis nesta plataforma."
},
"windows": {
- "pttUnavailable": "O listener nativo de Push-to-Talk não está disponível"
+ "pttUnavailable": "O listener de teclas do OpenWhispr não está disponível."
},
"common": {
"continue": "Continuar",
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index 3e8f47981..ea030a8f7 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -123,6 +123,8 @@
"osReserved": "«{{hotkey}}» может быть зарезервирована вашей операционной системой.",
"rightModifierNeedsListener": "«{{hotkey}}» нельзя использовать в этой среде рабочего стола: её сочетаниям клавиш нужна обычная клавиша. Добавьте клавишу, например Control+Alt+Space.",
"holdNeedsReleaseKey": "Для удержания нужна клавиша, отпускание которой macOS может заметить: Globe, правая клавиша вроде правого Option или сочетание с модификатором. Нажатие работает с любой клавишей.",
+ "holdNeedsRegularKey": "Чтобы использовать режим «Удержание», добавьте в сочетание обычную клавишу, например Control+Alt+Space. Среда рабочего стола не может сообщить об удержании одних только клавиш-модификаторов.",
+ "holdNeedsGnomePortal": "Чтобы использовать режим «Удержание», GNOME нужен портал глобальных сочетаний клавиш, который есть в GNOME 48 и новее. Режим «Нажатие» работает и без него.",
"registrationFailed": "Не удалось зарегистрировать «{{hotkey}}». Возможно, она используется другим приложением.",
"windowsKeyListenerMissing": "«{{hotkey}}» требует слушателя клавиш Windows, которого нет в этой установке. Выберите сочетание с обычной клавишей.",
"updateFailedCheckFormat": "Не удалось обновить горячую клавишу на «{{hotkey}}». Проверьте правильность формата.",
@@ -160,7 +162,7 @@
"close": "Закрыть"
},
"windows": {
- "pttUnavailable": "Нативный слушатель Push-to-Talk недоступен"
+ "pttUnavailable": "Слушатель клавиш OpenWhispr недоступен."
},
"common": {
"continue": "Продолжить",
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index 279f37dde..facad0808 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -123,6 +123,8 @@
"osReserved": "\"{{hotkey}}\" 可能被系统保留。",
"rightModifierNeedsListener": "\"{{hotkey}}\" 无法在此桌面上使用,其快捷键需要包含一个普通按键。请添加一个按键,例如 Control+Alt+Space。",
"holdNeedsReleaseKey": "按住说话需要 macOS 能检测到松开的按键:Globe、右侧 Option 之类的右侧按键,或带修饰键的快捷键。点按可用于任何按键。",
+ "holdNeedsRegularKey": "要使用按住模式,请在快捷键中添加一个普通按键,例如 Control+Alt+Space。桌面环境无法检测仅按住修饰键的操作。",
+ "holdNeedsGnomePortal": "要使用按住模式,GNOME 需要全局快捷键门户(GNOME 48 及更高版本自带)。点按无需该门户。",
"registrationFailed": "无法注册 \"{{hotkey}}\",该快捷键可能已被其他应用占用。",
"windowsKeyListenerMissing": "\"{{hotkey}}\" 需要 Windows 按键监听器,但此安装中缺少该组件。请选择包含普通按键的快捷键。",
"updateFailedCheckFormat": "无法将快捷键更新为 \"{{hotkey}}\",请检查格式是否有效。",
@@ -160,7 +162,7 @@
"close": "关闭"
},
"windows": {
- "pttUnavailable": "按住说话原生监听器不可用"
+ "pttUnavailable": "OpenWhispr 按键监听器不可用。"
},
"common": {
"continue": "继续",
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index 89d3acac5..b19ec76bc 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -123,6 +123,8 @@
"osReserved": "\"{{hotkey}}\" 可能被你的作業系統保留。",
"rightModifierNeedsListener": "\"{{hotkey}}\" 無法在此桌面上使用,其快捷鍵需要包含一個一般按鍵。請加入一個按鍵,例如 Control+Alt+Space。",
"holdNeedsReleaseKey": "按住說話需要 macOS 能偵測到放開的按鍵:Globe、右側 Option 之類的右側按鍵,或帶修飾鍵的快速鍵。點按可用於任何按鍵。",
+ "holdNeedsRegularKey": "要使用按住模式,請在快捷鍵中加入一個一般按鍵,例如 Control+Alt+Space。桌面環境無法偵測僅按住修飾鍵的操作。",
+ "holdNeedsGnomePortal": "要使用按住模式,GNOME 需要全域快捷鍵入口(GNOME 48 及更新版本內建)。點按不需要它。",
"registrationFailed": "無法註冊「{{hotkey}}」。可能已被其他應用程式使用。",
"windowsKeyListenerMissing": "「{{hotkey}}」需要 Windows 按鍵監聽程式,但此安裝中缺少該元件。請選擇包含一般按鍵的快捷鍵。",
"updateFailedCheckFormat": "無法將快速鍵更新為「{{hotkey}}」。請檢查格式是否有效。",
@@ -160,7 +162,7 @@
"close": "關閉"
},
"windows": {
- "pttUnavailable": "按住說話原生監聽程式無法使用"
+ "pttUnavailable": "OpenWhispr 按鍵監聽程式無法使用。"
},
"common": {
"continue": "繼續",
diff --git a/test/helpers/hotkeyActivationMode.test.js b/test/helpers/hotkeyActivationMode.test.js
index 88770d48b..913123db8 100644
--- a/test/helpers/hotkeyActivationMode.test.js
+++ b/test/helpers/hotkeyActivationMode.test.js
@@ -99,7 +99,7 @@ test("linux Hold reports the generic message when the listener binary is missing
assert.equal(manager.supportsPushToTalk("F8"), false);
assert.equal(
manager.getPushToTalkUnavailableReason("F8"),
- "Push-to-Talk native listener not available"
+ "OpenWhispr's key listener isn't available."
);
});
});
@@ -146,6 +146,41 @@ test("switching to Hold without input access is refused and keeps Tap", async ()
assert.match(failures[0].result.error, /usermod/);
});
+// Desktop backends can't hold a modifier-only chord, so both ways into that
+// combination must ask for a regular key rather than blame a conflict (#1977).
+test("a desktop backend refuses Hold with a modifier-only hotkey and asks for a regular key", async () => {
+ const manager = new HotkeyManager();
+ const failures = [];
+ manager.useKDE = true;
+ manager.activationMode = "tap";
+ manager.currentHotkey = "Control+Super";
+ manager.notifyHotkeyFailure = (hotkey, result) => failures.push({ hotkey, result });
+
+ const changed = await withPlatform("linux", () => manager.setActivationMode("push"));
+
+ assert.equal(changed, false);
+ assert.equal(manager.activationMode, "tap");
+ assert.equal(failures.length, 1);
+ assert.match(failures[0].result.error, /regular key/);
+ assert.doesNotMatch(failures[0].result.error, /reserved/);
+});
+
+test("a desktop backend on Hold refuses a modifier-only hotkey and asks for a regular key", async () => {
+ const manager = new HotkeyManager();
+ manager.useKDE = true;
+ manager.activationMode = "push";
+ manager.currentHotkey = "F8";
+
+ const result = await withPlatform("linux", () =>
+ manager.updateHotkey("Control+Super", () => undefined)
+ );
+
+ assert.equal(result.success, false);
+ assert.match(result.message, /regular key/);
+ assert.doesNotMatch(result.message, /reserved/);
+ assert.equal(manager.currentHotkey, "F8");
+});
+
// main.js restores the saved mode before initializeHotkey has chosen a backend,
// and GNOME, KDE and Hyprland hold without the listener. Refusing that early left
// the saved setting on Hold while main ran Tap, and nothing checked it again.
@@ -200,7 +235,7 @@ test("Windows refuses listener-only hotkeys when the key listener is missing", a
assert.equal(manager.supportsPushToTalk("F8"), false);
assert.equal(
manager.getPushToTalkUnavailableReason("F8"),
- "Push-to-Talk native listener not available"
+ "OpenWhispr's key listener isn't available."
);
assert.equal(await manager.setActivationMode("push"), false);
assert.equal(manager.getEffectiveDefaultHotkey(), "F8");
diff --git a/test/helpers/hotkeyModeInfoIpc.test.js b/test/helpers/hotkeyModeInfoIpc.test.js
index 3201e3fbf..c00f286fc 100644
--- a/test/helpers/hotkeyModeInfoIpc.test.js
+++ b/test/helpers/hotkeyModeInfoIpc.test.js
@@ -98,7 +98,7 @@ test.after(() => {
// The handler decides everything before its first await, so the patched
// platform covers the whole answer.
-function hotkeyModeInfo(backend, platform = "linux") {
+function hotkeyModeInfo(backend, platform = "linux", hotkey = "F8") {
hotkeyManager = Object.assign(new HotkeyManager(), {
isInitialized: true,
nativeListenerProbe: inputDenied,
@@ -107,7 +107,7 @@ function hotkeyModeInfo(backend, platform = "linux") {
const original = Object.getOwnPropertyDescriptor(process, "platform");
Object.defineProperty(process, "platform", { value: platform, configurable: true });
try {
- return handlers.get("get-hotkey-mode-info")({}, "F8");
+ return handlers.get("get-hotkey-mode-info")({}, hotkey);
} finally {
Object.defineProperty(process, "platform", original);
}
@@ -131,6 +131,42 @@ for (const [desktop, backend] of Object.entries(DESKTOP_BACKENDS)) {
});
}
+// Desktop backends can't hold a modifier-only chord, so the reason must ask for
+// a regular key rather than blame a conflict (#1977).
+for (const [desktop, backend] of Object.entries(DESKTOP_BACKENDS)) {
+ test(`${desktop} says Hold needs a regular key for a modifier-only hotkey`, async () => {
+ const info = await hotkeyModeInfo(backend, "linux", "Control+Super");
+
+ assert.equal(info.supportsPushToTalk, false);
+ assert.match(info.pushToTalkUnavailableReason, /regular key/);
+ assert.doesNotMatch(info.pushToTalkUnavailableReason, /reserved/);
+ });
+}
+
+// GNOME holds only through its GlobalShortcuts portal, which has nothing to do
+// with OpenWhispr's own key listener.
+test("GNOME without the shortcuts portal names the portal, not the key listener", async () => {
+ const info = await hotkeyModeInfo({
+ useGnome: true,
+ gnomeManager: { supportsPushToTalk: () => false },
+ });
+
+ assert.equal(info.supportsPushToTalk, false);
+ assert.match(info.pushToTalkUnavailableReason, /GNOME 48/);
+ assert.doesNotMatch(info.pushToTalkUnavailableReason, /listener/);
+});
+
+test("GNOME without the portal names the portal even for a modifier-only hotkey", async () => {
+ const info = await hotkeyModeInfo(
+ { useGnome: true, gnomeManager: { supportsPushToTalk: () => false } },
+ "linux",
+ "Control+Super"
+ );
+
+ assert.match(info.pushToTalkUnavailableReason, /GNOME 48/);
+ assert.doesNotMatch(info.pushToTalkUnavailableReason, /regular key/);
+});
+
test("without a desktop backend, denied input access reaches the renderer", async () => {
const info = await hotkeyModeInfo({});
@@ -148,7 +184,7 @@ test("Windows without its key listener reports Hold unavailable", async () => {
);
assert.equal(info.supportsPushToTalk, false);
- assert.equal(info.pushToTalkUnavailableReason, "Push-to-Talk native listener not available");
+ assert.equal(info.pushToTalkUnavailableReason, "OpenWhispr's key listener isn't available.");
assert.equal(info.linuxInputAccessDenied, false);
});
diff --git a/test/helpers/hotkeyModifierOnlyNative.test.js b/test/helpers/hotkeyModifierOnlyNative.test.js
index 06281e7ab..dc4517d51 100644
--- a/test/helpers/hotkeyModifierOnlyNative.test.js
+++ b/test/helpers/hotkeyModifierOnlyNative.test.js
@@ -114,7 +114,7 @@ test("a missing listener binary reports the push-to-talk unavailable message", a
assert.equal(result.success, false);
// setupShortcuts appends "Try: <suggestions>" to whatever the failure carried.
- assert.equal(result.error.startsWith("Push-to-Talk native listener not available"), true);
+ assert.equal(result.error.startsWith("OpenWhispr's key listener isn't available."), true);
});
// Windows answers through its own probe (windows-key-listener.exe); macOS watches