Improve wallpaper change
This commit is contained in:
parent
fc0f19b61c
commit
54274bece2
15
modeset.py
15
modeset.py
@ -66,15 +66,9 @@ def do_query(cmd: str):
|
|||||||
|
|
||||||
|
|
||||||
def change_wallpaper(mode: int, cringe=False):
|
def change_wallpaper(mode: int, cringe=False):
|
||||||
if not os.path.exists(PATH_RESC_WALLPS):
|
wallpaper = PATH_RESC_LIGHTW if mode == 0 else PATH_RESC_DARKW
|
||||||
get_wallpapers()
|
wallpaper += "/cringe" if cringe else ""
|
||||||
with open(PATH_RESC_WALLPS, 'r') as f:
|
run_command(f"wal --iterative -q -e -i {wallpaper}")
|
||||||
file = f.read()
|
|
||||||
f.close()
|
|
||||||
wlist = file.split(f"{mode}{1 if cringe else 0}")[1].split("EOR")[0].lstrip('\n').splitlines()
|
|
||||||
wallpaper = random.choice(wlist)
|
|
||||||
run_command(f"wal -i {wallpaper}")
|
|
||||||
run_command(f"betterlockscreen -u {wallpaper}")
|
|
||||||
|
|
||||||
|
|
||||||
def lock():
|
def lock():
|
||||||
@ -207,6 +201,9 @@ def main():
|
|||||||
elif sys.argv[0] == "--wallp":
|
elif sys.argv[0] == "--wallp":
|
||||||
log("modeset started with \"--wallp\"")
|
log("modeset started with \"--wallp\"")
|
||||||
change_wallpaper(mode)
|
change_wallpaper(mode)
|
||||||
|
elif sys.argv[0] == "--wallu":
|
||||||
|
log("modeset started with \"--wallu\"")
|
||||||
|
get_wallpapers()
|
||||||
elif len(sys.argv) == 0:
|
elif len(sys.argv) == 0:
|
||||||
print("modeset by fyb")
|
print("modeset by fyb")
|
||||||
print(f"local machine time: {get_hour()}")
|
print(f"local machine time: {get_hour()}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user