From: Phillip Berndt Date: Fri, 29 Jun 2018 07:14:58 +0000 (+0200) Subject: Consider configurations equal only if no additional outputs are enabled X-Git-Tag: 1.6~8 X-Git-Url: https://git.donarmstrong.com/?p=deb_pkgs%2Fautorandr.git;a=commitdiff_plain;h=71644199c85817ebb9258a1921e3a3b00deee8e9 Consider configurations equal only if no additional outputs are enabled Before, if 3 outputs were enabled, autorandr would consider a configuration which had only 2 of those "current". Fix this. --- 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