Skip to content

fix(scap-targets): keep partially visible X11 windows selectable - #2906

Merged
richiemcilroy merged 3 commits into
CapSoftware:mainfrom
yashranaway:fix/target-select
Oct 24, 2026
Merged

richiemcilroy merged 3 commits into
CapSoftware:mainfrom
yashranaway:fix/target-select

Conversation

@yashranaway

@yashranaway yashranaway commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

on linux, a window was matched to whichever display contained its centre point. move a window so its centre is off screen, or sitting in the gap between two monitors, and it dropped out of the window picker even though most of it was still visible.

now a window goes to the display it overlaps the most, and only disappears once none of it is on any display. the xvfb test moves a real window half off screen and checks it's still listed, plus unit tests for monitor gaps and two displays.

note: #2816 adds a second copy of the centre point check in its x11 snapshot parser, so whichever of the two lands second should switch that path to this overlap helper too.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with the previous CI coverage gap addressed.

Summary

The PR keeps partially visible X11 windows selectable by choosing the display with the largest overlap.

  • Partly visible Linux windows stay selectable.

Reviews (2) · Last reviewed commit: "test(scap-targets): run X11 target regre..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

@yashranaway is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

@yashranaway

Copy link
Copy Markdown
Contributor Author

@greptileai review

};

#[test]
#[ignore = "requires an isolated X11 server, run with xvfb-run"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 CI skips the regression test

The new X11 test is marked #[ignore], but no CI job runs it with --ignored. The existing Xvfb job runs only cap-gpui tests, so a change that breaks window selection can pass CI without exercising this test.

Add a Linux CI step that runs xvfb-run -a cargo test --locked -p scap-targets --test linux_targets -- --ignored.

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/scap-targets/tests/linux_targets.rs
Line: 14

Comment:
**CI skips the regression test**

The new X11 test is marked `#[ignore]`, but no CI job runs it with `--ignored`. The existing Xvfb job runs only `cap-gpui` tests, so a change that breaks window selection can pass CI without exercising this test.

Add a Linux CI step that runs `xvfb-run -a cargo test --locked -p scap-targets --test linux_targets -- --ignored`.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair, fixed in 09a22a2. the test now starts its own Xvfb, isn't ignored anymore, and runs in the existing linux desktop regression step. checked it fails with the old window selection and passes with the fix.

@richiemcilroy

Copy link
Copy Markdown
Member

Thanks @yashranaway, the fix looks right to us. Greptile's 4/5 is about coverage: the new X11 test in crates/scap-targets/tests/linux_targets.rs is #[ignore] and no CI job runs it with --ignored. Could you add a step to the existing Linux Xvfb job that runs xvfb-run -a cargo test --locked -p scap-targets --test linux_targets -- --ignored, then comment @greptileai review? Thanks!

@richiemcilroy

Copy link
Copy Markdown
Member

@greptileai review

@richiemcilroy
richiemcilroy merged commit 7a91546 into CapSoftware:main Oct 24, 2026
48 of 58 checks passed
cursor Bot pushed a commit to kyzer1023/Cap that referenced this pull request Oct 24, 2026
Keep batched X11 window queries and resolve each window display with display_for_bounds, matching the overlap rule from CapSoftware#2906.
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.

2 participants