Add swww wallpaper adapter

This commit is contained in:
Christian Schneider 2024-07-03 11:05:20 +02:00
parent c7f8b9e97b
commit ea5eeb8dfb

View file

@ -0,0 +1,22 @@
from subprocess import run
from shutil import which
from . import WallpaperProvider as _WProv
class SwwwProvider(_WProv):
def change_wallpaper(path: str):
run(["swww", "img", path], check=True)
def is_compatible() -> bool:
# check if swww is installed
if not which("swww"):
return False
# check if it's working (i.e. the daemon is running)
if run(["swww", "query"], capture_output=True).returncode != 0:
return False
return True
def __str__():
return "swww"