diff --git a/pywal/__main__.py b/pywal/__main__.py index f9bd2a2..05f96e7 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -14,7 +14,7 @@ import os import shutil import sys -from .settings import __version__, CACHE_DIR, MODULE_DIR +from .settings import __version__, CACHE_DIR, MODULE_DIR, CONF_DIR from . import colors from . import export from . import image @@ -125,7 +125,8 @@ def process_args(args): colors_plain = colors.get(image_file, light=args.l) if args.f == "list_themes": - themes = os.listdir(os.path.join(MODULE_DIR, "colorschemes")) + themes = os.listdir(os.path.join(CONF_DIR, "colorschemes")) + themes += os.listdir(os.path.join(MODULE_DIR, "colorschemes")) print("Themes:", ", ".join([theme.replace(".json", "") for theme in themes])) diff --git a/pywal/colors.py b/pywal/colors.py index 1619e40..664dd4b 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -7,7 +7,8 @@ import shutil import subprocess import sys -from .settings import CACHE_DIR, COLOR_COUNT, MODULE_DIR, __cache_version__ +from .settings import CACHE_DIR, COLOR_COUNT, MODULE_DIR, \ + CONF_DIR, __cache_version__ from . import util @@ -144,10 +145,17 @@ def terminal_sexy_to_wal(data): def file(input_file): """Import colorscheme from json file.""" - theme_file = os.path.join(MODULE_DIR, "colorschemes", - ".".join((input_file, "json"))) + theme_file = ".".join((input_file, "json")) + user_theme_dir = os.path.join(CONF_DIR, "colorschemes") + user_theme_file = os.path.join(user_theme_dir, theme_file) + theme_file = os.path.join(MODULE_DIR, "colorschemes", theme_file) - if os.path.isfile(theme_file): + util.create_dir(user_theme_dir) + + if os.path.isfile(user_theme_file): + input_file = user_theme_file + + elif os.path.isfile(theme_file): input_file = theme_file if os.path.isfile(input_file):