Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

review/voice-phase1 round 2: 8 fixes

Louis Raille08d3a59bb481
diff --git a/NotchBuddy/Resources/Localizable.xcstrings b/NotchBuddy/Resources/Localizable.xcstrings
index 4fc982e1..e6b1aec7 100644
--- a/NotchBuddy/Resources/Localizable.xcstrings
+++ b/NotchBuddy/Resources/Localizable.xcstrings
@@ -2690,6 +2690,70 @@
}
}
},
+ "Denied": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "مرفوض"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "প্রত্যাখ্যাত"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Denied"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Denegado"
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Refusé"
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "अस्वीकृत"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Ditolak"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Negado"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Отклонено"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "已拒绝"
+ }
+ }
+ }
+ },
"Deny": {
"localizations": {
"ar": {
@@ -3268,11 +3332,65 @@
},
"Enable voice command": {
"localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "تفعيل الأوامر الصوتية"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "ভয়েস কমান্ড সক্ষম করুন"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Enable voice command"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Activar comando de voz"
+ }
+ },
"fr": {
"stringUnit": {
"state": "translated",
"value": "Activer la commande vocale"
}
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "वॉइस कमांड सक्षम करें"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Aktifkan perintah suara"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Ativar comando de voz"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Включить голосовые команды"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "启用语音命令"
+ }
}
}
},
@@ -3660,6 +3778,70 @@
}
}
},
+ "Granted": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "ممنوح"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "অনুমোদিত"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Granted"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Concedido"
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Accordé"
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "अनुमत"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Diberikan"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Concedido"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Разрешено"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "已授权"
+ }
+ }
+ }
+ },
"Hide after": {
"localizations": {
"ar": {
@@ -4430,11 +4612,65 @@
},
"Listening…": {
"localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "جارٍ الاستماع…"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "শুনছি…"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Listening…"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Escuchando…"
+ }
+ },
"fr": {
"stringUnit": {
"state": "translated",
"value": "À l’écoute …"
}
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "सुन रहा हूँ…"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Mendengarkan…"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Ouvindo…"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Слушаю…"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "正在收听…"
+ }
}
}
},
@@ -4694,6 +4930,134 @@
}
}
},
+ "Microphone unavailable": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "الميكروفون غير متاح"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "মাইক্রোফোন অনুপলব্ধ"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Microphone unavailable"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Micrófono no disponible"
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Microphone indisponible"
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "माइक्रोफ़ोन अनुपलब्ध"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Mikrofon tidak tersedia"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Microfone indisponível"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Микрофон недоступен"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "麦克风不可用"
+ }
+ }
+ }
+ },
+ "Microphone:": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "الميكروفون:"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "মাইক্রোফোন:"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Microphone:"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Micrófono:"
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Microphone :"
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "माइक्रोफ़ोन:"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Mikrofon:"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Microfone:"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Микрофон:"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "麦克风:"
+ }
+ }
+ }
+ },
"Missing recipient.": {
"localizations": {
"ar": {
@@ -5207,6 +5571,70 @@
}
}
},
+ "No speech recognition model available on this device. Install one in System Settings → Keyboard → Dictation.": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "لا يوجد نموذج للتعرف على الكلام متاح على هذا الجهاز. قم بتثبيت واحد في إعدادات النظام → لوحة المفاتيح → الإملاء."
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "এই ডিভাইসে কোনো বক্তৃতা স্বীকৃতি মডেল পাওয়া যায়নি। সিস্টেম সেটিংস → কীবোর্ড → ডিকটেশনে একটি ইনস্টল করুন।"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "No speech recognition model available on this device. Install one in System Settings → Keyboard → Dictation."
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "No hay modelo de reconocimiento de voz disponible en este dispositivo. Instala uno en Ajustes del Sistema → Teclado → Dictado."
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Aucun modèle de reconnaissance vocale disponible sur cet appareil. Installez un modèle dans Réglages Système → Clavier → Dictée."
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "इस डिवाइस पर कोई वाक् पहचान मॉडल उपलब्ध नहीं है। सिस्टम सेटिंग्स → कीबोर्ड → डिक्टेशन में एक इंस्टॉल करें।"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Tidak ada model pengenalan ucapan yang tersedia di perangkat ini. Instal satu di Pengaturan Sistem → Keyboard → Dikte."
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Nenhum modelo de reconhecimento de fala disponível neste dispositivo. Instale um em Ajustes do Sistema → Teclado → Ditado."
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "На этом устройстве нет доступной модели распознавания речи. Установите её в Системных настройках → Клавиатура → Диктовка."
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "此设备上没有可用的语音识别模型。在系统设置 → 键盘 → 听写中安装一个。"
+ }
+ }
+ }
+ },
"Not connected": {
"localizations": {
"ar": {
@@ -5248,153 +5676,217 @@
"id": {
"stringUnit": {
"state": "translated",
- "value": "Tidak terhubung"
+ "value": "Tidak terhubung"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Não conectado"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Не подключено"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "未连接"
+ }
+ }
+ }
+ },
+ "Not installed": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "غير مثبت"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "ইনস্টল নেই"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Not installed"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "No instalado"
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Non installé"
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "इंस्टॉल नहीं"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Belum terpasang"
}
},
"pt-BR": {
"stringUnit": {
"state": "translated",
- "value": "Não conectado"
+ "value": "Não instalado"
}
},
"ru": {
"stringUnit": {
"state": "translated",
- "value": "Не подключено"
+ "value": "Не установлено"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
- "value": "未连接"
+ "value": "未安装"
}
}
}
},
- "Not installed": {
+ "Not playing": {
"localizations": {
"ar": {
"stringUnit": {
"state": "translated",
- "value": "غير مثبت"
+ "value": "لا يعزف"
}
},
"bn": {
"stringUnit": {
"state": "translated",
- "value": "ইনস্টল নেই"
+ "value": "চলছে না"
}
},
"en": {
"stringUnit": {
"state": "translated",
- "value": "Not installed"
+ "value": "Not playing"
}
},
"es": {
"stringUnit": {
"state": "translated",
- "value": "No instalado"
+ "value": "No está reproduciendo"
}
},
"fr": {
"stringUnit": {
"state": "translated",
- "value": "Non installé"
+ "value": "Pas en lecture"
}
},
"hi": {
"stringUnit": {
"state": "translated",
- "value": "इंस्टॉल नहीं"
+ "value": "नहीं चल रहा"
}
},
"id": {
"stringUnit": {
"state": "translated",
- "value": "Belum terpasang"
+ "value": "Tidak diputar"
}
},
"pt-BR": {
"stringUnit": {
"state": "translated",
- "value": "Não instalado"
+ "value": "Não está tocando"
}
},
"ru": {
"stringUnit": {
"state": "translated",
- "value": "Не установлено"
+ "value": "Не воспроизводится"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
- "value": "未安装"
+ "value": "未播放"
}
}
}
},
- "Not playing": {
+ "Not requested": {
"localizations": {
"ar": {
"stringUnit": {
"state": "translated",
- "value": "لا يعزف"
+ "value": "لم يُطلب"
}
},
"bn": {
"stringUnit": {
"state": "translated",
- "value": "চলছে না"
+ "value": "অনুরোধ করা হয়নি"
}
},
"en": {
"stringUnit": {
"state": "translated",
- "value": "Not playing"
+ "value": "Not requested"
}
},
"es": {
"stringUnit": {
"state": "translated",
- "value": "No está reproduciendo"
+ "value": "No solicitado"
}
},
"fr": {
"stringUnit": {
"state": "translated",
- "value": "Pas en lecture"
+ "value": "Non demandé"
}
},
"hi": {
"stringUnit": {
"state": "translated",
- "value": "नहीं चल रहा"
+ "value": "अनुरोध नहीं किया गया"
}
},
"id": {
"stringUnit": {
"state": "translated",
- "value": "Tidak diputar"
+ "value": "Belum diminta"
}
},
"pt-BR": {
"stringUnit": {
"state": "translated",
- "value": "Não está tocando"
+ "value": "Não solicitado"
}
},
"ru": {
"stringUnit": {
"state": "translated",
- "value": "Не воспроизводится"
+ "value": "Не запрошено"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
- "value": "未播放"
+ "value": "未请求"
}
}
}
@@ -6679,6 +7171,70 @@
}
}
},
+ "Permissions": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "الأذونات"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "অনুমতি"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Permissions"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Permisos"
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Permissions"
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "अनुमतियाँ"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Izin"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Permissões"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Разрешения"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "权限"
+ }
+ }
+ }
+ },
"Play": {
"localizations": {
"ar": {
@@ -7575,6 +8131,70 @@
}
}
},
+ "Request permissions": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "طلب الأذونات"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "অনুমতি অনুরোধ করুন"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Request permissions"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Solicitar permisos"
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Demander les permissions"
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "अनुमतियाँ अनुरोध करें"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Minta izin"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Solicitar permissões"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Запросить разрешения"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "请求权限"
+ }
+ }
+ }
+ },
"Resend": {
"localizations": {
"ar": {
@@ -7897,11 +8517,65 @@
},
"Say your command": {
"localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "قل أمرك"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "আপনার কমান্ড বলুন"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Say your command"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Di tu comando"
+ }
+ },
"fr": {
"stringUnit": {
"state": "translated",
"value": "Dites votre commande"
}
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "अपना आदेश बोलें"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Katakan perintah Anda"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Diga seu comando"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Скажите команду"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "说出您的命令"
+ }
}
}
},
@@ -8556,183 +9230,247 @@
"bn": {
"stringUnit": {
"state": "translated",
- "value": "শাফল বন্ধ"
+ "value": "শাফল বন্ধ"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Shuffle off"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Aleatorio desactivado"
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Aléatoire désactivé"
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "शफ़ल बंद"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Acak nonaktif"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Aleatório desativado"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Перемешивание выкл."
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "随机播放:关"
+ }
+ }
+ }
+ },
+ "Shuffle on": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "الترتيب العشوائي مفعّل"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "শাফল চালু"
}
},
"en": {
"stringUnit": {
"state": "translated",
- "value": "Shuffle off"
+ "value": "Shuffle on"
}
},
"es": {
"stringUnit": {
"state": "translated",
- "value": "Aleatorio desactivado"
+ "value": "Aleatorio activado"
}
},
"fr": {
"stringUnit": {
"state": "translated",
- "value": "Aléatoire désactivé"
+ "value": "Aléatoire activé"
}
},
"hi": {
"stringUnit": {
"state": "translated",
- "value": "शफ़ल बंद"
+ "value": "शफ़ल चालू"
}
},
"id": {
"stringUnit": {
"state": "translated",
- "value": "Acak nonaktif"
+ "value": "Acak aktif"
}
},
"pt-BR": {
"stringUnit": {
"state": "translated",
- "value": "Aleatório desativado"
+ "value": "Aleatório ativado"
}
},
"ru": {
"stringUnit": {
"state": "translated",
- "value": "Перемешивание выкл."
+ "value": "Перемешивание вкл."
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
- "value": "随机播放:关"
+ "value": "随机播放:开"
}
}
}
},
- "Shuffle on": {
+ "Sound": {
"localizations": {
"ar": {
"stringUnit": {
"state": "translated",
- "value": "الترتيب العشوائي مفعّل"
+ "value": "الصوت"
}
},
"bn": {
"stringUnit": {
"state": "translated",
- "value": "শাফল চালু"
+ "value": "শব্দ"
}
},
"en": {
"stringUnit": {
"state": "translated",
- "value": "Shuffle on"
+ "value": "Sound"
}
},
"es": {
"stringUnit": {
"state": "translated",
- "value": "Aleatorio activado"
+ "value": "Sonido"
}
},
"fr": {
"stringUnit": {
"state": "translated",
- "value": "Aléatoire activé"
+ "value": "Son"
}
},
"hi": {
"stringUnit": {
"state": "translated",
- "value": "शफ़ल चालू"
+ "value": "ध्वनि"
}
},
"id": {
"stringUnit": {
"state": "translated",
- "value": "Acak aktif"
+ "value": "Suara"
}
},
"pt-BR": {
"stringUnit": {
"state": "translated",
- "value": "Aleatório ativado"
+ "value": "Som"
}
},
"ru": {
"stringUnit": {
"state": "translated",
- "value": "Перемешивание вкл."
+ "value": "Звук"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
- "value": "随机播放:开"
+ "value": "声音"
}
}
}
},
- "Sound": {
+ "Speech recognition:": {
"localizations": {
"ar": {
"stringUnit": {
"state": "translated",
- "value": "الصوت"
+ "value": "التعرف على الكلام:"
}
},
"bn": {
"stringUnit": {
"state": "translated",
- "value": "শব্দ"
+ "value": "বক্তৃতা স্বীকৃতি:"
}
},
"en": {
"stringUnit": {
"state": "translated",
- "value": "Sound"
+ "value": "Speech recognition:"
}
},
"es": {
"stringUnit": {
"state": "translated",
- "value": "Sonido"
+ "value": "Reconocimiento de voz:"
}
},
"fr": {
"stringUnit": {
"state": "translated",
- "value": "Son"
+ "value": "Reconnaissance vocale :"
}
},
"hi": {
"stringUnit": {
"state": "translated",
- "value": "ध्वनि"
+ "value": "वाक् पहचान:"
}
},
"id": {
"stringUnit": {
"state": "translated",
- "value": "Suara"
+ "value": "Pengenalan ucapan:"
}
},
"pt-BR": {
"stringUnit": {
"state": "translated",
- "value": "Som"
+ "value": "Reconhecimento de fala:"
}
},
"ru": {
"stringUnit": {
"state": "translated",
- "value": "Звук"
+ "value": "Распознавание речи:"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
- "value": "声音"
+ "value": "语音识别:"
}
}
}
@@ -9443,11 +10181,65 @@
},
"Voice": {
"localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "صوت"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "ভয়েস"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Voice"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Voz"
+ }
+ },
"fr": {
"stringUnit": {
"state": "translated",
"value": "Voix"
}
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "आवाज़"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Suara"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Voz"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Голос"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "语音"
+ }
}
}
},
@@ -9835,6 +10627,134 @@
}
}
},
+ "When enabled, Coucou listens for the wake word « OK Coucou ». Speech recognition runs entirely on-device — no audio or transcript leaves your Mac.": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "عند التفعيل، يستمع Coucou لكلمة التنشيط « OK Coucou ». يعمل التعرف على الكلام بالكامل على الجهاز — لا يغادر أي صوت أو نص جهاز Mac."
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "সক্ষম হলে, Coucou ওয়েক ওয়ার্ড « OK Coucou » শোনে। ভাষণ স্বীকৃতি সম্পূর্ণ ডিভাইসে চলে — কোনো অডিও বা ট্রান্সক্রিপ্ট আপনার Mac ছেড়ে যায় না।"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "When enabled, Coucou listens for the wake word « OK Coucou ». Speech recognition runs entirely on-device — no audio or transcript leaves your Mac."
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Cuando está activado, Coucou escucha la palabra de activación « OK Coucou ». El reconocimiento de voz se ejecuta completamente en el dispositivo — ningún audio ni transcripción sale de tu Mac."
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Quand cette option est activée, Coucou écoute le mot de réveil « OK Coucou ». La reconnaissance vocale se fait entièrement sur l’appareil — aucun audio ni transcription ne quitte votre Mac."
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "सक्षम होने पर, Coucou वेक शब्द « OK Coucou » सुनता है। वाक् पहचान पूरी तरह डिवाइस पर चलती है — कोई ऑडियो या ट्रांसक्रिप्ट आपके Mac को नहीं छोड़ता।"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Saat diaktifkan, Coucou mendengarkan kata pengaktif « OK Coucou ». Pengenalan ucapan berjalan sepenuhnya di perangkat — tidak ada audio atau transkrip yang meninggalkan Mac Anda."
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Quando ativado, o Coucou escuta a palavra de ativação « OK Coucou ». O reconhecimento de fala é executado inteiramente no dispositivo — nenhum áudio ou transcrição sai do seu Mac."
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Когда включено, Coucou слушает слово активации « OK Coucou ». Распознавание речи работает полностью на устройстве — никакие аудиозаписи или транскрипции не покидают ваш Mac."
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "启用后,Coucou 会监听唤醒词« OK Coucou »。语音识别完全在设备上运行—任何音频或文字记录都不会离开您的 Mac。"
+ }
+ }
+ }
+ },
+ "While listening, macOS shows the orange microphone dot in the top-right of the menu bar. This is normal system behaviour.": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "أثناء الاستماع، يعرض macOS نقطة الميكروفون البرتقالية في أعلى يمين شريط القوائم. هذا هو السلوك الطبيعي للنظام."
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "শোনার সময়, macOS মেনু বারের উপরের-ডানে কমলা মাইক্রোফোন বিন্দু দেখায়। এটি স্বাভাবিক সিস্টেম আচরণ।"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "While listening, macOS shows the orange microphone dot in the top-right of the menu bar. This is normal system behaviour."
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Durante la escucha, macOS muestra el punto naranja del micrófono en la parte superior derecha de la barra de menús. Este es el comportamiento normal del sistema."
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Pendant l’écoute, macOS affiche le point orange du microphone en haut à droite de la barre de menus. C’est le comportement normal du système."
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "सुनते समय, macOS मेनू बार के ऊपर-दाईं ओर नारंगी माइक्रोफ़ोन बिंदु दिखाता है। यह सामान्य सिस्टम व्यवहार है।"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Saat mendengarkan, macOS menampilkan titik mikrofon oranye di kanan atas bilah menu. Ini adalah perilaku sistem yang normal."
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Durante a escuta, o macOS exibe o ponto laranja do microfone no canto superior direito da barra de menus. Este é o comportamento normal do sistema."
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Во время прослушивания macOS отображает оранжевую точку микрофона в правом верхнем углу строки меню. Это нормальное поведение системы."
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "收听时,macOS 会在菜单栏右上角显示橙色麦克风指示灯。这是正常的系统行为。"
+ }
+ }
+ }
+ },
"Workflow stopped.": {
"localizations": {
"ar": {
@@ -21414,6 +22334,70 @@
}
}
}
+ },
+ "« OK Coucou » — voice wake word": {
+ "localizations": {
+ "ar": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "« OK Coucou » — كلمة التنشيط الصوتية"
+ }
+ },
+ "bn": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "« OK Coucou » — ভয়েস ওয়েক ওয়ার্ড"
+ }
+ },
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "« OK Coucou » — voice wake word"
+ }
+ },
+ "es": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "« OK Coucou » — palabra de activación de voz"
+ }
+ },
+ "fr": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "« OK Coucou » — commande vocale mains libres"
+ }
+ },
+ "hi": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "« OK Coucou » — वॉइस वेक वर्ड"
+ }
+ },
+ "id": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "« OK Coucou » — kata pengaktif suara"
+ }
+ },
+ "pt-BR": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "« OK Coucou » — palavra de ativação de voz"
+ }
+ },
+ "ru": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "« OK Coucou » — голосовая активация"
+ }
+ },
+ "zh-Hans": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "« OK Coucou » — 语音唤醒词"
+ }
+ }
+ }
}
},
"version": "1.0"
diff --git a/NotchBuddy/Sources/App/SettingsView.swift b/NotchBuddy/Sources/App/SettingsView.swift
index 5a03432e..56f43748 100644
--- a/NotchBuddy/Sources/App/SettingsView.swift
+++ b/NotchBuddy/Sources/App/SettingsView.swift
@@ -1262,23 +1262,22 @@ struct SettingsView: View {
@ObservedObject private var voiceEngine = VoiceEngine.shared
@ViewBuilder private var voiceSection: some View {
- GroupBox("«\u{202F}OK Coucou\u{202F}» — commande vocale mains libres") {
+ GroupBox(String(localized: "«\u{202F}OK Coucou\u{202F}» — voice wake word")) {
VStack(alignment: .leading, spacing: 10) {
- Toggle("Activer la commande vocale", isOn: $voiceEngine.isEnabled)
+ Toggle(String(localized: "Enable voice command"), isOn: $voiceEngine.isEnabled)
.disabled(!voicePermissionsGranted && !voiceEngine.isEnabled)
- Text("Quand cette option est activée, Coucou écoute le mot de réveil «\u{202F}OK Coucou\u{202F}». La reconnaissance vocale se fait entièrement sur l'appareil — aucun audio ni transcription ne quitte votre Mac.")
+ Text("When enabled, Coucou listens for the wake word «\u{202F}OK Coucou\u{202F}». Speech recognition runs entirely on-device — no audio or transcript leaves your Mac.")
.font(.system(size: 11))
.foregroundColor(.secondary)
.fixedSize(horizontal: false, vertical: true)
- // Orange dot explanation
HStack(alignment: .top, spacing: 6) {
Circle()
.fill(Color(hex: "#F97316"))
.frame(width: 8, height: 8)
.padding(.top, 2)
- Text("Pendant l'écoute, macOS affiche le point orange du microphone en haut à droite de la barre de menus. C'est le comportement normal du système.")
+ Text("While listening, macOS shows the orange microphone dot in the top-right of the menu bar. This is normal system behaviour.")
.font(.system(size: 11))
.foregroundColor(.secondary)
.fixedSize(horizontal: false, vertical: true)
@@ -1288,7 +1287,7 @@ struct SettingsView: View {
HStack(spacing: 6) {
Image(systemName: "exclamationmark.triangle.fill")
.foregroundColor(.orange)
- Text("Aucun modèle de reconnaissance vocale disponible sur cet appareil. Installez un modèle dans Réglages Système → Clavier → Dictée.")
+ Text("No speech recognition model available on this device. Install one in System Settings \u{2192} Keyboard \u{2192} Dictation.")
.font(.system(size: 11))
.foregroundColor(.secondary)
.fixedSize(horizontal: false, vertical: true)
@@ -1299,7 +1298,7 @@ struct SettingsView: View {
HStack(spacing: 6) {
Image(systemName: "exclamationmark.triangle.fill")
.foregroundColor(.red)
- Text(String(localized: "Microphone unavailable: \(err)"))
+ Text("\(String(localized: "Microphone unavailable")): \(err)")
.font(.system(size: 11))
.foregroundColor(.secondary)
.fixedSize(horizontal: false, vertical: true)
@@ -1309,22 +1308,22 @@ struct SettingsView: View {
.padding(6)
}
- GroupBox("Permissions") {
+ GroupBox(String(localized: "Permissions")) {
VStack(alignment: .leading, spacing: 10) {
HStack(spacing: 6) {
Image(systemName: micStatusIcon)
.foregroundColor(micStatusColor)
- Text("Microphone : \(micStatusLabel)")
+ Text("\(String(localized: "Microphone:")) \(micStatusLabel)")
.font(.system(size: 12))
}
HStack(spacing: 6) {
Image(systemName: speechStatusIcon)
.foregroundColor(speechStatusColor)
- Text("Reconnaissance vocale : \(speechStatusLabel)")
+ Text("\(String(localized: "Speech recognition:")) \(speechStatusLabel)")
.font(.system(size: 12))
}
if !voicePermissionsGranted {
- Button("Demander les permissions") {
+ Button(String(localized: "Request permissions")) {
Task {
let ok = await VoiceSettings.requestPermissions()
voicePermissionsGranted = ok
@@ -1345,18 +1344,18 @@ struct SettingsView: View {
private var micStatusColor: Color { VoiceSettings.micStatus == .granted ? .green : .red }
private var micStatusLabel: String {
switch VoiceSettings.micStatus {
- case .granted: return "accordé"
- case .denied: return "refusé (Réglages Système → Confidentialité → Microphone)"
- case .undetermined: return "non demandé"
+ case .granted: return String(localized: "Granted")
+ case .denied: return String(localized: "Denied")
+ case .undetermined: return String(localized: "Not requested")
}
}
private var speechStatusIcon: String { VoiceSettings.speechStatus == .granted ? "checkmark.circle.fill" : "xmark.circle.fill" }
private var speechStatusColor: Color { VoiceSettings.speechStatus == .granted ? .green : .red }
private var speechStatusLabel: String {
switch VoiceSettings.speechStatus {
- case .granted: return "accordé"
- case .denied: return "refusé (Réglages Système → Confidentialité → Reconnaissance vocale)"
- case .undetermined: return "non demandé"
+ case .granted: return String(localized: "Granted")
+ case .denied: return String(localized: "Denied")
+ case .undetermined: return String(localized: "Not requested")
}
}
#endif
diff --git a/NotchBuddy/Sources/App/Voice/VoiceEngine.swift b/NotchBuddy/Sources/App/Voice/VoiceEngine.swift
index a4fd1342..07d9c15b 100644
--- a/NotchBuddy/Sources/App/Voice/VoiceEngine.swift
+++ b/NotchBuddy/Sources/App/Voice/VoiceEngine.swift
@@ -13,6 +13,7 @@ import Speech
/// - Fires island notifications (.voiceWoke / .voiceFinished) on the main thread.
/// - Auto-pauses on: screen lock, screen sleep, system sleep, Low Power Mode,
/// MacDictation active.
+/// - Wake window restarts every 20 s of continuous speech to bound recognition cost.
@MainActor
final class VoiceEngine: ObservableObject {
static let shared = VoiceEngine()
@@ -29,10 +30,10 @@ final class VoiceEngine: ObservableObject {
// MARK: - Pause reasons
- private var screenLocked = false
- private var screenSleeping = false
- private var lowPowerMode = false
- private var dictationActive = 0 // reference count: MacDictation instances recording
+ private var screenLocked = false
+ private var screenSleeping = false
+ private var lowPowerMode = false
+ private var dictationActive = 0 // reference count: MacDictation instances currently recording
var isPaused: Bool { screenLocked || screenSleeping || lowPowerMode || dictationActive > 0 }
@@ -40,15 +41,26 @@ final class VoiceEngine: ObservableObject {
private var audio: VoiceAudio?
private var spotter: WakeSpotter?
+ private var locale: Locale?
+
+ /// True while the VAD has detected voice activity (VAD rose, hasn't fallen yet).
+ private var voiceSegmentActive = false
// Command session timers and state
- private var silenceWork: DispatchWorkItem?
- private var commandMaxWork: DispatchWorkItem?
- private var lastWordCount = 0
+ private var silenceWork: DispatchWorkItem?
+ private var commandMaxWork: DispatchWorkItem?
+ private var wakeWindowWork: DispatchWorkItem? // 20 s window-restart timer
+ private var lastWordCount = 0
+
+ /// Time to start speaking after the wake phrase before the session times out.
+ private static let initialTimeout: TimeInterval = 3.0
+ /// Silence duration that ends a command once speaking has started.
+ private static let silenceTimeout: TimeInterval = 1.2
+ private static let commandMaxTime: TimeInterval = 10.0
+ /// Restart the wake recognition window every N seconds of continuous speech.
+ private static let wakeWindowMax: TimeInterval = 20.0
- private static let silenceTimeout: TimeInterval = 1.2
- private static let commandMaxTime: TimeInterval = 10.0
- private static let cancelPhrases = ["annule", "annuler", "cancel", "laisse tomber"]
+ private static let cancelPhrases = ["annule", "annuler", "cancel", "laisse tomber", "never mind"]
// MARK: - Init
@@ -79,40 +91,53 @@ final class VoiceEngine: ObservableObject {
private func startAudioPipeline() {
guard audio == nil else { return }
- guard let locale = suitableLocale() else {
+ guard let loc = suitableLocale() else {
recognizerUnavailable = true
return
}
recognizerUnavailable = false
audioError = nil
+ locale = loc
let a = VoiceAudio()
let s = WakeSpotter()
s.onWake = { [weak self] transcript in
- self?.wakeDetected(transcript: transcript, locale: locale)
+ self?.wakeDetected(transcript: transcript)
}
- s.onCommandUpdate = { [weak self] stripped in
- self?.commandUpdate(stripped)
+ s.onCommandUpdate = { [weak self] command in
+ self?.commandUpdate(command)
}
s.onCommandEnd = { [weak self] in
self?.endCommand(postFinished: true)
}
+ // Wake window ended naturally (final result in wake phase) — reopen if voice is still active.
+ s.onWakeWindowEnded = { [weak self] in
+ guard let self, !isListeningForCommand, voiceSegmentActive else { return }
+ let preroll = a.drainPreroll()
+ s.beginWindow(locale: loc, preroll: preroll)
+ scheduleWakeWindowRestart(audio: a, spotter: s, locale: loc)
+ }
+
a.onVoiceStart = { [weak self] in
guard let self else { return }
+ voiceSegmentActive = true
let preroll = a.drainPreroll()
- s.beginWindow(locale: locale, preroll: preroll)
+ s.beginWindow(locale: loc, preroll: preroll)
+ scheduleWakeWindowRestart(audio: a, spotter: s, locale: loc)
}
a.onVoiceEnd = { [weak self] in
guard let self else { return }
+ voiceSegmentActive = false
+ wakeWindowWork?.cancel(); wakeWindowWork = nil
// Only close the wake window if we're not already in command mode.
- // `isInCommandPhase` is lock-protected and safe to check on main before
- // `isListeningForCommand` is set (race with onWake dispatch).
- if !self.isListeningForCommand && !s.isInCommandPhase {
+ // isInCommandPhase is lock-protected and safe to check on main before
+ // isListeningForCommand is set (race with onWake dispatch).
+ if !isListeningForCommand && !s.isInCommandPhase {
s.endWindow()
}
}
@@ -132,22 +157,53 @@ final class VoiceEngine: ObservableObject {
private func stopAudioPipeline() {
endCommand(postFinished: false)
+ wakeWindowWork?.cancel(); wakeWindowWork = nil
audio?.stop()
audio = nil
spotter = nil
+ locale = nil
+ voiceSegmentActive = false
+ }
+
+ // MARK: - 20-second wake-window restart
+
+ private func scheduleWakeWindowRestart(audio: VoiceAudio, spotter: WakeSpotter, locale: Locale) {
+ wakeWindowWork?.cancel()
+ let item = DispatchWorkItem { [weak self] in
+ guard let self, !isListeningForCommand else { return }
+ let preroll = audio.drainPreroll()
+ spotter.endWindow()
+ spotter.beginWindow(locale: locale, preroll: preroll)
+ scheduleWakeWindowRestart(audio: audio, spotter: spotter, locale: locale)
+ }
+ wakeWindowWork = item
+ DispatchQueue.main.asyncAfter(deadline: .now() + Self.wakeWindowMax, execute: item)
}
// MARK: - Wake detection
- private func wakeDetected(transcript: String, locale: Locale) {
- guard isEnabled, !isPaused, !isListeningForCommand else { return }
- guard !shouldIgnoreWake() else { return }
+ private func wakeDetected(transcript: String) {
+ // FIX: reset spotter if we're going to ignore this wake, so the window doesn't
+ // stay permanently in command phase and block future wake detections.
+ guard isEnabled, !isPaused else {
+ spotter?.endWindow()
+ return
+ }
+ guard !isListeningForCommand else {
+ spotter?.endWindow()
+ return
+ }
+ guard !shouldIgnoreWake() else {
+ spotter?.endWindow()
+ return
+ }
+ wakeWindowWork?.cancel(); wakeWindowWork = nil
isListeningForCommand = true
commandTranscript = ""
lastWordCount = 0
audio?.bypassVAD = true
NotificationCenter.default.post(name: .voiceWoke, object: nil)
- // Silence and max-duration timers
+ // Initial timeout: 3 s to start speaking, then 1.2 s silence to finish.
resetSilenceTimer()
let maxItem = DispatchWorkItem { [weak self] in
Task { @MainActor in self?.endCommand(postFinished: true) }
@@ -156,14 +212,15 @@ final class VoiceEngine: ObservableObject {
DispatchQueue.main.asyncAfter(deadline: .now() + Self.commandMaxTime, execute: maxItem)
}
- private func commandUpdate(_ stripped: String) {
- commandTranscript = stripped
- let wc = stripped.split(separator: " ").count
+ private func commandUpdate(_ command: String) {
+ commandTranscript = command
+ let wc = command.split(separator: " ").count
if wc > lastWordCount {
lastWordCount = wc
resetSilenceTimer()
- let lower = stripped.lowercased()
- if Self.cancelPhrases.contains(where: { lower.contains($0) }) {
+ // Cancel only when the ENTIRE command is a cancel phrase (not a substring).
+ let trimmed = command.trimmingCharacters(in: .whitespaces)
+ if Self.cancelPhrases.contains(trimmed) {
endCommand(postFinished: true)
}
}
@@ -173,11 +230,14 @@ final class VoiceEngine: ObservableObject {
private func resetSilenceTimer() {
silenceWork?.cancel()
+ // Use the longer initial timeout before any words are spoken;
+ // switch to the shorter silence timeout once speaking has begun.
+ let timeout = lastWordCount > 0 ? Self.silenceTimeout : Self.initialTimeout
let item = DispatchWorkItem { [weak self] in
Task { @MainActor in self?.endCommand(postFinished: true) }
}
silenceWork = item
- DispatchQueue.main.asyncAfter(deadline: .now() + Self.silenceTimeout, execute: item)
+ DispatchQueue.main.asyncAfter(deadline: .now() + timeout, execute: item)
}
private func endCommand(postFinished: Bool) {
@@ -256,7 +316,6 @@ final class VoiceEngine: ObservableObject {
}
}
- // Pause while chat dictation is active.
NotificationCenter.default.addObserver(
forName: .dictationDidStart, object: nil, queue: .main
) { [weak self] _ in
diff --git a/NotchBuddy/Sources/App/Voice/WakePhrase.swift b/NotchBuddy/Sources/App/Voice/WakePhrase.swift
index bb3e897d..fb1c50f5 100644
--- a/NotchBuddy/Sources/App/Voice/WakePhrase.swift
+++ b/NotchBuddy/Sources/App/Voice/WakePhrase.swift
@@ -6,54 +6,71 @@ import Foundation
enum WakePhrase {
- /// Returns `true` when `raw` contains a recognised wake pattern.
+ // MARK: - Public API
+
+ struct SplitResult {
+ let matched: Bool
+ let command: String // words after the LAST wake phrase occurrence (lowercased, normalised)
+ }
+
+ /// Scans `raw` for a wake phrase at a word boundary (anywhere in the transcript,
+ /// not just the start). Returns the text following the **last** occurrence as the command.
///
/// Accepted patterns (case-insensitive, after phonetic normalisation):
- /// - "ok coucou" and variants: "okay coucou", "ok cuckoo", "ok kuku" …
+ /// - "ok coucou" and variants: "okay coucou", "ok cuckoo", "ok kuku", "ok cou cou" …
/// - "hey coucou"
///
- /// The match may be followed by command words ("ok coucou add GitHub").
- ///
- /// Intentionally excluded:
- /// - Standalone "coucou" — partial results arrive word-by-word, so the
- /// recogniser emits "coucou" before completing "coucou ça va", causing
- /// false wakes.
- /// - "dis coucou" — French ambiguity: "dis coucou à Marie" = "say hi to Marie".
- static func matchesWake(_ raw: String) -> Bool {
- // 1. Lower-case and strip punctuation
- var text = raw.lowercased()
+ /// Word-boundary search means "euh ok coucou add" matches and returns "add".
+ /// Standalone "coucou" never matches (no preceding "ok"/"hey").
+ static func split(_ raw: String) -> SplitResult {
+ // 1. Strip punctuation, lowercase, normalise phonetic variants
+ let normalised = normalise(raw)
+
+ // 2. Split into words
+ let words = normalised.split(separator: " ", omittingEmptySubsequences: true).map(String.init)
+ guard !words.isEmpty else { return SplitResult(matched: false, command: "") }
+
+ // 3. Wake phrase word-arrays
+ let patterns: [[String]] = [["ok", "coucou"], ["hey", "coucou"]]
+
+ // 4. Find LAST occurrence of any pattern
+ var lastMatchEnd: Int? = nil // word index immediately after the matched pattern
+
+ for pattern in patterns {
+ var i = 0
+ while i <= words.count - pattern.count {
+ if Array(words[i ..< i + pattern.count]) == pattern {
+ let end = i + pattern.count
+ if lastMatchEnd == nil || end > lastMatchEnd! { lastMatchEnd = end }
+ i = end // resume search after this match
+ } else {
+ i += 1
+ }
+ }
+ }
+
+ guard let end = lastMatchEnd else { return SplitResult(matched: false, command: "") }
+
+ let commandWords = Array(words[end...])
+ return SplitResult(matched: true, command: commandWords.joined(separator: " "))
+ }
+
+ // MARK: - Internal
+
+ /// Lowercase, strip punctuation, normalise phonetic / spelling variants.
+ static func normalise(_ raw: String) -> String {
+ var t = raw.lowercased()
.components(separatedBy: .punctuationCharacters)
.joined()
.trimmingCharacters(in: .whitespaces)
-
- // 2. Normalise common phonetic / spelling variants
- text = text
+ t = t
.replacingOccurrences(of: "cuckoo", with: "coucou")
.replacingOccurrences(of: "kuku", with: "coucou")
.replacingOccurrences(of: "kucou", with: "coucou")
.replacingOccurrences(of: "cou cou", with: "coucou")
.replacingOccurrences(of: "okay", with: "ok")
.replacingOccurrences(of: "o k ", with: "ok ")
- while text.contains(" ") { text = text.replacingOccurrences(of: " ", with: " ") }
-
- // 3. Prefix-based patterns (may be followed by command words).
- let wakePrefixes = ["ok coucou", "hey coucou"]
- for prefix in wakePrefixes {
- if text == prefix { return true }
- if text.hasPrefix(prefix + " ") { return true }
- }
- return false
- }
-
- /// Strip the wake phrase from the start of a transcript, returning the remainder.
- static func stripWakePhrase(_ raw: String) -> String {
- let lower = raw.lowercased()
- let phrases = ["ok coucou", "okay coucou", "ok cuckoo", "ok kuku",
- "hey coucou", "coucou"]
- for phrase in phrases where lower.hasPrefix(phrase) {
- return String(raw.dropFirst(phrase.count))
- .trimmingCharacters(in: .whitespaces)
- }
- return raw
+ while t.contains(" ") { t = t.replacingOccurrences(of: " ", with: " ") }
+ return t
}
}
diff --git a/NotchBuddy/Sources/App/Voice/WakeSpotter.swift b/NotchBuddy/Sources/App/Voice/WakeSpotter.swift
index 3c5bc3bf..53bc9554 100644
--- a/NotchBuddy/Sources/App/Voice/WakeSpotter.swift
+++ b/NotchBuddy/Sources/App/Voice/WakeSpotter.swift
@@ -8,6 +8,9 @@ import Speech
/// then switches to command mode in the same recognition session so words spoken
/// immediately after the wake phrase are not lost.
///
+/// Wake detection uses `WakePhrase.split` which searches anywhere in the transcript
+/// at a word boundary, not just the start ("euh ok coucou…" matches).
+///
/// Thread model: `beginWindow`, `endWindow` are called on the main actor.
/// `feed(_:)` may be called from any thread (the audio tap thread).
/// Recognition callbacks arrive on an internal Apple thread.
@@ -18,11 +21,14 @@ final class WakeSpotter: @unchecked Sendable {
/// Called once when the wake phrase is detected. Receives the raw partial transcript.
var onWake: ((String) -> Void)?
- /// Called during the command phase with the transcript stripped of the wake phrase.
+ /// Called during the command phase with the command portion of the transcript (normalised).
var onCommandUpdate: ((String) -> Void)?
/// Called when the recognition session ends naturally (final result or error)
/// while in command phase.
var onCommandEnd: (() -> Void)?
+ /// Called when the recognition session ends in wake phase (no command captured).
+ /// VoiceEngine uses this to reopen the window immediately if the VAD is still active.
+ var onWakeWindowEnded: (() -> Void)?
// MARK: - State (all guarded by `lock`)
@@ -101,6 +107,7 @@ final class WakeSpotter: @unchecked Sendable {
case woke(String)
case commandUpdate(String)
case commandEnd
+ case wakeWindowEnded
}
private func handleResult(_ result: SFSpeechRecognitionResult?, error: Error?) {
@@ -110,13 +117,15 @@ final class WakeSpotter: @unchecked Sendable {
if let transcript = result?.bestTranscription.formattedString {
switch phase {
case .wake:
- if WakePhrase.matchesWake(transcript) {
+ let r = WakePhrase.split(transcript)
+ if r.matched {
phase = .command
return .woke(transcript)
}
case .command:
- let stripped = WakePhrase.stripWakePhrase(transcript)
- return .commandUpdate(stripped)
+ let r = WakePhrase.split(transcript)
+ // In command phase, split always finds the wake prefix; fall back to full transcript.
+ return .commandUpdate(r.matched ? r.command : transcript.lowercased())
}
}
@@ -127,7 +136,7 @@ final class WakeSpotter: @unchecked Sendable {
recognizer = nil
active = false
phase = .wake
- return wasCommand ? .commandEnd : nil
+ return wasCommand ? .commandEnd : .wakeWindowEnded
}
return nil
}
@@ -140,6 +149,8 @@ final class WakeSpotter: @unchecked Sendable {
DispatchQueue.main.async { [weak self] in self?.onCommandUpdate?(s) }
case .commandEnd:
DispatchQueue.main.async { [weak self] in self?.onCommandEnd?() }
+ case .wakeWindowEnded:
+ DispatchQueue.main.async { [weak self] in self?.onWakeWindowEnded?() }
}
}
}
diff --git a/tests/WakePhraseTests.swift b/tests/WakePhraseTests.swift
index 48036647..8d5765a7 100644
--- a/tests/WakePhraseTests.swift
+++ b/tests/WakePhraseTests.swift
@@ -8,47 +8,64 @@ enum WakePhraseTests {
static var failures = 0
static func main() {
- // MARK: matchesWake — should trigger
- check("ok coucou", expected: true, WakePhrase.matchesWake("ok coucou"))
- check("OK COUCOU", expected: true, WakePhrase.matchesWake("OK COUCOU"))
- check("okay coucou", expected: true, WakePhrase.matchesWake("okay coucou"))
- check("Okay Coucou", expected: true, WakePhrase.matchesWake("Okay Coucou"))
- check("ok cuckoo", expected: true, WakePhrase.matchesWake("ok cuckoo"))
- check("ok kuku", expected: true, WakePhrase.matchesWake("ok kuku"))
- check("ok cou cou", expected: true, WakePhrase.matchesWake("ok cou cou"))
- check("hey coucou", expected: true, WakePhrase.matchesWake("hey coucou"))
- check("Hey Coucou", expected: true, WakePhrase.matchesWake("Hey Coucou"))
- check("ok coucou add github", expected: true, WakePhrase.matchesWake("ok coucou add github"))
- check("ok coucou ouvre figma", expected: true, WakePhrase.matchesWake("ok coucou ouvre figma"))
- // MARK: matchesWake — should NOT trigger
- check("standalone coucou", expected: false, WakePhrase.matchesWake("coucou"))
- check("standalone COUCOU", expected: false, WakePhrase.matchesWake("COUCOU"))
- check("partial coucou ça va", expected: false, WakePhrase.matchesWake("coucou ça va"))
- check("partial coucou comment", expected: false, WakePhrase.matchesWake("coucou comment tu vas"))
- check("ok google", expected: false, WakePhrase.matchesWake("ok google"))
- check("hey siri", expected: false, WakePhrase.matchesWake("hey siri"))
- check("bonjour coucou", expected: false, WakePhrase.matchesWake("bonjour coucou"))
- check("okkkk coucou", expected: false, WakePhrase.matchesWake("okkkk coucou"))
- check("empty string", expected: false, WakePhrase.matchesWake(""))
- // MARK: stripWakePhrase
- checkEq("strip ok coucou", WakePhrase.stripWakePhrase("ok coucou ajoute GitHub"), "ajoute GitHub")
- checkEq("strip hey coucou", WakePhrase.stripWakePhrase("hey coucou open figma"), "open figma")
- checkEq("strip ok cuckoo", WakePhrase.stripWakePhrase("ok cuckoo search"), "search")
- checkEq("strip okay coucou", WakePhrase.stripWakePhrase("okay coucou translate"), "translate")
- checkEq("no wake prefix", WakePhrase.stripWakePhrase("bonjour"), "bonjour")
- checkEq("wake phrase only", WakePhrase.stripWakePhrase("ok coucou"), "")
+ // MARK: split — should match
+ checkMatch("ok coucou", WakePhrase.split("ok coucou"), cmd: "")
+ checkMatch("OK COUCOU", WakePhrase.split("OK COUCOU"), cmd: "")
+ checkMatch("okay coucou", WakePhrase.split("okay coucou"), cmd: "")
+ checkMatch("Okay, Coucou, ajoute GitHub",
+ WakePhrase.split("Okay, Coucou, ajoute GitHub"), cmd: "ajoute github")
+ checkMatch("ok cuckoo add github", WakePhrase.split("ok cuckoo add github"), cmd: "add github")
+ checkMatch("ok kuku", WakePhrase.split("ok kuku"), cmd: "")
+ checkMatch("ok cou cou", WakePhrase.split("ok cou cou"), cmd: "")
+ checkMatch("hey coucou", WakePhrase.split("hey coucou"), cmd: "")
+ checkMatch("Hey Coucou", WakePhrase.split("Hey Coucou"), cmd: "")
+ checkMatch("ok coucou ouvre figma", WakePhrase.split("ok coucou ouvre figma"), cmd: "ouvre figma")
+
+ // Wake anywhere in transcript (word-boundary search)
+ checkMatch("euh ok coucou mets de la musique",
+ WakePhrase.split("euh ok coucou mets de la musique"), cmd: "mets de la musique")
+ checkMatch("la chanson dit ok coucou",WakePhrase.split("la chanson dit ok coucou"), cmd: "") // accepted false positive
+
+ // LAST occurrence wins
+ checkMatch("ok coucou search ok coucou play music",
+ WakePhrase.split("ok coucou search ok coucou play music"), cmd: "play music")
+
+ // Partial word-by-word delivery
+ checkNoMatch("ok alone", WakePhrase.split("ok"))
+ checkMatch("ok coucou partial", WakePhrase.split("ok coucou"), cmd: "")
+ checkMatch("ok coucou with more", WakePhrase.split("ok coucou mets"), cmd: "mets")
+
+ // MARK: split — should NOT match
+ checkNoMatch("standalone coucou", WakePhrase.split("coucou"))
+ checkNoMatch("standalone COUCOU", WakePhrase.split("COUCOU"))
+ checkNoMatch("partial coucou ça va", WakePhrase.split("coucou ça va"))
+ checkNoMatch("coucou comment", WakePhrase.split("coucou comment tu vas"))
+ checkNoMatch("ok google", WakePhrase.split("ok google"))
+ checkNoMatch("hey siri", WakePhrase.split("hey siri"))
+ checkNoMatch("okkkk coucou", WakePhrase.split("okkkk coucou"))
+ checkNoMatch("empty", WakePhrase.split(""))
+
// Summary
- if failures == 0 { print("\n25/25 tests passed.") }
+ if failures == 0 { print("\n\(total)/\(total) tests passed.") }
else { print("\n\(failures) test(s) FAILED."); exit(1) }
}
- static func check(_ label: String, expected: Bool, _ got: Bool) {
- if got == expected { print("✓ \(label)") }
- else { print("✗ \(label) — expected \(expected), got \(got)"); failures += 1 }
+ static var total = 0
+
+ static func checkMatch(_ label: String, _ r: WakePhrase.SplitResult, cmd: String) {
+ total += 1
+ if !r.matched {
+ print("✗ \(label) — expected match, got no match"); failures += 1; return
+ }
+ if r.command != cmd {
+ print("✗ \(label) — matched ✓ but command \"\(r.command)\" ≠ \"\(cmd)\""); failures += 1; return
+ }
+ print("✓ \(label)")
}
- static func checkEq(_ label: String, _ got: String, _ want: String) {
- if got == want { print("✓ \(label)") }
- else { print("✗ \(label) — got \"\(got)\", want \"\(want)\""); failures += 1 }
+ static func checkNoMatch(_ label: String, _ r: WakePhrase.SplitResult) {
+ total += 1
+ if r.matched { print("✗ \(label) — expected no match, got matched (cmd: \"\(r.command)\")"); failures += 1 }
+ else { print("✓ \(label)") }
}
}