2024-09-04 00:54:15 +06:00
|
|
|
#!/bin/python3
|
|
|
|
|
|
|
|
import os
|
|
|
|
import random
|
|
|
|
import time
|
|
|
|
import sys
|
|
|
|
|
|
|
|
path = '/home/fs/Pictures/pic/new_hidpi_wallpaper'
|
|
|
|
server = os.getenv('XDG_SESSION_TYPE')
|
|
|
|
|
|
|
|
|
|
|
|
if server == 'wayland':
|
|
|
|
command = 'killall swaybg; swaybg -i "{}" -m fill &'
|
|
|
|
else:
|
2024-09-16 22:32:45 +06:00
|
|
|
command = 'feh --randomize --bg-fill "{}"'
|
2024-09-04 00:54:15 +06:00
|
|
|
|
|
|
|
minute = 10
|
|
|
|
|
|
|
|
if len(sys.argv) > 1:
|
|
|
|
|
|
|
|
if sys.argv[1] == '-w':
|
|
|
|
while True:
|
|
|
|
files = [os.path.join(path, f) for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))]
|
|
|
|
random_file = random.choice(files)
|
|
|
|
os.system(command.format(random_file))
|
|
|
|
time.sleep(minute * 60)
|
|
|
|
|
|
|
|
elif sys.argv[1] == 'black':
|
|
|
|
p = '/home/fs/Pictures/blank.png'
|
|
|
|
os.system(command.format(p))
|
|
|
|
|
|
|
|
if sys.argv[1] == '-r':
|
|
|
|
files = [os.path.join(path, f) for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))]
|
|
|
|
random_file = random.choice(files)
|
|
|
|
os.system(command.format(random_file))
|
|
|
|
|
|
|
|
else:
|
|
|
|
os.system(command.format(sys.argv[1]))
|