Only count a closed lid as disconnected if there are other connected outputs

As per @Vladimir-csp's advice
This commit is contained in:
Christophe-Marie Duquesne 2019-11-10 17:23:59 +01:00
parent 51a6936165
commit 7a3320d07b
1 changed files with 7 additions and 1 deletions

View File

@ -324,7 +324,7 @@ class XrandrOutput(object):
raise AutorandrException("Parsing XRandR output failed, couldn't find any display modes", report_bug=True) raise AutorandrException("Parsing XRandR output failed, couldn't find any display modes", report_bug=True)
options = {} options = {}
if not match["connected"] or is_closed_lid(match["output"]): if not match["connected"]:
edid = None edid = None
elif match["edid"]: elif match["edid"]:
edid = "".join(match["edid"].strip().split()) edid = "".join(match["edid"].strip().split())
@ -518,6 +518,12 @@ def parse_xrandr_output():
if output_modes: if output_modes:
modes[output_name] = output_modes modes[output_name] = output_modes
# consider a closed lid as disconnected if other outputs are connected
if sum(o.edid != None for o in outputs.values()) > 1:
for output_name in outputs.keys():
if is_closed_lid(output_name):
outputs[output_name].edid = None
return outputs, modes return outputs, modes