epicenter icon indicating copy to clipboard operation
epicenter copied to clipboard

feat: add system tray

Open vishesh-sachan opened this issue 2 months ago • 0 comments

This Pull Request introduces complete system tray functionality to the Whispering application

1. System Tray Integration

  • Full Desktop Integration: The application can now be minimized or closed to the system tray instead of quitting, allowing it to run silently in the background.
  • Interactive Tray Menu: Includes standard "Show Whispering" to restore the window and a "Quit" option.
  • Left-Click Behavior: A single left-click on the tray icon toggles the application window's visibility.

2. Dynamic State Indicators

The tray icon changes automatically to provide visual feedback on the app's current status:

  • Idle: Default state when no activity is occurring.
  • Recording: Indicates that a voice recording is actively in progress.
  • Processing: Shows when a recording is being transcribed.
  • Dynamic Tooltips: The icon tooltip updates (e.g., "Whispering - Recording") to further communicate the current state.

3. User Configuration

  • A new System Tray section has been added to the Settings page.
  • Minimize to Tray: A toggle to hide the window to the tray when the close button is clicked.
  • Start Minimized: An option to launch the application directly to the system tray on startup.

🛠️ Technical Details & Implementation

Backend (Rust/Tauri)

  • New tray.rs module: Implements the entire tray management logic, including icon switching, menu setup, and event handling.
  • Window Management: Intercepts the window close event to hide the window instead of quitting, respecting the user's closeToTray setting.
  • State Management: Uses thread-safe state management (Arc<Mutex<>>) to handle tray state updates across different application threads (recording, transcription).
  • New Commands: Introduced new Tauri commands for the frontend to manage and update the tray state in real-time.

Frontend (Svelte/TypeScript)

  • Settings Schema/UI: Updated settings.ts and the Settings page UI to include the new tray configuration options.
  • Recording Pipeline Integration: The application's recording and transcription services now dispatch updates to the backend to ensure the tray icon accurately reflects the Recording and Processing states.
  • Reliability: Ensured robust state transitions across different recording methods (VAD, CPAL, etc.) and corrected timing issues in icon updates for a smoother user experience.

📂 Files Impacted

  • src-tauri/src/tray.rs (New)
  • src-tauri/src/lib.rs (Tray setup and event handling)
  • src/lib/settings/settings.ts (New tray settings schema)
  • src/lib/stores/settings.svelte.ts (Settings store integration)
  • src/routes/(config)/settings/+page.svelte (System Tray settings UI)
  • ...and various files in src/lib/services and src/lib/query for state-change integration.

vishesh-sachan avatar Oct 07 '25 14:10 vishesh-sachan