mirror of
https://github.com/anufrievroman/waypaper.git
synced 2024-11-26 11:33:19 +03:00
Fix bug where while loop could be infinite.
This commit is contained in:
parent
4379444183
commit
8d366a4e4f
@ -119,13 +119,14 @@ def change_wallpaper(image_path: str, cf: Config, monitor: str, txt: Chinese|Eng
|
|||||||
wallpaper_command = ["hyprctl", "hyprpaper", "wallpaper", f"{monitor},{image_path}"]
|
wallpaper_command = ["hyprctl", "hyprpaper", "wallpaper", f"{monitor},{image_path}"]
|
||||||
unload_command = ["hyprctl", "hyprpaper", "unload", "all"]
|
unload_command = ["hyprctl", "hyprpaper", "unload", "all"]
|
||||||
result: str = ""
|
result: str = ""
|
||||||
while result != "ok":
|
retry_counter: int = 0
|
||||||
|
while result != "ok" and retry_counter < 10:
|
||||||
try:
|
try:
|
||||||
result = subprocess.check_output(unload_command, encoding="utf-8").strip()
|
result = subprocess.check_output(unload_command, encoding="utf-8").strip()
|
||||||
result = subprocess.check_output(preload_command, encoding="utf-8").strip()
|
result = subprocess.check_output(preload_command, encoding="utf-8").strip()
|
||||||
result = subprocess.check_output(wallpaper_command, encoding="utf-8").strip()
|
result = subprocess.check_output(wallpaper_command, encoding="utf-8").strip()
|
||||||
except Exception:
|
except Exception:
|
||||||
continue
|
retry_counter += 1
|
||||||
|
|
||||||
elif cf.backend == "none":
|
elif cf.backend == "none":
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user