stable ver start

This commit is contained in:
Arthur 2022-06-18 23:49:00 +05:00
parent c125d5bdbd
commit 1e395280e4
4 changed files with 33 additions and 13 deletions

Binary file not shown.

26
func.py Normal file
View File

@ -0,0 +1,26 @@
import os
import random
PATH = '/home/arthur/img/Wallpapers/media/'# path to media
files = os.listdir(PATH)
media = random.choices(files)[0]
def run(command,output=False):
devNull = ">/dev/null"
if output == True:
os.system(command)
else:
os.system(command + devNull)
def kill():
with open('/tmp/wallpyper','r') as file:
for pid in file:
run(f'kill {pid}')
def setWallPeper():
if media[-4:] != '.gif':
run(f"feh --bg-scale {PATH}{media}")
else:
run(f"back4.sh auto {PATH}{media} & echo $! > /tmp/wallpyper",True)

7
main.py Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/python3
from func import *
if __name__ == '__main__':
kill()
setWallPeper()

View File

@ -1,13 +0,0 @@
import os
import random
PATH = '/home/arthur/img/Wallpapers/media/'# path to media
files = os.listdir(PATH)
media = random.choices(files)[0]
if media[-4:] != '.gif':
os.system(f"feh --bg-scale {PATH}{media}")
else:
os.system(f"back4.sh auto {PATH}{media}")