X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=autorandr.py;h=7ad9736b136f516a7f0309a3b80b17f907b53809;hb=54abf9d6f1b712fd40279230f4e8e6cfce8ea54a;hp=9f1f557baf14f82241cd50538e047f535f12a19d;hpb=9a023ca0fa8fd7a12a99e8852a063266bf49f078;p=deb_pkgs%2Fautorandr.git diff --git a/autorandr.py b/autorandr.py index 9f1f557..7ad9736 100755 --- a/autorandr.py +++ b/autorandr.py @@ -1270,8 +1270,12 @@ def main(argv): profiles.update(load_profiles(profile_path)) profile_symlinks.update(get_symlinks(profile_path)) read_config(options, profile_path) - # Sort by descending mtime - profiles = OrderedDict(sorted(profiles.items(), key=lambda x: -x[1]["config-mtime"])) + # Sort by mtime + sort_direction = -1 + if "--cycle" in options: + # When cycling through profiles, put the profile least recently used to the top of the list + sort_direction = 1 + profiles = OrderedDict(sorted(profiles.items(), key=lambda x: sort_direction * x[1]["config-mtime"])) except Exception as e: raise AutorandrException("Failed to load profiles", e) @@ -1426,7 +1430,7 @@ def main(argv): scripts_path = profile["path"] except KeyError: raise AutorandrException("Failed to load profile '%s': Profile not found" % load_profile) - if load_profile in detected_profiles and detected_profiles[0] != load_profile: + if "--dry-run" not in options: update_mtime(os.path.join(scripts_path, "config")) add_unused_outputs(config, load_config) if load_config == dict(config) and "-f" not in options and "--force" not in options: