]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
Consider configurations equal only if no additional outputs are enabled
authorPhillip Berndt <phillip.berndt@googlemail.com>
Fri, 29 Jun 2018 07:14:58 +0000 (09:14 +0200)
committerPhillip Berndt <phillip.berndt@googlemail.com>
Fri, 29 Jun 2018 07:14:58 +0000 (09:14 +0200)
Before, if 3 outputs were enabled, autorandr would consider a
configuration which had only 2 of those "current". Fix this.

autorandr.py

index f14f5ab536152f60109e47524d092f673e0ba753..2a4ddb7f3baffdf10f6c6d3847ed90c18afec40f 100755 (executable)
@@ -755,10 +755,24 @@ def apply_configuration(new_configuration, current_configuration, dry_run=False)
 
 
 def is_equal_configuration(source_configuration, target_configuration):
-    "Check if all outputs from target are already configured correctly in source"
+    """
+        Check if all outputs from target are already configured correctly in source and
+        that no other outputs are active.
+    """
     for output in target_configuration.keys():
-        if (output not in source_configuration) or (source_configuration[output] != target_configuration[output]):
-            return False
+        if "off" in target_configuration[output].options:
+            if (output in source_configuration or "off" not in source_configuration[output].options):
+                return False
+        else:
+            if (output not in source_configuration) or (source_configuration[output] != target_configuration[output]):
+                return False
+    for output in source_configuration.keys():
+        if "off" in source_configuration[output].options:
+            if output in target_configuration and "off" not in target_configuration.options:
+                return False
+        else:
+            if output not in target_configuration:
+                return False
     return True