Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dictate for Linux

Push-to-talk dictation for Linux. Hold Ctrl+Space, speak, release — your words are typed into the focused window.

Runs in the background from the system tray. Primarily targets Wayland (with X11 support).

How It Works

Ctrl+Space held → microphone records (parec) → release → transcribe (faster-whisper) → type text
  • evdev captures the hotkey at the kernel input level (works on Wayland)
  • parec records audio via PipeWire/PulseAudio
  • faster-whisper transcribes offline using the Whisper model
  • Wayland: types the text character-by-character via an evdev UInput virtual keyboard (avoids paste/key-repeat issues), and copies to clipboard via wl-copy
  • X11: uses xdotool type to insert text
  • Session type is auto-detected from XDG_SESSION_TYPE
  • No keyboard grab: the hotkey uses Ctrl+Space so the compositor sees key release and Space is not stuck after dictation

Requirements

  • Python 3.10+
  • faster-whisper (pip install faster-whisper)
  • evdev (pip install evdev)
  • PyQt6 (for system tray)
  • parec (comes with PulseAudio / PipeWire's PulseAudio compat)
  • wl-clipboard (Wayland, sudo apt install wl-clipboard) or xdotool (X11)
  • User must be in the input group (for hotkey capture via evdev)

Setup

Run the setup script to install dependencies and configure permissions:

./setup.sh

This will:

  1. Add your user to the input group (needed for evdev hotkey capture)
  2. Install wl-clipboard if not present (provides wl-copy for Wayland text injection)
  3. Pre-download the Whisper model

You must log out and back in after setup for the group change to take effect.

Usage

System tray (recommended)

python3 tray.py

A tray icon appears: gray = idle, red = recording, blue = transcribing. Right-click to quit.

Headless

python3 dictate.py

Options

--model {tiny,base,small,medium}   Whisper model size (default: base)
--language LANG                    Language code (default: en)
--backend {auto,wl-paste,xdotool}  Text injection backend (default: auto)
--verbose, -v                      Verbose logging

Autostart on login

Copy the desktop entry to your autostart directory:

cp dictate.desktop ~/.config/autostart/

Edit the Exec= path inside if your install location differs.

Troubleshooting

"No keyboard devices found" — Your user is not in the input group. Run sudo usermod -aG input $USER and log out/in.

Hotkey — The default is Ctrl+Space (no keyboard grab), so Space and modifiers are released normally after dictation.

No audio captured — Verify your microphone works with parec --raw > /dev/null (Ctrl+C to stop). Check pactl list sources short to see available input devices.

Text not appearing in focused window — The UInput virtual keyboard may not be recognized by your compositor. Check that /dev/uinput is accessible (user should be in the input group). You can test clipboard manually with wl-copy "test" && sleep 0.1 && wl-paste.

How Text Injection Works

On Wayland, the app types the transcribed text character-by-character using an evdev UInput virtual keyboard. This avoids the key-repeat and stuck-Space issues that can occur when simulating Ctrl+V. The text is also copied to the Wayland clipboard via wl-copy so you can paste it elsewhere. The hotkey is Ctrl+Space with no keyboard grab, so the compositor receives key release events and Space is not left held after dictation.

On X11, xdotool type is used to insert the text directly. Dictation overwrites the clipboard on Wayland (wl-copy); on X11 with the xdotool backend it does not touch the clipboard.

Inspired By

nerd-dictation — offline speech-to-text for Linux.

About

Push-to-talk dictation for Linux. Runs in the background from the system tray.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages