d5656b8060 fix(text-injection): route XWayland xdotool fallback through clipboard paste (#680)
* fix(text-injection): route XWayland xdotool fallback through clipboard paste

xdotool type simulates keypresses against the active X keyboard layout, so
a character the layout doesn't map comes out as the wrong glyph or garbled
(#657). The native ydotool path already avoids this by pasting via the
clipboard instead of typing (_inject_with_wayland_tool); the XWayland
xdotool fallback (_inject_with_xdotool) never got the same treatment.

Prefer clipboard paste on that fallback too when ydotool is installed,
falling back to raw xdotool type only when no paste tool is available or
the paste itself fails.

Fixes #657

* fix(text-injection): X11 clipboard paste for the XWayland fallback

jatinkrmalik's review on #680 pointed out the AppImage build does not
bundle ydotool, so the prior fix's ydotool clipboard paste never ran on
the actual reported setup; it fell through to the same layout-dependent
xdotool type as before. It also flagged a real paste-target mismatch:
an XWayland window reads the X11 CLIPBOARD selection, not the Wayland
clipboard wl-copy/ydotool write to.

The XWayland fallback now copies via xclip/xsel and pastes with
xdotool key --clearmodifiers ctrl+v when either is installed, waiting
for held modifiers to release first (the same wait already used by the
native ydotool path). ydotool clipboard paste stays as a second
fallback when xclip/xsel are absent; xdotool type is the last resort.

New regression test drives inject_text() end-to-end with no ydotool on
PATH, reproducing the reported AppImage/GNOME log rather than calling
the fallback method directly, so it also covers the recovery check
that could otherwise skip this path.

* fix(text-injection): thread x11_only through clipboard read/clear so restore matches the paste backend

jatinkrmalik's rebase pulled in the layout-aware paste work from #788,
and greptile's review on the merged branch caught a real gap in this
PR's own XWayland path: _copy_to_clipboard already takes x11_only to
write the X11 CLIPBOARD via xclip/xsel (since that is what an xdotool
paste actually reads), but _read_clipboard and _clear_clipboard never
gained the same parameter. On a Wayland host, _read_clipboard prefers
wl-paste, so the "previous clipboard" saved before an XWayland paste
could be read from an unrelated Wayland clipboard, and restoring it
back through _copy_to_clipboard with no x11_only wrote to that same
wrong backend, leaving the X11 CLIPBOARD stuck on the dictated text.

Threads x11_only through both helpers and every restore call site
(the immediate-failure path and the delayed _restore closure), so an
XWayland paste captures, clears, and restores the same X11 CLIPBOARD
selection it wrote to.

* fix(text-injection): annotate clipboard helpers and XWayland paste tests

Greptile P2 on #680: give `_get_clipboard_tools` a return annotation and
mark the new XWayland clipboard-paste regression tests `-> None`.

* fix(text-injection): derive XWayland paste from environment

Drop the ydotool/wl-copy second fallback on WAYLAND_XDOTOOL (wrong
clipboard, and rc=0 is not a paste) and the x11_only flag stack. Paste
picks xclip/xsel + xdotool from environment; user-facing copy stays
on the session clipboard.

* fix(text-injection): always pass host_env() to the paste chord

The AST guard only recognizes a direct host_env() call. The ternary
around it looked like we were handing the AppImage library path to
xdotool.

* test(text-injection): give XWayland injector stubs clipboard restore state

_inject_with_xdotool now pastes first, and that path reads
_clipboard_restore_target. The __new__ helper in test_text_injector_ext
never set it.

* fix(text-injection): skip clipboard restore on a stale paste failure

If a newer paste has already copied its text, the older paste's failure
handler must not write its saved clipboard back. Success restores already
honored the generation counter; the failure path did not.

* fix(text-injection): keep original clipboard across a stale paste failure

Publish the restore target as soon as copy succeeds (first writer wins)
so an overlapping paste inherits it. If the older paste then fails, the
newer restore still writes the pre-first clipboard, not intermediate
dictated text.

---------

Co-authored-by: Jatin K Malik <jatinkrmalik@gmail.com>
2026-09-12 13:16:10 -07:00
2025-05-25 23:20:08 -05:00

Vocalinux

Vocalinux

Voice dictation for Linux

Ubuntu Debian Fedora Arch openSUSE

Privacy: on-device X11 & Wayland License: AGPL-3.0 Python 3.11+ PRs Welcome

Discord VocaHQ Follow on X GitHub release PyPI AUR

Website · Install · Docs · Releases

Vocalinux turns speech into typed text in whatever app has focus. It is a free, AGPL-3.0-licensed desktop app for X11 and Wayland. After you download a model, local engines (whisper.cpp by default, plus OpenAI Whisper, Faster Whisper, VOSK, and Parakeet) run speech-to-text on your machine. An optional remote HTTP API is off unless you configure it.

No Voca account is required. Models download once. After that, speech-to-text stays on your machine.

Current release: v0.16.2. Stability patch on the 0.16 series (KDE leftover IBus, Wayland/IBus shortcuts, BackSpace for "delete that", installer glslc, release integrity pins). Series highlights include the in-app update checker, Right Alt push-to-talk for new installs, searchable languages, unused-model cleanup, and the family tone picker. Details: docs/UPDATE.md.

Features

  • On-device after model download: Local engines; speech-to-text stays on your machine
  • X11 and Wayland: Text injection via xdotool, IBus, wtype, ydotool, or clipboard fallback
  • Several engines: whisper.cpp (default), OpenAI Whisper, Faster Whisper, VOSK, Parakeet, plus optional remote HTTP API
  • GPU acceleration: Vulkan for AMD, Intel, and NVIDIA with whisper.cpp
  • Toggle or push-to-talk: New installs default to hold Right Alt; existing configs keep their shortcut
  • System tray + settings: Searchable sidebar, Speech Model simple setup with Advanced as an island, status icons, audio feedback
  • Start on login: XDG autostart (desktop session, not a systemd service)
  • Packaging: install script, AppImage, AUR, PyPI, Snap (--edge), Flatpak (release bundles and local build; not on Flathub)

Screenshots

Vocalinux in action. Full gallery on the website screenshots page.

Product

Transcription in Action
Real-time voice-to-text transcription
System Tray
System tray with listening indicator
About View
About & Updates in Settings
Log Viewer
Log viewer for debugging

Settings

Speech Engine settings
Speech Engine
Recognition settings
Recognition
Audio settings
Audio
Performance settings
Performance
General settings
General
Advanced tuning and settings
Advanced

Install

curl -fsSL https://raw.githubusercontent.com/VocaHQ/vocalinux/main/install.sh -o /tmp/vl.sh
bash /tmp/vl.sh

Prefer to review the script first: open /tmp/vl.sh before running it, or clone the repo and run ./install.sh locally.

The installer detects hardware, recommends an engine, downloads a default model (~74MB for whisper.cpp tiny), installs neural VAD when ONNX Runtime is available, and sets up desktop integration. Typical install time with whisper.cpp is about 1-2 minutes.

Engine When to use
whisper.cpp (default) Best default; Vulkan GPU on AMD, Intel, and NVIDIA
Whisper (OpenAI) PyTorch path; NVIDIA/CUDA
Faster Whisper CPU-friendly Whisper via CTranslate2 / INT8
VOSK Low RAM / minimal footprint
Parakeet CPU; NVIDIA NeMo ASR via sherpa-onnx; 25 European languages
Remote API Offload to a server you configure

Non-interactive options:

bash /tmp/vl.sh --auto                              # whisper.cpp defaults
bash /tmp/vl.sh --auto --engine=whisper             # OpenAI Whisper
bash /tmp/vl.sh --auto --engine=faster_whisper      # Faster Whisper (CPU)
bash /tmp/vl.sh --auto --engine=vosk                # VOSK only
bash /tmp/vl.sh --auto --engine=parakeet            # Parakeet (CPU)

For a specific release tag, see GitHub Releases or ./install.sh --tag=v0.16.2.

Arch Linux (AUR)

yay -S vocalinux

See docs/AUR.md.

AppImage

Download the x86_64 or aarch64 AppImage from Releases, mark it executable, and run it. Built against glibc 2.35 (Debian 12+, Ubuntu 22.04+, Fedora 36+, Arch, Tumbleweed). Host text-injection tools (xdotool on X11; wtype / ydotool / clipboard tools on Wayland) are still required. Current AppImages rebuild whisper.cpp with Vulkan and use the host GPU driver. Prefer the installer when you want system deps, a CUDA build, and models set up automatically.

Flatpak (any distro)

GitHub Releases attach Vocalinux-<version>-x86_64.flatpak and Vocalinux-<version>-aarch64.flatpak. After the Flathub GNOME runtime is present:

flatpak install --user ./Vocalinux-<version>-x86_64.flatpak

Bundles do not auto-update. Local build:

flatpak install flathub org.gnome.Platform//50 org.gnome.Sdk//50
flatpak-builder --user --install --force-clean build-dir \
  packaging/flatpak/com.vocalinux.Vocalinux.yml
flatpak run com.vocalinux.Vocalinux

Ships whisper.cpp with Vulkan. It is not on Flathub (submission flathub#9368 closed 2026-07-23 on policy grounds). Details: packaging/flatpak/README.md.

Snap (Ubuntu Snap Store)

Listing: snapcraft.io/vocalinux. stable is still a manual promote after QA.

sudo snap install vocalinux --edge
sudo snap connect vocalinux:audio-record   # if mic is not auto-connected
sudo snap connect vocalinux:raw-input      # global keyboard shortcuts (evdev)
sudo snap connect vocalinux:uinput         # native Wayland typing (ydotool)

The v0.16.2 store snap (latest/edge rev 7) has no uinput plug. snap connect vocalinux:uinput fails with snap "vocalinux" has no plug named "uinput", and dictation only reaches XWayland apps. After snap info vocalinux shows a revision that lists uinput under plugs, sudo snap refresh vocalinux then connect uinput for native GNOME/GTK/Qt windows.

From source

git clone https://github.com/VocaHQ/vocalinux.git
cd vocalinux
./install.sh
# or pick the engine up front
./install.sh --engine=whisper_cpp
./install.sh --engine=vosk
./install.sh --engine=parakeet --auto

After installation

vocalinux                 # if ~/.local/bin is on PATH
# or
~/.local/share/vocalinux/venv/bin/vocalinux

You can also launch Vocalinux from your application menu.

Nightly builds

Daily builds from main appear on Releases. Use the latest stable or beta release for production; nightlies are untested.

Requirements

OS Linux (Ubuntu 24.04+, Debian 12+, Fedora 42+, Arch, openSUSE Tumbleweed)
Python 3.11 or newer
Display X11 or Wayland
Hardware Microphone; GPU optional (Vulkan)

The distro must ship Python 3.11+ because Vocalinux uses distro PyGObject (python3-gi). Ubuntu 22.04 (Python 3.10) and Debian 11 (3.9) are below that floor. Distribution notes: docs/DISTRO_COMPATIBILITY.md.

Usage

Dictation

  1. Push-to-talk (default on new installs): hold Right Alt (Option on Mac-layout keyboards) and speak
  2. Speak into the microphone
  3. Release to stop, or switch to Toggle mode in Settings (double-tap a key to start/stop)

Existing configs keep their saved shortcut.

Voice commands

English phrases always work. With a non-English recognition language, matching punctuation / line-break phrases in that language are also recognized (Italian virgola / punto, French virgule / point, etc.).

Command Action
"new line" Line break
"period" / "full stop" / "dot" .
"comma" ,
"question mark" ?
"exclamation mark" !
"delete that" Delete last sentence
"capitalize" Capitalize next word

CLI

vocalinux --help
vocalinux --version
vocalinux --debug
vocalinux --engine whisper_cpp    # default
vocalinux --engine whisper
vocalinux --engine faster_whisper
vocalinux --engine vosk
vocalinux --engine parakeet
vocalinux --engine remote_api
vocalinux --model medium
vocalinux --model medium.en-q5_0  # exact whisper.cpp variant
vocalinux --model large-v3-turbo
vocalinux --wayland
vocalinux --start-minimized

Autostart

Start on Login creates an XDG autostart desktop entry (~/.config/autostart/). It does not install a systemd unit. Enable from the first-run dialog, tray menu, or Settings.

Configuration

Stored at ~/.config/vocalinux/config.json. Prefer the Settings dialog for day-to-day changes. Settings → Speech Model starts with a simple setup; expand Advanced for engine, size, and specialization.

Neural VAD (Silero) is used when onnxruntime is available; install via pip install "vocalinux[vad]" for manual/PyPI installs. The installer attempts this automatically.

Documentation

Document Description
Installation Installer, AppImage, AUR, Flatpak, Snap, running
Manual / PyPI install Package lists and pip workflows
Troubleshooting Common failures
User guide Dictation, engines, models, tips
Update guide Upgrade steps and release notes
Changelog Release history pointers
Support Where to get help
Distribution compatibility Distro matrix and session notes
Remote HTTP API Offload transcription to a server
Contributing Dev setup, style, PR process
Security Supported versions and vulnerability reporting
Docs index Full documentation map

Privacy and security

  • Local engines process audio on-device after you download a model; no Voca account required
  • Optional remote API is off by default and only used when you configure a server
  • Model downloads are checked against pinned checksums

Report vulnerabilities privately per SECURITY.md.

Development

git clone https://github.com/VocaHQ/vocalinux.git
cd vocalinux
./install.sh --dev
source venv/bin/activate
pytest
python -m vocalinux.main --debug

See CONTRIBUTING.md for the two-venv layout, just recipes, and PR guidelines.

Roadmap

Shipped: graphical settings, multi-language support, whisper.cpp default, Vulkan GPU, Wayland/IBus, Flatpak packaging, AppImage, in-app update checker, Parakeet and Faster Whisper engines, Snap recipe.

Planned:

  • Application-specific voice commands
  • Debian/Ubuntu package (.deb)
  • User-customizable voice command map
  • Flathub publication (not currently listed; see #167)

Voca ecosystem

Vocalinux is part of VocaHQ. On-device speech-to-text first, one app per platform. Optional VocaGateway is self-hosted and not on-device.

Platform Project Website GitHub Status
Linux VocaLinux vocalinux.com VocaHQ/vocalinux Available now (v0.16.2)
macOS VocaMac vocamac.com VocaHQ/vocamac Beta (v0.9.0)
Windows VocaWin vocawin.com VocaHQ/vocawin Unsigned beta (v0.1.0-beta.1)
Phone VocaPhone vocaphone.vocahq.com VocaHQ/vocaphone Android beta / iOS TestFlight
Gateway VocaGateway vocagateway.vocahq.com VocaHQ/vocagateway Beta · optional · not on-device

VocaWin is unsigned. SmartScreen may warn about an unknown publisher. It is not a Microsoft Store ship.

Talk to us: Discord · X @vocahq · hello@vocahq.com

Contributing

Bug reports, docs, and code are welcome. Start with CONTRIBUTING.md and good first issues.

Contributors

Thanks to everyone who has contributed code, docs, or fixes:

Vocalinux contributors

Repository mirrors

GitHub is the primary forge for issues, PRs, CI, and releases.

Role URL
Primary https://github.com/VocaHQ/vocalinux
Read-only mirror (Codeberg) https://codeberg.org/jatinkrmalik/vocalinux

Open issues and pull requests on GitHub only.

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0), aligning with the other VocaHQ distribution projects.

You may use, study, modify, and redistribute the software under AGPL-3.0. If you run a modified version as a network service, AGPL also requires that you make the corresponding source available.

Star Chart

Star History Chart

S
Description
Free, offline voice dictation for Void Linux and niri. Vulkan GPU acceleration, signed xbps repository.
Readme AGPL-3.0
35 MiB
v0.19.1
Latest
2026-11-06 21:18:19 +00:00
Languages
Python 84.5%
TypeScript 8.6%
Shell 5.6%
CSS 0.6%
Just 0.2%
Other 0.4%