Skip to main content

Moonsway TTS

Moonsway TTS is a small on-device push-to-toggle dictation CLI for Sway. Moonshine Voice transcribes the microphone locally, and each finalized transcript line is typed into the keyboard-focused application with wtype.

Partial hypotheses are deliberately not typed. They can change while you speak, so inserting them would require destructive Backspace-based rewrites.

Requirements

  • Linux with Sway or another Wayland compositor supporting virtual-keyboard-unstable-v1
  • wtype
  • Python 3.12+
  • A working PortAudio input device

On Arch Linux, install the external system dependencies with:

sudo pacman -S portaudio wtype

The selected Moonshine model is downloaded on the first daemon launch and reused from the local cache. No API key or hosted speech service is used.

Installation

Run without installing:

uvx moonsway-tts --help

Install as a tool with uv:

uv tool install moonsway-tts

Install with pip:

pip install moonsway-tts

Or use my Forgejo PyPI instance:

uvx --index https://forgejo.chrispaganon.com/api/packages/chris-paganon/pypi/simple/ moonsway-tts --help
uv tool install --index https://forgejo.chrispaganon.com/api/packages/chris-paganon/pypi/simple/ moonsway-tts
pip install --index-url https://forgejo.chrispaganon.com/api/packages/chris-paganon/pypi/simple/ moonsway-tts

Usage

Start the long-running daemon:

moonsway-tts daemon

The model loads immediately, but the microphone remains stopped until a control command is sent. Stopping dictation closes the microphone capture stream, so the idle daemon does not reserve the input device and other applications can continue using it. Starting dictation opens the stream again without reloading the model. From another terminal:

moonsway-tts status
moonsway-tts start
moonsway-tts toggle
moonsway-tts stop

Each completed Moonshine line is trimmed, followed by one space, and passed to wtype over standard input without a shell. Use --separator to change the suffix and --wtype-delay if an application drops very fast key events:

moonsway-tts daemon --separator $'\n' --wtype-delay 2

The default delay is 1 ms because wtype 0.4 rejects a zero delay. Inspect all model, language, logging, and socket options with:

moonsway-tts --help
moonsway-tts daemon --help
moonsway-tts --version

Sway configuration

Install Moonsway TTS as a tool, then locate its executable:

uv tool install moonsway-tts
uv tool dir --bin

Add the executable path reported by uv tool dir --bin to the Sway configuration. For the usual uv tool location:

set $moonsway_tts /home/you/.local/bin/moonsway-tts
exec $moonsway_tts daemon
bindsym --release --no-repeat F9 exec $moonsway_tts toggle

Replace /home/you and F9 as needed. An unmodified key released before the command runs avoids physical Ctrl, Shift, Alt, or Super state interfering with injected text.

Do not run another microphone dictation service on the same binding. If replacing Handy, remove or comment out its autostart and binding. Reloading a Sway configuration adds the binding, but Sway's ordinary exec is intended for session startup; start the daemon in a terminal for the current session or restart the Sway session.

Text goes to the keyboard-focused field, not necessarily the window under the mouse pointer. Avoid moving focus or the caret until the finalized line has been inserted.

Development

Clone the repository and install the locked environment:

git clone https://codeberg.org/chris-paganon/moonsway-tts.git
cd moonsway-tts
uv sync --locked

Run the quality checks:

uv run ruff check .
uv run ruff format --check .
uv run mypy src tests
uv run pytest -q

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moonsway_tts-0.1.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moonsway_tts-0.1.1-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file moonsway_tts-0.1.1.tar.gz.

File metadata

  • Download URL: moonsway_tts-0.1.1.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for moonsway_tts-0.1.1.tar.gz
Algorithm Hash digest
SHA256 180ded5e60b531866f3b3f96accf39d7f0dd3c76251964afb671427498621502
MD5 224543ffff4dcd2ad202950c6f0eab35
BLAKE2b-256 4a0c7ae6c25bdb916d26c4bd4926d5b80a99c5d683898cb6b2e6657a81413feb

See more details on using hashes here.

File details

Details for the file moonsway_tts-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: moonsway_tts-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for moonsway_tts-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c29a839b03c1c4b013adc031829db28a876848093522caf8fe9a064f16a6c5bc
MD5 c5bc38aead813d934523ac865fb77aeb
BLAKE2b-256 332936fc18fb939d446dbafd4825a6e308ffd387891e094089d7a42fb7273186

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page