Skip to content

feat: add Linux platform support - #15

Open
bet4it wants to merge 8 commits into
harry0703:mainfrom
bet4it:feat/linux-support
Open

feat: add Linux platform support#15
bet4it wants to merge 8 commits into
harry0703:mainfrom
bet4it:feat/linux-support

Conversation

@bet4it

@bet4it bet4it commented Sep 10, 2026

Copy link
Copy Markdown

Summary

This PR adds comprehensive Linux platform support (Wayland and X11), enabling FlashVoice to run smoothly across modern Linux desktop environments.

Key Changes:

  1. Window Management & Floating Indicator:

    • Fixed Wayland compatibility in tauri-plugin-windows, preserving the pill capsule shape and preventing window decorations from disrupting indicator layout.
    • Configured set_focusable(false) for the floating indicator window so clicking it does not steal keyboard focus from target input fields.
    • Implemented custom self-drawn titlebar for Linux desktop windows.
  2. Global Shortcuts:

    • Implemented Linux global shortcut capture via handy-keys in tauri-plugin-keyhook, supporting push-to-talk and toggle-to-talk without stealing key input.
  3. Text Injection (Auto-Type):

    • Added Linux implementation to tauri-plugin-textinject using ydotool and wl-copy/clipboard injection.
    • Safely saves and restores original clipboard contents in the background after paste execution.
  4. Tray & Audio Playback:

    • Switched to full-color tray icon on Linux for optimal panel visibility.
    • Fixed audio playback on Linux by converting local recording paths to object blob URLs in WebKitGTK.
    • Wired Linux speaker input stubs and resolved unused variable warnings for clean builds.

Verification

  • pnpm lint
  • pnpm type-check
  • pnpm test
  • pnpm build
  • pnpm rust:fmt:check
  • pnpm rust:clippy
  • pnpm rust:test
  • Relevant Rust checks or tests were run when Rust code changed

Manual verification conducted on Linux (NixOS, Linux 6.12, GNOME 47 on Wayland):

  • Tested push-to-talk and toggle-to-talk recording with both mouse and keyboard combinations.
  • Tested automatic text injection into text editors, browsers, and terminal windows.
  • Tested floating indicator window dragging, animations, and focus preservation.
  • Tested system tray menu actions and recorded audio playback.

Risks and impact

  • Compatibility: All new logic is guarded behind #[cfg(target_os = "linux")] or runtime platform checks (isLinux). macOS and Windows execution paths remain completely untouched.
  • Performance: Key injection is lightweight; clipboard restoration is handled asynchronously in a background thread to prevent blocking the UI.
  • Privacy: None. All speech recognition, audio caching, and text injection occur entirely on-device.

Checklist

  • This pull request has one clear objective.
  • Complex logic has clear English comments, and important boundaries have actionable logs.
  • No API keys, tokens, signing material, personal data, build output, or assets with unclear licenses are included.
  • User-visible changes include appropriate tests, documentation, or screenshots.

- Add handy-keys dependency for Linux under tauri-plugin-keyhook
- Implement Linux keyboard listener thread using evdev and handy-keys
- Map physical key and modifier events to normalized KeyEventPayload
- Unify ShortcutService to use keyhook on all platforms (Windows, macOS, Linux)
- Add default shortcuts for Linux in config store
- Convert local recording files to Blob URLs on Linux to avoid WebKitGTK asset protocol failure with GStreamer
- Add automatic Blob URL revocation and error event handling in WxAudioPlayer
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.

1 participant