* feat(post-processing): pipe transcriptions through user-defined script Add a configurable post-processing step that passes each transcription result to an external executable via stdin and uses its stdout as the text to type. Enables custom transforms (formatting, LLM rewriting, etc.) without modifying Vocalinux. Falls back to original text on script failure or timeout. * test(post-processor): add unit tests and extract apply_post_processing Move config-reading logic from main.py closure into apply_post_processing() in post_processor.py so it can be tested independently. Add 11 unit tests covering PostProcessor.process() and apply_post_processing(). * docs(post-processing): document post-processing script feature * fix formatting of one file * fix(post-processing): run the user script with a stripped host environment Rebase compat: the host_process AST guard requires every subprocess spawned for a host binary to pass env=host_env() so an AppImage's LD_LIBRARY_PATH/GI_TYPELIB_PATH/PYTHONHOME do not leak in. Also give apply_post_processing() a typed ConfigManager parameter and keep text_callback_wrapper's local variable typed as str for mypy. * fix(post-processing): preserve paragraph breaks and tighten script handling Take script stdout verbatim instead of rstripping every trailing newline, so the "new paragraph" voice command's break survives a passthrough script. A single trailing newline is still dropped, but only when the transcription had none — it is almost always just the line terminator echo/print-style tools append. Also stop writing transformed output to the log (it can carry sensitive dictation into retained logs), catch only the expected process/OS/encoding failures instead of every Exception, and add the missing signature annotations. * fix(main): run the post-processing script off the recognition thread A user script may take seconds per segment, and text callbacks run on the recognition thread that drains the bounded audio-segment queue; stalling it drops queued dictation once the queue fills. Submit post-processing and injection to a dedicated single-worker executor so the backlog waits instead of losing speech, while keeping injection order. On timeout or failure the worker falls back to the original text, and an unexpected error is logged with a traceback and still injects the original rather than silently dropping the segment. Also pin the callback tests' get_str mock to no-script so they exercise the synchronous path deterministically, and add a callback test proving transformed text (including preserved paragraph breaks) reaches the injector. * docs(post-processing): annotate new callbacks and clarify stdout contract Add the missing type annotations on the new Settings page callbacks per the repository guide, and document that script stdout is used verbatim (a lone trailing newline added by line-oriented tools is dropped only when the transcription had none) and that scripts run on a dedicated worker. * test(main): annotate new post-processing callback tests * fix(main): bind queued dictation to its target app and drain worker on quit Route every transcription segment through the single post-processing worker (a pass-through when no script is configured) so clearing the script path mid-queue can no longer let a later segment overtake an earlier one still running. A segment that can sit in the backlog — a script is configured or a job is still running — is bound to the application focused when it was dictated; the worker drops it if focus has verifiably moved to another application, so delayed dictation cannot land in the wrong app. Wire the worker into the tray quit path via an on_quit hook: it clears the acceptance flag, cancels pending jobs, and waits — bounded by the script's own timeout — so nothing injects after the injector stops. * fix(main): keep voice actions ordered and probe focus off the recognition thread - Queue voice-command actions on the post-processing worker so an action can no longer overtake dictated text still waiting to be injected. - Move the submit-time focus probe onto a dedicated executor; the recognition thread only submits the probe, and the job joins the result at inject time, so compositor tools can no longer stall consumption of the bounded audio-segment queue. - Re-check the quit flag after the inject-time focus re-probe, then shut both workers down without waiting on a running script so quitting does not freeze on the script timeout. * fix(main): capture submit-time focus on dedicated threads and serialize quit - Replace the shared focus-probe executor with a fresh daemon thread per submission so a slow earlier probe cannot delay a later one past the focus change it is meant to capture; jobs read the result off a one-slot queue at inject time. - Give queued voice actions the same submit-time focus binding as text segments so a queued shortcut is dropped instead of fired into a newly focused application. - Hold injection_lock across the accept-check plus inject/action call so quit waits only for an in-flight injection instead of racing it. - Queue the IDLE reset of last_injected_text behind pending worker jobs so a queued 'delete that' still sees the text it targets. * fix(main): keep actions instant on a free worker and bound quit wait - An action now starts a submit-time focus probe only when it actually queues behind other jobs; with a free worker there is no delay window to bind against, so the probe's compositor calls are skipped and the action stays immediate even when a script is configured. - Probe and executor submission now happen inside pending_jobs_lock so queue order matches callback order — a job that saw an empty queue can no longer slip behind one that arrived while it was submitting. - Every inject-path subprocess call (xdotool window/key/type, wtype and ydotool type) is bounded by a timeout, and the quit hook's injection_lock wait is capped, so quitting can no longer freeze on a stalled injector subprocess. * fix(main): bind every action to submit-time focus without slowing it down - Every voice action now starts a submit-time focus probe: submission never guarantees immediate execution, so skipping the binding left a focus-change window in which a shortcut could fire into another app. The worker waits on the probe for at most one second — milliseconds on a healthy desktop — so immediate actions stay immediate while a genuinely stalled probe falls back to the injector's own targeting. - Quit waits for an in-flight injection without a cap again: every inject-path subprocess is individually bounded, so the wait always ends with the injection and a long transcription is never cut off. - The wtype/ydotool typing timeout is now derived from the configured per-key delay (a generous multiple), so a legitimately slow type can never be cut mid-text; a timed-out type no longer falls through to the clipboard fallback, which would duplicate the partial fragment. * fix(main): drop unverified actions and make quit-time injection abortable - An action whose submit-time focus probe cannot answer inside its one-second bound is now dropped instead of running unverified: a stalled probe can no longer leave a shortcut pointing at whatever application happens to be focused. - Quit asks the injector to abort in-flight injections, and injection paths honour it: the xdotool chunk loop stops between chunks, the wtype/ydotool type call runs as a polling Popen that can be killed, and paste/shortcut/backspace entry points exit early. The quit hook still waits for an in-flight injection, but the wait is bounded by at most one already-running subprocess call — never the injection's full length — and no subprocess is ever stopped mid-call by a timeout cap on the wait itself. - Annotate the remaining untyped test helpers. * fix(main): wait out slow focus probes; restore run() in wayland typing - An action no longer races its submit-time focus probe on a one-second bound: the job waits for the probe's own answer, whose compositor calls already carry per-call timeouts and short-circuit absent tools. A slow but living probe delays the command instead of discarding it, so a valid "undo" can no longer be lost to timing alone, and focus verification still decides every drop. - Wayland typing goes back to subprocess.run so tests keep intercepting the same entry point. Abortability is preserved by typing in 200-character chunks with the shutdown check between calls — a whole-string call could not be interrupted, but no single chunk holds the injector for more than its own scaled budget. - The abort flag gains a class-level default so injectors built without __init__ in tests still answer the checks; each real instance gets its own event in __init__. - Update call-shape assertions for the typed-call timeout and finish annotating the test methods touched by the callback refactor. * fix(inject): never retype text a failed chunked call already sent - _PartiallyTyped carries the confirmed-delivered prefix length out of the chunked type loops, so every downstream fallback continues from the untyped remainder: the Wayland-to-xdotool switch types only the tail, and the clipboard fallback copies only the tail, never the whole string a second time. - The xdotool retry loop gains the same accounting — a retry now resumes at the first untyped chunk instead of restarting at the top and duplicating everything the failed attempt already delivered. - Annotate the remaining test signature the repository guide requires. * fix(inject): report partial typing as failure even when clipboard lands A chunked type call that dies mid-text leaves only a prefix on screen, and the remainder-fallback keeps it that way: it copies the tail for a manual paste but now returns False, so the caller no longer records the full transcription as injected and a following "delete that" cannot erase text that was never typed. * fix(inject): keep deletion state aligned with delivered text inject_text now records how many characters a call confirmed on screen as last_typed_count: the whole length on success, the typed prefix after a partial failure, -1 when the delivered amount is unknowable. The transcription caller uses it to keep last_injected_text honest — a following "delete that" erases the typed prefix or nothing, never the previous segment or text that never arrived. * fix(inject): never replay input a timed-out portal job may have delivered - RemoteDesktopPortalError.delivered=None marks an unreported job's count as unknowable; all three portal fallbacks demote and skip instead of replaying, and text injection surfaces as TimeoutExpired so no full-text clipboard copy is offered - _PartiallyTyped counts raised after a portal demote are rebased onto the original text (typed_prefix) so the caller clips the real prefix - evdev: a consumed pure-modifier press is withheld and replayed ahead of the first non-target press, so holding RightAlt for AltGr composition still reaches the application - history: extend_latest gains an expected_latest CAS guard so a late segment from an older worker merges only into its own session's snippet, never into a newer session's entry - quit path aborts in-flight injections before waiting on the lock so quitting cannot freeze behind a long transcription's typing budget - tests: stop _ensure_ydotoold leaking a real Popen in Wayland tests * fix(shortcut): replay withheld modifiers across devices and after SYN_DROPPED - Replay withheld modifier presses from every device, not only the fd the character arrived on: split keyboards deliver AltGr and the character on separate devices, and a per-fd check forwarded a plain character. - Let the post-SYN_DROPPED resync run when only withheld modifiers exist for the fd, so a press whose release the dropped burst ate is pruned instead of replaying a stale modifier on the next ordinary key. * fix(history,pads): keep late segments pad-bound deliveries and pad deletions correct - Track the worker behind the ended session's snippet so late segments from an older worker cannot merge into a newer session's entry - Skip the focus-change drop for dictation-pad segments and pad-bound editing commands, which never target the focused application - Refuse 'delete that' when a manual pad edit blurred the segment boundaries instead of deleting the stale recorded length * style: drop unneeded nonlocal for mutated worker set * fix(shortcut): share one evdev device layer across shortcut listeners Each KeyboardShortcutManager built its own EvdevKeyboardBackend, and on evdev every backend opened and grabbed the same physical keyboards: the first grabber received all events and the rest received none, so per-language shortcuts could never fire on Wayland. All backends now bind to a process-wide EvdevDeviceHub that opens each keyboard once, owns the grabs and the paired uinput clones, and fans every event out to each registered engine. An event is re-emitted to applications only when no engine consumed it, so suppression semantics stay the same while per-engine matching state (combo progress, withheld modifiers, swallowed presses) remains independent. * fix(history): own late segments per worker and decide pad routing once - ended_worker_snippets maps each ended session's worker to its own (snippet, commit epoch): late deliveries merge into their session's entry however many sessions have committed since, so one session's stragglers never split across Recent Snippets entries. - The leftover-segment commit reads the live history epoch inside the session lock: a mid-session clear() no longer makes the stale ended epoch refuse valid post-clear dictation. - The pad-bound routing decision is captured once per job and passed to the injector/action handler, so a toggle flip between the focus check and delivery cannot reroute text or shortcuts into the focused app. - Dead recognition workers are pruned from the tracking set and map so long runs don't accumulate finished threads. - The custom-terms switch now suppresses GTK's own state-set on save failure so it shows the value that actually persisted. * fix(shortcut): serialize evdev device layer teardown against restart The last listener's unregister released the engine lock before joining the monitor thread and closing devices, so a new listener registering in that gap opened keyboards the stale teardown then closed — it stayed active but dead, and briefly grabbed keyboards stopped forwarding input. A lifecycle lock now covers the whole close/open transition in register, unregister, and the monitor's unexpected-exit teardown, so a cold start can only open devices after the previous generation finished closing (also making the new generation's grabs succeed). A generation stamp tells a monitor thread that outlived its join() its incarnation is over even when running has gone True again. * fix(injection): log focus-probe failures and narrow clipboard fallback catch A crashed focus probe turned into an unknown result with no logged error, indistinguishable from unavailable focus information; the partial-typing clipboard fallback caught every exception. Log the probe failure with context and narrow the clipboard catch to the exceptions the fallback path can actually raise. * fix(shortcut): join the evdev monitor outside the lifecycle lock If the monitor exited unexpectedly while the last listener unregistered, its cleanup queued on the lifecycle lock that unregister() held for the join — stalling shutdown for the join's full 2s timeout. The close now finishes inside the lock and the join waits after it is released, so the monitor's own cleanup can run and exit instead of queueing behind it. Closing before the join also dies the monitor's read/select on the closed fds right away. A _closed gate on _open_keyboard_device keeps a rescan from opening a device between detach and close that nothing would ever close. * fix(injection): narrow focus-probe catch to the raisable exception set get_focused_window() reports Optional and never raises; the catch now covers only what can realistically escape the queue write and logs it with context, keeping the waiting job released. * fix(shortcut): tag evdev device fds with the generation that opened them A monitor that outlived join() could still touch a newer generation's devices: the loop re-checked the generation only at the top, so mid-iteration it could dispatch from, forward to, or remove devices a restarted listener had just opened. Every fd is now tagged with the generation that opened it, and the tag is verified at each point a monitor could mutate shared state — fd lookup for dispatch, clone forwarding, forwarder release, device removal, and rescan opens — while dispatch re-checks the generation between events and the per-fd loop breaks on it. Cold starts bump the generation before opening so fresh devices are tagged for the new generation. Devices an older generation opened stay tagged stale, so its reader leaves them alone. --------- Co-authored-by: Jatin K Malik <jatinkrmalik@gmail.com>
16 KiB
AGENTS.md — Vocalinux
Voice dictation for Linux: GTK 3 tray app (Python) plus a Next.js marketing site in web/. Default speech engine is whisper.cpp (pywhispercpp); OpenAI Whisper, Vosk, and a user-configured remote API are optional. Do not invent features, user counts, or privacy claims.
Commit attribution
Agents must not add themselves as commit co-authors or add Co-authored-by
trailers for agents.
Critical: git worktrees for every branch and PR
Never create a branch, commit, or open a pull request in the primary checkout. Always use a linked git worktree so the main working tree stays on main and stays clean. Do not git switch / git checkout a feature branch in the primary directory, and do not leave it dirty.
git fetch origin
git worktree add /tmp/vocalinux-<task> -b <type>/<short-name> origin/main
# All edits, commits, and `gh pr create` happen inside that worktree.
git worktree remove /tmp/vocalinux-<task>
git worktree prune
Rules:
- One worktree per branch, one branch per PR
- Place worktrees outside the primary working tree (
/tmp/vocalinux-<task>or a sibling directory such as../.worktrees/vocalinux-<task>) - Never run two tasks in the same worktree
- Never commit directly to
main - Clean up the worktree after the PR is pushed
Toolchain
| Piece | Current |
|---|---|
| Python | >=3.11 (requires-python in pyproject.toml; CI: 3.11–3.14). Floor, classifiers, CI matrix and install.sh must agree — tests/test_python_version_policy.py |
| GTK | GTK 3 via distro python3-gi (PyGObject). Never pip-install it |
| uv | >=0.12,<0.13 ([tool.uv] in pyproject.toml). uv.lock is the source of truth; CI runs uv sync --locked / uv run --locked, which fails on drift |
| just | https://just.systems or distro package just |
| Format / lint / types | Black + isort (line length 100), flake8 (E9,F63,F7,F82 only), mypy src/ (targets 3.11). The three linters live in the lint dependency group, not the dev extra, so CI can install them without building the project |
| Website | Next.js / TypeScript in web/ — see web/AGENTS.md |
Two virtualenvs, on purpose:
.venv/— uv's, for dev tooling.just depssyncs it; every other Pythonjustrecipe usesuv run --no-syncso it does not prune extras thatjust deps-allinstalled. No activation needed.venv/— whatinstall.shbuilds for the app itself, from the system Python so distrogiis importable.
Never run install.sh from an activated .venv: it drops an inherited VIRTUAL_ENV from PATH and picks $SYSTEM_PYTHON (default /usr/bin/python3) precisely because a venv built from uv's interpreter cannot see distro PyGObject.
Setup
./install.sh --dev # system deps + venv + editable install + tests
# non-interactive / no TTY:
./install.sh --dev --auto
./install.sh --dev --auto --no-rebuild-whispercpp # skip cmake/Vulkan rebuild
source venv/bin/activate
Manual venv (must see distro gi):
uv venv --system-site-packages --python /usr/bin/python3
source venv/bin/activate
# exclude pygobject from uv sync/export:
# --no-install-package pygobject / --no-emit-package pygobject
uv pip install -e ".[dev,vad]"
install.sh flags: --engine=whisper_cpp|whisper|vosk|remote_api, --test, --skip-models, --venv-dir=PATH. Default engine is whisper_cpp.
Commands
just lint # flake8 (critical) + black --check + isort --check
just format # black + isort
just typecheck # mypy src/
just test # pytest -v
just test-cov # pytest --cov=src --cov-report=html
just deps # sync .venv with dev+vad extras and the lint group
just deps-all # also whisper/vosk/docs; later recipes use --no-sync so they keep it
just lock # regenerate uv.lock, requirements/*.txt and the Flatpak dep manifest
just lock-check # fail if uv.lock is stale vs pyproject.toml
just distro-packages # regenerate install.d/package_map.sh from YAML
just distro-packages-check # fail if the generated package map is stale
just flatpak-deps # regenerate the Flatpak dep manifest from requirements/runtime.txt (needs PyPI)
just flatpak-deps-check # fail if that manifest is behind the export
just model-checksums # refresh pinned model digests after adding a model
just appimage # build the AppImage in its pinned base image (needs docker)
just appimage-boot fedora:42 # boot that AppImage in a distro container
just aur-gate # build the AUR PKGBUILD on current Arch (needs docker)
just install-gate debian:12 # run install.sh unattended in a distro container
just verify-release # check a published release as published (needs gh)
just pre-commit # pre-commit run --all-files
just run-debug # vocalinux --debug
just run-source-debug
pytest
pytest tests/test_command_processor.py
pytest tests/test_command_processor.py::TestCommandProcessor::test_initialization
pytest -m "not slow"
pytest -m "not integration"
python -m vocalinux.main --debug
python -m vocalinux.main --transcribe-file path/to/audio.wav # diarized file transcription
Website: web/AGENTS.md, web/PRODUCT.md, web/DESIGN.md. Do not duplicate site commands here.
Dependencies (uv)
uv.lock is authoritative. just lock regenerates it, the hash-pinned requirements/*.txt exports, and packaging/flatpak/python3-dependencies.yaml. The AppImage build installs from runtime/vad plus appimage.txt; install.sh consumes the runtime and selected extras with --require-hashes --no-deps --no-build-isolation, then installs the project with --no-deps --no-build-isolation. Do not edit requirements/*.txt by hand, nor the url/sha256 pairs in packaging/flatpak/python3-dependencies.yaml. Change pyproject.toml (or requirements/whisper.in for the Whisper engine, requirements/appimage*.in for the AppImage), run just lock, and commit the lock plus the exports with the manifest change.
| Constraint | Rule |
|---|---|
| PyGObject | Distro python3-gi only, via --system-site-packages. Pip install fails on Ubuntu 24.04 (girepository-2.0). uv-managed interpreters do not see distro gi unless the venv is created that way |
[vosk] extra |
Wheel-only on PyPI (no sdist). Never part of a source-buildable lock. install.sh --engine=vosk installs it |
| Whisper CPU torch | requirements/whisper.txt is compiled from requirements/whisper.in. Pin torch to a +cpu local version — PyPI CUDA wheels win resolution regardless of index order. OpenAI Whisper does not use torchaudio, and the CPU index can lag torch |
| pywhispercpp | Pinned in install.sh as PYWHISPERCPP_VERSION (keep in sync with uv.lock) |
| Installer build tools | [dependency-groups].installer-build exports to requirements/installer-build.txt. Bootstrap uses hashed wheels on new and reused venvs; source builds use these tools without build isolation. Its setuptools >=83 floor keeps the pinned installer tools patched; do not add it to [build-system] (Arch). Backend rebuilds select pywhispercpp's complete hash block from runtime.txt via scripts/installer_requirements.py, with --no-deps so they cannot replace the runtime |
| Installer Whisper export | Compiled universally from Python 3.11, constrained by runtime.txt and installer-build.txt to keep shared pins consistent. Uses a +cpu torch pin and best-match index resolution so the CPU index's older copies of shared packages do not downgrade the runtime |
| Remote installer | After cloning, hand off to the tagged install.sh with the original arguments and remote venv path. The installer and its exports must come from the same revision, including when the tag predates the pinned installer |
[vad] extra |
onnxruntime for Silero VAD |
| One export per extra | Every extra in pyproject.toml needs a hash-pinned requirements/<extra>.txt (underscores become dashes), written by a uv export line in just lock. install.sh installs six of them, so an extra with no export is an install path with nothing pinned, which is how [parakeet], [faster_whisper] and [vosk] reached users. tests/test_dependency_exports.py enumerates the extras and the installer's call sites rather than trusting the recipe to stay complete; docs is the one exemption and it carries its reason in EXPORT_EXEMPT |
| Exports match the lock | just export-check re-runs every uv export line in just lock and fails if a committed export is behind uv.lock. It reads those lines out of the recipe, so an export added there is checked without touching scripts/check_exports.py, and it runs under UV_OFFLINE=1: uv export reads the lock and nothing else. The lint job runs it, because an export named in the recipe and never regenerated is a snapshot, not a pin. uv pip compile targets are out of scope by design (they resolve against live indexes) |
| AppImage PyGObject | Pinned separately in requirements/appimage.in, and below 3.52: the AppImage bundles its own interpreter and builds PyGObject against the base image's girepository-1.0, while uv.lock's 3.56 needs girepository-2.0 (glib 2.80+) |
| AppImage build inputs | Base image, tooling, interpreter, shaderc and the Vulkan headers are pinned in packaging/appimage/tool_checksums.txt. Build with just appimage (docker) — building on the host ships the host's glibc, which is what kept the AppImage off Debian 12 |
| AppImage boot matrix | packaging/appimage/boot-test.sh runs the finished AppImage in distro containers, and the matrix in unified-pipeline.yml must keep distros both older and newer than the build image: the old ones prove the glibc floor, the new ones catch a bundle that breaks the host binaries it spawns. A distro added there needs its package recipe in the script — tests/test_appimage_packaging.py checks both |
| Flatpak deps | packaging/flatpak/python3-dependencies.yaml is generated from requirements/runtime.txt by scripts/sync_flatpak_deps.py (just flatpak-deps, which just lock runs itself). It resolves each artifact by the digest uv already recorded, so the Flatpak downloads the bytes in uv.lock. The project installs there with pip3 install --no-deps, so nothing inside the build evaluates pyproject.toml — tests/test_flatpak_packaging.py checks the invariant offline |
| Speech models | Verified against digests pinned in src/vocalinux/utils/model_checksums.txt before install, by both install.sh and the runtime downloaders. Fails closed — an unpinned model is refused. Regenerate with just model-checksums (never by hand); tests/test_model_checksums.py fails if it falls behind. whisper.cpp URLs use a pinned Hugging Face commit, never main |
Optional extras: vosk, whisper, vad, dev.
Layout
src/vocalinux/
├── main.py, version.py, common_types.py
├── audio/
│ └── playback_ducker.py # lower default sink while dictating
├── single_instance.py # $XDG_DATA_HOME/vocalinux/instance.lock
├── auto_pause_monitor.py # unload model while configured apps run
├── model_keepalive.py # idle unload
├── suspend_handler.py # logind PrepareForSleep
├── custom_dictionary.py # terms bias + transcript correction file contracts
├── speech_recognition/
│ ├── recognition_manager.py # whisper.cpp / Whisper / Vosk / remote
│ ├── command_processor.py # voice commands
│ ├── diarization.py # TinyDiarize per-speaker file transcription (--transcribe-file / tray)
│ ├── silero_vad.py
│ └── data/ # bundled silero_vad.onnx
├── text_injection/
│ ├── text_injector.py # X11 / clipboard / xdotool
│ └── ibus_engine.py # Wayland IBus injection
├── ui/
│ ├── tray_indicator.py, settings_dialog.py, first_run_dialog.py
│ ├── transcript_dialog.py # speaker-tagged transcript viewer/export
│ ├── config_manager.py, action_handler.py, audio_feedback.py
│ ├── autostart_manager.py, keyboard_shortcuts.py
│ ├── logging_dialog.py, logging_manager.py
│ └── keyboard_backends/ # pynput (X11), evdev (Wayland)
├── utils/
│ ├── paths.py, resource_manager.py
│ ├── update_checker.py, update_monitor.py
│ ├── pywhispercpp_loader.py # bundled-lib preloader for source-built installs
│ └── whispercpp_model_info.py, vosk_model_info.py
└── resources/ # SVG icons + WAV cues (also repo resources/)
Also: tests/, docs/, packaging/ (AppImage, AUR, Flatpak), scripts/,
install.sh (bootstrap and orchestration), install.d/ (sourced installer modules),
uninstall.sh, web/. scripts/distro-package-map.yaml owns installer package
names; install.d/package_map.sh is generated by just distro-packages.
| Task | Start here |
|---|---|
| Voice command | speech_recognition/command_processor.py |
| Engine / models | speech_recognition/recognition_manager.py |
| Text injection | text_injection/text_injector.py, ibus_engine.py |
| Settings | ui/config_manager.py, ui/settings_dialog.py |
| Hotkeys | ui/keyboard_shortcuts.py, ui/keyboard_backends/ |
Style
- Type hints on all function signatures.
Protocolinterfaces live incommon_types.py - Imports: stdlib → third-party → local (
isortblack profile) - Names:
PascalCaseclasses,snake_casefunctions,UPPER_SNAKE_CASEconstants,_privatemethods logger = logging.getLogger(__name__)per module- Triple-quoted docstrings on modules, classes, and public functions
- Specific exceptions; log errors with context
subprocesscalls that run a host binary passenv=host_env()(utils/host_process.py): a host binary inheriting the AppImage's library paths dies on the wrong GLib. The one spawn of our own interpreter (start_engine_process) passes the environment untouched — it needs the bundle.tests/test_host_process.pywalks the AST and fails on either mistake- Tests:
tests/test_*.py,test_*functions,unittest.TestCaseor pytest;pytest-mockviamocker - Markers:
@pytest.mark.slow,integration,audio(hardware). Default timeout 10s (pytest-timeout)
Git and PRs
Conventional Commits: type(scope): short description with optional body and Fixes #123.
Types: feat, fix, docs, style, refactor, test, chore.
feat(commands): add "select all" voice command
fix(tray): resolve icon not updating on Wayland
docs(readme): update installation instructions
Branch prefixes: feature/, fix/, docs/, refactor/, test/, release/ (e.g. release/v0.7.0-beta).
- Never push to
main. Never commit onmain - Every change goes through a PR (including docs)
- Wait for CI (
.github/workflows/unified-pipeline.yml) before asking for merge - Squash merge
- Do not merge the PR yourself
- Fill
.github/PULL_REQUEST_TEMPLATE.md
Releases: follow docs/RELEASE_PROCESS.md. Version source of truth is src/vocalinux/version.py; sync README, docs/INSTALL.md, docs/UPDATE.md, web/src/app/page.tsx, web/package.json. Prep on release/vX.Y.Z-PHASE; tag after merge.
Website
Site-only work: web/AGENTS.md (commands, layout map). Product claims: web/PRODUCT.md. Visual system: web/DESIGN.md. Git/worktree/PR rules are this file — do not duplicate them under web/.
Runtime (any Linux dev machine)
- Create venvs with
--system-site-packages. Do not drop that flag - Kill the app by PID, never
pkill -f vocalinux(matches editors, shells, and cwd paths) - Stale instance:
$XDG_DATA_HOME/vocalinux/instance.lock(default~/.local/share/vocalinux/instance.lock) - Default dictation shortcut: hold Right Alt (push-to-talk). Existing
~/.config/vocalinux/config.jsonwins - Headless speech smoke:
pywhispercpp.model.Model+CommandProcessor(first run may download the tiny model)
Update this file when commands, layout, or agent rules change.