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. 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.0.tar.gz (8.3 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.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moonsway_tts-0.1.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.0.tar.gz
Algorithm Hash digest
SHA256 3ec1bcba856527959217adbc58eba58d1d57b9b8eaa6f1bff4602a64a04356c5
MD5 a6b5cfae58d40e734b497ba8094e92bf
BLAKE2b-256 0e2352f0993a0af26d449bb9802fd86bf0d5f1b6ae8ec6af1090a491dd16072c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: moonsway_tts-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee41e7b0c6f3dd6e8d1f8895335505a5e0f65c40c725100f6d4b5ce16bb41770
MD5 a097cb574f139b0c4001bc1668fce4ca
BLAKE2b-256 08b5b4710c295b657753f771e5507018825563dcc8cbc20cc841be84768554f0

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1.0 This release

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