-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Motivation
The xcap crate's Linux support creates significant maintenance burden:
Heavy dependencies
xcap 0.5.0+ requires pipewire, wayland, dbus, and other system libraries not available in standard CI/cross-compilation environments. Issue #3914 raised by @DOsinga - xcap contributes to large binary size.
Cross-compilation blockers
- Cross-rs uses Ubuntu 20.04 for glibc compatibility
- Ubuntu 20.04 lacks pipewire in standard repos
- PPA approach fails due to GPG signature issues in Docker
- PR chore: Bump xcap to 0.7.0, let android can cargo build without extra patch #4344 attempted xcap 0.7.0 upgrade, was closed after months of CI failures
Version lock
To avoid Linux deps, we're locked to xcap 0.4.0 which:
- Uses objc2 (fixes macOS core-foundation 0.10.1 compatibility)
- Only needs dbus + xcb on Linux (already in Cross.toml)
- v0.4.1+ adds libwayshot, v0.5.0+ adds pipewire/zbus
Proposal
Remove screen capture support on Linux while keeping it on macOS/Windows.
Alternatives Considered
| Alternative | Why not |
|---|---|
| Keep xcap 0.4.0 forever | Locks us to old version, miss bug fixes |
| Fork xcap with feature flags | Maintenance burden, xcap issue #35 open since Jan 2023 |
| Custom Dockerfile for cross | Complex, fragile, Ubuntu 20.04 PPA issues persist |
| Disable xcap entirely | Loses useful macOS/Windows functionality |
Implementation
Use conditional compilation to exclude screen capture on Linux:
#[cfg(not(target_os = "linux"))]
use xcap::{Monitor, Window};
#[cfg(not(target_os = "linux"))]
#[tool(...)]
pub async fn list_windows(...) { ... }
#[cfg(not(target_os = "linux"))]
#[tool(...)]
pub async fn screen_capture(...) { ... }Update Cargo.toml:
[target.'cfg(not(target_os = "linux"))'.dependencies]
xcap = "0.8.0"Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request