Skip to content

feat: Statically compiled Linux screenshot utility using XDG Desktop Portal#2066

Closed
hulto wants to merge 4 commits intomainfrom
feature/linux-static-screenshot-11694920894656435776
Closed

feat: Statically compiled Linux screenshot utility using XDG Desktop Portal#2066
hulto wants to merge 4 commits intomainfrom
feature/linux-static-screenshot-11694920894656435776

Conversation

@hulto
Copy link
Collaborator

@hulto hulto commented Mar 12, 2026

Added a new screenshot crate that provides cross-platform screenshot capabilities. On Linux, it uses pure-Rust zbus to communicate with the XDG Desktop Portal, bypassing dynamic C libraries (like libxcb/libX11) to ensure static compilation. It integrates seamlessly into the existing eldritch-libreport crate.


PR created automatically by Jules for task 11694920894656435776 started by @hulto

…th Wayland support

This commit introduces a new `screenshot` crate within `implants/lib/screenshot`
to handle cross-platform screen capturing.

For non-Linux platforms, it relies on the `xcap` crate.
For Linux, `xcap` has been explicitly removed to satisfy the requirement for
statically compiling binaries. Instead, Linux screenshots are captured natively
using the XDG Desktop Portal via pure-Rust D-Bus communication (`zbus`),
thereby avoiding dynamic C-library dependencies. The integration correctly
handles Wayland and X11 seamlessly.

The `eldritch-libreport` payload has been updated to use this new module.

Co-authored-by: hulto <7121375+hulto@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2758    ±0 2758    ±0 0    ±0 0    ±0 0    ±0 0    ±0 1ms    ±0

Previous Results

Build 🏗️ Result 🧪 Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
#1623 2758 2758 0 0 0 0 38.7s

Insights

Average Tests per Run Total Flaky Tests Total Failed Slowest Test (p95)
2758 0 0 5.5s

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
TestDockerExecutor_Build_ContextCancellation 1 5.5s 5.5s
eldritch-libsys: std::dll_inject_impl::tests::test_dll_inject_simple 1 5.1s 5.1s
TestInteractiveShell 1 5.1s 5.1s
TestOtherStreamOutput 1 5.0s 5.0s
imix::bin/imix: install::tests::test_install_execution 3 1.6s 4.7s
imix::bin/imix: install::tests::test_install_execution 3 1.6s 4.7s
imix::bin/imix: install::tests::test_install_execution 3 1.6s 4.7s
imix::bin/imix: tests::task_tests::test_task_eprint_behavior 3 3.0s 3.0s
imix::bin/imix: tests::task_tests::test_task_eprint_behavior 3 3.0s 3.0s
imix::bin/imix: tests::task_tests::test_task_eprint_behavior 3 3.0s 3.0s

🎉 No failed tests in this run. | 🍂 No flaky tests in this run.

Github Test Reporter by CTRF 💚

🔄 This comment has been updated

google-labs-jules bot and others added 3 commits March 13, 2026 01:01
…rt warnings

The previous commit failed CI on macOS and Windows because the `tokio-stream`
dependency was defined globally but only used in the Linux target, and `xcap`
was restricted strictly to non-Linux targets resulting in an unusable
dependency graph for those builds.

This commit refines `screenshot/Cargo.toml` so that:
- `tokio-stream` is strictly limited to the `target_os = "linux"` configuration.
- `xcap` remains used across all platforms except Linux where it correctly
  swaps into native Wayland/X11 operations using D-Bus (`zbus`) to avoid
  dynamically linking `libxcb` and `libX11` causing static compilation breakages.

It also resolves an unused import warning by renaming an unused binding (`_proxy`).

Co-authored-by: hulto <7121375+hulto@users.noreply.github.com>
Ensures proper D-Bus proxy construction on the `x86_64-unknown-linux-gnu` target using `zbus::Proxy::new` and properly extracts the URI using `try_from` from `zvariant` to fulfill the Wayland/X11 screenshot functionality without shelling out to external binaries and without blocking static compilation by importing dynamic C libraries.

Co-authored-by: hulto <7121375+hulto@users.noreply.github.com>
In `zbus` 5.x, the `Proxy::new` method was removed in favor of the `Builder` pattern. This commit modifies the Linux-specific Wayland/X11 screenshot functionality to explicitly use `zbus::proxy::Builder::new` to properly adhere to the latest `zbus` syntax in the CI environment. It also corrects formatting inconsistencies that caused GitHub actions `cargo fmt --check` to fail.

Co-authored-by: hulto <7121375+hulto@users.noreply.github.com>
@hulto
Copy link
Collaborator Author

hulto commented Mar 14, 2026

Fails silenly

@hulto hulto closed this Mar 14, 2026
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