Use separate flag for last used wallpaper

This commit is contained in:
Lorenz Leitner 2019-09-11 19:40:34 +02:00
parent fefcd53fcf
commit bab56a88a8

View File

@ -76,9 +76,6 @@ def get_args():
arg.add_argument("-l", action="store_true", arg.add_argument("-l", action="store_true",
help="Generate a light colorscheme.") help="Generate a light colorscheme.")
arg.add_argument("-d", action="store_true",
help="Generate a dark colorscheme. Default.")
arg.add_argument("-n", action="store_true", arg.add_argument("-n", action="store_true",
help="Skip setting the wallpaper.") help="Skip setting the wallpaper.")
@ -104,6 +101,9 @@ def get_args():
arg.add_argument("-v", action="store_true", arg.add_argument("-v", action="store_true",
help="Print \"wal\" version.") help="Print \"wal\" version.")
arg.add_argument("-w", action="store_true",
help="Use last used wallpaper for color generation.")
arg.add_argument("-e", action="store_true", arg.add_argument("-e", action="store_true",
help="Skip reloading gtk/xrdb/i3/sway/polybar") help="Skip reloading gtk/xrdb/i3/sway/polybar")
@ -141,6 +141,7 @@ def parse_args_exit(parser):
if not args.i and \ if not args.i and \
not args.theme and \ not args.theme and \
not args.R and \ not args.R and \
not args.w and \
not args.backend: not args.backend:
parser.error("No input specified.\n" parser.error("No input specified.\n"
"--backend, --theme, -i or -R are required.") "--backend, --theme, -i or -R are required.")
@ -178,14 +179,10 @@ def parse_args(parser):
if args.R: if args.R:
colors_plain = theme.file(os.path.join(CACHE_DIR, "colors.json")) colors_plain = theme.file(os.path.join(CACHE_DIR, "colors.json"))
if args.l: if args.w:
cached_wallpaper = util.read_file(os.path.join(CACHE_DIR, "wal")) cached_wallpaper = util.read_file(os.path.join(CACHE_DIR, "wal"))
colors_plain = colors.get(cached_wallpaper[0], True, args.backend, colors_plain = colors.get(cached_wallpaper[0], args.l, args.backend,
sat=args.saturate) sat=args.saturate)
elif args.d:
cached_wallpaper = util.read_file(os.path.join(CACHE_DIR, "wal"))
colors_plain = colors.get(cached_wallpaper[0], False, args.backend,
sat=args.saturate)
if args.b: if args.b:
args.b = "#%s" % (args.b.strip("#")) args.b = "#%s" % (args.b.strip("#"))