X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=autorandr.py;h=30fa225ade5599340d27e59fe052576c8c8b69fe;hb=59e50efac123ba8b99589d30104be2eae2f5ebed;hp=391f35686a23fd2ce9ae132e527ca612bbccc275;hpb=16ff46476517fcf2773b2cb781163d50470b7533;p=deb_pkgs%2Fautorandr.git diff --git a/autorandr.py b/autorandr.py index 391f356..30fa225 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 and "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 @@ -1164,7 +1178,7 @@ def main(argv): exec_scripts(profile_folder, "postsave", { "CURRENT_PROFILE": options["--save"], "PROFILE_FOLDER": profile_folder, - "MONITORS": ":".join(load_config.keys()), + "MONITORS": ":".join(config.keys()), }) except Exception as e: raise AutorandrException("Failed to save current configuration as profile '%s'" % (options["--save"],), e)