main: add -f flag to read colorscheme from file
@@ -27,6 +27,9 @@ def get_args():
arg.add_argument("-i", metavar="\"/path/to/img.jpg\"",
help="Which image or directory to use.")
+ arg.add_argument("-f", metavar="\"/path/to/colorscheme/file\"",
+ help="Which colorscheme file to use.")
+
arg.add_argument("-n", action="store_true",
help="Skip setting the wallpaper.")
@@ -58,6 +61,11 @@ def process_args(args):
" Refer to \"wal -h\" for more info.")
exit(1)
+ if args.i and args.f:
+ print("error: conflicting arguments -i and -f.\n"
+ " Refer to \"wal -h\" for more info.")
+ exit(1)
+
# -q
if args.q:
sys.stdout = sys.stderr = open(os.devnull, "w")
@@ -91,6 +99,12 @@ def process_args(args):
set_colors.send_sequences(colors_plain, args.t)
export_colors.export_colors(colors_plain)
+ # -f
+ elif args.f:
+ colors_plain = util.read_file(args.f)
+ set_colors.send_sequences(colors_plain, args.t)
+ export_colors.export_colors(colors_plain)
+
# -o
if args.o:
util.disown(args.o)
