mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-05-21 16:50:55 +02:00
theme: Update flag
This commit is contained in:
parent
400e7d0c42
commit
2bd4c7b75b
@ -41,17 +41,17 @@ def get_args(args):
|
|||||||
help="Which color backend to use.",
|
help="Which color backend to use.",
|
||||||
const="list_backends", type=str, nargs="?", default="wal")
|
const="list_backends", type=str, nargs="?", default="wal")
|
||||||
|
|
||||||
|
arg.add_argument("--theme", metavar="/path/to/file or theme_name",
|
||||||
|
help="Which colorscheme file to use. \
|
||||||
|
Use 'wal -f' to list available builtin themes.",
|
||||||
|
const="list_themes", nargs="?")
|
||||||
|
|
||||||
arg.add_argument("-c", action="store_true",
|
arg.add_argument("-c", action="store_true",
|
||||||
help="Delete all cached colorschemes.")
|
help="Delete all cached colorschemes.")
|
||||||
|
|
||||||
arg.add_argument("-i", metavar="\"/path/to/img.jpg\"",
|
arg.add_argument("-i", metavar="\"/path/to/img.jpg\"",
|
||||||
help="Which image or directory to use.")
|
help="Which image or directory to use.")
|
||||||
|
|
||||||
arg.add_argument("-f", metavar="/path/to/colorscheme/file or theme_name",
|
|
||||||
help="Which colorscheme file to use. \
|
|
||||||
Use 'wal -f' to list available builtin themes.",
|
|
||||||
const="list_themes", nargs="?")
|
|
||||||
|
|
||||||
arg.add_argument("-g", action="store_true",
|
arg.add_argument("-g", action="store_true",
|
||||||
help="Generate an oomox theme.")
|
help="Generate an oomox theme.")
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ def process_args(args):
|
|||||||
" Refer to \"wal -h\" for more info.")
|
" Refer to \"wal -h\" for more info.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if args.i and args.f:
|
if args.i and args.theme:
|
||||||
print("error: Conflicting arguments -i and -f.\n"
|
print("error: Conflicting arguments -i and -f.\n"
|
||||||
" Refer to \"wal -h\" for more info.")
|
" Refer to \"wal -h\" for more info.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -109,14 +109,15 @@ def process_args(args):
|
|||||||
reload.colors()
|
reload.colors()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if args.f == "list_themes":
|
if args.theme == "list_themes":
|
||||||
themes = [theme.name.replace(".json", "") for theme in theme.index()]
|
themes = [theme.name.replace(".json", "")
|
||||||
print("Themes:", ", ".join(themes))
|
for theme in theme.list_themes()]
|
||||||
print("Extra: 'random (select a random theme)'")
|
print("Themes:", themes)
|
||||||
|
print("Extra: 'random' (select a random theme)")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if args.backend == "list_backends":
|
if args.backend == "list_backends":
|
||||||
print("Available backends:", colors.list_backends())
|
print("Backends:", colors.list_backends())
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if args.q:
|
if args.q:
|
||||||
@ -139,8 +140,8 @@ def process_args(args):
|
|||||||
image_file = image.get(args.i)
|
image_file = image.get(args.i)
|
||||||
colors_plain = colors.get(image_file, args.l, args.backend)
|
colors_plain = colors.get(image_file, args.l, args.backend)
|
||||||
|
|
||||||
if args.f:
|
if args.theme:
|
||||||
colors_plain = theme.file(args.f)
|
colors_plain = theme.file(args.theme)
|
||||||
|
|
||||||
if args.a:
|
if args.a:
|
||||||
util.Color.alpha_num = args.a
|
util.Color.alpha_num = args.a
|
||||||
@ -150,7 +151,7 @@ def process_args(args):
|
|||||||
colors_plain["special"]["background"] = args.b
|
colors_plain["special"]["background"] = args.b
|
||||||
colors_plain["colors"]["color0"] = args.b
|
colors_plain["colors"]["color0"] = args.b
|
||||||
|
|
||||||
if args.i or args.f:
|
if args.i or args.theme:
|
||||||
if not args.n:
|
if not args.n:
|
||||||
wallpaper.change(colors_plain["wallpaper"])
|
wallpaper.change(colors_plain["wallpaper"])
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from .settings import CONF_DIR, MODULE_DIR
|
|||||||
from . import util
|
from . import util
|
||||||
|
|
||||||
|
|
||||||
def index():
|
def list_themes():
|
||||||
"""List all installed theme files."""
|
"""List all installed theme files."""
|
||||||
return [*os.scandir(os.path.join(CONF_DIR, "colorschemes")),
|
return [*os.scandir(os.path.join(CONF_DIR, "colorschemes")),
|
||||||
*os.scandir(os.path.join(MODULE_DIR, "colorschemes"))]
|
*os.scandir(os.path.join(MODULE_DIR, "colorschemes"))]
|
||||||
@ -46,7 +46,7 @@ def file(input_file):
|
|||||||
theme_file = user_theme_file
|
theme_file = user_theme_file
|
||||||
|
|
||||||
elif input_file == "random":
|
elif input_file == "random":
|
||||||
themes = [theme.path for theme in index()]
|
themes = [theme.path for theme in list_themes()]
|
||||||
random.shuffle(themes)
|
random.shuffle(themes)
|
||||||
theme_file = themes[0]
|
theme_file = themes[0]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user