Debian Codegraph @

util/check_x_xrandr_icc.py

raw
1 #!/usr/bin/env python3
2
3 import os
4 from binascii import hexlify
5 import sys
6
7 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
8
9 from DisplayCAL import xrandr
10 from DisplayCAL.icc_profile import ICCProfile
11 from DisplayCAL.real_display_size_mm import real_display_size_mm
12
13 for i in range(5):
14 # Show ICC info for first five screens / outputs
15 try:
16 x_icc_c = xrandr.get_atom("_ICC_PROFILE" if i < 1 else "_ICC_PROFILE_%i" % i)
17 except ValueError:
18 x_icc_c = None
19 if x_icc_c:
20 print("Root window %s" % ("_ICC_PROFILE" if i < 1 else "_ICC_PROFILE_%i" % i))
21 x_icc = ICCProfile("".join(chr(n) for n in x_icc_c))
22 print("Description:", x_icc.getDescription())
23 print("Checksum ID:", hexlify(x_icc.calculate_id()))
24 print("")
25 try:
26 xrr_icc_c = xrandr.get_output_property(i, "_ICC_PROFILE")
27 except ValueError:
28 xrr_icc_c = None
29 if xrr_icc_c:
30 print("XRandR Output %i _ICC_PROFILE:" % i)
31 xrr_icc = ICCProfile("".join(chr(n) for n in xrr_icc_c))
32 print("Description:", xrr_icc.getDescription())
33 print("Checksum ID:", hexlify(xrr_icc.calculate_id()))
34 print("")