From 7a3320d07b36f330305a4cd716675e4cee9d8ba7 Mon Sep 17 00:00:00 2001 From: Christophe-Marie Duquesne Date: Sun, 10 Nov 2019 17:23:59 +0100 Subject: [PATCH] Only count a closed lid as disconnected if there are other connected outputs As per @Vladimir-csp's advice --- autorandr.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/autorandr.py b/autorandr.py index 963303e..36f8420 100755 --- a/autorandr.py +++ b/autorandr.py @@ -324,7 +324,7 @@ class XrandrOutput(object): raise AutorandrException("Parsing XRandR output failed, couldn't find any display modes", report_bug=True) options = {} - if not match["connected"] or is_closed_lid(match["output"]): + if not match["connected"]: edid = None elif match["edid"]: edid = "".join(match["edid"].strip().split()) @@ -518,6 +518,12 @@ def parse_xrandr_output(): if 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 -- 2.39.2