misc: fixes

This commit is contained in:
Dylan Araps 2018-04-09 09:09:23 +10:00
parent 7b5586e149
commit 97b241c916
3 changed files with 10 additions and 9 deletions

View File

@ -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()]

View File

@ -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()

View File

@ -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="")