setup project with daemon, socket, cmd, air, notifying, state

This commit is contained in:
LeonardoTrapani
2025-08-07 00:01:49 +02:00
parent d3fc5ee3a4
commit f7936610c9
11 changed files with 457 additions and 25 deletions
+53 -25
View File
@@ -1,26 +1,28 @@
# Hyprvoice
> **Voicepowered typing for Wayland/Hyprland desktops** — press a global shortcut, speak, and watch words appear in whatever window youre focused on.
> **Voicepowered typing for Wayland/Hyprland desktops** — press a global shortcut, speak, and watch words appear in whatever window you're focused on.
**🚧 Early Development Status:** This project is currently in early development. Not ready for production use yet.
---
## Why does this hyprvoice exist?
Typing is slow, repetitive strain injuries are real, and proprietary speechtotext solutions leak your data. This project aims to give Wayland users a fast, privacyrespecting alternative that works entirely on their own hardware _or_ any cloud ASR they trust.
Typing is slow, repetitive strain injuries are real. This project aims to give Wayland users a fast, privacyrespecting alternative that works entirely on their own hardware _or_ any cloud ASR they trust.
---
## Key Features
## Current Implementation Status
| Category | Highlights |
| ------------------------- | ------------------------------------------------------------------------------------------------------------ |
| **Hotkey daemon** | Background service triggered by a global shortcut (via `hyprctl dispatch exec …` or other compositor hooks). |
| **Live audio capture** | Lowlatency PipeWire input with optional VAD/noise gate. |
| **Pluggable ASR** | 🔌 Local Whisper (via `whisper.cpp`) or cloud APIs (OpenAI, Deepgram, AssemblyAI). Select at runtime. |
| **Optional LLM polish** | Feed raw transcript into a local Ollama model or GPT4o to add punctuation, change tone, etc. |
| **Text injection** | `wtype`/`ydotool` sends keystrokes to the focused surface; clipboard fallback for stubborn clients. |
| **Zerofriction config** | Single `~/.config/hyprvoice/config.toml` with sensible defaults and live reload on SIGHUP. |
| **Crossplatform binary** | Static Go build; no Python environment required. |
| Component | Status | Description |
| ------------------------- | ------- | ------------------------------------------------------------ |
| **Hotkey daemon** | ✅ Done | Background service with Unix socket IPC for command handling |
| **Desktop notifications** | ✅ Done | Recording state changes via `notify-send` |
| **Service management** | ✅ Done | Install/remove systemd user service with embedded unit file |
| **Live audio capture** | 🔄 TODO | PipeWire input with VAD/noise gate |
| **ASR backends** | 🔄 TODO | Local Whisper or cloud APIs (OpenAI, Deepgram, AssemblyAI) |
| **Text injection** | 🔄 TODO | `wtype`/`ydotool` keystrokes to focused window |
| **Configuration** | 🔄 TODO | TOML config file with runtime reload |
---
@@ -39,13 +41,15 @@ hyprvoice-install run --backend whispercpp
systemctl --user enable --now hyprvoice.service
# 4. Add a key binding in Hyprland conf
bind = $mod, R, exec, hyprvoice toggle
bind = SUPER, R, exec, hyprvoice toggle
```
---
## Configuration file (`~/.config/hyprvoice/config.toml`)
**Note:** Configuration file support is not yet implemented. This shows the planned format:
```toml
[asr]
backend = "whispercpp" # whispercpp | openai
@@ -68,22 +72,46 @@ All options are documented in the sample config generated by `--init`.
---
## Architecture Overview
## Architecture
```
┌──────────┐ PCM ┌──────────┐ chunks ┌─────────text ┌──────────┐
Hotkey │────────▶│ Audio │──────── ASR │──────▶│ Inject
Listener │ Capture │ Adapter │ │ (wtype)
└──────────┘ └──────────┘ └──────────┘ └──────────┘
│ stats / errors │ ▼
└──────────────┬────────┘ ┌──────────┐
Desktop │
└──────────────────▶ UI │
──────────
┌──────────────┐ Unix Socket ┌──────────────┐ PCM ┌──────────┐
CLI Client ────────────────│ Hotkey │──────▶│ Audio
(toggle/stop) │ Daemon │ │ Capture
└────────────── │ (hotkeydaemon│ │ (pipewire│
│ + bus)│ + VAD)
└──────────────┘ └──────────┘
│ │
notify-sendchunks
▼ ▼
┌──────────────┐ ┌──────────
│ Desktop │ │ ASR │
│ Notification │ │ Adapter │
└──────────────┘ │(whisper/ │
│ openai) │
└──────────┘
│ text
┌──────────┐
│ Inject │
│ (wtype/ │
│ ydotool) │
└──────────┘
```
Each box is a Go package inside `internal/` so you can swap implementations without touching public APIs.
**Planned Components:**
- `cmd/hyprvoice`: CLI with Cobra commands (existing: `serve`, `toggle`, `stop`)
- `internal/bus`: Unix socket IPC for daemon communication (✅ implemented)
- `internal/hotkeydaemon`: Background service managing recording state (✅ implemented)
- `internal/notify`: Desktop notifications via `notify-send` (✅ implemented)
- `internal/audiocapture`: PipeWire input with VAD/noise gate (🔄 TODO)
- `internal/asr`: ASR backends (Whisper, OpenAI, etc.) (🔄 TODO)
- `internal/inject`: Text injection via wtype/ydotool (🔄 TODO)
- `internal/config`: TOML configuration with runtime reload (🔄 TODO)
Each box will be a Go package inside `internal/` so you can swap implementations without touching public APIs.
---