From 36372f535ddea5b3276c340f804115ca9c905175 Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Thu, 22 Jan 2015 15:29:08 +0100 Subject: [PATCH] Keep outputs with edid when loading profiles fixes #13 --- autorandr.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/autorandr.py b/autorandr.py index b2bca69..1be7e7b 100755 --- a/autorandr.py +++ b/autorandr.py @@ -242,17 +242,17 @@ class XrandrOutput(object): if line: line = line.split(None, 1) options[line[0]] = line[1] if len(line) > 1 else None - if "off" in options: + + if options["output"] in edid_map: + edid = edid_map[options["output"]] + elif "off" in options: edid = None else: - if options["output"] in edid_map: - edid = edid_map[options["output"]] - else: - fuzzy_edid_map = [ re.sub("(card[0-9]+|-)", "", x) for x in edid_map.keys() ] - fuzzy_output = re.sub("(card[0-9]+|-)", "", options["output"]) - if fuzzy_output not in fuzzy_edid_map: - raise RuntimeError("Failed to find a corresponding output in config/setup for output `%s'" % options["output"]) - edid = edid_map[list(edid_map.keys())[fuzzy_edid_map.index(fuzzy_output)]] + fuzzy_edid_map = [ re.sub("(card[0-9]+|-)", "", x) for x in edid_map.keys() ] + fuzzy_output = re.sub("(card[0-9]+|-)", "", options["output"]) + if fuzzy_output not in fuzzy_edid_map: + raise RuntimeError("Failed to find a corresponding output in config/setup for output `%s'" % options["output"]) + edid = edid_map[list(edid_map.keys())[fuzzy_edid_map.index(fuzzy_output)]] output = options["output"] del options["output"] @@ -340,7 +340,7 @@ def load_profiles(profile_path): buffer.append(line) for output_name in list(config.keys()): - if "off" in config[output_name].options: + if config[output_name].edid is None: del config[output_name] profiles[profile] = config -- 2.39.2