From e9b22f6ae88d4ff171bb1f77053497ecc184647a Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 3 Jan 2024 18:46:39 +0100 Subject: [PATCH] Improving the post command This adds the ability to use $wallpaper variable in the postcommand, as discussed in #26 --- waypaper/changer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/waypaper/changer.py b/waypaper/changer.py index cf8428c..344b982 100644 --- a/waypaper/changer.py +++ b/waypaper/changer.py @@ -85,10 +85,14 @@ def change_wallpaper(image_path, cf, monitor, txt): else: print(f"{txt.err_notsup} {cf.backend}") + # Run a post command: if cf.post_command: command = cf.post_command.split(" ") + for index, word in enumerate(command): + if word == "$wallpaper": + command[index] = image_path subprocess.Popen(command) - print(f"{cf.post_command} executed") + print(f'{" ".join(command)} executed') except Exception as e: print(f"{txt.err_wall} {e}")