From 54274bece2e27b2c14249172e4064e85e304abee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferit=20Yi=C4=9Fit=20BALABAN?= Date: Fri, 17 Jun 2022 12:38:41 +0300 Subject: [PATCH] Improve wallpaper change --- modeset.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/modeset.py b/modeset.py index 120612e..768a570 100755 --- a/modeset.py +++ b/modeset.py @@ -66,15 +66,9 @@ def do_query(cmd: str): def change_wallpaper(mode: int, cringe=False): - if not os.path.exists(PATH_RESC_WALLPS): - get_wallpapers() - with open(PATH_RESC_WALLPS, 'r') as f: - 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}") + wallpaper = PATH_RESC_LIGHTW if mode == 0 else PATH_RESC_DARKW + wallpaper += "/cringe" if cringe else "" + run_command(f"wal --iterative -q -e -i {wallpaper}") def lock(): @@ -207,6 +201,9 @@ def main(): elif sys.argv[0] == "--wallp": log("modeset started with \"--wallp\"") change_wallpaper(mode) + elif sys.argv[0] == "--wallu": + log("modeset started with \"--wallu\"") + get_wallpapers() elif len(sys.argv) == 0: print("modeset by fyb") print(f"local machine time: {get_hour()}")