wallpaper: better (and more spaghetti) logic with cache

This commit is contained in:
2025-11-28 12:22:44 +01:00
parent 915f19f142
commit 3d0c6f8de0
3 changed files with 79 additions and 29 deletions
@@ -34,7 +34,7 @@ def getNiriSocket():
def _log(msg: str):
print(msg)
# print(msg)
# logFIle = Path("/tmp/niri-autoblur.log")
# try:
@@ -104,7 +104,7 @@ class AutoBlur:
_blurredDir: Path
_isBlurred = threading.Event()
_thread: threading.Thread | None = None
_lastWallpaer: Path | None = None
_lastWallpaper: Path | None = None
_isFirst = True
def __init__(self, normalDir, blurredDir, interval=0.2):
@@ -204,13 +204,13 @@ class AutoBlur:
sleep(self._interval)
def _apply(self, wallpaper: Path) -> bool:
if wallpaper == self._lastWallpaer:
if wallpaper == self._lastWallpaper:
return True
if not swwwLoadImg("background", wallpaper):
return False
self._lastWallpaer = wallpaper
self._lastWallpaper = wallpaper
return True