Skip to content

Conversation

@itsdevcoffee
Copy link
Owner

Summary

Complete settings panel with path validation, native file pickers, and smart daemon restart.

Features

Settings Panel ⚙️

  • Visual config editor (no manual TOML editing)
  • Three sections: Model, Audio, Output
  • Glassmorphic design with smooth animations

Premium Path Validation

  • Real-time validation with visual feedback
  • Green checkmark if path exists
  • Red X if path missing
  • Yellow warning if wrong type
  • 500ms debounce (smooth, not spammy)
  • Tilde expansion (~ → /home/user)

Native File/Folder Pickers 📁

  • Cross-platform OS dialogs
  • Model path: File OR directory picker
  • Audio clips: Folder picker only
  • Browse buttons with clear icons

Smart Daemon Restart 🔄

  • Banner notification after saving
  • Safety check (blocks if recording)
  • Progress states: Apply → Restarting → Success
  • Auto-detects ACTUAL running binary
  • Restarts same daemon (hyprvoice-gpu → hyprvoice-gpu)
  • Graceful shutdown + startup verification

Dropdown Fixes 🎨

  • Dark background (readable)
  • Custom cyan dropdown arrow
  • White text on dark background

Technical

  • Added Tauri dialog plugin
  • Path validation backend (expand ~, check exists, verify type)
  • Binary detection via ps aux
  • Smart daemon restart with timeouts
  • All TypeScript type checks passing

Testing

  • Settings load from config.toml
  • Settings save to config.toml
  • Path validation works
  • File pickers open native dialogs
  • Daemon restarts with correct binary
  • Safety checks prevent restart while recording

Premium UX throughout! 🚀

**New Features:**
- Complete settings UI with glassmorphic design
- Edit config.toml visually (no manual file editing needed)
- Live config loading and saving

**Settings Sections:**

1. **Model Configuration**
   - Model selector dropdown (tiny, base, small, large-v3-turbo)
   - Language input (e.g., 'en')
   - Model path editor
   - Technical vocabulary prompt (optional textarea)

2. **Audio Configuration**
   - Recording timeout slider (10-300 seconds with live preview)
   - Save audio clips toggle (animated glassmorphic toggle)
   - Audio clips path editor (conditional, only shows if enabled)

3. **Output Configuration**
   - Append space toggle
   - Refresh command editor (for Waybar/Polybar integration)

**UX Features:**
- Save button with states: Save → Saving (spinner) → Saved! (green checkmark)
- Reset button to reload from disk
- Smooth animations on all interactions
- Input validation and error handling
- Glassmorphic inputs with focus states

**Backend:**
- Added get_config() Tauri command
- Added save_config() Tauri command
- Reads/writes ~/.config/hyprvoice/config.toml
- Type-safe config structures

**Styling:**
- New .glass-input utility class
- Focus states with cyan glow
- Disabled states
- Custom select and textarea styling

Settings changes hot-reload in the Tauri window!
**Smart Restart System:**

**Banner Component (RestartBanner.tsx):**
- Animated slide-down notification
- Context-aware states:
  - ⚡ Needs restart (cyan) - Shows after saving
  - ⚠️  Recording warning (yellow) - If trying to restart while recording
  - ✓ Success (green) - Daemon restarted successfully
  - ✗ Error (red) - Restart failed with retry button
- Auto-dismisses success after 3 seconds
- Manual dismiss with X button

**Restart Flow:**
1. User saves settings → Banner appears: 'Restart needed'
2. User clicks 'Apply Changes' → Button shows spinner
3. Backend:
   - Sends Shutdown to daemon
   - Waits up to 3s for graceful shutdown
   - Spawns new daemon process
   - Waits up to 5s for startup
   - Verifies daemon is responsive
4. Success → Green banner: '✓ Daemon restarted!' (auto-dismiss 3s)
5. Error → Red banner with 'Retry' button

**Safety Features:**
- ✅ Checks if recording before restart
- ✅ Shows warning if recording active
- ✅ Graceful daemon shutdown (not force-kill)
- ✅ Verifies new daemon started successfully
- ✅ Error handling with retry option

**Backend (restart_daemon command):**
- Auto-detects daemon binary (hyprvoice-test > hyprvoice-cuda > hyprvoice)
- Detached process (daemon runs independently)
- Timeout handling
- Detailed error messages

**UX Details:**
- Smooth animations (slide, fade)
- Colored borders (cyan/yellow/green/red)
- Spinning refresh icon while restarting
- Clear messaging at each step
- Matches Raycast/VS Code restart patterns

Premium, professional experience that prevents user errors!
**Cross-Platform File Selection:**
- Added @tauri-apps/plugin-dialog (works on Linux, macOS, Windows)
- Native OS file picker dialogs

**New Browse Buttons:**
- 📁 Model Path - File picker for model selection
- 📁 Audio Clips Path - Folder picker for recordings directory
- Glassmorphic folder icon buttons
- Opens native file dialog

**UX Improvements:**
- No more typing paths manually
- Native OS dialogs (file explorer on Linux, Finder on macOS)
- Auto-populates with current path as default
- Validates selection automatically
- Updates input field when folder selected

**Technical:**
- tauri-plugin-dialog handles platform differences
- Single API works everywhere
- Respects OS native UI/UX patterns

Premium experience - users never have to type file paths!
- Set select background to dark (#0a0a0a)
- Style option elements with dark background (#1a1a1a)
- White text on dark background (readable)
- Hover state for options (#2a2a2a)

Fixes white-on-white text issue in model selector dropdown
- Use !important to override browser defaults
- Darker select background (#0a0a0a)
- White text explicitly set
- Cyan highlight for selected option
- Ensures readability across all browsers/themes
- Remove browser default appearance
- Add custom cyan dropdown arrow (SVG)
- Force very dark background
- Force white text
- Proper padding for custom arrow

Fixes light gray on light gray issue in select element
Add console.log and try/catch to debug folder picker
Will help identify why dialog isn't opening
Added permissions for dialog plugin:
- dialog:allow-open - Allow file/folder dialogs
- dialog:default - Default dialog permissions
- shell:allow-execute - For daemon restart

Fixes 'dialog.open not allowed' permission error
**PathInput Component:**
- Reusable validated path input
- Works for both files and directories
- Real-time validation with visual feedback

**Validation Features:**
- ✅ Checks if path exists (500ms debounce)
- ✅ Verifies type matches (file vs directory)
- ✅ Expands ~ to home directory
- ✅ Shows validation icon:
  - 🔄 Spinner while checking
  - ✓ Green check if valid
  - ✗ Red X if doesn't exist
  - ⚠ Yellow warning if wrong type
- ✅ Helper text below input
- ✅ Border color changes (green/red/cyan)

**Icon Indicators:**
- File picker: 📄 FileText icon
- Folder picker: 📁 FolderOpen icon
- Validation: Animated spinner → Check/X/Warning

**UX Details:**
- Debounced validation (doesn't spam while typing)
- Spinner rotates smoothly
- Color-coded feedback (green = good, red = bad, yellow = warning)
- Helpful messages ('File exists', 'Path does not exist', etc.)
- Type checking ('Expected directory, found file')

**Replaces:**
- Raw model path input → PathInput with file validation
- Raw audio clips path input → PathInput with directory validation

Premium, foolproof UX that prevents invalid paths!
Model paths can be:
- Directory (e.g., whisper-large-v3-turbo-safetensors/)
- OR file (e.g., model.gguf)

Changed model path validation from type='file' to type='any'
to accept both. Validation now shows green checkmark for
existing paths regardless of type.
Fixed getValidationMessage() to properly handle type='any'
Now shows green 'Directory exists' instead of yellow warning
**Problem:**
- User running hyprvoice-gpu
- Restart always started hyprvoice-test (hardcoded priority)
- Wrong daemon started after restart!

**Solution:**
- Added detect_running_binary() function
- Parses 'ps aux' to find actual running process
- Extracts the binary path from process list
- Restarts the SAME binary that was running

**Detection Logic:**
1. Run ps aux
2. Find line with 'hyprvoice' and 'daemon'
3. Extract path (e.g., /home/user/.local/bin/hyprvoice-gpu)
4. Use that exact path to restart

**Fallback:**
If detection fails, tries in order:
- hyprvoice-gpu
- hyprvoice-cuda
- hyprvoice-test
- hyprvoice

**Result:**
- hyprvoice-gpu → restarts hyprvoice-gpu ✅
- hyprvoice-cuda → restarts hyprvoice-cuda ✅
- Maintains user's daemon choice

Debug output: Logs detected binary to stderr
@itsdevcoffee itsdevcoffee merged commit 9ffbe1c into main Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants