stable ver start
This commit is contained in:
parent
c125d5bdbd
commit
1e395280e4
BIN
__pycache__/func.cpython-38.pyc
Normal file
BIN
__pycache__/func.cpython-38.pyc
Normal file
Binary file not shown.
26
func.py
Normal file
26
func.py
Normal 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
7
main.py
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
from func import *
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
kill()
|
||||||
|
setWallPeper()
|
13
wallpyper.py
13
wallpyper.py
@ -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}")
|
|
Loading…
Reference in New Issue
Block a user