]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
Only count a closed lid as disconnected if there are other connected outputs
authorChristophe-Marie Duquesne <chmd@chmd.fr>
Sun, 10 Nov 2019 16:23:59 +0000 (17:23 +0100)
committerChristophe-Marie Duquesne <chmd@chmd.fr>
Sun, 10 Nov 2019 16:23:59 +0000 (17:23 +0100)
As per @Vladimir-csp's advice

autorandr.py

index 963303e38c0181dcdd89d54e2f8b528be495587c..36f8420ab39654d5d0ec509a9f20912a2071b456 100755 (executable)
@@ -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