From 582a5d777a2b9d3dc67111b28a4b70588b3f7fa8 Mon Sep 17 00:00:00 2001 From: Alex J Lennon Date: Sun, 9 Aug 2026 20:50:39 +0100 Subject: [PATCH] Default MCQ audio off until the human opts in. Quiet-first packaged default: audio_enabled=false so new installs and missing prefs stay muted; checkbox/prefs true still unmutes. Co-authored-by: Cursor --- prefs.example.json | 2 +- scripts/test_install.py | 2 +- scripts/test_prefs_audio_env.py | 4 ++++ src/ask_question_mcp/doctor.py | 2 +- src/ask_question_mcp/gtk4_list_ask.py | 2 +- src/ask_question_mcp/linux_webview_ask.py | 2 +- src/ask_question_mcp/prefs.py | 8 ++++---- 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/prefs.example.json b/prefs.example.json index 96bf2f1..0ace4e8 100644 --- a/prefs.example.json +++ b/prefs.example.json @@ -1,5 +1,5 @@ { - "audio_enabled": true, + "audio_enabled": false, "duck_enabled": true, "ack_enabled": false, "always_listen": false, diff --git a/scripts/test_install.py b/scripts/test_install.py index 5cf32fc..fb2e34d 100644 --- a/scripts/test_install.py +++ b/scripts/test_install.py @@ -74,7 +74,7 @@ def test_prefs_quiet_defaults() -> None: d = prefs_mod.defaults() assert d["always_listen"] is False assert d["ack_enabled"] is False - assert d["audio_enabled"] is True + assert d["audio_enabled"] is False def main() -> None: diff --git a/scripts/test_prefs_audio_env.py b/scripts/test_prefs_audio_env.py index 834c89a..663f7f0 100644 --- a/scripts/test_prefs_audio_env.py +++ b/scripts/test_prefs_audio_env.py @@ -24,6 +24,10 @@ def main() -> int: os.environ.pop("ASK_QUESTION_AUDIO", None) assert prefs.get_audio_enabled() is False, "prefs false must mute" + # No prefs file → packaged default is quiet (audio off). + prefs_path.unlink(missing_ok=True) + assert prefs.get_audio_enabled() is False, "shipped default must mute" + prefs_path.write_text('{"audio_enabled": true}\n', encoding="utf-8") assert prefs.get_audio_enabled() is True, "prefs true must unmute" diff --git a/src/ask_question_mcp/doctor.py b/src/ask_question_mcp/doctor.py index 426af74..0de429b 100644 --- a/src/ask_question_mcp/doctor.py +++ b/src/ask_question_mcp/doctor.py @@ -970,7 +970,7 @@ def setup_guide(topic: str) -> dict[str, Any]: "Complete the STT walkthrough (topic=stt).", "Put both URLs in mcp.json `env` (see topic=mcp).", "Re-run check_setup until ready.tts and ready.stt are true.", - "Keep the dialog Audio checkbox on (prefs audio_enabled, default true).", + "Turn the dialog Audio checkbox on (prefs audio_enabled, default false).", ], "docs": [DOCS_VOICE], } diff --git a/src/ask_question_mcp/gtk4_list_ask.py b/src/ask_question_mcp/gtk4_list_ask.py index 03b2907..824b886 100644 --- a/src/ask_question_mcp/gtk4_list_ask.py +++ b/src/ask_question_mcp/gtk4_list_ask.py @@ -2624,7 +2624,7 @@ def _poll_speak_phase() -> bool: GLib.timeout_add(150, _poll_speak_phase) always = False if _prefs is None else _prefs.get_always_listen() - audio_on = True if _prefs is None else _prefs.get_audio_enabled() + audio_on = False if _prefs is None else _prefs.get_audio_enabled() if always and audio_on: start_voice_listen_thread() diff --git a/src/ask_question_mcp/linux_webview_ask.py b/src/ask_question_mcp/linux_webview_ask.py index 09bfea4..f56fc81 100644 --- a/src/ask_question_mcp/linux_webview_ask.py +++ b/src/ask_question_mcp/linux_webview_ask.py @@ -986,7 +986,7 @@ def main() -> int: ui_payload["voice_answer"] = voice_answer ui_payload["audio_mode"] = audio_mode ui_payload["audio_enabled"] = ( - bool(_prefs.get_audio_enabled()) if _prefs is not None else True + bool(_prefs.get_audio_enabled()) if _prefs is not None else False ) ui_payload["always_listen"] = ( bool(_prefs.get_always_listen()) if _prefs is not None else False diff --git a/src/ask_question_mcp/prefs.py b/src/ask_question_mcp/prefs.py index 0cc89b9..5122065 100644 --- a/src/ask_question_mcp/prefs.py +++ b/src/ask_question_mcp/prefs.py @@ -30,11 +30,11 @@ _PREFS_PATH = Path.home() / ".config" / "ask-question-mcp" / "prefs.json" # Packaged defaults for new installs / other users (no prefs.json required). -# Text-first: speak questions when TTS is configured; do not auto-listen or -# speak acks until the human opts in (dialog checkbox / prefs.json / env). +# Quiet-first: Audio checkbox off until the human opts in (dialog / prefs.json). +# ``ASK_QUESTION_AUDIO=0`` still hard-mutes; ``=1`` does not force speak on. # Volumes tuned 2026-07-26 under session duck + pw-play + flat-volumes boost. _DEFAULTS: dict[str, Any] = { - "audio_enabled": True, + "audio_enabled": False, "duck_enabled": True, "ack_enabled": False, "always_listen": False, @@ -102,7 +102,7 @@ def get_audio_enabled() -> bool: env = _env_bool("ASK_QUESTION_AUDIO") if env is False: return False - return bool(load_prefs().get("audio_enabled", True)) + return bool(load_prefs().get("audio_enabled", _DEFAULTS["audio_enabled"])) def set_audio_enabled(enabled: bool) -> None: