takes place, and `postsave`, which is executed after a profile was
stored/altered.
+If you experience issues with xrandr being executed too early after connecting
+a new monitor, then you can create a script `predetect`, which will be executed
+before autorandr attempts to run xrandr. Place e.g. `sleep 1` into that file
+to make autorandr wait a second before running xrandr.
+
All scripts can also be placed in any of the `$XDG_CONFIG_DIRS`. In addition to
the script names themselves, any executables in subdirectories named
`script_name.d` (e.g. `postswitch.d`) are executed as well. In scripts, some of
## Changelog
* *2017-01-18* Accept comments (lines starting with `#`) in config/setup files
+* *2017-01-20* New script hook, `predetect`
**autorandr 1.0**
and system-wide configuration folders, named script_name or residing in
subdirectories named script_name.d.
+ If profile_path is None, only global scripts will be invoked.
+
meta_information is expected to be an dictionary. It will be passed to the block scripts
in the environment, as variables called AUTORANDR_<CAPITALIZED_KEY_HERE>.
if not os.path.isdir(user_profile_path):
user_profile_path = os.path.join(os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config")), "autorandr")
- for folder in chain((profile_path, os.path.dirname(profile_path), user_profile_path),
- (os.path.join(x, "autorandr") for x in os.environ.get("XDG_CONFIG_DIRS", "/etc/xdg").split(":"))):
+ candidate_directories = chain((user_profile_path,), (os.path.join(x, "autorandr") for x in os.environ.get("XDG_CONFIG_DIRS", "/etc/xdg").split(":")))
+ if profile_path:
+ candidate_directories = chain((profile_path,), candidate_directories)
+
+ for folder in candidate_directories:
if script_name not in ran_scripts:
script = os.path.join(folder, script_name)
profile_symlinks = { k: v for k, v in profile_symlinks.items() if v in (x[0] for x in virtual_profiles) or v in profiles }
+ exec_scripts(None, "predetect")
config, modes = parse_xrandr_output()
if "--fingerprint" in options: