This commit is contained in:
Arthur 2022-07-03 17:46:29 +05:00
parent e7754a1638
commit a898f5edd1
2 changed files with 6 additions and 14 deletions

View File

@ -90,5 +90,4 @@ exec wallpyper
``` ```
Author - Karimullin Arthur Author - Karimullin Arthur
Mail - KarimullinArthur@riseup.net Mail - KarimullinArthur@riseup.net

19
func.py
View File

@ -21,20 +21,15 @@ def kill():
def configParsing(): def configParsing():
pathToConfig = os.path.expanduser('~')+'/.config/wallpyper/config' pathToConfig = os.path.expanduser('~')+'/.config/wallpyper/config'
try: with open(pathToConfig) as file:
with open(pathToConfig) as file: contentFile = file.read()
contentFile = file.read() config = json.loads(contentFile)
config = json.loads(contentFile) return config
return config
except FileNotFoundError:
createConfig()
def setWallPaper(): def setWallPaper():
config = configParsing() PATH = configParsing()['path_to_wallpapers']
PATH = configParsing['path_to_wallpapers']
files = os.listdir(PATH) files = os.listdir(PATH)
media = random.choices(files)[0] media = random.choices(files)[0]
if media[-4:] != '.gif': if media[-4:] != '.gif':
@ -42,5 +37,3 @@ def setWallPaper():
else: else:
run(f"back4.sh auto {PATH}{media} & echo $! > /tmp/back4.sh.pid",True) run(f"back4.sh auto {PATH}{media} & echo $! > /tmp/back4.sh.pid",True)
# > tmp/back4.sh.pid write PID for kill() # > tmp/back4.sh.pid write PID for kill()
setWallPaper()