From e5ae9d8c97fe6251c2b587de0cb4fbd605196075 Mon Sep 17 00:00:00 2001 From: Phillip Berndt Date: Mon, 23 Feb 2015 11:20:43 +0100 Subject: [PATCH] Detect if xrandr fails completely 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autorandr.py b/autorandr.py index 19f1a5e..aadb7d4 100755 --- a/autorandr.py +++ b/autorandr.py @@ -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): -- 2.39.2