Skip to content
swesleybrownPublic

About

Send text from the terminal, Neovim, or any screen region to a browser text-to-speech extension with one keypress

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReadAloud

Send text from anywhere on a Linux desktop to a browser text-to-speech extension, with one keypress.

Browser reader extensions like Speechify read web pages beautifully and everything else not at all. Getting a block of terminal output or an editor buffer read aloud means copying it, switching to the web app, pasting, and clicking play — around seven steps, every time.

ReadAloud turns arbitrary text into a local web page. The extension sees an ordinary page and does what it already does well.

any text  →  readaloud  →  localhost page  →  reader extension speaks

Built for Omarchy (Arch + Hyprland) with Speechify in Chromium, but nothing is specific to either — the engine is one config line.

Why not just use a text-to-speech API?

Because for a heavy listener it costs far more. Consumer subscriptions are priced for one human listening; APIs are priced for programmatic resale.

Monthly Yearly
Speechify Premium subscription ~$11.58 ~$139
Speechify API, same volume ~$499 ~$5,988
ElevenLabs API, same volume ~$600 ~$7,200

If you already pay for a reader, the problem worth solving is the friction, not the synthesis.

What you get

Trigger Does
SUPER+SHIFT+R Reads highlighted text, falling back to the clipboard
SUPER+ALT+R OCRs a screen region, then reads it
readaloud / say Reads stdin, arguments, clipboard or selection
<leader>ar Neovim: the visual selection, or the paragraph at the cursor
<leader>aa Neovim: the whole buffer

The OCR path matters more than it sounds. It reaches text that cannot be selected at all — image-only PDFs, text baked into screenshots, remote desktop sessions, anything rendered as pixels.

Install

git clone https://github.com/swesleybrown/readaloud.git
cd readaloud
./install.sh

The installer copies the script, server, and systemd unit into place, writes a default config if none exists, and starts the service. It prints the Hyprland and Neovim snippets for you to paste — it does not edit those files itself.

Requirements: python3, curl, jq, wl-clipboard, a Wayland compositor, and a browser reader extension. On Hyprland, autoplay additionally uses hyprctl. OCR uses omarchy-capture-text (hyprpicker, slurp, grim, tesseract).

Enabling autoplay

Find your extension's play/pause shortcut at chrome://extensions/shortcuts and set READALOUD_PLAY_MODS and READALOUD_PLAY_KEY to match. Speechify defaults to Alt+A on Linux.

If playback does not start on its own, raise READALOUD_PLAY_DELAY before changing anything else. See docs/troubleshooting.md.

Usage

man zfs | say                 # pipe anything
cat draft.md | readaloud
readaloud "some text"
readaloud --clipboard
readaloud --auto              # selection, falling back to clipboard
readaloud --ocr               # drag a region, OCR it, read it
readaloud --backend piper     # override the engine for one run

say is a symlink to readaloud.

How it works

A small Python server (standard library only) holds the current text in memory and serves it as a clean, readable page. Pushing new text bumps a version counter; the open page polls and reloads itself.

The ordering is the fiddly part. Naively sending the play shortcut after focusing the window starts reading the previous text, which the reload then cuts off. So the page reports back when the new version is actually rendered, and the CLI waits for that confirmation before triggering playback.

Endpoint Purpose
GET / The reader page
GET /version Current text version, polled by the page
POST /text Replace the text, returns the new version
POST /loaded Page reports a version is rendered
POST /ready Page reports the extension injected its UI
GET /raw Current text as plain text
GET /health Liveness check

Everything binds to 127.0.0.1. Nothing leaves the machine except whatever your reader extension itself sends.

Switching engines

READALOUD_BACKEND=piper routes every keybind, pipe and Neovim mapping to local synthesis instead — free, offline, no word quota, and a noticeably more robotic voice. Install with yay -S piper-tts.

Note that on Arch, extra/piper is an unrelated gaming mouse utility. The package you want is aur/piper-tts.

Local engines are a poor fit for long-form listening and a good fit for short system chatter, or as overflow when a subscription quota runs out.

Documentation

License

MIT

About

Send text from the terminal, Neovim, or any screen region to a browser text-to-speech extension with one keypress

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages