You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add identifying information about monitors under Linux (#477)
* Whitespace and README typo cleanups
* Make XIDs and other primitive types comparable
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.
* Add InternAtom support
* Add EDID parser
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.
* Add details about monitors on Linux
See BoboTiG/python-mss PR #469 and issue #153.
There are no plans to add similar code to the legacy Xlib backend.
* Implement suggested fixes from review
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.
* Add CHANGELOG and CHANGES entries
* Set monitor["is_primary"] = False if applicable
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 #469, will use the first
monitor in that event.)
* Type fix
Copy file name to clipboardExpand all lines: CHANGES.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,31 @@
17
17
- Added `EnumDisplayDevicesW` to `CFUNCTIONS` for querying device details.
18
18
- Modified `_monitors_impl()` callback to extract primary monitor flag, device names, and device interface name (unique_id) using Win32 APIs; `unique_id` uses `EDD_GET_DEVICE_INTERFACE_NAME` when available.
19
19
20
+
### linux/base.py
21
+
- Reworked `_monitors_impl()` to prefer XRandR 1.5+ `GetMonitors` when available, falling back to enumerating active CRTCs.
22
+
- Added monitor identification fields from RandR + EDID where available: `is_primary`, `output`, `name`, and `unique_id`.
23
+
- Added EDID lookup via RandR `EDID`/`EdidData` output property and parsing via `mss.tools.parse_edid()`.
24
+
25
+
### linux/xcb.py
26
+
- Added `intern_atom()` helper with per-connection caching and support for predefined atoms.
27
+
- Added `XCB_NONE` constant (`Atom(0)`).
28
+
- Added additional XRandR request wrappers used for monitor identification (`GetMonitors`, `GetOutputInfo`, `GetOutputPrimary`, `GetOutputProperty`).
29
+
30
+
### linux/xcbhelpers.py
31
+
- Added `InternAtomReply` structure and typed binding for `xcb_intern_atom`.
32
+
- Added `__eq__()`/`__hash__()` to `XID` for value-based comparisons.
33
+
34
+
### xcbproto/gen_xcb_to_py.py
35
+
- Extended the generator to include additional XRandR requests used by the XCB backends (`GetOutputInfo`, `GetOutputPrimary`, `GetOutputProperty`, `GetMonitors`).
36
+
- Updated typedef generation to emit value-based `__eq__()`/`__hash__()` implementations.
37
+
- Refactored code generation helpers and formatting (use `textwrap.indent`/`dedent`).
38
+
39
+
### tools.py
40
+
- Added `parse_edid()` helper for extracting identifying fields (legacy model id, serial number, manufacture/model year, and display name) from EDID blocks.
41
+
42
+
### linux/xshmgetimage.py
43
+
- Fixed XID type handling for `drawable`/`visual` (avoid mixing raw `.value` with typed IDs).
0 commit comments