configuration file

This commit is contained in:
LeonardoTrapani
2025-08-18 22:59:22 +02:00
parent bcaf1181a0
commit b8a22662f3
13 changed files with 556 additions and 109 deletions
+87 -22
View File
@@ -190,22 +190,48 @@ hyprvoice status
## Configuration
Configuration will be read from `~/.config/hyprvoice/config.toml` (planned). Currently, the daemon uses default settings.
Configuration is automatically loaded from `~/.config/hyprvoice/config.toml`. The daemon creates this file with sensible defaults and helpful comments on first run. Changes to the config file are applied immediately without restarting the daemon.
### Transcription Providers
Hyprvoice will support multiple transcription backends:
Hyprvoice supports multiple transcription backends:
#### OpenAI Whisper API
#### Generated Configuration Example
Fast, accurate cloud-based transcription:
The daemon automatically creates `~/.config/hyprvoice/config.toml` with helpful comments:
```toml
# Hyprvoice Configuration
# This file is automatically generated with defaults.
# Edit values as needed - changes are applied immediately without daemon restart.
# Audio Recording Configuration
[recording]
sample_rate = 16000 # Audio sample rate in Hz (16000 recommended for speech)
channels = 1 # Number of audio channels (1 = mono, 2 = stereo)
format = "s16" # Audio format (s16 = 16-bit signed integers)
buffer_size = 8192 # Internal buffer size in bytes (larger = less CPU, more latency)
device = "" # PipeWire audio device (empty = use default microphone)
channel_buffer_size = 30 # Audio frame buffer size (frames to buffer)
# Speech Transcription Configuration
[transcription]
provider = "openai"
api_key = "your_openai_api_key"
model = "whisper-1"
language = "auto" # or "en", "es", etc.
provider = "openai" # Transcription service ("openai" only currently supported)
api_key = "" # OpenAI API key (or set OPENAI_API_KEY environment variable)
language = "" # Language code (empty for auto-detect, "en", "it", "es", "fr", etc.)
model = "whisper-1" # OpenAI model name ("whisper-1" recommended)
# Text Injection Configuration
[injection]
mode = "fallback" # Injection method ("clipboard", "type", "fallback")
restore_clipboard = true # Restore original clipboard after injection
wtype_timeout = "5s" # Timeout for direct typing via wtype
clipboard_timeout = "3s" # Timeout for clipboard operations
# Desktop Notification Configuration
[notifications]
enabled = true # Enable desktop notifications
type = "desktop" # Notification type ("desktop", "log", "none") -- always keep "desktop" unless debugging
```
#### whisper.cpp Local (Planned)
@@ -219,14 +245,27 @@ model_path = "~/models/ggml-base.en.bin"
threads = 4
```
#### Text Injection (Current)
#### Recording Configuration
Audio capture settings:
```toml
[recording]
sample_rate = 16000 # Audio sample rate in Hz
channels = 1 # Number of audio channels (1 for mono)
format = "s16" # Audio format (s16 recommended)
buffer_size = 8192 # Internal buffer size in bytes
device = "" # PipeWire device (empty for default)
channel_buffer_size = 30 # Audio frame buffer size
```
#### Text Injection
Configurable text injection with multiple modes:
```toml
[injection]
mode = "fallback" # "clipboard", "type", or "fallback"
always_copy_clipboard = true
restore_clipboard = true
wtype_timeout = "5s"
clipboard_timeout = "3s"
@@ -240,10 +279,36 @@ clipboard_timeout = "3s"
**Behavior:**
- `always_copy_clipboard = true`: Always copy text to clipboard regardless of mode
- `restore_clipboard = true`: Save and restore original clipboard content
- Smart fallback ensures text injection always succeeds when possible
#### Notifications
Desktop notification settings:
```toml
[notifications]
enabled = true # Enable/disable notifications
type = "desktop" # "desktop", "log", or "none"
```
**Notification Types:**
- **`desktop`**: Use notify-send for desktop notifications
- **`log`**: Log messages to console only
- **`none`**: Disable all notifications
Always keep `type = "desktop"` unless debugging.
### Configuration Hot-Reloading
The daemon automatically watches the config file for changes and applies them immediately:
- **Notification settings**: Applied instantly
- **Injection settings**: Applied to current and future operations
- **Recording/Transcription settings**: Applied to new recording sessions
- **Invalid configs**: Rejected with error notification, daemon continues with previous config
### Service Configuration
#### Systemd Service
@@ -281,17 +346,17 @@ systemctl --user enable --now hyprvoice.service
## Development Status
| Component | Status | Notes |
| --------------------- | ------ | -------------------------------- |
| Core daemon & IPC | ✅ | Unix socket control plane |
| Recording workflow | ✅ | Toggle recording via PipeWire |
| Audio capture | ✅ | Efficient PipeWire integration |
| Desktop notifications | ✅ | Status feedback via notify-send |
| OpenAI transcription | ✅ | HTTP API integration |
| Text injection | ✅ | Clipboard + wtype with fallback |
| Configuration system | | TOML-based user settings |
| Comprehensive tests | ⏳ | Pipeline and integration testing |
| whisper.cpp support | ⏳ | Local model inference |
| Component | Status | Notes |
| --------------------- | ------ | ---------------------------------------- |
| Core daemon & IPC | ✅ | Unix socket control plane |
| Recording workflow | ✅ | Toggle recording via PipeWire |
| Audio capture | ✅ | Efficient PipeWire integration |
| Desktop notifications | ✅ | Status feedback via notify-send |
| OpenAI transcription | ✅ | HTTP API integration |
| Text injection | ✅ | Clipboard + wtype with fallback |
| Configuration system | | TOML-based user settings with hot-reload |
| Comprehensive tests | ⏳ | Pipeline and integration testing |
| whisper.cpp support | ⏳ | Local model inference |
**Legend**: ✅ Complete · ⏳ Planned