diff --git a/pokemonterminal/wallpaper/adapters/swww.py b/pokemonterminal/wallpaper/adapters/swww.py new file mode 100644 index 0000000..5cf286d --- /dev/null +++ b/pokemonterminal/wallpaper/adapters/swww.py @@ -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"