Skip to content

Add more detail about _monitors on Linux#2

Closed
jholveck wants to merge 5 commits intomainfrom
feat-xcb-better-monitors
Closed

Add more detail about _monitors on Linux#2
jholveck wants to merge 5 commits intomainfrom
feat-xcb-better-monitors

Conversation

@jholveck
Copy link
Owner

This is a placeholder PR to let the AI review the branch before I send it upstream.

This is adding support for monitor detail to the XCB backends. We've decided to add several optional fields to the monitors dicts: name (human-readable name, if available), unique_id (a platform-specific opaque string that identifies the monitor as best as possible across configuration changes), is_primary (for the primary monitor, where things like the taskbar live), and output (Linux only, included since that's how users interact with some monitor configuration tools, like the xrandr command-line tool).

The Sphinx docs, and the other platforms, are being updated in a separate branch. Xlib is a legacy backend and won't be updated.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds enhanced monitor detail support to the XCB (X11) backend on Linux, introducing optional fields for monitor metadata including human-readable names, unique identifiers, primary monitor indication, and output names. The implementation leverages XRandR 1.5+ monitors when available, with a fallback to CRTC enumeration for older servers.

Changes:

  • Added EDID parsing functionality to extract monitor metadata (model names, serial numbers, manufacturing information)
  • Implemented atom interning and caching mechanism for efficient X11 property lookups
  • Extended monitor detection to use XRandR GetMonitors (v1.5+) and GetOutputInfo APIs
  • Generated Python bindings for additional XRandR protocol requests

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/xcbproto/gen_xcb_to_py.py Added XRandR requests (GetOutputInfo, GetOutputPrimary, GetOutputProperty, GetMonitors) to code generator configuration with improved comment explaining InternAtom special handling
src/xcbproto/README.md Updated maintainer workflow documentation to include ruff formatting step (contains spelling error)
src/mss/tools.py Implemented parse_edid() function to extract monitor identification data from EDID blocks (has off-by-one error and padding issue)
src/mss/linux/xcbhelpers.py Added InternAtomReply structure and initialization for xcb_intern_atom function
src/mss/linux/xcbgen.py Generated Python bindings for new XRandR structures and requests, including formatting improvements
src/mss/linux/xcb.py Implemented intern_atom() with predefined atom table and per-connection caching (has critical cache bug and unused imports)
src/mss/linux/base.py Refactored monitor detection to support RandR 1.5+ monitors and CRTC-based fallback, extracting EDID data and output information

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI commented Feb 20, 2026

@jholveck I've opened a new pull request, #3, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI commented Feb 20, 2026

@jholveck I've opened a new pull request, #4, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jholveck jholveck force-pushed the feat-xcb-better-monitors branch from 1c6f00c to ba1adf3 Compare February 20, 2026 10:57
Otherwise, you need things like `this_visual_id.value == that_visual_id.value`,
and get unexpected negatives for just `this_visual_id == that_visual_id`.
This can be a potential source of bugs.
This will be needed to get the monitor's human-friendly name under
Linux: XRandR will give us the EDID block, but we need to parse it.
See BoboTiG/python-mss PR BoboTiG#469 and issue BoboTiG#153.

There are no plans to add similar code to the legacy Xlib backend.
@jholveck jholveck force-pushed the feat-xcb-better-monitors branch from ba1adf3 to 861926a Compare February 20, 2026 11:42
@jholveck jholveck closed this Feb 20, 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.

3 participants