rr- / screeninfo

Fetch location and size of physical screens.
Other
208 stars 36 forks source link

Function get_monitors() mismatching monitor names and resolutions #47

Closed Lawrence-Chiappelli closed 3 years ago

Lawrence-Chiappelli commented 3 years ago

I'm trying to get matching monitor names and resolutions per the get_monitors() function. However, I am getting conflicting or inaccurate output.

I have monitor HDMI-0 @ 1920x1080 and DP-4 @ 1280x768. If I specify the Xinerama environment, I get the expected output as indicated in the README (albeit with the exception it doesn't output monitor names)- but, generic usage of get_monitors() doesn't behave the same way.


Code used:

from screeninfo import get_monitors
for monitor in get_monitors():
    print(f"Monitor info: {monitor.name} @ ({monitor.width}x{monitor.height})")

Output:

Monitor info: HDMI-0 @ (1280x768) Monitor info: DP-4 @ (1920x1080)

At least the raw names are correct, but as previously indicated, the corresponding resolutions are incorrect. As a result I need to do some kind of trickery to work around this. I am unclear if this is intentional or the result of my own system. If there's any relevant information I can provide about my system, please let me know.

rr- commented 3 years ago

There are two enumerators, xinerama (which does not provide information about physical size or names) and xrandr. It appears you receive wrong information from xrandr enumerator, with swapped names of the monitors.

Can you post the output of xrandr command?

Lawrence-Chiappelli commented 3 years ago

There are two enumerators, xinerama (which does not provide information about physical size or names) and xrandr. It appears you receive wrong information from xrandr enumerator, with swapped names of the monitors.

Can you post the output of xrandr command?

So, after typing in the xrandr command, the output was the same. Xrandr is correct. after having re-examined how my monitors are connected. The fault is on me for mixing up my monitor connections after some experimentation. That being said I apologize for any confusion. Nonetheless I appreciate your clarifications and trying to help out!