From b484c0ea9c9a4838278bbd661a7cc384333c1df8 Mon Sep 17 00:00:00 2001 From: Phillip Berndt Date: Sun, 17 Feb 2019 13:16:58 +0100 Subject: [PATCH] Follow up fixes for #139/#128 --- autorandr.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/autorandr.py b/autorandr.py index e11628c..c108c26 100755 --- a/autorandr.py +++ b/autorandr.py @@ -140,7 +140,7 @@ class XrandrOutput(object): # This regular expression is used to parse an output in `xrandr --verbose' XRANDR_OUTPUT_REGEXP = """(?x) - ^(?P[^ ]+)\s+ # Line starts with output name + ^\s*(?P\S[^ ]*)\s+ # Line starts with output name (?: # Differentiate disconnected and connected disconnected | # in first line unknown\ connection | @@ -317,7 +317,7 @@ class XrandrOutput(object): else: edid = "%s-%s" % (XrandrOutput.EDID_UNAVAILABLE, match["output"]) - if not match["connected"]: + if not match["connected"] or not match["width"]: options["off"] = None else: if match["mode_name"]: @@ -338,7 +338,8 @@ class XrandrOutput(object): options["reflect"] = "y" elif match["reflect"] == "X and Y": options["reflect"] = "xy" - options["pos"] = "%sx%s" % (match["x"], match["y"]) + if match["x"] or match["y"]: + options["pos"] = "%sx%s" % (match["x"] or "0", match["y"] or "0") if match["panning"]: panning = [match["panning"]] if match["tracking"]: