Created
June 24, 2018 18:04
-
-
Save antoinebou12/7a212ccd84cc95e040b2dd0e14662445 to your computer and use it in GitHub Desktop.
Xlib python example that display all the screen and resolution
This file contains 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
import os | |
from Xlib import display | |
d = display.Display() | |
s = d.screen().root | |
output = os.popen("xrandr --listmonitors | grep '*' | awk {'print $4'}").read().splitlines() | |
num_sc = s.xinerama_get_screen_count().screen_count | |
width = s.get_geometry().width | |
height = s.get_geometry().height | |
print("Total count screens: %s" % num_sc) | |
for i in range(num_sc): | |
print("\tScreen %s(%s): %sX%s" % (i, output[i], width, height)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment