Building BeringAssistant: From Hotkeys to AI-Powered Dictation on Linux

Building BeringAssistant
Photo by Soumil Kumar

Building BeringAssistant: From Hotkeys to AI-Powered Dictation on Linux

A story about hotkeys, Rust, Wyoming protocol, GPU growing pains, and knowing when good enough is good enough.


How It Started

It started simply enough. I wanted a hotkey. Specifically, I wanted to highlight text anywhere on my desktop, hit a key combo, and have my computer read it back to me. Text-to-speech. Nothing revolutionary, screen readers have existed for decades. But I wanted it to feel native, fast, and not require me to context-switch into some dedicated app.

If you’re a Mac user, you already have this. macOS has Spoken Content built right into System Settings: highlight text, hit a key, and the system reads it back in a decent voice. Voice Control lets you dictate into any application. It just works, out of the box, no setup required. Apple has been shipping this for years and it’s remarkably polished.

I run Linux. By choice. I love Linux..the control, the transparency, the fact that I understand what my machine is doing. But Linux doesn’t ship with anything remotely equivalent out of the box. The tools that exist are either ancient (eSpeak sounds like a 1980s answering machine), require complex daemons, or are locked to specific desktop environments. If you want something that actually works well and feels modern, you build it yourself.

So I did.

And yes, I know the tools are out there. There’s Nerd Dictation, there’s whisper-live, there are KDE and GNOME accessibility layers, there are projects on GitHub that do parts of this. I’m aware. Some of them are probably pretty good. A reasonable person could spend an afternoon evaluating existing solutions, pick the best one, configure it, and be done.

That’s just not me.

There’s something about building it yourself that I can’t fully explain to people who don’t feel it. You understand every decision. You know exactly why it works and exactly why it fails. When it breaks at 11pm you know where to look. When you want to add something weird, like routing your voice through an agent on your OpenClaw server, you don’t file a feature request, you just do it. The codebase is yours. The architecture reflects your actual needs, not someone else’s assumptions about what you probably want.

Maybe that’s inefficient. Maybe it’s just a personality trait dressed up as engineering philosophy. Either way, it’s how I like to work.

What I didn’t expect was that a “simple hotkey app” would turn into a full afternoon of Rust, AI model embedding, GPU archaeology, and a genuine appreciation for just how far the open source AI ecosystem has come.


The Stack

The final app, BeringAssistant, does two things:

  • Tap the hotkey (Ctrl+F1) with text selected → text-to-speech via Piper
  • Hold the hotkey → push-to-talk speech-to-text via Whisper, types the result wherever your cursor is

No GUI. No tray icon. No configuration wizard. Just a background process that listens to keyboard events via evdev, grabs your Wayland primary selection with wl-paste, and talks to AI inference engines.

I wrote it in Rust. Not because Python couldn’t do it. I actually started in Python. But Rust lets me ship a single binary with no runtime, no daemon dependencies, and direct uinput access for typing results back into any application. KDE Plasma Wayland doesn’t support the virtual keyboard protocol that most typing tools depend on, so going low-level with uinput was the right call.


Wyoming Protocol: The Unsung Hero

Here’s where it gets interesting. Both Piper (TTS) and Whisper (STT) are available as Docker containers from LinuxServer.io, running on my Unraid NAS. They speak the Wyoming protocol, a lightweight TCP protocol originally built for the Home Assistant voice pipeline.

Wyoming is elegant. Each message is a newline-delimited JSON header followed by binary payload:

{"type": "synthesize", "data_length": 42, "payload_length": 0}\n
{"text": "hello world", "voice": {"name": "en_US-lessac-medium"}}

The server streams audio chunks back. The client reassembles them. That’s it.

What I love about this is how composable it is. Piper doesn’t know about Whisper. Whisper doesn’t know about Piper. My app doesn’t care what’s running on the other end. It just speaks the protocol. Today it’s Docker containers on Unraid. Tomorrow it could be a Raspberry Pi in the corner, or a local binary, or a cloud endpoint. The interface is stable.

I built a proper Wyoming client in Rust with streaming STT. Each transcript segment from Whisper gets typed into the active window as it arrives, rather than waiting for the full transcription. That’s the kind of responsiveness that makes voice input actually usable.


The AI Model Ecosystem Is Undeniably Remarkable

Let me pause here because this deserves to be said out loud.

I pulled in whisper-rs, Rust bindings to whisper.cpp, and with four lines in Cargo.toml, I had a fully functional, offline speech recognition engine compiled into our binary. The model file is 465MB. The transcription quality on the small model is genuinely impressive for everyday dictation.

I downloaded Piper, a neural text-to-speech engine trained on real human voices, and it synthesizes speech fast enough to feel interactive. The en_US-lessac-medium voice sounds like a person, not a robot. A few years ago this would have required expensive cloud APIs or specialized hardware.

I got all of this:

  • A real neural TTS voice
  • Accurate offline speech recognition
  • Streaming transcription with segment-by-segment output
  • All running on commodity hardware

…and the only thing I had to write was the glue code. The models, the inference engines, the voice data — all open source, all available with a wget and a Cargo.toml entry. That is extraordinary. We are living in a moment where the hard part of AI, the training, the architecture, the optimization, has been done by researchers and engineers who published their work openly, and we get to build on top of it.


What Worked

Almost everything, honestly.

The tap vs hold state machine took a couple of iterations. The first version used timer.is_finished() to detect whether the hold threshold had been crossed, but the timer task was still running (doing the audio recording) when the key came up, so it falsely detected taps. The fix was an Arc<AtomicBool> flag that is triggered the moment the 400ms threshold fires, clean and correct.

Stopping TTS on hotkey re-press was satisfying to get right. The first pass just killed the playback task, but then pressing the hotkey would immediately start a new TTS for the same selected text. The fix was a tts_stopped_this_press flag. If the hotkey press stopped an active TTS, the key-up handler skips starting a new one. One press to stop, next press to start something new.

The streaming STT worked well. Faster-whisper sends one transcript event per segment as it processes, and by sending each segment through a channel to the typer, words appear on screen as they’re recognized rather than all at once at the end.

uinput typing just worked. No ydotool daemon, no wtype binary, no Wayland protocol compatibility issues. Just direct kernel-level virtual keyboard input.


What Didn’t Work: The GPU Adventure

Here’s the honest part.

I have an NVIDIA RTX 5080. It’s a Blackwell architecture GPU, one of the newest consumer cards available. The idea of running Whisper inference locally on that card is truly exciting. Sub-second transcription. No network round-trip.

So I added features = ["cuda"] to the whisper-rs dependency and ran the build.

It failed.

The whisper-rs-sys 0.9 crate bundles a version of whisper.cpp that targets CUDA compute architectures sm_52, sm_61, and sm_70 Maxwell, Pascal, and Volta. These are GPUs from 2014-2017. CUDA 13.1, which ships with driver support for the RTX 5080, has dropped support for those old architectures. nvcc refuses to compile them.

The RTX 5080 is sm_100 — Blackwell. It’s too new. The Rust ecosystem hasn’t caught up yet.

I could have patched the bundled CMakeLists.txt in the cargo registry. I could have forked whisper-rs-sys and updated the architecture list. I could have tried overriding cmake variables or pinning an older CUDA toolkit. These are all things I considered.

But here’s the thing. I already have a working solution. Faster-whisper running in Docker on Unraid, connected over the Wyoming protocol, gives me excellent transcription quality right now. The extra complexity of local GPU inference, the build toolchain requirements, the model files bundled with the binary, the architecture compatibility matrix, didn’t obviously improve the user experience enough to justify the debugging session.

There’s a version of this story where you spend three hours fighting nvcc flags and cmake variables for a GPU that’s too new for the library that wraps the library that talks to it. That version isn’t fun, and it doesn’t make the app better.


Knowing When Good Enough Is Good Enough

This is the real lesson from today, and it’s one I think about a lot in software.

There’s always a more optimal version of anything. Local inference is faster than remote. A dedicated GPU is faster than CPU. A custom-trained model would be more accurate. A lower-level audio backend would have less latency. You can optimize indefinitely.

But BeringAssistant works. It works well. I can highlight text and hear it read back to me. I can hold a key, speak a sentence, and see it appear in whatever text field I’m focused on. The TTS voice sounds good. The transcription accuracy is solid.

Tomorrow I’m installing an old GTX 3070 in the Unraid server. With GPU passthrough to the faster-whisper Docker container and WHISPER_COMPUTE_TYPE=float16, transcription will be noticeably faster. No code changes required. The Wyoming protocol abstracts all of that away. That’s good architecture paying dividends.

And after that, there’s probably a better approach for fully local inference. The whisper-rs ecosystem will mature. Blackwell support will land. Someone will figure out how to ship whisper.cpp as a proper Rust crate with sane architecture detection. When that day comes, swapping out the Wyoming backend for a local one is an afternoon’s work.

For now, the app works. The hotkey works. The voice sounds good. The typing is accurate.

That’s enough. Time to ship it and move on to the next thing.


Where This Goes Next

Here’s the thing about building your own infrastructure: you own the integration points.

I already run llama.cpp on a dedicated AI server on my local network, a machine that exists purely to run inference, always on, always available. Fast, private, local LLM inference with nothing leaving the house. And now I have a reliable pipeline for capturing voice input and outputting text anywhere on the screen. The obvious next step is connecting them. Speak a question, have it route through the local LLM, read the answer back, a fully private, fully local voice assistant. No cloud. No subscription. No sending your conversations to someone else’s servers.

The Wyoming protocol abstracts the speech layer cleanly enough that swapping in different models or chaining them together is straightforward. Want Whisper to transcribe, then send the transcript to llama.cpp, then pipe the response through Piper? That’s not much more than a new code path in the controller.

But the integration I’m most excited about is OpenClaw. If you’ve read my last couple of posts you already know I’ve been building out an OpenClaw server that handles automations, agents that can take actions, query things, orchestrate workflows across my home lab. It’s been doing real work for me. And now the question that’s sitting in the back of my mind is: what does it look like to just talk to those agents? Hold a key, speak a request, have an OpenClaw agent handle it and read the result back. Voice as a universal interface to automation. No typing a prompt into a terminal, no switching to a browser tab, just speak and let the agents work.

That’s the vision. The plumbing for the voice layer is now in place. The OpenClaw server is running. Whether they connect cleanly is the open question, there are always integration details that only reveal themselves when you actually try to wire two things together. But it feels close.

One thing that’s still nagging at me is true streaming transcription. Right now the flow is: hold key, speak, release key, wait, text appears. I did implement segment-by-segment output, so if faster-whisper returns multiple segments they type out progressively. But that’s streaming on the output side. What I actually want is streaming on the input side, words appearing on screen while I’m still talking, the way Google’s live captions work or how a good voice assistant feels when it’s keeping up with you in real time.

That’s a harder problem. It requires continuous audio chunking, voice activity detection to know when a sentence ends, and an inference engine that can handle partial audio windows without waiting for silence. Whisper wasn’t really designed for that. It’s a batch model at heart. There are approaches: streaming wrappers, WebRTC VAD, chunked inference with overlapping windows. But none of them are clean, and I haven’t found one that feels right yet.

So that part of the story isn’t finished. There will probably be more posts on this in the coming weeks as I dig deeper. Maybe the GPU in the Unraid server unlocks something. Maybe there’s a different model architecture better suited to real-time. Maybe I’m overthinking it and the current “release to transcribe” model is actually fine for how I end up using it day to day.

We’ll see.

What I Actually Built

For the curious, here’s what ended up in the project:

  • src/wyoming.rs - Wyoming protocol client (TTS + streaming STT)
  • src/audio.rs - cpal-based recording and playback with stop-signal support
  • src/typing.rs - uinput virtual keyboard for typing STT results
  • src/config.rs - TOML config loading with env var overrides
  • src/main.rs - tap/hold state machine, PID file management, orchestration
  • docker-compose.yml - Piper + faster-whisper stack for Portainer/Unraid
  • download_assets.sh - downloads piper binary, voice model, and whisper model
  • 34 passing tests - Wyoming protocol integration tests with mock TCP servers, config tests, typing mapping tests

The binary depends on:

  • wl-paste (from wl-clipboard) for reading Wayland primary selection
  • Membership in the input group for evdev access
  • Nothing else.

That’s the whole thing. A hotkey daemon that talks to AI. Written in an afternoon. Running great.