]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
Detect if xrandr fails completely
authorPhillip Berndt <phillip.berndt@googlemail.com>
Mon, 23 Feb 2015 10:20:43 +0000 (11:20 +0100)
committerPhillip Berndt <phillip.berndt@googlemail.com>
Mon, 23 Feb 2015 10:20:43 +0000 (11:20 +0100)
Xrandr 1.0.2 didn't output --verbose like output at all. This change
detects that and outputs an error, instead of producing an empty
configuration.

autorandr.py

index 19f1a5e2e2242f43097f12346364413fc5441e8d..aadb7d4f608e3e179fefe87d7b8f563cc8042d58 100755 (executable)
@@ -328,6 +328,8 @@ def parse_xrandr_output():
 
     # Split at output boundaries and instanciate an XrandrOutput per output
     split_xrandr_output = re.split("(?m)^([^ ]+ (?:(?:dis)?connected|unknown connection).*)$", xrandr_output)
+    if len(split_xrandr_output) < 2:
+        raise RuntimeError("No output boundaries found")
     outputs = OrderedDict()
     modes = OrderedDict()
     for i in range(1, len(split_xrandr_output), 2):