From 97b241c9160ad9304fdd281e735c21c238a028af Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 9 Apr 2018 09:09:23 +1000 Subject: [PATCH] misc: fixes --- pywal/__main__.py | 8 ++++---- pywal/backends/colorz.py | 2 +- pywal/reload.py | 9 +++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pywal/__main__.py b/pywal/__main__.py index a06eab9..f448607 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -104,6 +104,10 @@ def parse_args_exit(parser): if args.i and args.theme: parser.error("Conflicting arguments -i and -f.") + if args.r: + reload.colors() + sys.exit(0) + if not args.i and \ not args.theme and \ not args.R and \ @@ -111,10 +115,6 @@ def parse_args_exit(parser): parser.error("No input specified.\n" "--backend, --theme, -i or -R are required.") - if args.r: - reload.colors() - sys.exit(0) - if args.theme == "list_themes": themes = [theme.name.replace(".json", "") for theme in theme.list_themes()] diff --git a/pywal/backends/colorz.py b/pywal/backends/colorz.py index 490f585..642ff6b 100644 --- a/pywal/backends/colorz.py +++ b/pywal/backends/colorz.py @@ -12,7 +12,7 @@ from .. import util def gen_colors(img): """Generate a colorscheme using Colorz.""" - cmd = ["colorz", "-n", "6", "--bold", "0", "--no-preview"] + cmd = ["colorz", "-n", "6", "--bold", "0", "--no-preview", "--no-bg-img"] return subprocess.check_output([*cmd, img]).splitlines() diff --git a/pywal/reload.py b/pywal/reload.py index 02d1073..6c12387 100644 --- a/pywal/reload.py +++ b/pywal/reload.py @@ -14,8 +14,9 @@ from . import util def tty(tty_reload): """Load colors in tty.""" tty_script = os.path.join(CACHE_DIR, "colors-tty.sh") + term = os.environ.get("TERM") - if os.path.isfile(tty_script) and tty_reload: + if tty_reload and term == "linux": subprocess.Popen(["sh", tty_script]) @@ -26,7 +27,7 @@ def xrdb(xrdb_files=None): if shutil.which("xrdb") and OS != "Darwin": for file in xrdb_files: - subprocess.run(["xrdb", "-merge", "-nocpp", file]) + subprocess.run(["xrdb", "-merge", "-nocpp", "-quiet", file]) def oomox(gen_theme): @@ -81,8 +82,8 @@ def colors(cache_dir=CACHE_DIR): """Reload colors. (Deprecated)""" sequences = os.path.join(cache_dir, "sequences") - sys.stderr.write("'wal -r' is deprecated: " - "Use 'cat %s' instead.\n" % sequences) + logging.error("'wal -r' is deprecated: " + "Use 'cat %s' instead.", sequences) if os.path.isfile(sequences): print("".join(util.read_file(sequences)), end="")