Improving the post command

This adds the ability to use $wallpaper variable in the postcommand, as discussed in #26
This commit is contained in:
Roman 2024-01-03 18:46:39 +01:00
parent 1f0c345b09
commit e9b22f6ae8

View File

@ -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}")