Fix Mermaid labels by quoting text; ensure GitHub-compatible syntax.

This commit is contained in:
LeonardoTrapani
2025-08-14 19:49:57 +02:00
parent 0619a36abd
commit 688152ea13
+58 -37
View File
@@ -48,11 +48,13 @@ bind = SUPER, R, exec, hyprvoice toggle
## Usage ## Usage
### Basic Usage ### Basic Usage
- Press your toggle key to start; press again to stop. - Press your toggle key to start; press again to stop.
- Audio is captured via PipeWire; the pipeline enters `transcribing` after the first frame. - Audio is captured via PipeWire; the pipeline enters `transcribing` after the first frame.
- On toggleoff during `transcribing`, an `inject` action is sent. Injection is currently simulated (no clipboard paste yet). - On toggleoff during `transcribing`, an `inject` action is sent. Injection is currently simulated (no clipboard paste yet).
### CLI Commands ### CLI Commands
```bash ```bash
# Start the daemon # Start the daemon
hyprvoice serve hyprvoice serve
@@ -74,15 +76,15 @@ hyprvoice stop
## Status ## Status
| Component | State | Notes | | Component | State | Notes |
| -------------------------- | ----- | ---------------------------------------------------------- | | ---------------------- | ----- | -------------------------------------------------------- |
| Daemon (control plane) | ✅ | IPC server, lifecycle; forwards status from the pipeline | | Daemon (control plane) | ✅ | IPC server, lifecycle; forwards status from the pipeline |
| Recording control | ✅ | `hyprvoice toggle` | | Recording control | ✅ | `hyprvoice toggle` |
| Desktop notifications | ✅ | `notify-send` (logs fallback) | | Desktop notifications | ✅ | `notify-send` (logs fallback) |
| Audio capture | ✅ | PipeWire (`pw-record`) frames + bounded channels | | Audio capture | ✅ | PipeWire (`pw-record`) frames + bounded channels |
| ASR backends | ⏳ | Not implemented yet (cloud/local planned) | | ASR backends | ⏳ | Not implemented yet (cloud/local planned) |
| Text injection | ⏳ | Not implemented; will use clipboard + `wtype`/`ydotool` | | Text injection | ⏳ | Not implemented; will use clipboard + `wtype`/`ydotool` |
| Service management | 🔄 | `systemd --user` unit example provided | | Service management | 🔄 | `systemd --user` unit example provided |
Legend: ✅ done · 🔄 in progress · ⏳ planned Legend: ✅ done · 🔄 in progress · ⏳ planned
@@ -94,29 +96,42 @@ Legend: ✅ done · 🔄 in progress · ⏳ planned
- State machine (pipeline): `idle → recording → transcribing → injecting → idle`. - State machine (pipeline): `idle → recording → transcribing → injecting → idle`.
- Rule: switch to `transcribing` as soon as the first audio frame arrives. - Rule: switch to `transcribing` as soon as the first audio frame arrives.
### ASCII diagram ### Diagrams
```mermaid
flowchart LR
subgraph Client
CLI["CLI/Tool"]
end
subgraph Daemon
D["Control Daemon (lifecycle + IPC)"]
end
subgraph Pipeline
A["Audio Capture"]
T["Transcribing (ASR TBD)"]
I["Injecting (stub)"]
end
N["notify-send/log"]
CLI -- unix socket --> D
D -- start/stop --> A
A -- frames --> T
T -- status --> D
D -- events --> N
D -- inject action --> T
T --> I
I -->|done| D
``` ```
+-------------------+ Unix socket IPC +-----------+
CLI cmd → | Control Daemon | <---------------------------- | CLI/Tool |
|-------------------| +-----------+
| Lifecycle only | events events
| (start/stop pipe) | -----> [Notifications] -----> notify-send/log
| |
| status ←------+
+--+-----------+----+
|
Audio | frames
Frames v
+---------------------------- Pipeline ----------------------------+
| +--------+ +-------------+ +-----------+ |
| | Audio |-->| Transcribing| ...→ | Injecting | → idle |
| | Capture| | (ASR TBD) | | (stub) | |
| +--------+ +-------------+ +-----------+ |
+------------------------------------------------------------------+
State (pipeline): ```mermaid
idle --toggle--> recording --first frame--> transcribing --inject--> injecting --done--> idle stateDiagram-v2
[*] --> idle
idle --> recording: toggle
recording --> transcribing: first_frame
transcribing --> injecting: inject_action
injecting --> idle: done
recording --> idle: abort
injecting --> idle: abort
``` ```
### Data flow ### Data flow
@@ -146,6 +161,7 @@ sudo cp hyprvoice /usr/local/bin/
``` ```
### Dependencies ### Dependencies
- Cobra CLI - Command-line interface framework - Cobra CLI - Command-line interface framework
- Go 1.24.5+ - Programming language runtime - Go 1.24.5+ - Programming language runtime
@@ -154,10 +170,13 @@ sudo cp hyprvoice /usr/local/bin/
## Configuration ## Configuration
### File Locations ### File Locations
- Socket: `~/.cache/hyprvoice/control.sock` - IPC communication - Socket: `~/.cache/hyprvoice/control.sock` - IPC communication
- PID file: `~/.cache/hyprvoice/hyprvoice.pid` - Process tracking - PID file: `~/.cache/hyprvoice/hyprvoice.pid` - Process tracking
### Systemd Service ### Systemd Service
In the future, this will be implemented with the command `hyprvoice install`
The daemon runs as a user service. To create a systemd service file: The daemon runs as a user service. To create a systemd service file:
```bash ```bash
@@ -188,6 +207,7 @@ systemctl --user enable --now hyprvoice.service
## Development ## Development
### Project Structure ### Project Structure
``` ```
hyprvoice/ hyprvoice/
├── cmd/hyprvoice/ # Main CLI application ├── cmd/hyprvoice/ # Main CLI application
@@ -201,17 +221,22 @@ hyprvoice/
``` ```
### State Machine ### State Machine
The pipeline operates with these states: The pipeline operates with these states:
- idle → recording → transcribing → injecting → idle - idle → recording → transcribing → injecting → idle
### IPC Protocol ### IPC Protocol
Single-character commands over Unix socket: Single-character commands over Unix socket:
- `t` - Toggle recording - `t` - Toggle recording
- `s` - Get status - `s` - Get status
- `v` - Get protocol version - `v` - Get protocol version
- `q` - Quit daemon - `q` - Quit daemon
### Running in Development ### Running in Development
```bash ```bash
# Terminal 1: Start daemon with logs # Terminal 1: Start daemon with logs
go run ./cmd/hyprvoice serve go run ./cmd/hyprvoice serve
@@ -223,14 +248,6 @@ go run ./cmd/hyprvoice status
--- ---
## Recent changes
- Migrated runtime state from the daemon to the pipeline. The daemon now just starts/stops the pipeline and proxies status.
- Introduced an action channel for control (`inject`), enabling toggletoinject behavior while transcribing.
- Implemented PipeWire recording via `pw-record` with bounded channels and basic backpressure logging.
- Desktop notifications wired for start/end/abort (transcribing notification hook available).
- Added CLI commands: `serve`, `toggle`, `status`, `version`, `stop`.
## Direction / Roadmap ## Direction / Roadmap
- ASR integration: start with a cloud streaming backend; add a local backend later. - ASR integration: start with a cloud streaming backend; add a local backend later.
@@ -247,6 +264,7 @@ go run ./cmd/hyprvoice status
### Common Issues ### Common Issues
**Daemon won't start** **Daemon won't start**
```bash ```bash
# Check if already running # Check if already running
hyprvoice status hyprvoice status
@@ -260,6 +278,7 @@ rm ~/.cache/hyprvoice/control.sock
``` ```
**No notifications** **No notifications**
```bash ```bash
# Test notify-send # Test notify-send
notify-send "Test notification" notify-send "Test notification"
@@ -269,6 +288,7 @@ which notify-send
``` ```
**Permission errors** **Permission errors**
```bash ```bash
# Check socket permissions # Check socket permissions
ls -la ~/.cache/hyprvoice/control.sock ls -la ~/.cache/hyprvoice/control.sock
@@ -279,6 +299,7 @@ mkdir -p ~/.cache/hyprvoice
``` ```
### Debug Mode ### Debug Mode
```bash ```bash
# Run with verbose logging # Run with verbose logging
hyprvoice serve 2>&1 | tee hyprvoice.log hyprvoice serve 2>&1 | tee hyprvoice.log