python-voiceio 1.18.0__tar.gz → 1.18.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_voiceio-1.18.0/python_voiceio.egg-info → python_voiceio-1.18.1}/PKG-INFO +1 -1
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/pyproject.toml +1 -1
- {python_voiceio-1.18.0 → python_voiceio-1.18.1/python_voiceio.egg-info}/PKG-INFO +1 -1
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/python_voiceio.egg-info/SOURCES.txt +1 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_evdev_uaccess.py +7 -6
- python_voiceio-1.18.1/tests/test_evdev_x11_optional.py +199 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_security_hardening.py +2 -2
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_setup.py +75 -3
- python_voiceio-1.18.1/voiceio/__init__.py +1 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/cli/doctor.py +5 -6
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/cli/uninstall.py +2 -2
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/health.py +26 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/hotkeys/evdev.py +42 -11
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/platform.py +66 -15
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/setup/noninteractive.py +4 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/setup/steps.py +7 -4
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/setup/system.py +14 -5
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/typers/ydotool.py +12 -9
- python_voiceio-1.18.0/voiceio/__init__.py +0 -1
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/LICENSE +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/README.md +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/python_voiceio.egg-info/dependency_links.txt +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/python_voiceio.egg-info/entry_points.txt +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/python_voiceio.egg-info/requires.txt +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/python_voiceio.egg-info/top_level.txt +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/setup.cfg +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_announce.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_app_wiring.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_audio_quality.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_audio_source.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_backend_probes.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_cancel.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_cli.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_clipboard_read.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_clipboard_typer.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_commands.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_concurrency_lockdown.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_config.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_context_terms.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_corrections.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_dead_mic.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_decoders.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_engine.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_errorlog.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_fallback.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_fcitx_bridge.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_feedback_stream.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_focus.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_gpu_fallback.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_health.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_hints.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_history.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_hotkey_modes.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_ibus_engine_limits.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_ibus_engine_listener.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_ibus_pending.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_ibus_pids.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_ibus_ping.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_ibus_session.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_ibus_textlimit.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_ibus_typer.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_idle_audio.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_install_env.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_learn_clean.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_learn_import.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_learn_language.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_learn_metrics.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_learn_pipeline.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_learn_quiet.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_learn_resume.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_learn_review.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_learn_targets.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_llm.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_llm_api.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_mic_gain.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_modifier_guard.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_numbers.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_paste_last.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_pipeline.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_platform.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_postcorrect.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_postprocess.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_prebuffer.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_presence.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_prompt.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_quiet_audio.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_recorder_integration.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_report.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_retention.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_robustness.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_server.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_service.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_sherpa.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_spool.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_streaming.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_suggest.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_tokens.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_transcriber.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_tray.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_tts.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_typer_manager.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_vad.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_vocabulary.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_wordfreq.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/tests/test_worker_decode.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/__main__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/announce.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/app.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/audio_source.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/backends.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/cli/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/cli/configcmd.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/cli/corrections.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/cli/history.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/cli/learn.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/cli/models.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/cli/servicecmd.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/cli/vocab.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/clipboard_read.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/commands.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/config.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/consent.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/context_terms.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/core/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/core/bias.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/core/decoders/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/core/decoders/base.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/core/decoders/catalog.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/core/decoders/faster_whisper/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/core/decoders/faster_whisper/worker.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/core/decoders/fetch.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/core/decoders/lanes.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/core/decoders/sherpa.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/core/decoders/whispercpp.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/core/engine.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/core/pipeline.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/corrections.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/data/60-voiceio-uaccess.rules +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/data/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/demo.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/display.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/errorlog.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/feedback.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/focus.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/hints.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/history.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/hotkeys/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/hotkeys/base.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/hotkeys/chain.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/hotkeys/pynput_backend.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/hotkeys/socket_backend.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/ibus/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/ibus/engine.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/ibus/install.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/ibus/pending.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/ibus/session.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/ibus/textlimit.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/idle_audio.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/install_env.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/learn/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/learn/augment.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/learn/clean.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/learn/evaluate.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/learn/importer.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/learn/metrics.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/learn/quiet.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/learn/review.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/learn/store.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/learn/teacher.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/learn/train.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/llm.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/llm_api.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/mic_gain.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/models/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/models/silero_vad.onnx +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/numbers.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/pidlock.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/postcorrect.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/postprocess.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/power.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/presence.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/privacy.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/prompt.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/quiet_audio.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/recorder.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/report.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/retention.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/server/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/server/__main__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/server/app.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/server/config.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/server/runtime.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/service.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/setup/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/setup/configfile.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/setup/extras.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/setup/hotkey.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/setup/speech.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/setup/ui.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/sounds/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/sounds/alert.wav +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/sounds/commit.wav +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/sounds/start.wav +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/sounds/stop.wav +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/spool.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/streaming.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/suggest.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/tokens.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/tray/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/tray/_icons.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/tray/_indicator.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/tray/_pystray.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/tts/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/tts/base.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/tts/chain.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/tts/edge_engine.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/tts/espeak.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/tts/piper_engine.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/tts/player.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/tts/supertonic_engine.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/typers/__init__.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/typers/base.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/typers/chain.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/typers/clipboard.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/typers/collecting.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/typers/fcitx_bridge.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/typers/ibus.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/typers/manager.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/typers/modifier_guard.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/typers/paste.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/typers/pynput_type.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/typers/wtype.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/typers/xdotool.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/ui.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/vad.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/vocab_stats.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/vocabulary.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/watchdog.py +0 -0
- {python_voiceio-1.18.0 → python_voiceio-1.18.1}/voiceio/wordfreq.py +0 -0
|
@@ -31,13 +31,13 @@ def test_rule_ships_as_package_data():
|
|
|
31
31
|
assert (ROOT / "voiceio" / "data" / "__init__.py").exists()
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
def
|
|
34
|
+
def test_install_cmd_is_single_root_script():
|
|
35
35
|
cmd = evdev_mod.uaccess_install_cmd()
|
|
36
|
-
assert cmd[:
|
|
37
|
-
script = cmd[
|
|
38
|
-
assert f"
|
|
39
|
-
assert "
|
|
40
|
-
assert "
|
|
36
|
+
assert cmd[:3] == ["sudo", "sh", "-c"] and len(cmd) == 4
|
|
37
|
+
script = cmd[3]
|
|
38
|
+
assert f"> {evdev_mod.UACCESS_RULE_PATH}" in script
|
|
39
|
+
assert "udevadm control --reload-rules" in script
|
|
40
|
+
assert "udevadm trigger" in script
|
|
41
41
|
assert "uaccess" in script
|
|
42
42
|
assert "usermod" not in script
|
|
43
43
|
|
|
@@ -60,6 +60,7 @@ def _deny_all_inputs(monkeypatch, tmp_path):
|
|
|
60
60
|
|
|
61
61
|
def test_probe_offers_uaccess_rule(monkeypatch, tmp_path):
|
|
62
62
|
monkeypatch.setattr("voiceio.platform.is_nixos", lambda: False)
|
|
63
|
+
monkeypatch.setattr(evdev_mod, "_pynput_covers_hotkey", lambda: False)
|
|
63
64
|
_deny_all_inputs(monkeypatch, tmp_path)
|
|
64
65
|
result = evdev_mod.EvdevHotkey().probe()
|
|
65
66
|
assert not result.ok
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"""On X11 pynput covers the hotkey: evdev access (a root-only udev rule) is
|
|
2
|
+
optional there, and setup/doctor must not fail on it or offer the install."""
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
from types import SimpleNamespace
|
|
7
|
+
from unittest.mock import MagicMock, patch
|
|
8
|
+
|
|
9
|
+
import pytest
|
|
10
|
+
|
|
11
|
+
from voiceio import config, health
|
|
12
|
+
from voiceio import platform as plat
|
|
13
|
+
from voiceio.backends import ProbeResult
|
|
14
|
+
from voiceio.hotkeys import evdev as evdev_mod
|
|
15
|
+
from voiceio.platform import Platform
|
|
16
|
+
|
|
17
|
+
_DENIED = ProbeResult(ok=False, reason="No permission to read /dev/input",
|
|
18
|
+
fix_hint="install udev rule", fix_cmd=evdev_mod.uaccess_install_cmd())
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _cfg(backend="auto"):
|
|
22
|
+
return SimpleNamespace(hotkey=SimpleNamespace(backend=backend),
|
|
23
|
+
llm=SimpleNamespace(enabled=False))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _report(display, pynput_ok=True, backend="auto", monkeypatch=None):
|
|
27
|
+
monkeypatch.setattr(config, "load", lambda *a, **k: _cfg(backend))
|
|
28
|
+
p = Platform(os="linux", display_server=display, desktop="kde")
|
|
29
|
+
chain = ([("pynput", MagicMock(), ProbeResult(ok=pynput_ok, reason="pynput missing"))]
|
|
30
|
+
if display == "x11" else [])
|
|
31
|
+
chain += [("evdev", MagicMock(), _DENIED), ("socket", MagicMock(), ProbeResult(ok=True))]
|
|
32
|
+
with patch("voiceio.health.hotkey_chain.resolve", lambda platform: chain), \
|
|
33
|
+
patch("voiceio.health.typer_chain.resolve",
|
|
34
|
+
lambda platform: [("xdotool", MagicMock(), ProbeResult(ok=True))]), \
|
|
35
|
+
patch.dict("sys.modules", {"sounddevice": MagicMock()}):
|
|
36
|
+
return health.check_health(p)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _evdev(report):
|
|
40
|
+
return next(b for b in report.hotkey_backends if b.name == "evdev")
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@pytest.mark.parametrize("display,pynput_ok,backend,expected", [
|
|
44
|
+
("x11", True, "auto", True),
|
|
45
|
+
("x11", True, "pynput", True),
|
|
46
|
+
("x11", True, "evdev", False), # pinned: evdev is the hotkey
|
|
47
|
+
("x11", False, "auto", False), # no pynput: evdev is next in the chain
|
|
48
|
+
("wayland", True, "auto", False), # evdev is the only physical listener
|
|
49
|
+
("unknown", True, "auto", False),
|
|
50
|
+
])
|
|
51
|
+
def test_evdev_optional(display, pynput_ok, backend, expected):
|
|
52
|
+
assert evdev_mod.evdev_optional(display, pynput_ok, backend) is expected
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def test_doctor_shows_evdev_optional_on_x11_with_pynput(monkeypatch):
|
|
56
|
+
report = _report("x11", monkeypatch=monkeypatch)
|
|
57
|
+
b = _evdev(report)
|
|
58
|
+
assert b.optional and not b.fix_cmd and not b.fix_hint
|
|
59
|
+
assert report.all_ok
|
|
60
|
+
line = next(ln for ln in health.format_report(report).splitlines() if "evdev" in ln)
|
|
61
|
+
assert "pynput handles the hotkey on X11" in line
|
|
62
|
+
assert "✗" not in line
|
|
63
|
+
assert "udev" not in health.format_report(report)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@pytest.mark.parametrize("display,pynput_ok,backend", [
|
|
67
|
+
("wayland", True, "auto"), ("x11", False, "auto"), ("x11", True, "evdev"),
|
|
68
|
+
])
|
|
69
|
+
def test_doctor_keeps_evdev_fix_elsewhere(monkeypatch, display, pynput_ok, backend):
|
|
70
|
+
b = _evdev(_report(display, pynput_ok, backend, monkeypatch=monkeypatch))
|
|
71
|
+
assert not b.optional
|
|
72
|
+
assert b.fix_cmd == evdev_mod.uaccess_install_cmd()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _run_doctor_fix(monkeypatch, report):
|
|
76
|
+
from voiceio import install_env
|
|
77
|
+
from voiceio.cli import doctor
|
|
78
|
+
privileged, ran = [], []
|
|
79
|
+
monkeypatch.setattr(health, "check_health", lambda: report)
|
|
80
|
+
monkeypatch.setattr(health, "format_report", lambda r: "")
|
|
81
|
+
monkeypatch.setattr(health, "usage_findings", lambda: [])
|
|
82
|
+
monkeypatch.setattr(plat, "check_system_deps", lambda: [])
|
|
83
|
+
monkeypatch.setattr(config, "check_permissions", lambda: [])
|
|
84
|
+
monkeypatch.setattr(install_env, "stale_install_paths", lambda: [])
|
|
85
|
+
monkeypatch.setattr(install_env, "running_ephemeral", lambda: False)
|
|
86
|
+
monkeypatch.setattr(doctor, "_offer_report", lambda *a: False)
|
|
87
|
+
monkeypatch.setattr(doctor, "_run_privileged", lambda *a, **k: privileged.append(a))
|
|
88
|
+
monkeypatch.setattr("subprocess.run", lambda *a, **k: ran.append(a))
|
|
89
|
+
report.cli_in_path = True
|
|
90
|
+
with pytest.raises(SystemExit):
|
|
91
|
+
doctor._cmd_doctor(argparse.Namespace(live=False, fix=True, report=False))
|
|
92
|
+
return privileged, ran
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def test_doctor_fix_skips_udev_install_on_x11_with_pynput(monkeypatch):
|
|
96
|
+
privileged, ran = _run_doctor_fix(monkeypatch, _report("x11", monkeypatch=monkeypatch))
|
|
97
|
+
assert privileged == [] and ran == []
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def test_doctor_fix_still_offers_udev_install_on_wayland(monkeypatch):
|
|
101
|
+
privileged, _ = _run_doctor_fix(monkeypatch, _report("wayland", monkeypatch=monkeypatch))
|
|
102
|
+
assert [a[0] for a in privileged] == ["Fix evdev"]
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def test_probe_drops_udev_fix_when_pynput_covers(monkeypatch, tmp_path):
|
|
106
|
+
from pathlib import Path
|
|
107
|
+
monkeypatch.setattr("voiceio.platform.is_nixos", lambda: False)
|
|
108
|
+
monkeypatch.setattr(evdev_mod, "_pynput_covers_hotkey", lambda: True)
|
|
109
|
+
(tmp_path / "event0").write_text("")
|
|
110
|
+
monkeypatch.setattr(Path, "glob", lambda self, pat: [tmp_path / "event0"])
|
|
111
|
+
|
|
112
|
+
def deny(*a, **k):
|
|
113
|
+
raise PermissionError
|
|
114
|
+
monkeypatch.setattr("builtins.open", deny)
|
|
115
|
+
result = evdev_mod.EvdevHotkey().probe()
|
|
116
|
+
assert not result.ok and not result.fix_cmd
|
|
117
|
+
assert result.fix_hint == evdev_mod.NOT_NEEDED_ON_X11
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def test_pynput_covers_hotkey_reads_display_and_config(monkeypatch):
|
|
121
|
+
from voiceio.hotkeys import pynput_backend
|
|
122
|
+
monkeypatch.setattr(pynput_backend.PynputHotkey, "probe", lambda self: ProbeResult(ok=True))
|
|
123
|
+
monkeypatch.setattr(plat, "_detect_display_server", lambda: "x11")
|
|
124
|
+
monkeypatch.setattr(config, "load", lambda *a, **k: _cfg("auto"))
|
|
125
|
+
assert evdev_mod._pynput_covers_hotkey()
|
|
126
|
+
monkeypatch.setattr(config, "load", lambda *a, **k: _cfg("evdev"))
|
|
127
|
+
assert not evdev_mod._pynput_covers_hotkey()
|
|
128
|
+
monkeypatch.setattr(config, "load", lambda *a, **k: _cfg("auto"))
|
|
129
|
+
monkeypatch.setattr(plat, "_detect_display_server", lambda: "wayland")
|
|
130
|
+
assert not evdev_mod._pynput_covers_hotkey()
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
# ── setup ────────────────────────────────────────────────────────────────
|
|
134
|
+
|
|
135
|
+
_CHECKS = {
|
|
136
|
+
"is_windows": False, "is_mac": False, "is_linux": True, "display": "x11",
|
|
137
|
+
"audio": True, "audio_devices": [object()], "pynput": True, "xdotool": True,
|
|
138
|
+
"xclip": False, "ydotool": False, "wtype": False, "ibus": False, "ibus_gi": False,
|
|
139
|
+
"cuda": False, "evdev_access": False, "evdev_optional": True,
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def test_setup_shows_evdev_optional_on_x11(capsys):
|
|
144
|
+
from voiceio.setup import steps
|
|
145
|
+
steps._print_capability_checks(dict(_CHECKS))
|
|
146
|
+
line = next(ln for ln in capsys.readouterr().out.splitlines() if "evdev" in ln)
|
|
147
|
+
assert "pynput handles the hotkey on X11" in line
|
|
148
|
+
assert "✗" not in line and "doctor --fix" not in line
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def test_setup_keeps_evdev_hint_on_wayland(capsys, monkeypatch):
|
|
152
|
+
from voiceio.setup import steps
|
|
153
|
+
monkeypatch.setattr("voiceio.platform.is_nixos", lambda: False)
|
|
154
|
+
steps._print_capability_checks(dict(_CHECKS, display="wayland", pynput=False,
|
|
155
|
+
evdev_optional=False))
|
|
156
|
+
line = next(ln for ln in capsys.readouterr().out.splitlines() if "evdev" in ln)
|
|
157
|
+
assert "✗" in line and "doctor --fix" in line
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def test_check_system_detects_pynput_on_startx_x11(monkeypatch):
|
|
161
|
+
"""XDG_SESSION_TYPE=tty under startx: DISPLAY still says X11."""
|
|
162
|
+
from voiceio.hotkeys import pynput_backend
|
|
163
|
+
from voiceio.setup import system
|
|
164
|
+
monkeypatch.setenv("XDG_SESSION_TYPE", "tty")
|
|
165
|
+
monkeypatch.setenv("DISPLAY", ":0")
|
|
166
|
+
monkeypatch.delenv("WAYLAND_DISPLAY", raising=False)
|
|
167
|
+
monkeypatch.setattr("sys.platform", "linux")
|
|
168
|
+
monkeypatch.setattr(plat, "_detect_os", lambda: "linux")
|
|
169
|
+
monkeypatch.setattr(pynput_backend.PynputHotkey, "probe", lambda self: ProbeResult(ok=True))
|
|
170
|
+
monkeypatch.setattr(evdev_mod.EvdevHotkey, "probe", lambda self: _DENIED)
|
|
171
|
+
checks = system._check_system()
|
|
172
|
+
assert checks["display"] == "x11"
|
|
173
|
+
assert checks["pynput"] and not checks["evdev_access"] and checks["evdev_optional"]
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def test_setup_picks_auto_backend_on_x11_without_evdev(monkeypatch):
|
|
177
|
+
from voiceio.setup import steps
|
|
178
|
+
monkeypatch.setattr("voiceio.ibus.install.ensure", lambda: True)
|
|
179
|
+
state = steps.SetupState(checks=dict(_CHECKS))
|
|
180
|
+
steps._select_output_backend(state)
|
|
181
|
+
assert state.backend == "auto" # pynput first, not the socket-only fallback
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
# ── install commands ─────────────────────────────────────────────────────
|
|
185
|
+
|
|
186
|
+
@pytest.mark.parametrize("cmd,rule_path", [
|
|
187
|
+
(evdev_mod.uaccess_install_cmd(), evdev_mod.UACCESS_RULE_PATH),
|
|
188
|
+
])
|
|
189
|
+
def test_install_cmd_creates_rules_dir_first(cmd, rule_path):
|
|
190
|
+
script = cmd[-1]
|
|
191
|
+
assert cmd[:3] == ["sudo", "sh", "-c"]
|
|
192
|
+
assert script.index("mkdir -p /etc/udev/rules.d") < script.index(f"> {rule_path}")
|
|
193
|
+
assert "sudo" not in script
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def test_ydotool_install_cmd_creates_rules_dir_first():
|
|
197
|
+
from voiceio.typers import ydotool
|
|
198
|
+
test_install_cmd_creates_rules_dir_first(ydotool.uinput_udev_install_cmd(),
|
|
199
|
+
ydotool.UINPUT_UDEV_RULE_PATH)
|
|
@@ -188,7 +188,7 @@ def test_uinput_install_cmd_uses_sudo_not_chmod_0666():
|
|
|
188
188
|
from voiceio.typers import ydotool
|
|
189
189
|
cmd = ydotool.uinput_udev_install_cmd()
|
|
190
190
|
joined = " ".join(cmd)
|
|
191
|
-
assert "sudo
|
|
191
|
+
assert cmd[0] == "sudo" and "> /etc/udev/rules.d/" in joined
|
|
192
192
|
assert "udevadm control --reload-rules" in joined
|
|
193
193
|
assert "chmod 0666" not in joined
|
|
194
194
|
|
|
@@ -201,7 +201,7 @@ def test_ydotool_probe_offers_udev_not_chmod(monkeypatch):
|
|
|
201
201
|
result = ydotool.YdotoolTyper().probe()
|
|
202
202
|
assert not result.ok
|
|
203
203
|
assert "chmod 0666" not in " ".join(result.fix_cmd)
|
|
204
|
-
assert "sudo
|
|
204
|
+
assert result.fix_cmd[0] == "sudo" and "udevadm" in " ".join(result.fix_cmd)
|
|
205
205
|
|
|
206
206
|
|
|
207
207
|
# ── doctor --fix consent prompt for privileged actions ───────────────────
|
|
@@ -352,11 +352,20 @@ def test_setup_offers_nightly_learning_once(monkeypatch):
|
|
|
352
352
|
|
|
353
353
|
# ── root commands with no terminal (agent, launcher, GUI) ────────────
|
|
354
354
|
|
|
355
|
-
def
|
|
355
|
+
def _tools(monkeypatch, *names):
|
|
356
|
+
"""Only these privilege tools are on PATH; not running as root."""
|
|
357
|
+
monkeypatch.setattr(plat, "_is_root", lambda: False)
|
|
358
|
+
monkeypatch.setattr(plat.shutil, "which",
|
|
359
|
+
lambda name: f"/usr/bin/{name}" if name in names else None)
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
def _no_terminal(monkeypatch, *, sudo_cached=False, pkexec=True, display=True,
|
|
363
|
+
sudo=True, doas=False, doas_cached=False):
|
|
356
364
|
monkeypatch.setattr(plat, "_has_tty", lambda: False)
|
|
357
365
|
monkeypatch.setattr(plat, "_sudo_without_password", lambda: sudo_cached)
|
|
358
|
-
monkeypatch.setattr(plat
|
|
359
|
-
|
|
366
|
+
monkeypatch.setattr(plat, "_doas_without_password", lambda: doas_cached)
|
|
367
|
+
_tools(monkeypatch, *[n for n, on in (("sudo", sudo), ("doas", doas),
|
|
368
|
+
("pkexec", pkexec)) if on])
|
|
360
369
|
monkeypatch.delenv("DISPLAY", raising=False)
|
|
361
370
|
if display:
|
|
362
371
|
monkeypatch.setenv("WAYLAND_DISPLAY", "wayland-0")
|
|
@@ -366,6 +375,7 @@ def _no_terminal(monkeypatch, *, sudo_cached=False, pkexec=True, display=True):
|
|
|
366
375
|
|
|
367
376
|
def test_privileged_argv_unchanged_with_a_terminal(monkeypatch):
|
|
368
377
|
monkeypatch.setattr(plat, "_has_tty", lambda: True)
|
|
378
|
+
_tools(monkeypatch, "sudo", "doas", "pkexec")
|
|
369
379
|
argv = ["sudo", "apt", "install", "ibus"]
|
|
370
380
|
assert plat.privileged_argv(argv) == argv
|
|
371
381
|
|
|
@@ -395,6 +405,8 @@ def test_privileged_argv_drops_emerge_ask_without_a_terminal(monkeypatch):
|
|
|
395
405
|
"pkexec", "emerge", "media-libs/portaudio"]
|
|
396
406
|
monkeypatch.setattr(plat, "_has_tty", lambda: True)
|
|
397
407
|
assert plat.privileged_argv(["sudo", "emerge", "--ask", "x"]) == ["sudo", "emerge", "--ask", "x"]
|
|
408
|
+
_tools(monkeypatch, "doas")
|
|
409
|
+
assert plat.privileged_argv(["sudo", "emerge", "--ask", "x"]) == ["doas", "emerge", "--ask", "x"]
|
|
398
410
|
|
|
399
411
|
|
|
400
412
|
def test_privileged_argv_prefers_cached_sudo(monkeypatch):
|
|
@@ -403,6 +415,66 @@ def test_privileged_argv_prefers_cached_sudo(monkeypatch):
|
|
|
403
415
|
"sudo", "-n", "apt", "install", "-y", "x"]
|
|
404
416
|
|
|
405
417
|
|
|
418
|
+
def test_privileged_argv_uses_doas_with_a_terminal_when_no_sudo(monkeypatch):
|
|
419
|
+
monkeypatch.setattr(plat, "_has_tty", lambda: True)
|
|
420
|
+
_tools(monkeypatch, "doas", "pkexec")
|
|
421
|
+
assert plat.privileged_argv(["sudo", "apt", "install", "x"]) == ["doas", "apt", "install", "x"]
|
|
422
|
+
_tools(monkeypatch, "sudo", "doas")
|
|
423
|
+
assert plat.privileged_argv(["sudo", "apt", "install", "x"]) == ["sudo", "apt", "install", "x"]
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
def test_privileged_argv_runs_the_udev_fix_under_doas(monkeypatch):
|
|
427
|
+
from voiceio.hotkeys.evdev import uaccess_install_cmd
|
|
428
|
+
monkeypatch.setattr(plat, "_has_tty", lambda: True)
|
|
429
|
+
_tools(monkeypatch, "doas")
|
|
430
|
+
cmd = uaccess_install_cmd()
|
|
431
|
+
argv = plat.privileged_argv(cmd)
|
|
432
|
+
assert argv == ["doas", *cmd[1:]]
|
|
433
|
+
assert "sudo" not in " ".join(argv) # the script itself never calls sudo
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
def test_privileged_argv_without_terminal_order_is_sudo_doas_pkexec(monkeypatch):
|
|
437
|
+
argv = ["sudo", "apt", "install", "x"]
|
|
438
|
+
_no_terminal(monkeypatch, sudo_cached=True, doas=True, doas_cached=True)
|
|
439
|
+
assert plat.privileged_argv(argv) == ["sudo", "-n", "apt", "install", "-y", "x"]
|
|
440
|
+
_no_terminal(monkeypatch, sudo_cached=False, doas=True, doas_cached=True)
|
|
441
|
+
assert plat.privileged_argv(argv) == ["doas", "-n", "apt", "install", "-y", "x"]
|
|
442
|
+
_no_terminal(monkeypatch, sudo=False, doas=True, doas_cached=True)
|
|
443
|
+
assert plat.privileged_argv(argv) == ["doas", "-n", "apt", "install", "-y", "x"]
|
|
444
|
+
_no_terminal(monkeypatch, doas=True, doas_cached=False)
|
|
445
|
+
assert plat.privileged_argv(argv) == ["pkexec", "apt", "install", "-y", "x"]
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
def test_privileged_argv_as_root_drops_sudo(monkeypatch):
|
|
449
|
+
_tools(monkeypatch)
|
|
450
|
+
monkeypatch.setattr(plat, "_is_root", lambda: True)
|
|
451
|
+
assert plat.privileged_argv(["sudo", "udevadm", "trigger"]) == ["udevadm", "trigger"]
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
def test_privileged_argv_none_without_any_tool(monkeypatch, capsys):
|
|
455
|
+
from voiceio.cli import doctor
|
|
456
|
+
from voiceio.hotkeys.evdev import uaccess_install_cmd
|
|
457
|
+
monkeypatch.setattr(plat, "_has_tty", lambda: True)
|
|
458
|
+
_tools(monkeypatch)
|
|
459
|
+
cmd = uaccess_install_cmd()
|
|
460
|
+
assert plat.privileged_argv(cmd) is None
|
|
461
|
+
msg = plat.privilege_unavailable_message(cmd)
|
|
462
|
+
assert "as root" in msg and "su" in msg
|
|
463
|
+
assert "sudo" not in msg.split("\n", 1)[1] # the command to paste in a root shell
|
|
464
|
+
assert "mkdir -p /etc/udev/rules.d" in msg
|
|
465
|
+
# doctor --fix prints that instead of running anything
|
|
466
|
+
ran = []
|
|
467
|
+
monkeypatch.setattr("subprocess.run", lambda *a, **k: ran.append(a))
|
|
468
|
+
monkeypatch.setattr(doctor, "_confirm_privileged", lambda d, c: True)
|
|
469
|
+
assert doctor._run_privileged("Fix evdev", cmd, 5) is False
|
|
470
|
+
assert ran == [] and "as root" in capsys.readouterr().out
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
def test_as_root_command_strips_sudo():
|
|
474
|
+
assert plat.as_root_command(["sudo", "emerge", "--ask", "x"]) == "emerge --ask x"
|
|
475
|
+
assert plat.as_root_command(["sh", "-c", "a | sudo tee f && sudo -n b"]) == "sh -c 'a | tee f && b'"
|
|
476
|
+
|
|
477
|
+
|
|
406
478
|
@pytest.mark.parametrize("pkexec,display", [(False, True), (True, False)])
|
|
407
479
|
def test_privileged_argv_gives_up_without_pkexec_or_desktop(monkeypatch, pkexec, display):
|
|
408
480
|
_no_terminal(monkeypatch, pkexec=pkexec, display=display)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.18.1"
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
import argparse
|
|
5
|
+
import shlex
|
|
5
6
|
import sys
|
|
6
7
|
|
|
7
8
|
|
|
@@ -44,13 +45,12 @@ def _confirm_privileged(description: str, command_str: str) -> bool:
|
|
|
44
45
|
|
|
45
46
|
def _run_privileged(description: str, argv: list[str], timeout: float,
|
|
46
47
|
cmd_str: str | None = None) -> bool | None:
|
|
47
|
-
"""Ask first, then run a root command
|
|
48
|
-
|
|
48
|
+
"""Ask first, then run a root command with sudo, doas or pkexec (see
|
|
49
|
+
platform.privileged_argv), else print it for the user to run as root.
|
|
49
50
|
|
|
50
51
|
Returns True when it ran, False when it failed or could not run, None
|
|
51
52
|
when the user declined. Raises nothing.
|
|
52
53
|
"""
|
|
53
|
-
import shlex
|
|
54
54
|
import subprocess
|
|
55
55
|
|
|
56
56
|
from voiceio import platform as plat
|
|
@@ -59,8 +59,7 @@ def _run_privileged(description: str, argv: list[str], timeout: float,
|
|
|
59
59
|
return None
|
|
60
60
|
run_argv = plat.privileged_argv(argv)
|
|
61
61
|
if run_argv is None:
|
|
62
|
-
print(
|
|
63
|
-
print(f" {cmd_str}")
|
|
62
|
+
print(plat.privilege_unavailable_message(argv))
|
|
64
63
|
return False
|
|
65
64
|
try:
|
|
66
65
|
subprocess.run(run_argv, check=True, timeout=timeout)
|
|
@@ -155,7 +154,7 @@ def _cmd_doctor(args: argparse.Namespace) -> None:
|
|
|
155
154
|
|
|
156
155
|
for b in report.hotkey_backends + report.typer_backends:
|
|
157
156
|
if not b.ok and b.fix_cmd:
|
|
158
|
-
cmd_str =
|
|
157
|
+
cmd_str = shlex.join(b.fix_cmd)
|
|
159
158
|
if _is_privileged_cmd(b.fix_cmd):
|
|
160
159
|
ran = _run_privileged(f"Fix {b.name}", b.fix_cmd, 120, cmd_str=cmd_str)
|
|
161
160
|
if ran is None:
|
|
@@ -165,10 +165,10 @@ def _cmd_uninstall() -> None:
|
|
|
165
165
|
continue
|
|
166
166
|
cmd = f"sudo rm {rule_path}"
|
|
167
167
|
if _confirm_privileged(f"Remove the voiceio {what} udev rule", cmd):
|
|
168
|
-
from voiceio.platform import privileged_argv
|
|
168
|
+
from voiceio.platform import privilege_unavailable_message, privileged_argv
|
|
169
169
|
argv = privileged_argv(["sudo", "rm", rule_path])
|
|
170
170
|
if argv is None:
|
|
171
|
-
print(
|
|
171
|
+
print(privilege_unavailable_message(["sudo", "rm", rule_path]))
|
|
172
172
|
continue
|
|
173
173
|
try:
|
|
174
174
|
subprocess.run(argv, timeout=120)
|
|
@@ -19,6 +19,7 @@ class BackendStatus:
|
|
|
19
19
|
reason: str = ""
|
|
20
20
|
fix_hint: str = ""
|
|
21
21
|
fix_cmd: list[str] = field(default_factory=list)
|
|
22
|
+
optional: bool = False # failing, but another backend covers it
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
@dataclass
|
|
@@ -72,6 +73,8 @@ def check_health(p: plat.Platform | None = None) -> HealthReport:
|
|
|
72
73
|
fix_hint=probe.fix_hint, fix_cmd=probe.fix_cmd,
|
|
73
74
|
))
|
|
74
75
|
|
|
76
|
+
_mark_evdev_optional(report)
|
|
77
|
+
|
|
75
78
|
# Probe typer backends
|
|
76
79
|
for name, backend, probe in typer_chain.resolve(p):
|
|
77
80
|
report.typer_backends.append(BackendStatus(
|
|
@@ -128,6 +131,26 @@ def check_health(p: plat.Platform | None = None) -> HealthReport:
|
|
|
128
131
|
return report
|
|
129
132
|
|
|
130
133
|
|
|
134
|
+
def _mark_evdev_optional(report: HealthReport) -> None:
|
|
135
|
+
"""On X11 a working pynput covers the hotkey: show evdev as optional and
|
|
136
|
+
drop its root-only udev fix, so `doctor --fix` doesn't run it."""
|
|
137
|
+
from voiceio.hotkeys.evdev import NOT_NEEDED_ON_X11, evdev_optional
|
|
138
|
+
pynput_ok = any(b.name == "pynput" and b.ok for b in report.hotkey_backends)
|
|
139
|
+
try:
|
|
140
|
+
from voiceio.config import load
|
|
141
|
+
backend = load().hotkey.backend
|
|
142
|
+
except Exception:
|
|
143
|
+
backend = "auto"
|
|
144
|
+
if not evdev_optional(report.platform.display_server, pynput_ok, backend):
|
|
145
|
+
return
|
|
146
|
+
for b in report.hotkey_backends:
|
|
147
|
+
if b.name == "evdev" and not b.ok:
|
|
148
|
+
b.optional = True
|
|
149
|
+
b.reason = NOT_NEEDED_ON_X11
|
|
150
|
+
b.fix_hint = ""
|
|
151
|
+
b.fix_cmd = []
|
|
152
|
+
|
|
153
|
+
|
|
131
154
|
def _kde_input_method_warning(p: plat.Platform, kwinrc: Path | None = None) -> str:
|
|
132
155
|
"""KWin on Wayland only hands text to the input method picked under
|
|
133
156
|
Virtual Keyboard; without IBus there, voiceio has no live preview."""
|
|
@@ -423,6 +446,9 @@ def _check_line(label: str, ok: bool, detail: str = "",
|
|
|
423
446
|
def _backend_line(b: BackendStatus, active: bool = False) -> list[str]:
|
|
424
447
|
lines = []
|
|
425
448
|
tag = f" {CYAN}◀ active{RESET}" if active else ""
|
|
449
|
+
if b.optional and not b.ok:
|
|
450
|
+
lines.append(f" {DIM}○{RESET} {b.name} {DIM}{b.reason}{RESET}")
|
|
451
|
+
return lines
|
|
426
452
|
detail = ""
|
|
427
453
|
if not b.ok:
|
|
428
454
|
detail = b.reason
|
|
@@ -26,20 +26,47 @@ def uaccess_rule() -> str:
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def uaccess_install_cmd() -> list[str]:
|
|
29
|
-
"""argv that installs the uaccess rule and applies it
|
|
30
|
-
|
|
31
|
-
One ``sh -c`` so the whole privileged action shows as a single
|
|
32
|
-
doctor's consent prompt.
|
|
33
|
-
|
|
34
|
-
`
|
|
29
|
+
"""argv that installs the uaccess rule and applies it, as root.
|
|
30
|
+
|
|
31
|
+
One root ``sh -c`` so the whole privileged action shows as a single
|
|
32
|
+
string in doctor's consent prompt. It starts with ``sudo``;
|
|
33
|
+
platform.privileged_argv swaps that for doas or pkexec when needed, and
|
|
34
|
+
the script itself never calls sudo. `mkdir -p` because some distros
|
|
35
|
+
(Gentoo) ship no /etc/udev/rules.d. `trigger` re-runs the rules for
|
|
36
|
+
existing input devices, so access is granted immediately — no re-login,
|
|
37
|
+
unlike the `input` group.
|
|
35
38
|
"""
|
|
36
39
|
script = (
|
|
37
|
-
f"
|
|
38
|
-
f"
|
|
39
|
-
"&&
|
|
40
|
-
"&&
|
|
40
|
+
f"mkdir -p {shlex.quote(str(Path(UACCESS_RULE_PATH).parent))} "
|
|
41
|
+
f"&& printf %s {shlex.quote(uaccess_rule())} > {UACCESS_RULE_PATH} "
|
|
42
|
+
"&& udevadm control --reload-rules "
|
|
43
|
+
"&& udevadm trigger --subsystem-match=input --action=change"
|
|
41
44
|
)
|
|
42
|
-
return ["sh", "-c", script]
|
|
45
|
+
return ["sudo", "sh", "-c", script]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# Shown by setup and doctor instead of a failing evdev check.
|
|
49
|
+
NOT_NEEDED_ON_X11 = "optional, not needed: pynput handles the hotkey on X11"
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def evdev_optional(display_server: str, pynput_ok: bool, backend: str = "auto") -> bool:
|
|
53
|
+
"""True when evdev access is not needed: on X11 the chain tries pynput
|
|
54
|
+
first, so a working pynput covers the hotkey. Not when the config pins
|
|
55
|
+
the evdev backend, and never on Wayland, where evdev is the only
|
|
56
|
+
physical listener.
|
|
57
|
+
"""
|
|
58
|
+
return display_server == "x11" and pynput_ok and backend != "evdev"
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _pynput_covers_hotkey() -> bool:
|
|
62
|
+
try:
|
|
63
|
+
from voiceio.config import load
|
|
64
|
+
from voiceio.hotkeys.pynput_backend import PynputHotkey
|
|
65
|
+
from voiceio.platform import _detect_display_server
|
|
66
|
+
return evdev_optional(_detect_display_server(), PynputHotkey().probe().ok,
|
|
67
|
+
load().hotkey.backend)
|
|
68
|
+
except Exception:
|
|
69
|
+
return False
|
|
43
70
|
|
|
44
71
|
|
|
45
72
|
def nixos_hint() -> str:
|
|
@@ -127,6 +154,10 @@ class EvdevHotkey:
|
|
|
127
154
|
ok=False, reason="No permission to read /dev/input",
|
|
128
155
|
fix_hint=nixos_hint(),
|
|
129
156
|
)
|
|
157
|
+
if _pynput_covers_hotkey():
|
|
158
|
+
# The udev rule needs root; don't offer it for nothing.
|
|
159
|
+
return ProbeResult(ok=False, reason="No permission to read /dev/input",
|
|
160
|
+
fix_hint=NOT_NEEDED_ON_X11)
|
|
130
161
|
return ProbeResult(
|
|
131
162
|
ok=False, reason="No permission to read /dev/input",
|
|
132
163
|
fix_hint=(
|