From d576ba2fb219db46acbb6ff02e99710d27ffa89a Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 11 Feb 2024 16:22:04 +0100 Subject: [sway.wallpaper] add window_manager flag for i3 --- .config/sway/bin/wallpaper.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to '.config') diff --git a/.config/sway/bin/wallpaper.py b/.config/sway/bin/wallpaper.py index 8838053..4445ae7 100755 --- a/.config/sway/bin/wallpaper.py +++ b/.config/sway/bin/wallpaper.py @@ -42,13 +42,22 @@ parser.add_argument( default=0.35 ) +parser.add_argument( + '--window_manager', + default='sway' +) + args = parser.parse_args() config = json.loads(args.config) -if shutil.which('swaybg') is None: - sys.exit('swaybg not found') +if args.window_manager == 'sway': + if shutil.which('swaybg') is None: + sys.exit('swaybg not found') +elif args.window_manager == 'i3': + if shutil.which('feh') is None: + sys.exit('feh not found') if args.consider_daylight and shutil.which('sunwait') is None: sys.exit('sunwait not found') @@ -154,9 +163,13 @@ while True: if args.unique: already_selected_file_paths[selected_config['id']].append(selected_file_path) - # run swaybg - swaybg_cmd = ['swaybg', '-i', selected_file_path, '-m', 'fill'] - replacing_process = subprocess.Popen(swaybg_cmd) + # run bg command + if args.window_manager == 'sway': + bg_cmd = ['swaybg', '-i', selected_file_path, '-m', 'fill'] + elif args.window_manager == 'i3': + bg_cmd = ['feh', '--bg-scale', selected_file_path] + + replacing_process = subprocess.Popen(bg_cmd) # wait until new instance of swaybg has booted up properly time.sleep(5) -- cgit v1.2.3