summaryrefslogtreecommitdiff
path: root/pywal
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2018-04-01 15:50:08 +1000
committerDylan Araps <dylan.araps@gmail.com>2018-04-01 15:50:08 +1000
commit3c7c8516e5307e969335e84341a215383d0ad87f (patch)
treee0886bed7fc18454a85306f71a8a6c7c47bbac95 /pywal
parente8ebff12476a8a13c77b9365502456f528a3e6a2 (diff)
general: Make -R work with theme files.
Diffstat (limited to 'pywal')
-rw-r--r--pywal/__main__.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/pywal/__main__.py b/pywal/__main__.py
index 0214fa7..0405741 100644
--- a/pywal/__main__.py
+++ b/pywal/__main__.py
@@ -128,15 +128,6 @@ def process_args(args):
scheme_dir = os.path.join(CACHE_DIR, "schemes")
shutil.rmtree(scheme_dir, ignore_errors=True)
- if args.R:
- image_file = os.path.join(CACHE_DIR, "wal")
-
- if os.path.isfile(image_file):
- args.i = util.read_file(image_file)[0]
- else:
- print("image: No colorscheme to restore, try 'wal -i' first.")
- sys.exit(1)
-
if args.i:
image_file = image.get(args.i)
colors_plain = colors.get(image_file, args.l, args.backend)
@@ -144,6 +135,16 @@ def process_args(args):
if args.theme:
colors_plain = theme.file(args.theme)
+ if args.R:
+ cache_file = os.path.join(CACHE_DIR, "colors.json")
+
+ if os.path.isfile(cache_file):
+ colors_plain = theme.file(cache_file)
+
+ else:
+ print("image: No colorscheme to restore, try 'wal -i' first.")
+ sys.exit(1)
+
if args.a:
util.Color.alpha_num = args.a
@@ -152,7 +153,7 @@ def process_args(args):
colors_plain["special"]["background"] = args.b
colors_plain["colors"]["color0"] = args.b
- if args.i or args.theme:
+ if args.i or args.theme or args.R:
if not args.n:
wallpaper.change(colors_plain["wallpaper"])