mirror of
https://github.com/anufrievroman/waypaper.git
synced 2024-09-11 16:26:14 +03:00
Improving the post command
This adds the ability to use $wallpaper variable in the postcommand, as discussed in #26
This commit is contained in:
parent
1f0c345b09
commit
e9b22f6ae8
@ -85,10 +85,14 @@ def change_wallpaper(image_path, cf, monitor, txt):
|
|||||||
else:
|
else:
|
||||||
print(f"{txt.err_notsup} {cf.backend}")
|
print(f"{txt.err_notsup} {cf.backend}")
|
||||||
|
|
||||||
|
# Run a post command:
|
||||||
if cf.post_command:
|
if cf.post_command:
|
||||||
command = cf.post_command.split(" ")
|
command = cf.post_command.split(" ")
|
||||||
|
for index, word in enumerate(command):
|
||||||
|
if word == "$wallpaper":
|
||||||
|
command[index] = image_path
|
||||||
subprocess.Popen(command)
|
subprocess.Popen(command)
|
||||||
print(f"{cf.post_command} executed")
|
print(f'{" ".join(command)} executed')
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"{txt.err_wall} {e}")
|
print(f"{txt.err_wall} {e}")
|
||||||
|
Loading…
Reference in New Issue
Block a user