Linux desktop setup and testing
Install and test the experimental Linux daemon and CLI.
A functional command-line session service for Arch/Omarchy with Hyprland and PipeWire. This is a development candidate, not a supported Linux release. It records only after an explicit start, supports hold and toggle commands, reuses a pinned resident Parakeet worker, and keeps recoverable audio/transcripts locally. The Omarchy bar plugin in ../omarchy-plugin is the desktop frontend and Fast/Thorough cleanup models are optional (see below). Mac pipeline parity and X11, GNOME or KDE adapters are not provided.
Note
The automated tests use synthetic WAVs, fake capture/engine processes, and Unix sockets. They establish application behavior, including real child-process cleanup. They do not establish microphone, model, Hyprland, native Wayland delivery, or Omarchy compatibility. Those require a recorded Linux session test. The earlier Ubuntu model checkpoint belongs to ../linux-engine-proof/README.md; its 5/6 exact result is not desktop acceptance.
Quick start
- Check an existing setup:
mouthtype-linux --config /absolute/path/linux.json doctor. It's a read-only report. - Install the client:
python3 tools/linux-desktop/install.py --prefix "$HOME/.local". - Prepare the speech model:
python3 tools/linux-desktop/setup_speech.py --destination "$HOME/.local/share/mouthtype/speech-candidate". - Start a foreground session:
mouthtype-linux --config "$HOME/.local/share/mouthtype/speech-candidate/linux.json" serve. - Bind keys for
start,stop,toggleandcancelin your compositor, using unused keys. See Hold, toggle and cancellation.
The sections below explain each step. The Omarchy bar plugin in ../omarchy-plugin is the desktop frontend.
GNOME and KDE Plasma
Ubuntu 26.04 GNOME and Fedora 44 KDE Plasma (Wayland) use the desktop portals for typing access and global shortcuts, with the Qt settings window, tray icon and KDE pill from mouthtype-linux-desktop. This is experimental and not yet verified on real hardware. The user-facing guide, with install, first-run prompts, shortcuts, doctor failures and uninstall, is docs/guides/linux-gnome-kde.md.
Check an existing setup
Run mouthtype-linux --config /absolute/path/linux.json doctor for a read-only report, or add --json after doctor for structured output. Exit status is 0 when required setup checks pass and 2 when something needs attention. It checks the target platform, configuration, configured Python's pinned speech distribution metadata, four model-file hashes, configured spelling/phrase libraries, required helpers and an existing service's status. It does not import the speech runtime, load weights, open a microphone, read the clipboard, install packages, download files or change the desktop. Optional notification feedback and a stopped service are warnings, with next steps.
Passing means the inspected setup is consistent. It does not prove that the audio server is connected, the speech runtime can load its native libraries, the model recognizes speech, a notification appeared, or Hyprland can deliver into a particular field. Physical acceptance remains separate. Type mode requires its existing explicit unknown-secure-field opt-in; recover-only remains the default.
Install and prepare
Where Linux stands: there is no published package yet (the AUR recipe in packaging/arch/aur builds locally and apt is coming soon), so a source install is the working path. The order for a new user is: install, log in again so the first-run unit prepares speech and the bar widget and binds Super+Alt+M and Super+Shift+T, take a first dictation and pick where words go in the plugin's first-open card, optionally prepare Fast cleanup, check with mouthtype-linux doctor, and run mouthtype-linux-setup --uninstall before removing a package. Basic cleanup is on by default and delivery starts recovery-only. The full flow has run on one Arch/Omarchy desk; HiDPI, multi-monitor and other distros are untried. The same story, in user terms, is docs/guides/linux.md.
The initial runtime target is Linux x86_64 with native Python in a dedicated environment, PipeWire's pw-record, and optionally hyprctl plus wtype for automatic typing. Arch's pipewire-audio, hyprland, and wtype packages provide those commands; use the distro's normal signed package management. No root input daemon or input-device group is needed. This script does not install packages, weights, permissions, bindings, autostart, or services.
From a source checkout or the development source archive, run python3 tools/linux-desktop/install.py --prefix "$HOME/.local". The new launcher is ~/.local/bin/mouthtype-linux; ensure that directory is in the compositor's PATH. Installation refuses to overwrite an existing launcher or payload and says how to continue: --update replaces this installer's launcher and payload, --uninstall removes them (a launcher that is not Mouthtype's is never deleted). It leaves user configuration, models and recordings untouched. An existing installation can also be preserved by choosing a different prefix.
Then python3 tools/linux-desktop/setup.py does the rest in order: it checks the required helpers and the Omarchy shell config before downloading anything, prepares speech if needed, runs doctor, and installs or updates the Omarchy plugin with its login service (--skip-plugin, --no-autostart, --shortcut toggle|hold, --no-transform-shortcut; Super+Shift+T opens Transform Selection by default). On a terminal it then offers AI cleanup with download estimates; --cleanup fast|thorough does it without asking and --cleanup skip never offers. It downloads the pinned upstream llama-server release (b11703, about 17 MB, SHA-256 checked) rather than using a distro package: Arch extra/llama-cpp (0.6.0, build 11429) and Debian llama.cpp-tools (testing and unstable only) are not revision 27c7a769d, and the engine worker refuses any other revision. Nothing is compiled; --cleanup fast --build-server compiles it locally instead. setup.py --uninstall [--purge] reverses the per-user pieces. On GNOME and KDE Wayland sessions (detected, or forced with --desktop gnome|kde) setup skips the Omarchy plugin: after the speech model and doctor it prints what the two desktop prompts are, asks the portal for typing access (on a terminal, or with --grant; --skip-grant leaves it), enables mouthtype-linux.service (the shortcut prompt appears when it starts), and adds an XDG autostart entry for the Qt settings window (--background, tray only) when mouthtype-desktop is installed. A refused typing grant does not fail setup; delivery stays recover-only until it is granted. --uninstall removes the service, the autostart entry and the GNOME fallback shortcut, and --purge also the stored grant. With no --config, the client uses ~/.config/mouthtype/linux.json when present and otherwise the linux.json that setup_speech.py wrote under ~/.local/share/mouthtype/speech-candidate. The Arch package recipe for the AUR is in packaging/arch/aur.
Install with apt (coming soon). A mouthtype-linux package for Debian 13 and Ubuntu 24.04 or newer is built from packaging/debian and tested in clean containers, but the signed repository is not published yet, so sudo apt install mouthtype-linux will not work until it is. Once it is live: add the one-time source (mouthtype.sources and mouthtype-archive-keyring.gpg from https://mouthtype.app/apt/), sudo apt update, sudo apt install mouthtype-linux, then run mouthtype-linux-setup as your normal user. Hyprland is a recommendation only (Debian 13 and Ubuntu 24.04 do not package it) and Quickshell is a suggestion. Run mouthtype-linux-setup --uninstall before apt remove. The full guide is docs/guides/linux.md; maintainers publish with packaging/debian/README.md.
For a local Arch test package, a clean committed full repository checkout can run python3 scripts/prepare-linux-arch.py --destination /absolute/new/arch-bundle. This creates a standalone local-source PKGBUILD bundle with explicit source integrity/provenance and its own 0.1.0test.r<commit-time>.<revision> version, without changing signed app metadata. The attached test suffix sorts below the matching stable version. Follow the bundle's README to build as an ordinary user and install with normal pacman policy. No AUR entry, public source endpoint, signing key, model download, service or binding is added. The existing 60-file payload is reused. The installer supports --prefix /usr --destdir /absolute/staging-root so a package-stage path never appears in the runtime launcher. Staged system-package payload directories and newly created prefix parents use mode 0755, and payload files use mode 0644 regardless of the build umask. Existing staging ancestors are preserved. The manual user install retains its private mode 0700 payload root. Package removal leaves separately prepared user models, configuration and recovery outside /usr alone.
Prerequisites come from normal signed package management on Arch/Omarchy.
| Package | Needed for |
|---|---|
python, python-pip, curl, pipewire-audio | Required. |
libnotify | Optional recording feedback. |
wtype, wl-clipboard | Only deliberate paste or typing delivery. |
ffmpeg | Only audio file transcription. |
git, cmake, base-devel | Only --build-server, which compiles the pinned cleanup server instead of downloading it. |
The ordered end-to-end checklist for people and coding agents, covering this client, speech setup, the Omarchy plugin in ../omarchy-plugin and its login service, is website/public/linux/agent-install.md, published at https://mouthtype.app/linux/agent-install.md. Preparation reports missing required helpers and never invokes a package manager. Native Arch Python3.14 installed the pinned sherpa wheels in the remote runtime experiment; actual desktop acceptance remains separate. Missing binary wheels fail preparation without replacing or downgrading system Python.
Explicitly prepare the speech model with python3 tools/linux-desktop/setup_speech.py --destination "$HOME/.local/share/mouthtype/speech-candidate". This downloads the exact published Parakeet INT8 archive, verifies its pinned SHA-256 before extracting only the four regular speech files, and uses the existing verifier to check each extracted digest. It creates a dedicated virtual environment, installs the pinned requirements as binary packages from PyPI, checks the runtime import/version, and writes private engines.json, linux.json, and a provenance receipt. It does not load models, record audio, start a service, register shortcuts or change the clipboard. No cleanup-model download or C++ build is required for this speech client.
The destination must be new. Existing files are refused before downloads or subprocesses; an interrupted new setup remains for inspection. Choose another destination for a clean retry. Every download/install child has a finite deadline and is stopped/reaped. The approximately 465 MiB model download permits slow continuous progress for at most one hour; curl aborts below 1 KiB/s for 60 seconds, retains its 20-second connection limit, and has a slightly larger outer process deadline. The receipt records preparation, not inference or desktop acceptance. Keep the archive, weights and environment outside the source checkout.
The helper prints the exact foreground launch command with its generated recover-only config. For the example above it is mouthtype-linux --config "$HOME/.local/share/mouthtype/speech-candidate/linux.json" serve. The default delivery.mode is recover, which makes no clipboard or keyboard changes. The resident service checks the configured artifact hashes again before each cold worker load. If artifacts are already available, the separate manual engine preparation procedure still works; config.example.json can reference that config and its environment Python.
Relative engine_config paths resolve beside the client config. capture_target optionally selects a PipeWire node name or serial using the documented pw-record --target option. An unavailable target fails rather than switching silently to another device.
Start a bounded foreground session with mouthtype-linux serve. It exits after 12 hours or an explicit mouthtype-linux shutdown; --lifetime-seconds after serve selects 1 second through 24 hours. Start it again explicitly for a new session. No restart loop, recurring job, login item, or systemd unit is installed. Termination cancels active capture/inference, stops owned processes and removes the socket. Audio from an interrupted take stays recoverable. A second service cannot replace the live socket; a later service can reclaim its own stale socket after a crash.
Hold, toggle and cancellation
Choose unused compositor keys. Nothing edits or reloads your compositor configuration automatically.
Note
Omarchy can already bind F9 to Voxtype, so inspect/remove that conflict or choose other keys before using these examples.
Commands
Every verb below is a mouthtype-linux subcommand.
| Command | Does |
|---|---|
start | Starts one recording. Repeated start is ignored. |
stop | Finalizes one recording and transcribes it. Repeated stop never duplicates insertion. |
toggle | Starts when idle and stops when recording. Does nothing during transcription or cancellation. |
cancel | Discards an active take and prevents a late inference result from being delivered. |
status | Reports state, a coarse error category and recovery ID, without transcript, window title or audio. |
watch | Prints one JSON line per state change until the service exits. --retry keeps reconnecting. |
list | Lists take IDs and whether audio and text exist. |
recover ID | Prints the selected transcript exactly, with no automatic delivery. --raw prints the original recognition. |
transcribe ID | Asks the running service to transcribe a take that has audio only, always into recovery. |
forget ID | Deletes that take's generated files, refusing a take currently in use. |
capabilities | Prints the client's interface version and feature list without contacting the service. |
import FILE | Transcribes one WAV, AIFF or M4A file through the running service. |
import-status | Reports the file job state, a coarse error code and the decoded duration. |
import-cancel | Stops decoding or inference and discards any partial result. |
import-result | Prints the latest file result exactly. |
import-save PATH | Writes the latest file result as UTF-8. |
import-forget | Removes the latest file result. |
doctor | Read-only setup check. See above. |
serve | Runs a bounded foreground session. |
shutdown | Ends the service explicitly. |
Note
For Hyprland 0.55 and newer, adapt the current Lua examples in hyprland.lua using hl.bind and nonblocking hl.dsp.exec_cmd. F10 toggles; F11 cancels. The examples no longer include a bare F9 hold: press and release start separate mouthtype-linux start and stop processes with no ordering between them, so a quick tap or rapid repeat can leave a recording running. Hold-to-talk on a plugin install goes through the plugin's control.py start and control.py stop, which order the two events (the plugin's Change Dictation Shortcut menu writes that binding; the example files carry it commented out). A CLI-only install has toggle and cancel. hyprland-legacy.conf is separately labeled for 0.54 and older.
Custom modifier combinations need release-order acceptance on the chosen compositor version. The 60-second default recording cap cancels an overlong take instead of inserting a partial result. The maximum configurable cap is 120 seconds. Lost capture is preserved as interrupted audio rather than transcribed automatically.
Live state for frontends
The Omarchy bar widget and floating pill that use these interfaces live in ../omarchy-plugin.
mouthtype-linux watch connects once and prints one JSON line per state change until the service exits; --retry keeps reconnecting and prints {"event": "disconnected"} once per outage. Each line carries the session state, coarse error, delivery outcome, recovery ID, elapsed recording seconds, the file-import state and, while recording, a level in dBFS computed from the newest 100 ms of the growing take; no transcript, window title or audio ever appears. The service serves at most eight watchers, drops one that stops reading, and polls at 20 Hz while recording so a meter can follow speech. The Omarchy plugin's floating pill is built on this stream.
Recovery and deliberate delivery
Recovery lives in $XDG_STATE_HOME/mouthtype/recovery, default ~/.local/state/mouthtype/recovery. Directories use mode 0700; recording/transcript files use 0600. Recordings and transcripts remain until explicitly forgotten.
- At
maximum_recovery_takessaved take directories (default 200, 1 to 5000), another recording is refused asrecovery_fullinstead of silently deleting user data.statusreportstakesandmaximum_takes. - Completed audio follows the Mac saved-audio policy. When the service starts and after each take, a completed take's WAV older than
audio_retention_days(default 90,nullfor no age limit) or beyondaudio_retention_megabytes(default 2048, oldest first) is removed while its transcript and raw recognition stay. - Audio without a transcript, waiting for explicit recovery, is never removed by that audio policy.
- Separately,
history_keep(defaultnull) forgets everything but that many newest takes, audio and text alike, after each dictation and at service start. The Omarchy menu offers Keep all, 5, 20 or 50. - No text is included in routine status/errors, process arguments or compositor logs.
Recovered takes never replay on startup. mouthtype-linux transcribe ID is for a crash or model error that left audio only: read the result with recover. Existing transcripts are never overwritten. See the command table.
New takes save original engine text in raw-recognition.txt and final text in transcript.txt, both mode 0600. mouthtype-linux recover ID --raw prints the original exactly, including its line endings. An older take without a raw file reports unavailable rather than substituting its final result. If final saving failed after raw recognition was saved, explicit transcribe ID finishes from that saved raw text using the current dictionary; it does not run recognition again or deliver automatically. Forget removes both text files and the audio. Cancelling a recovered take preserves its existing audio/raw text.
Warning
Automatic delivery is opt-in. Set delivery.mode to paste or type, then either provide a nonempty delivery.allowed_classes array of exact Hyprland window classes or set delivery.any_window to true, and set delivery.allow_unknown_secure_field to true only after considering the limitation below.
paste is the Mac-like path: the transcript is placed on the Wayland clipboard with wl-copy and one Ctrl+V chord is sent to the window captured at recording start, through Hyprland's send_shortcut dispatcher first (falling back to the legacy sendshortcut form, then to wtype), after checking that it is still the unlocked active window. Line breaks and tabs travel as text, so multiline Basic cleanup results can be pasted. Windows whose class is in terminal_classes (a built-in list of common terminals plus Omarchy's org.omarchy.agent, overridable) or whose owning process name is in terminal_executables (ghostty, alacritty, kitty, foot and other terminals, so a terminal launched with a custom class is still recognised) receive Ctrl+Shift+V instead, and a transcript containing a line break is refused for a terminal as unsupported_text unless allow_terminal_multiline is true, because a pasted line break runs a command. With restore_clipboard (default true) the previous text clipboard is read once before the paste and put back restore_delay_seconds later (default 1.5, range 0.1 to 30, so a slow target has time to read it), only if the clipboard still holds the pasted transcript. A clipboard holding an image, a file list or more text than the 1 MiB read limit can't be put back, so it is never overwritten: the transcript is kept in recovery and the outcome is clipboard_kept. If wl-copy fails or the clipboard never takes the text, nothing is pasted and the outcome is clipboard_failed. Neither outcome retries. A clipboard marked with x-kde-passwordManagerHint is replaced but not restored, so a copied password isn't re-published. Successful helper exits mean the paste was requested, not that the field received it; the delivered cue says so.
Clipboard copies Mouthtype makes (paste delivery, Copy on a take or file transcript, transform copy, copy-last) are concealed like the Mac's pasteboard marker: when wl-copy is wl-clipboard 2.3 or newer it runs with --sensitive, which adds the x-kde-passwordManagerHint offer beside text/plain;charset=utf-8 and sets CLIPBOARD_STATE=sensitive for wl-paste --watch consumers such as cliphist. Older wl-copy builds get the plain copy, so history managers may record it. Restoring your earlier clipboard after a paste stays a plain copy.
Any cli_<name>.py file next to desktop.py that defines register(subparsers) and run(args, context) is loaded at startup and adds its own subcommands; a module that fails to import or register is skipped with a one-line JSON error on stderr and never replaces a built-in command. context carries config, recovery, imports, runtime and socket as paths, plus request(action, identity=None, **fields) to send one command to the running service. Engine workers also exit, along with llama-server, within about a second if the service is killed without cleaning up.
type submits the characters directly and keeps the stricter rules below. The service captures address/class/PID at recording start, checks the current unlocked target before delivery, and declines delivery if target identity changed or is unavailable. It submits one UTF-8 text stream to wtype - via stdin. It never borrows or overwrites the clipboard, focuses another window, synthesizes a paste chord, or retries after uncertainty. The helper has a 15-second deadline; a timeout may have typed a prefix, so read recovery and check the target before doing anything else.
Warning
Hyprland window identity does not establish editable-field identity or whether a field is a password field. Automatic typing therefore requires the explicit unknown-field opt-in and a known suitable field.
AT-SPI context, secure-field detection and insertion read-back are unsupported. A helper returning success means delivery is unknown, not verified. Focus can change during key submission. Newline, tab, Escape and other C0/C1 control characters are refused for automatic typing because wtype turns some into Return/Tab actions. The full transcript remains available in recovery. Never enable automatic typing for a terminal or other command-executing field without understanding those limits.
Config keys
These keys live in linux.json. Relative paths resolve beside that file.
| Key | Values | Default |
|---|---|---|
delivery.mode | recover, paste, type | recover |
delivery.allowed_classes | Nonempty array of exact Hyprland window classes | Not set |
delivery.any_window | true or false | Not set |
delivery.allow_unknown_secure_field | true only after considering the typing limitation | Off |
delivery.restore_clipboard | true or false | true |
delivery.terminal_classes, delivery.terminal_executables | Lists that select Ctrl+Shift+V | Built-in lists |
delivery.allow_terminal_multiline | true lets a multiline transcript paste into a terminal | Off |
capture_target | A PipeWire node name or serial | Not set |
maximum_recovery_takes | 1 to 5000 | 200 |
audio_retention_days | A number of days, or null for no age limit | 90 |
audio_retention_megabytes | A size in megabytes | 2048 |
history_keep | A number of newest takes to keep, or null | null |
dictionary | Path to the saved-spellings JSON | Not set |
phrases | Path to the saved-phrases JSON | Not set |
phrase_clipboard | true enables the {clipboard} variable | false |
notifications | true, false or "errors" (only errors and the ready cue) | true |
slash_commands | true or false. "slash research" becomes "/research" in terminals, code editors and coding agents | true |
cleanup | off, basic, fast, thorough | off |
cleanup_idle_seconds | seconds of no use before the cleanup server is stopped (0 disables); the next recording or take reloads it and status shows loading | 600 |
cleanup_engine | Path to cleanup.json | Not set |
Statistics and last-take verbs
mouthtype-linux stats prints one JSON object rebuilt from the recovery directory on every call (the Omarchy panel reads the same data through control.py stats). It holds words today, this week and all time, take count, speaking speed (average and peak, from takes of at least 5 words and 3 seconds; rates above 400 wpm are ignored), the current and longest streak, words by hour of day over 30 days, today's tape (each take with its time, words, duration and an audio_only flag), High scores (fastest, biggest day, longest streak, longest take, each with its date) and time saved against typing at 40 wpm. Nothing new is written to disk. Because recovery is bounded (maximum_recovery_takes, history_keep, Forget), every number covers only what is still saved, and the result carries history_limited: true. Speaking time is the length of recording.wav rather than voiced time, and a take whose WAV was retired by the audio policy keeps its words but has no duration, so it leaves speed and time saved alone.
mouthtype-linux copy-last puts the newest saved transcript on the clipboard. mouthtype-linux paste-last delivers it to the active window through the same delivery the service uses after a take: the allowed-window check, the terminal rules, the target recheck, the clipboard guard and cancellation (SIGINT or SIGTERM stops it before any key is sent). It needs delivery.mode set to paste or type, refuses while the service is recording or transcribing, and exits 2 with a JSON error on stderr when it can't deliver. A successful exit means the paste was requested, not that the field received it.
Explicit saved spellings
Optionally add "dictionary": "dictionary.json" to linux.json. Relative paths resolve beside that client configuration; absolute paths and ~ are accepted. The existing Mac library can be copied as a regular UTF-8 JSON file containing an array such as [{"heard":"post hog","written":"PostHog","starred":true}]. heard and written must be strings; starred is optional, boolean or null and does not affect matching. Unknown fields are ignored. No library is created, edited or learned automatically.
The service validates and snapshots the configured file before each recording or explicit audio recovery. A missing/malformed/nonregular file or one over 4 MiB refuses that operation with dictionary_unavailable; it never silently drops a configured library. Fixing the file takes effect on the next start without restarting. Edits during a take apply to the next take. Omitting dictionary or using an empty array leaves text unchanged.
Matching uses whole-word Unicode boundaries, canonical equivalence and per-character lowercase, with the longest normalized source first and the first duplicate winning. Source whitespace matches any whitespace run. Replacement text is inserted literally, once, without chaining into another rule. Empty sources and empty replacements are ignored, matching the Core matcher rather than imposing the Mac editor's validation limits. Final recovery and optional delivery use the replaced text; original recognition stays separate. There is no phonetic matching, speech-model boosting or cleanup-model integration here. Editing the library is mouthtype-linux spellings (see Editing the libraries).
Unicode and vendored matcher details
The portable matcher vendors the MIT grapheme v0.7.2 iterator at immutable commit 56f7f2d16d54576290634b7484eeece52c538bcb, with Unicode 16.0 data and licenses in vendor/grapheme. Alphabetic/numeric boundary ranges are also pinned to Unicode 16.0 in spelling-unicode.json; whitespace uses Unicode White_Space. Lowercase mappings come from the running Python's Unicode database, so recently introduced characters can differ across Python/Swift versions. The committed shared spelling fixtures pass against the actual Core matcher, covering combining accents, Greek/Cyrillic, Hangul, Indic clusters, emoji, boundaries, precedence and nonchaining. This is not a promise that all Unicode versions agree. The local Swift 6.4 Character implementation differs on one of 1,093 official Unicode 16 grapheme cases (✁✁); the vendored iterator passes all 1,093. No runtime dependency download is needed.
Saved phrases
Optionally add "phrases": "phrases.json" to linux.json. Paths resolve beside that configuration, like dictionary. The Mac library format is an array of {"trigger":"my address","expansion":"First Street"} entries. No library is created or edited automatically. A configured missing, malformed, nonregular or oversized library refuses recording/recovery with phrases_unavailable. The limit is 1 MiB, with unique nonblank triggers up to 128 graphemes and nonblank expansions up to 16,000 graphemes.
Each recording or explicit recovery snapshots the library and its variables before capture/inference. Saved spellings run first, then phrases use the same whole-word, case-insensitive, longest-trigger and single-pass matcher. Expansion text is literal, preserves its whitespace and is never rewritten by spelling rules or another phrase. {date} uses an English long date such as October 17, 2026; Linux does not yet mirror the Mac's locale-dependent date formatting. Unknown variables stay literal. The final result is limited to 2 MiB; a failed expansion keeps the original recognized text and audio for explicit recovery.
Editing the libraries
mouthtype-linux spellings and mouthtype-linux phrases edit the two files above without the service running; they are what the panel's Dictionary and Transforms pages call. Each writes under a lock on the library's directory and ends in an atomic rename that keeps the file's mode and follows a symlink, so the service never reads a half-written file. Validation and wording mirror the Mac editors. A library the service could not read is reported as problem and is never overwritten. Extra keys on spelling and phrase entries survive an edit. The first write to an unconfigured library creates dictionary.json or phrases.json beside linux.json and adds the matching key to linux.json (after a .bak.<time> copy), reported as adopted_config. A running service read its paths at start, so after adopted_config is true the service must be restarted before it applies the new library.
spellings list | add HEARD WRITTEN | edit HEARD NEW_HEARD NEW_WRITTEN [--expect-written W] | remove HEARD [--expect-written W]
spellings import FILE.csv [--dry-run] [--expect-digest D] [--expect-csv-digest C]
phrases list | add TRIGGER EXPANSION | edit TRIGGER NEW_TRIGGER NEW_EXPANSION [--expect-expansion X] | remove TRIGGER [--expect-expansion X]Every command prints one JSON object and exits 0, or prints {"error": message} on stderr and exits 1. --expect-* refuses the change (the Mac's "changed outside the editor" message) when the saved text is no longer what the page showed. Heard phrases and triggers match ignoring case and whitespace runs; heard phrases and triggers are stored with whitespace collapsed and spellings with the ends trimmed. Limits are the service's: 4 MiB for spellings, 1 MiB for phrases, 128 characters for a heard phrase, spelling or trigger, and 16,000 for an expansion.
Library state, returned by list and by every change (with result and entry added; result is added, updated, unchanged, removed or imported):
{"kind": "spellings", "path": "...", "configured": true, "exists": true, "digest": "<sha256 or missing>", "count": 2,
"entries": [{"heard": "post hog", "written": "PostHog", "starred": false, "warning": null}],
"problem": null, "writable": true}Phrase entries are {"trigger", "expansion"}. warning is the Mac's everyday-word notice (it does not block saving). digest identifies the file contents for the import check below.
spellings import reads a CSV of up to 1 MiB and 5,000 rows with a name column or heard,written columns (either order) and a header row, using the Mac's quoting rules. --dry-run writes nothing and returns the sheet's preview:
{"file": "names.csv", "problem": null, "can_import": true, "digest": "...", "csv_digest": "...",
"counts": {"add": 1, "existing": 1, "duplicate": 0, "invalid": 0},
"rows": [{"row": 2, "heard": "shawn", "written": "Sean", "result": "add", "label": "Add", "warning": null}]}result is add, existing, duplicate or invalid; label is the sheet text ("Already saved", "Duplicate row", or the invalid reason); row is the CSV line. problem is set instead of rows for an unreadable CSV or wrong headers. can_import needs no problem, no invalid row and at least one add; one invalid row blocks the whole import. Importing appends only the add rows in one write and returns the library state with imported and skipped. --expect-digest and --expect-csv-digest take the preview's digest and csv_digest and refuse (the Mac's "changed after this preview" message) if the library or the CSV moved since, so the rows written are the rows shown. Suggestions from corrections are not part of the Linux client.
{clipboard} additionally requires "phrase_clipboard": true and the optional distro wl-clipboard package. It defaults off. If any configured expansion uses that variable, a start/recovery reads the default Wayland clipboard once through wl-paste --no-newline --type text; no clipboard watcher, write or key event is started. The read has a one-second deadline and 1 MiB limit. Missing permission, helper, text or failed reads refuse that operation with phrase_context_unavailable, rather than silently deleting the trigger. A successfully read empty text offer expands to empty, like Core. Use the initial Hyprland/data-control target; other compositors and clipboard behavior still require acceptance. These are explicit clipboard reads even in recovery-only delivery mode.
Raw recognition is saved before replacements as private raw-recognition.txt. Phrase/spelling failure leaves it available for recovery without another inference. Final text stays in transcript.txt; explicit raw recovery and existing completed results are unchanged. Cancelling a new unfinished take removes only its own generated audio/raw data; cancelling recovery preserves the old originals. No retry is delivered automatically.
Transcribe an audio file
mouthtype-linux capabilities prints this client's interface version and feature list without contacting the service, so a frontend shows only controls the installed client supports. mouthtype-linux import /absolute/file.m4a asks the running service to transcribe one WAV, AIFF or M4A file of at most 10 minutes and 512 MB, matching the Mac guide. The container is identified by content through ffprobe; the optional distro ffmpeg package provides both helpers, and a missing helper fails the job as decoder_unavailable. The file is decoded by an owned, bounded ffmpeg process into a private 16 kHz mono PCM16 WAV below $XDG_STATE_HOME/mouthtype/imports, then recognized by the same resident Parakeet worker, with a deadline that grows with the file's duration rather than the microphone cap. The original file is never written. Source paths and transcript text stay out of status replies and diagnostics.
import-status reports preparing, transcribing, cancelling, finished, empty, cancelled or failed, a coarse error code, and the decoded duration. import-cancel stops decoding or inference when the current operation returns and discards any partial result; the decoder is stopped and the speech worker is reloaded on the next request, as with cancelled dictation. One file job runs at a time, and a job is refused as session_active while dictation or recovery is active; start, toggle and transcribe are refused as file_import_active while a file job holds the speech engine. status includes the current file_import state.
The result is the full raw recognition. Cleanup, saved spellings and phrases are not applied, nothing is pasted, and the job does not appear in list, recent dictation history or word counts. import-result prints the latest result exactly, and import-save /path/notes.txt writes it as UTF-8, refusing a destination that resolves to the original audio file and refusing to replace an existing file without --overwrite. Both read saved state and work without the service. Starting a new file job replaces the previous result; import-forget removes it explicitly. Interrupted jobs are removed on the next service start. The decoded WAV is deleted after recognition, cancellation or failure.
Optional basic cleanup
"cleanup": "off" is the default when the key is absent (the linux.json that setup_speech.py writes sets "basic") and leaves recognition text exactly as it arrived before explicit saved-spelling/phrase rules. Choose "cleanup": "basic" in linux.json for deterministic spoken punctuation, paragraph/newline commands, bullet/numbered lists, sentence-start casing and whitespace formatting. Configuration is loaded when the foreground service starts; an admitted take keeps its own cleanup setting. No additional model or network request is needed. Paragraph/newline/list commands produce line breaks. Automatic type delivery refuses those control-bearing results as unsupported_text; the full formatted transcript stays available through recovery. Single-line punctuation results can use the existing guarded typing path. This does not add multiline paste or send Return/Tab keys.
Basic uses Core's command vocabulary and noun/clause/list guards: “hello comma world new paragraph thanks” becomes Hello, world, a blank line, and Thanks. Ordinary uses such as “the Oxford comma,” “a new line of products” and “next week” remain words. It does not remove fillers, change spoken numbers, paraphrase or perform Mac AI cleanup. Command intent is still heuristic, including Core's known ambiguous bare “bullet”/“next” cases; review the result or keep cleanup off when literal wording matters.
Quoted/backticked text, fenced code and code-looking paths, addresses and identifiers are protected from command/casing/inner-whitespace changes. These are explicit preservation rules beyond the unprotected Core stages, not a claim of identical output for every input. Unknown or unclosed prose quotations can still be ambiguous. Saved spellings and phrases run after cleanup, so their inserted case, indentation and line endings remain literal. No surrounding app text is read and no cross-take history is used to guess words.
Input/output formatting is limited to 2 MiB. Raw recognition is saved first. A formatting failure preserves the original raw text/audio; explicit recovery uses the current cleanup setting without another inference when raw text is available, and never pastes automatically. Cancellation while formatting runs remains immediate and cannot publish late text. Existing completed results are never reformatted on startup.
Fast and Thorough cleanup with local models
| Level | Model | Notes |
|---|---|---|
| Basic | None | Deterministic. No extra model or network request. |
| Fast | S1-mini by Superwhisper, GGUF Q4_K_M | Budget of 1 s plus 35 ms a word, at most 10 s. |
| Thorough | Qwen3-4B-Instruct-2507, GGUF Q4_K_M | Budget of 2 s plus 200 ms a word, at most 30 s. Slow on CPU. |
"cleanup": "fast" or "thorough" adds a local model pass after Basic cleanup, matching the Mac levels: Fast is S1-mini by Superwhisper (GGUF Q4_K_M, Apache-2.0 with its naming clause) with its native control line; Thorough is Qwen3-4B-Instruct-2507 (GGUF Q4_K_M, Apache-2.0) with the Mac app's shared cleanup prompt, because the Mac Thorough model's terms are gated and it has no pinned llama.cpp build here. Both run through the pinned llama.cpp CPU server from ../linux-engine-proof/pins.json, listening on loopback only, started once by the service and stopped with it. Neither level is implied by the other, and neither is on by default.
Prepare explicitly with python3 tools/linux-desktop/setup_cleanup.py --destination "$HOME/.local/share/mouthtype/cleanup-candidate" --level fast (add --level thorough for both). It downloads the pinned upstream llama-server release (llama_binary in pins.json: HTTPS only, SHA-256 checked, only llama-server and its shared libraries unpacked into server/, any unsafe archive entry rejects the whole archive) unless --server names an existing pinned build or --build-server clones and compiles the pinned revision for the CPU, downloads each GGUF with a bounded curl, verifies the pinned SHA-256 before placing it, hashes the server, and writes private cleanup.json, a receipt and a cleanup-setup.json progress file. It never edits linux.json; add "cleanup_engine": "/path/cleanup.json" and the chosen level yourself, then restart the service. doctor verifies the configured model and server hashes without loading them, and its llama_server check runs llama-server --version and --list-devices (no model is loaded) to report whether the server is present, which revision it is, and whether a compute backend loads.
Package installs set themselves up. The Arch package ships mouthtype-linux-firstrun.service (source: systemd/), enabled for every user. At the first graphical login it runs mouthtype-linux firstrun, which does nothing if speech is prepared and the bar plugin is present, and otherwise runs setup.py --shortcut toggle (speech model, plugin, both shortcuts with their conflict checks, login service). It shows progress and failures as notifications. $XDG_STATE_HOME/mouthtype/firstrun.json records done, uninstalled (after mouthtype-linux-setup --uninstall, so it is not redone) or failed; a failure retries at the next login, at most three times, and the oneshot unit has no Restart=, so it cannot loop. mouthtype-linux-setup stays the manual and repair path. Any package (the Debian one included) gets this by installing that unit and enabling it for all users; nothing else is packaging-specific.
At each take the raw recognition is saved first, Basic cleanup runs, then the model receives that text within a budget derived from the on-machine benchmark (Fast: 1 s plus 35 ms a word, at most 10 s; Thorough: 2 s plus 200 ms a word, at most 30 s). Takes under two or over 400 words skip the model. A timeout closes only the HTTP request, so the server stays warm; cancellation stops the worker and the next take reloads it. The model text replaces the Basic text only when the ported Mac guard accepts it: non-empty, within the length cap, same negations, certainty words, question form and time of day, every number, acronym, capitalised name, quoted or code-like literal kept, at least half the content words retained and at most half new. Spoken numbers may become one written value only as the exact value (twenty four as 24, twenty second as 22nd, fifteen hundred as 1500, a spoken year only next to a date cue), every scale word (hundred, thousand, million, billion) is kept or folded into the written value, 9:05 needs a time cue, A/B is accepted only as "A/B test", and each AM or PM stays with its own time. Any other outcome, including a crashed or missing model, keeps the Basic text and the audio. Each take records cleanup.json with the level, outcome (ok, guard-rejected, timeout, failed, skipped), milliseconds and reason, never text; status reports the level, last outcome and the model state (absent, idle, loading, ready, failed). Saved spellings and phrases still run after the model.
Benchmark numbers on the development machine
On this machine (Ryzen 5 3600, 6 threads, CPU only) the pinned S1-mini loaded in about 0.9 s and answered the 75 Mac cleanup fixtures with a median of 0.4 s, under 1 s up to about 30 words and about 7 s at 220 words, with 2.2 GiB resident; 39 of 75 matched the Mac reference exactly, the differences being S1's habit of keeping spoken register. The Thorough candidate on the same CPU loaded in about 2.3 s and answered the same fixtures with a median of 2.7 s, about 3 s at 10 to 19 words, 11 s at 50 words and 38 s at 220 words, with 5.3 GiB resident; 42 of 75 matched exactly and, on the 19 smart-correction fixtures, 8 against S1-mini's 11. Thorough is therefore selectable but slow here: its budget of 2 s plus 200 ms a word, capped at 30 s, means takes over roughly 140 words keep the Basic text. It is a different model with a different prompt, evaluated separately, not Fast under another name. GPU offload is possible through gpu_layers in cleanup.json with a Vulkan build of the same revision, which this setup script does not produce.
Model load time and integrity
The service loads the speech model in the background once its socket is bound, and Transform Selection uses the running service's server when it already has the Thorough model loaded, so that model is never in memory twice. Otherwise it keeps its own Thorough server for 60 seconds after the last transform (MOUTHTYPE_TRANSFORM_IDLE_SECONDS, 0 loads per run). To avoid rehashing gigabytes on every load, a model file that passed a full SHA-256 check is remembered in $XDG_STATE_HOME/mouthtype/verified-models.json and skipped while its path, size, mtime, inode, device and ctime all match exactly. The tradeoff is that a file edited by someone who can also restore all of those fields goes unnoticed until the full re-verify that runs at least once a day. Set MOUTHTYPE_VERIFY_FULL=1 to hash every file on every load.
Tone, swearing softening and Style contexts
tone.py ports Core's tone stage (Formal, Casual, Very casual) and profanity.py ports ProfanityRemover, which is what Formal does: it removes or swaps swearing used as an exclamation or intensifier, with Core's word lists and rules. Casual drops the final full stop of a short message. Very casual also lowercases safe sentence starts. Core's part-of-speech tagger is Apple's NLTagger, which Linux does not have, so lexical.py answers those few questions from word lists and suffix rules. tone-fixtures.json holds Core's output for 791 sentences and records the 2 the guesser gets differently.
styles.py holds the Style contexts: Personal, Work, Email and Other. Each has a tone and an optional cleanup level. Built-in members are apps by window class (Signal, Telegram, Discord; Slack, Teams; Thunderbird, Evolution, Geary), and you can add apps, remove built-ins, or set a per-app rule. Your rules beat your added apps, which beat built-ins, and Other covers everything unlisted. Websites are not supported on Linux. The styles block in linux.json is optional. With no block, no tone applies anywhere and cleanup runs at the global level, so existing installs behave as before.
mouthtype-linux style show
mouthtype-linux style set-tone work casual
mouthtype-linux style set-cleanup other off
mouthtype-linux style add-app personal org.example.Chat --name Chat
mouthtype-linux style rule foot --cleanup off
mouthtype-linux style resolve Slack
mouthtype-linux style preview casual "See you Friday."The service uses these settings on every take. It resolves the window class captured when the take started, runs the Basic stage with that context's tone, and, when the context overrides the cleanup level to Fast or Thorough, runs that model for the take (Off and Basic overrides skip the model). A model reply gets the tone applied again, so Formal still softens swearing a model puts back. An override level with no model prepared in cleanup.json keeps the Basic text. Style edits take effect on the next take: the service checks the config file's modification time when a take starts, and keeps the styles it already has if the file can't be read or no longer validates. A model level first used by an override loads in the background, so that first take may keep its Basic text.
Window classes come from hyprctl clients. The built-in classes were checked against: the Telegram Desktop desktop file (StartupWMClass=TelegramDesktop, icon and id org.telegram.desktop), Arch's signal-desktop packaging requests (Signal sets Wayland app_id signal), the Flathub manifests for Signal (org.signal.Signal), Thunderbird (org.mozilla.Thunderbird), Evolution (org.gnome.Evolution), Geary (org.gnome.Geary) and Discord (com.discordapp.Discord), the Flathub Slack desktop file (StartupWMClass=Slack) and the teams-for-linux docs (the app takes a --class). Discord's plain discord and Teams' teams-for-linux are the usual Electron names and were not confirmed in a desktop file; check yours with hyprctl clients.
python3 tools/linux-desktop/check_tone.py (Mac with the Swift compiler) compares the word lists with Core's source and replays the fixtures through Core; --write-fixtures regenerates them.
Recording feedback
Coarse desktop notifications are enabled by default through the existing notify-send helper. They identify ready, recording, transcribing, saved, cancelled and error states without transcript text, window titles or audio. Subsequent cues replace the previous notification when the desktop returns a notification ID. Active cues expire if a later replacement cannot be submitted; shutdown replaces an active recording cue with cancellation. Desktop notification presentation is best effort and never counts as delivery verification.
Spoken slash commands run as part of Basic cleanup, before spoken commands, and only when the window class at record start is a coding target: kitty, Alacritty, foot, ghostty, org.wezfurlong.wezterm, code, cursor, zed, claude, codex, orca, or a class starting with jetbrains- (case-insensitive). "slash code dash review" becomes "/code-review"; "press the slash key" and a bare "slash" are left alone. Mac also converts on claude.ai and chatgpt.com by page host; Wayland exposes no page host, so browser sites are not covered on Linux. Set slash_commands to false to turn it off.
Set notifications to "errors" to send only the error and ready cues (the Omarchy plugin does this when it is installed, because the bar pill already shows recording and transcribing), or to false to disable this helper. If it is missing, hung or rejected by the desktop, dictation and recovery continue; status reports feedback as unavailable. submitted_unknown means the helper accepted a cue, not that the desktop displayed it. Each helper has a short deadline and its owned process group is stopped/reaped. This client does not install the helper, notification service, bindings or login integration. Arch's libnotify and Ubuntu's libnotify-bin provide notify-send through their normal signed package management.
For maintainers
The rest of this page is for people working on the client itself.
Checks and development archive
Run python3 -W error::ResourceWarning -m unittest discover -s tools/linux-desktop -p 'test_*.py'. No test opens a microphone, launches a compositor or loads/downloads a model.
In a full repository checkout with the Swift compiler, python3 tools/linux-desktop/check_cleanup.py verifies the generated command data, shared formatting baselines and command-context/Unicode differential cases against the actual Core stages. The nine recorded literal-policy cases keep independent preservation expectations; they are not counted as identical Core output. Separately, python3 tools/linux-desktop/check_phrases.py checks the shared phrase fixtures against the actual Core SnippetExpander and span rewriting without launching the app. The check copies only the exact current edit-record definition from its GRDB-owning file into a temporary compilation unit. Separately, python3 tools/linux-desktop/check_spellings.py checks the shared fixtures against the real Core sources. This bounded test does not build or start the Mac app. The Linux source archive contains the portable fixtures/conformance checks and all vendored dependencies; it does not include the Mac-only comparison utility or Core sources.
Create a new source-only archive with python3 tools/linux-desktop/install.py --archive /absolute/new/mouthtype-linux-development.tar.gz. Its explicit file list includes the service, installer, bindings, engine adapter/pins/requirements, GPL license and third-party notices. It includes no model weights, user configuration, recordings or private planning. It is not a signed release package and does not promise a tested desktop baseline.
Runtime references
- Hyprland current binds and Lua migration
- Hyprland flags and release behavior
- Hyprland command interface and JSON flag
- PipeWire pw-record format, target and resampling options
- wtype stdin and virtual keyboard implementation
These sources were inspected on 2026-10-16. No Voxtype/Omarchy implementation was copied. Existing runtime/model licenses and provenance remain in the engine pins and third-party notices.
Explicit remote component acceptance
Component runner, workflow and evidence notes
acceptance.py is a separate opt-in Linux runner. Its capabilities command records available helpers and /dev/dri nodes without starting a compositor or microphone. pipewire starts an isolated PipeWire graph with the upstream synthetic 440 Hz test source and WirePlumber's policy-only profile, captures it through the real production adapter, checks PCM format/signal/frequency, and stops its processes. It does not load speech weights or open physical sources. Run it in an isolated D-Bus session using dbus-run-session -- python3 tools/linux-desktop/acceptance.py pipewire.
The separate sway command runs an owned headless Sway/pixman session, opens the synthetic native GTK3 Wayland target, sends one Unicode stdin stream through real wtype, and checks exact target text, focus and an existing clipboard sentinel. Run dbus-run-session -- python3 tools/linux-desktop/acceptance.py sway as an ordinary non-root user on the disposable runner. Its dependencies are Sway, wtype, wl-clipboard, GTK3, Python GObject bindings and D-Bus. This is a Sway/wtype component check, not a Hyprland adapter or Omarchy acceptance check. It has not been run when this source was initially written. A successful result must be tied to fetched runner evidence before changing that status.
Each component has a 45-second execution limit, short per-operation/readiness deadlines and owned-group cleanup before returning. All fixtures are synthetic. Logs from a failed component are bounded and emitted for investigation; no user recordings or dictation are used. The runtime scripts neither grant privileges nor disable compositor security restrictions. Current Hyprland/Aquamarine renderer paths require a DRM/dmabuf render device, including for nested sessions. An output-free session does not remove that requirement; record actual render-device availability before scheduling its desktop acceptance.
The narrow Linux desktop components workflow runs on PRs that change these files and supports an explicit manual dispatch. It uses the existing hosted Ubuntu 24.04 kernel with separately pinned official Ubuntu 26.04 and Arch starting userlands, normal signed package updates, ordinary-user D-Bus/component sessions and read-only repository permissions. Exact installed packages and raw component results are retained for 14 days. There are no weights, secrets, physical audio devices, paid runners or recurring schedules. Ubuntu 26.04 is used for the current WirePlumber policy-profile API rather than pretending Ubuntu 24.04's older WirePlumber has it. Passing these synthetic components still does not mark Arch/Omarchy desktop support complete.
Recording start/toggle requests carry a short local monotonic admission deadline, checked before and after target lookup. Expired or queued requests cannot begin a microphone take after their client has already timed out. Target probes have shorter individual deadlines than the client response budget. Repeated cancellation remains busy until inference has stopped. Cancelling an explicitly recovered audio take preserves its original saved WAV; only a newly recorded active take is disposable.
The first actual component runs exposed two integration mistakes and an environment boundary. Upstream pw-record intentionally returns exit status 1 after an operator's SIGINT closes the WAV, because success status is reserved for a drained playback stream. The adapter now accepts that status only after explicitly stopping a previously live recorder, while retaining complete PCM format/frame validation and treating a natural early exit as interruption. The native Wayland test waits for the exact app node in the compositor tree before requesting focus; a fixture file appearing is not proof the window has mapped.
Arch's signed packaged Sway 1.12 carries cap_sys_nice, and its executable was denied by the default hosted container boundary before startup. That failure is preserved as evidence. The Arch component job therefore builds a separately labeled unprivileged upstream Sway 1.12 component from immutable release commit 88869399f421d9180dd8b6ed0b5a1f4a3585d252, verifies the source archive SHA-256 in sway-build.json, and builds with two jobs against the recorded signed Arch libraries. It neither changes the installed package/file capabilities nor grants container privileges. The test result identifies this source build, while capabilities evidence continues to probe the original packaged executable. This establishes no packaged-Sway, Hyprland or Omarchy support claim. Source download, build commands and owned child groups have finite deadlines; source/binary digests and build logs accompany the component evidence.
The source-built component includes the exact upstream circular-scroll compatibility fix 1652c54b73f67df17b7b4ab0b0f7048204aa8104, verified by its pinned patch digest and applied with exact context. Released Sway 1.12 predates Arch's libinput 1.32 enum; the backport handles that enum rather than disabling upstream -Werror. Source and patch identities remain separate in the receipt. Failed component artifacts may include the generated synthetic WAV and final owned compositor/target state for diagnosis. These fixtures contain no user recordings or desktop state.