From 6c909b7461c534711118bd7b8c0819bafffab0dd Mon Sep 17 00:00:00 2001 From: Chris King Date: Wed, 19 Jul 2023 23:04:15 -0500 Subject: [PATCH] Enable wallpaper overrides when using a theme Change such that `--theme` and `-i` no longer conflict; instead the `-i` flag will act as an override for the wallpaper of the theme. This has the added benefit of not rendering templates with a None value (such as `$wallpaper` in `sway-colors` when a wallpaper isn't defined. --- pywal/__main__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pywal/__main__.py b/pywal/__main__.py index 91ead11f..806cc308 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -131,9 +131,6 @@ def parse_args_exit(parser): colors.palette() sys.exit(0) - if args.i and args.theme: - parser.error("Conflicting arguments -i and -f.") - if args.r: reload.colors() sys.exit(0) @@ -172,7 +169,7 @@ def parse_args(parser): if args.a: util.Color.alpha_num = args.a - if args.i: + if args.i and not args.theme: image_file = image.get(args.i, iterative=args.iterative, recursive=args.recursive) colors_plain = colors.get(image_file, args.l, args.backend, @@ -180,6 +177,8 @@ def parse_args(parser): if args.theme: colors_plain = theme.file(args.theme, args.l) + if args.i: + colors_plain["wallpaper"] = args.i if args.R: colors_plain = theme.file(os.path.join(CACHE_DIR, "colors.json"))