X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=autorandr.py;h=2a4ddb7f3baffdf10f6c6d3847ed90c18afec40f;hb=a3e0693ea48225f41222537499dd3eb132f4e5b3;hp=f14f5ab536152f60109e47524d092f673e0ba753;hpb=6511bf29f9a8c3082d5bbdccaf5fa8ad3de0214d;p=deb_pkgs%2Fautorandr.git diff --git a/autorandr.py b/autorandr.py index f14f5ab..2a4ddb7 100755 --- a/autorandr.py +++ b/autorandr.py @@ -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