From cac505a0d57923537195340167acaf4d682846ad 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 3dc8827..1d5838f 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -134,9 +134,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) @@ -175,7 +172,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.cols16, args.backend, @@ -183,6 +180,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"))