mirror of
https://github.com/anufrievroman/waypaper.git
synced 2024-09-11 16:26:14 +03:00
Merge 8d366a4e4f
into 4120bf97d4
This commit is contained in:
commit
733b71c9a2
@ -4,6 +4,7 @@ import subprocess
|
||||
import time
|
||||
from waypaper.config import Config
|
||||
from waypaper.translations import Chinese, English, French, German, Polish, Russian
|
||||
import sys
|
||||
|
||||
|
||||
def change_wallpaper(image_path: str, cf: Config, monitor: str, txt: Chinese|English|French|German|Polish|Russian):
|
||||
@ -117,9 +118,15 @@ def change_wallpaper(image_path: str, cf: Config, monitor: str, txt: Chinese|Eng
|
||||
monitor = ""
|
||||
wallpaper_command = ["hyprctl", "hyprpaper", "wallpaper", f"{monitor},{image_path}"]
|
||||
unload_command = ["hyprctl", "hyprpaper", "unload", "all"]
|
||||
subprocess.Popen(unload_command)
|
||||
subprocess.Popen(preload_command)
|
||||
subprocess.Popen(wallpaper_command)
|
||||
result: str = ""
|
||||
retry_counter: int = 0
|
||||
while result != "ok" and retry_counter < 10:
|
||||
try:
|
||||
result = subprocess.check_output(unload_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()
|
||||
except Exception:
|
||||
retry_counter += 1
|
||||
|
||||
elif cf.backend == "none":
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user