Add identifying information about monitors under Linux#477
Open
jholveck wants to merge 9 commits intoBoboTiG:mainfrom
Open
Add identifying information about monitors under Linux#477jholveck wants to merge 9 commits intoBoboTiG:mainfrom
jholveck wants to merge 9 commits intoBoboTiG:mainfrom
Conversation
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.
BoboTiG
approved these changes
Feb 20, 2026
Uses the := walrus operator to reduce redundant dict lookups. Also (this wasn't in the review), refactors an "in" test from a version I wrote when I needed a more complicated test, to one that's easier to read.
In the previous code, "is_primary" would only be set on the primary monitor (where it's True). This change sets it on all monitors, to parallel the Windows behavior. This code won't set it at all if the primary monitor cannot be determined (XRandR 1.2), although it might set all of them to False if XRandR tells us explicitly that no monitor is primary. (MSSBase.primary_monitor, in the pending PR BoboTiG#469, will use the first monitor in that event.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this PR
Adds new attributes to the _monitors dicts. These are all optional; they’re only populated if they can be probed via XRandR.
output: The output name, as used in XRandR. This is the main identifier used in some monitor configuration tools, like the Linux xrandr command-line tool. This is only populated under Linux.name: The human-friendly monitor name, from the EDID blockunique_id: A platform-specific string that tries to identify the monitor as specifically as possible, across reconnections and configuration changes. On Linux, this is a URL-query-formatted string including the ID, serial, and dates from the EDID block.is_primary: True if the monitor is marked as “primary”. This is where things like the taskbar are expected to appear.This change also adds support for RandR 1.5 Monitors, a user-configurable concept that aligns with the MSS monitor concept. This separates the physical CRTC concept from the logical concept, used for things like tiled displays.
This change also adds some small developer-visible improvements: it adds support for InternAtom, and also makes XIDs and other X primitive types comparable (preventing one class of bugs).
Fixes #153 (for Linux)
Related to #469 ; this is the Linux side
./check.shpassed