From 38c65b12f1f8b5ce7e8623717e430879a8301723 Mon Sep 17 00:00:00 2001 From: Phillip Berndt Date: Sun, 24 Mar 2019 20:42:02 +0100 Subject: [PATCH] Make mode parsing more robust for broken cases --- autorandr.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/autorandr.py b/autorandr.py index d80b7d9..84361be 100755 --- a/autorandr.py +++ b/autorandr.py @@ -332,10 +332,11 @@ class XrandrOutput(object): options["mode"] = "%sx%s" % (match["mode_width"], match["mode_height"]) else: if match["rotate"] not in ("left", "right"): - options["mode"] = "%sx%s" % (match["width"], match["height"]) + options["mode"] = "%sx%s" % (match["width"] or 0, match["height"] or 0) else: - options["mode"] = "%sx%s" % (match["height"], match["width"]) - options["rotate"] = match["rotate"] + options["mode"] = "%sx%s" % (match["height"] or 0, match["width"] or 0) + if match["rotate"]: + options["rotate"] = match["rotate"] if match["primary"]: options["primary"] = None if match["reflect"] == "X": -- 2.39.2