diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-02-11 16:22:04 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-02-11 16:22:04 +0100 |
commit | d576ba2fb219db46acbb6ff02e99710d27ffa89a (patch) | |
tree | f673453e78375d2d1a29f95608981a02ff263aab /.config/sway | |
parent | 7085874f1e1287836742888f09b87b63436660ad (diff) |
[sway.wallpaper] add window_manager flag for i3
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) |