-
Notifications
You must be signed in to change notification settings - Fork 1
Native indicator renderer for Linux (X11) #28
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestpriority:mediumNormal priorityNormal priority
Description
Overview
Add native rendering support for Linux to match the macOS implementation. Currently Linux uses WebView fallback.
Background
- macOS native renderer completed in Phase 1: Add native rendering dependencies and foundation #24, Phase 2: Implement all indicator styles with animations #25, Phase 3: Integrate with audio pipeline and replace WebView #26 (NSWindow + Core Graphics)
- Windows/Linux use WebView fallback (working but slower)
- Linux has X11 overlay capabilities that can match macOS performance
Technical Approach
X11 Implementation:
- Use
x11rbcrate (already a dependency for mouse tracking) - Create borderless override-redirect window
- Use XRender extension for compositing/transparency
- Blit SoftwareRenderer pixmap via XPutImage or XRender
Key Considerations:
- X11 only (Wayland compositors don't allow arbitrary overlay positioning)
- Detect X11 vs Wayland at runtime
- Fall back to WebView on Wayland
- Reuse existing SoftwareRenderer from Phase 2
Implementation Pattern
Follow the macOS pattern from src-tauri/src/recording_indicator/native.rs:
#[cfg(target_os = "linux")]
mod linux {
use super::*;
use x11rb::connection::Connection;
use x11rb::protocol::xproto::*;
pub struct NativeIndicator {
conn: /* X11 connection */,
window: Window,
renderer: SoftwareRenderer,
// ...
}
}Files to Modify
src-tauri/src/recording_indicator/native.rs: Add Linux implementationsrc-tauri/src/recording_indicator.rs: Update platform checkssrc-tauri/src/audio/preview.rs: Update platform checkssrc-tauri/Cargo.toml: Ensure x11rb available (already is)
Acceptance Criteria
- Native indicator works on X11-based Linux
- Graceful fallback to WebView on Wayland
- All three styles render correctly (pill, cursor-dot, fixed-float)
- <1% CPU usage during recording
- <50ms show latency
Performance Target
Match macOS metrics:
- Zero IPC overhead (direct function calls)
- <1% CPU usage
- <50ms show latency
Testing
- Test on X11 (Ubuntu 22.04, Fedora, Arch)
- Test Wayland fallback (Ubuntu Wayland session)
- Verify visual quality matches WebView
- Profile CPU/memory usage
Dependencies
- Requires Phase 3: Integrate with audio pipeline and replace WebView #26 (Phase 3) ✅ Complete
- Requires Linux testing environment
References
- macOS implementation:
src-tauri/src/recording_indicator/native.rs - x11rb examples: https://github.com/psychon/x11rb/tree/master/examples
- XRender extension: For compositing/transparency
Notes
- Windows implementation not planned (WebView works well enough)
- Wayland cannot support arbitrary overlay positioning (compositor restriction)
- Linux users on Wayland will use WebView fallback (expected limitation)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpriority:mediumNormal priorityNormal priority