No description
Find a file
2026-02-25 10:23:56 -03:00
src Remove log_transcript config and enforce JSON AI output 2026-02-25 10:23:56 -03:00
systemd Refine config and runtime flow 2026-02-24 14:15:17 -03:00
tests Remove log_transcript config and enforce JSON AI output 2026-02-25 10:23:56 -03:00
.gitignore Update project files 2026-02-10 11:01:36 -03:00
AGENTS.md Add Esc cancel support 2026-02-24 14:23:03 -03:00
config.example.json Remove log_transcript config and enforce JSON AI output 2026-02-25 10:23:56 -03:00
Makefile Refine config and runtime flow 2026-02-24 14:15:17 -03:00
pyproject.toml Refine config and runtime flow 2026-02-24 14:15:17 -03:00
README.md Remove log_transcript config and enforce JSON AI output 2026-02-25 10:23:56 -03:00
uv.lock Refine config and runtime flow 2026-02-24 14:15:17 -03:00

lel

Python X11 STT daemon that records audio, runs Whisper, applies local AI cleanup, and injects text.

Requirements

  • X11 (Wayland support scaffolded but not available yet)
  • sounddevice (PortAudio)
  • faster-whisper
  • llama-cpp-python
  • Tray icon deps: gtk3, libayatana-appindicator3
  • Python deps (core): numpy, pillow, faster-whisper, llama-cpp-python, sounddevice
  • X11 extras: PyGObject, python-xlib

System packages (example names): portaudio/libportaudio2.

Ubuntu (X11)
sudo apt install -y portaudio19-dev libportaudio2 python3-gi gir1.2-gtk-3.0 libayatana-appindicator3-1
Debian (X11)
sudo apt install -y portaudio19-dev libportaudio2 python3-gi gir1.2-gtk-3.0 libayatana-appindicator3-1
Arch Linux (X11)
sudo pacman -S --needed portaudio gtk3 libayatana-appindicator
Fedora (X11)
sudo dnf install -y portaudio portaudio-devel gtk3 libayatana-appindicator-gtk3
openSUSE (X11)
sudo zypper install -y portaudio portaudio-devel gtk3 libayatana-appindicator3-1

Python Daemon

Install Python deps:

X11 (supported):

uv sync --extra x11

Wayland (scaffold only):

uv sync --extra wayland

Run:

uv run python3 src/leld.py --config ~/.config/lel/config.json

Config

Create ~/.config/lel/config.json:

{
  "daemon": { "hotkey": "Cmd+m" },
  "recording": { "input": "0" },
  "stt": { "model": "base", "device": "cpu" },
  "injection": { "backend": "clipboard" },
  "ai": { "enabled": true },
  "vocabulary": {
    "replacements": [
      { "from": "Martha", "to": "Marta" },
      { "from": "docker", "to": "Docker" }
    ],
    "terms": ["Systemd", "Kubernetes"],
    "max_rules": 500,
    "max_terms": 500
  },
  "domain_inference": { "enabled": true, "mode": "auto" }
}

Recording input can be a device index (preferred) or a substring of the device name.

ai.enabled is accepted for compatibility but currently has no runtime effect. AI cleanup is always enabled and uses the locked local Llama-3.2-3B GGUF model downloaded to ~/.cache/lel/models/ on first use.

Use -v/--verbose to enable DEBUG logs, including recognized/processed transcript text and llama.cpp logs (llama:: prefix). Without -v, logs are INFO level.

Vocabulary correction:

  • vocabulary.replacements is deterministic correction (from -> to).
  • vocabulary.terms is a preferred spelling list used as hinting context.
  • Wildcards are intentionally rejected (*, ?, [, ], {, }) to avoid ambiguous rules.
  • Rules are deduplicated case-insensitively; conflicting replacements are rejected.
  • Limits are bounded by max_rules and max_terms.

Domain inference:

  • domain_inference.mode currently supports auto.
  • Domain context is advisory only and is used to improve cleanup prompts.
  • When confidence is low, it falls back to general context.

STT hinting:

  • Vocabulary is passed to Whisper as hotwords/initial_prompt only when those arguments are supported by the installed faster-whisper runtime.

systemd user service

mkdir -p ~/.local/share/lel/src/assets
cp src/*.py ~/.local/share/lel/src/
cp src/assets/*.png ~/.local/share/lel/src/assets/
cp systemd/lel.service ~/.config/systemd/user/lel.service
systemctl --user daemon-reload
systemctl --user enable --now lel

Usage

  • Press the hotkey once to start recording.
  • Press it again to stop and run STT.
  • Press Esc while recording to cancel without processing.
  • Transcript contents are logged only when -v/--verbose is used.

Wayland note:

  • Running under Wayland currently exits with a message explaining that it is not supported yet.

Injection backends:

  • clipboard: copy to clipboard and inject via Ctrl+Shift+V (GTK clipboard + XTest)
  • injection: type the text with simulated keypresses (XTest)

AI processing:

  • Local llama.cpp model only (no remote provider configuration).

Control:

make run
make check