diff options
Diffstat (limited to '.config/sway')
-rwxr-xr-x | .config/sway/bin/wallpaper.py | 23 |
1 files changed, 18 insertions, 5 deletions
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) |