Skip to content

Remove Linux screen capture support due to xcap maintenance burden #6301

@codefromthecrypt

Description

@codefromthecrypt

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

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

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions