X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=autorandr.py;h=f14f5ab536152f60109e47524d092f673e0ba753;hb=6b27e2a62d07f864c722c6d19fe5a9ade9457077;hp=db95507477819f0dbae90cd12a131a67ad48c244;hpb=97bc4d1889f48b94c6caf6415a748eb3088a46e8;p=deb_pkgs%2Fautorandr.git diff --git a/autorandr.py b/autorandr.py index db95507..f14f5ab 100755 --- a/autorandr.py +++ b/autorandr.py @@ -68,7 +68,7 @@ help_text = """ Usage: autorandr [options] -h, --help get this small help --c, --change reload current setup +-c, --change automatically load the first detected profile -d, --default make profile the default profile -l, --load load profile -s, --save save your current setup to profile @@ -1161,7 +1161,11 @@ def main(argv): try: profile_folder = os.path.join(profile_path, options["--save"]) save_configuration(profile_folder, config) - exec_scripts(profile_folder, "postsave", {"CURRENT_PROFILE": options["--save"], "PROFILE_FOLDER": profile_folder}) + exec_scripts(profile_folder, "postsave", { + "CURRENT_PROFILE": options["--save"], + "PROFILE_FOLDER": profile_folder, + "MONITORS": ":".join(config.keys()), + }) except Exception as e: raise AutorandrException("Failed to save current configuration as profile '%s'" % (options["--save"],), e) print("Saved current configuration as profile '%s'" % options["--save"]) @@ -1243,7 +1247,7 @@ def main(argv): if "-d" in options: options["--default"] = options["-d"] - if not load_profile and "--default" in options: + if not load_profile and "--default" in options and ("-c" in options or "--change" in options): load_profile = options["--default"] if load_profile: @@ -1281,6 +1285,7 @@ def main(argv): script_metadata = { "CURRENT_PROFILE": load_profile, "PROFILE_FOLDER": scripts_path, + "MONITORS": ":".join(load_config.keys()), } exec_scripts(scripts_path, "preswitch", script_metadata) if "--debug" in options: