diff --git a/pywal/__main__.py b/pywal/__main__.py index a816360..cdd5001 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -95,11 +95,6 @@ def process_args(args): elif args.f: colors_plain = util.read_file_json(args.f) - # If wallpaper is unset, set it to "None" - if "wallpaper" not in colors_plain: - colors_plain["wallpaper"] = "None" - args.n = True - # -i or -f if args.i or args.f: sequences.send_sequences(colors_plain, args.t) diff --git a/pywal/util.py b/pywal/util.py index 2796d8e..6c5b420 100644 --- a/pywal/util.py +++ b/pywal/util.py @@ -54,6 +54,11 @@ def read_file_json(input_file): """Read data from a json file.""" with open(input_file) as json_file: data = json.load(json_file) + + # If wallpaper is unset, set it to "None" + if "wallpaper" not in data: + data["wallpaper"] = "None" + return data diff --git a/pywal/wallpaper.py b/pywal/wallpaper.py index 59f1aeb..5e524a3 100644 --- a/pywal/wallpaper.py +++ b/pywal/wallpaper.py @@ -82,6 +82,9 @@ def set_desktop_wallpaper(desktop, img): def set_wallpaper(img): """Set the wallpaper.""" + if not os.path.isfile(img): + return + desktop = get_desktop_env() if desktop: