mirror of
https://github.com/LazoCoder/Pokemon-Terminal
synced 2024-11-23 04:13:20 +00:00
commit
3312d54809
2 changed files with 19 additions and 18 deletions
19
pokemonterminal/wallpaper/adapters/feh.py
Normal file
19
pokemonterminal/wallpaper/adapters/feh.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from . import WallpaperProvider as _WProv
|
||||
from os import system
|
||||
from pathlib import Path
|
||||
from shutil import which
|
||||
import subprocess
|
||||
|
||||
|
||||
class FehProvider(_WProv):
|
||||
def change_wallpaper(path: str):
|
||||
system(f'feh --no-fehbg --bg-fill "{path}"')
|
||||
|
||||
def is_compatible() -> bool:
|
||||
root_window_prop = str(subprocess.check_output('xprop -root -notype', shell=True))
|
||||
return which("feh") is not None and \
|
||||
(Path.home() / '.fehbg').is_file() and \
|
||||
any(wm_signature in root_window_prop for wm_signature in ('I3_PID', '_OPENBOX_PID'))
|
||||
|
||||
def __str__():
|
||||
return "feh wallpaper tool"
|
|
@ -1,18 +0,0 @@
|
|||
from . import WallpaperProvider as _WProv
|
||||
from os import environ as _environ, system as _system
|
||||
from shutil import which as _which
|
||||
from sys import exit as _exit
|
||||
|
||||
|
||||
class I3wmAdapter(_WProv):
|
||||
def change_wallpaper(path: str):
|
||||
file = _which("feh")
|
||||
if file is None:
|
||||
# I did the checking here not to seem we don't support i3
|
||||
print("feh not found, you need it to set the background in i3.")
|
||||
_exit(0)
|
||||
_system(f'feh --bg-fill "{path}"')
|
||||
|
||||
def is_compatible() -> bool:
|
||||
return 'i3' in _environ.get('XDG_CURRENT_DESKTOP', '') and \
|
||||
'i3' in _environ.get('XDG_SESSION_DESKTOP', '')
|
Loading…
Reference in a new issue