mirror of
https://github.com/LazoCoder/Pokemon-Terminal
synced 2024-11-22 11:53:07 +00:00
Add swww wallpaper adapter
This commit is contained in:
parent
c7f8b9e97b
commit
ea5eeb8dfb
1 changed files with 22 additions and 0 deletions
22
pokemonterminal/wallpaper/adapters/swww.py
Normal file
22
pokemonterminal/wallpaper/adapters/swww.py
Normal 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"
|
Loading…
Reference in a new issue