X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=autorandr.py;h=648e91392e875aac8a45fe8da1a51afccf4f1241;hb=ca61a75c09807b92c8086b975e9c28c6d27779a3;hp=f62c34dd30396d4b09789ef9063e8ce142776d7c;hpb=6de7ca40da4532334f35cf5bec1dc1bc190ce44a;p=deb_pkgs%2Fautorandr.git diff --git a/autorandr.py b/autorandr.py index f62c34d..648e913 100755 --- a/autorandr.py +++ b/autorandr.py @@ -129,7 +129,7 @@ class XrandrOutput(object): (?:[\ \t]*tracking\ (?P[0-9]+x[0-9]+\+[0-9]+\+[0-9]+))? # Tracking information (?:[\ \t]*border\ (?P(?:[0-9]+/){3}[0-9]+))? # Border information (?:\s*(?: # Properties of the output - Gamma: (?P[0-9\.: ]+) | # Gamma value + Gamma: (?P(?:inf|[0-9\.: e])+) | # Gamma value Transform: (?P(?:[\-0-9\. ]+\s+){3}) | # Transformation matrix EDID: (?P\s*?(?:\\n\\t\\t[0-9a-f]+)+) | # EDID of the output (?![0-9])[^:\s][^:\n]+:.*(?:\s\\t[\\t ].+)* # Other properties @@ -291,6 +291,10 @@ class XrandrOutput(object): print("Warning: Output %s has a transformation applied. Could not determine correct mode! Using `%s'." % (match["output"], options["mode"]), file=sys.stderr) if match["gamma"]: gamma = match["gamma"].strip() + # xrandr prints different values in --verbose than it accepts as a parameter value for --gamma + # Also, it is not able to work with non-standard gamma ramps. Finally, it auto-corrects 0 to 1, + # so we approximate by 1e-10. + gamma = ":".join([ str(max(1e-10, round(1./float(x), 3))) for x in gamma.split(":") ]) options["gamma"] = gamma if match["rate"]: options["rate"] = match["rate"] @@ -720,6 +724,5 @@ if __name__ == '__main__': print("Exception: {0}".format(e.__class__.__name__)) sys.exit(2) - print("Unhandled exception ({0}). Please report this as a bug.".format( - e), file=sys.stderr) + print("Unhandled exception ({0}). Please report this as a bug.".format(e), file=sys.stderr) raise