]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
execute scripts in directories in a fixed order (by file name)
authorFranz Berger <fberger.work@gmail.com>
Fri, 26 Aug 2022 07:35:23 +0000 (09:35 +0200)
committerPhillip Berndt <phillip.berndt@googlemail.com>
Thu, 1 Dec 2022 07:44:21 +0000 (08:44 +0100)
README.md
autorandr.py

index c2308b0c97ffc5cc01a340e2ffa9ee737e5dd4ce..531bdc2e2eb0b177e2b6a84e5d9c9fbb687887aa 100644 (file)
--- a/README.md
+++ b/README.md
@@ -189,6 +189,8 @@ where they will only be executed on changes regarding that specific profile.
 
 Instead (or in addition) to these scripts, you can also place as many executable
 files as you like in subdirectories called `script_name.d` (e.g. `postswitch.d`).
+The order of execution of scripts in these directories is by file name, you can
+force a certain ordering by naming them `10-wallpaper`, `20-restart-wm`, etc.
 
 If a script with the same name occurs multiple times, user configuration
 takes precedence over system configuration (as specified by the
index d9b853b6fb97ef2ba9f5aa9df462571b5159cb04..431069a1928f868060f0277fdf8917bf9e7f5d51 100755 (executable)
@@ -1187,7 +1187,7 @@ def exec_scripts(profile_path, script_name, meta_information=None):
 
         script_folder = os.path.join(folder, "%s.d" % script_name)
         if os.access(script_folder, os.R_OK | os.X_OK) and os.path.isdir(script_folder):
-            for file_name in os.listdir(script_folder):
+            for file_name in sorted(os.listdir(script_folder)):
                 check_name = "d/%s" % (file_name,)
                 if check_name not in ran_scripts:
                     script = os.path.join(script_folder, file_name)