Skip to content

Commit

Permalink
Keep outputs with edid when loading profiles
Browse files Browse the repository at this point in the history
fixes #13
  • Loading branch information
RasmusWL committed Jan 22, 2015
1 parent c51f73a commit 36372f5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions autorandr.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,17 @@ def from_config_file(cls, edid_map, configuration):
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"]

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 36372f5

Please sign in to comment.