summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2017-08-12 13:04:40 +1000
committerDylan Araps <dylan.araps@gmail.com>2017-08-12 13:04:40 +1000
commitfda6f3a051564ed353a3d7a2689bb3ddac906c2e (patch)
tree14b083a43ca3413d40254c94ccd171962e874403
parentc68057ec487f207ade6774939a9555f99d39084d (diff)
args: Added -R to restore the scheme.
-rw-r--r--pywal/__main__.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/pywal/__main__.py b/pywal/__main__.py
index dbca515..01d7840 100644
--- a/pywal/__main__.py
+++ b/pywal/__main__.py
@@ -58,6 +58,9 @@ def get_args(args):
arg.add_argument("-r", action="store_true",
help="Reload current colorscheme.")
+ arg.add_argument("-R", action="store_true",
+ help="Restore previous theme.")
+
arg.add_argument("-t", action="store_true",
help="Fix artifacts in VTE Terminals. \
(Termite, xfce4-terminal)")
@@ -99,6 +102,15 @@ def process_args(args):
if args.a:
util.Color.alpha_num = args.a
+ 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, notify=not args.q)