From e8ebff12476a8a13c77b9365502456f528a3e6a2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 1 Apr 2018 15:39:24 +1000 Subject: [PATCH 01/23] general: cleanup. --- pywal/__main__.py | 1 - pywal/colors.py | 18 +++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pywal/__main__.py b/pywal/__main__.py index 866f6ba..0214fa7 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -157,7 +157,6 @@ def process_args(args): wallpaper.change(colors_plain["wallpaper"]) sequences.send(colors_plain, to_send=not args.s) - export.every(colors_plain) if not args.e: diff --git a/pywal/colors.py b/pywal/colors.py index c0a0f1f..280f090 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -82,6 +82,14 @@ def cache_fname(img, backend, light, cache_dir): return [cache_dir, "schemes", "%s_%s_%s_%s.json" % (*file_parts,)] +def get_backend(backend): + """Figure out which backend to use.""" + if backend == "random": + backends = list_backends() + random.shuffle(backends) + return backends[0] + + def get(img, light=False, backend="wal", cache_dir=CACHE_DIR): """Generate a palette.""" # home_dylan_img_jpg_backend_1.2.2.json @@ -95,21 +103,17 @@ def get(img, light=False, backend="wal", cache_dir=CACHE_DIR): else: logging.info("Generating a colorscheme...") - - if backend == "random": - backends = list_backends() - random.shuffle(backends) - backend = backends[0] - - logging.info("Using %s backend.", backend) + backend = get_backend(backend) # Dynamically import the backend we want to use. # This keeps the dependencies "optional". try: __import__("pywal.backends.%s" % backend) except ImportError: + __import__("pywal.backends.wal") backend = "wal" + logging.info("Using %s backend.", backend) backend = sys.modules["pywal.backends.%s" % backend] colors = colors_to_dict(getattr(backend, "get")(img, light), img) From 3c7c8516e5307e969335e84341a215383d0ad87f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 1 Apr 2018 15:50:08 +1000 Subject: [PATCH 02/23] general: Make -R work with theme files. --- pywal/__main__.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/pywal/__main__.py b/pywal/__main__.py index 0214fa7..0405741 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -128,15 +128,6 @@ def process_args(args): scheme_dir = os.path.join(CACHE_DIR, "schemes") shutil.rmtree(scheme_dir, ignore_errors=True) - if args.R: - image_file = os.path.join(CACHE_DIR, "wal") - - if os.path.isfile(image_file): - args.i = util.read_file(image_file)[0] - else: - print("image: No colorscheme to restore, try 'wal -i' first.") - sys.exit(1) - if args.i: image_file = image.get(args.i) colors_plain = colors.get(image_file, args.l, args.backend) @@ -144,6 +135,16 @@ def process_args(args): if args.theme: colors_plain = theme.file(args.theme) + if args.R: + cache_file = os.path.join(CACHE_DIR, "colors.json") + + if os.path.isfile(cache_file): + colors_plain = theme.file(cache_file) + + else: + print("image: No colorscheme to restore, try 'wal -i' first.") + sys.exit(1) + if args.a: util.Color.alpha_num = args.a @@ -152,7 +153,7 @@ def process_args(args): colors_plain["special"]["background"] = args.b colors_plain["colors"]["color0"] = args.b - if args.i or args.theme: + if args.i or args.theme or args.R: if not args.n: wallpaper.change(colors_plain["wallpaper"]) From 9c8ea3e45e92b890c4517fd90d6f5347bfcfeec9 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 1 Apr 2018 15:55:45 +1000 Subject: [PATCH 03/23] general: cleanup. --- pywal/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pywal/__main__.py b/pywal/__main__.py index 0405741..eb2c6e7 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -42,7 +42,7 @@ def get_args(args): Use 'wal --backend' to list backends.", const="list_backends", type=str, nargs="?", default="wal") - arg.add_argument("--theme", metavar="/path/to/file or theme_name", + arg.add_argument("--theme", "-f", metavar="/path/to/file or theme_name", help="Which colorscheme file to use. \ Use 'wal --theme' to list builtin themes.", const="list_themes", nargs="?") From dc8ca8af2792090c83ee58749b72e40e66301625 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 1 Apr 2018 16:40:17 +1000 Subject: [PATCH 04/23] general: Add palette to output. --- pywal/__main__.py | 1 + pywal/colors.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/pywal/__main__.py b/pywal/__main__.py index eb2c6e7..d273cc1 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -158,6 +158,7 @@ def process_args(args): wallpaper.change(colors_plain["wallpaper"]) sequences.send(colors_plain, to_send=not args.s) + colors.palette() export.every(colors_plain) if not args.e: diff --git a/pywal/colors.py b/pywal/colors.py index 280f090..157f7df 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -89,6 +89,24 @@ def get_backend(backend): random.shuffle(backends) return backends[0] + return backend + + +def palette(): + """Generate a palette from the colors.""" + col_width = " " * (os.get_terminal_size().columns // 8) + + for i in range(0, 16): + if i % 8 == 0: + print() + + if i > 7: + i = "8;5;%s" % i + + print("\033[4%sm%s\033[0m" % (i, col_width), end="") + + print("\n") + def get(img, light=False, backend="wal", cache_dir=CACHE_DIR): """Generate a palette.""" From 61ba210355e06e4ec09f268e8eabf85193728a85 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 1 Apr 2018 16:46:35 +1000 Subject: [PATCH 05/23] general: Fix -q --- pywal/__main__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pywal/__main__.py b/pywal/__main__.py index d273cc1..04fbffc 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -10,6 +10,7 @@ Created by Dylan Araps. """ import argparse +import logging import os import shutil import sys @@ -122,6 +123,7 @@ def process_args(args): sys.exit(0) if args.q: + logging.getLogger().disabled = True sys.stdout = sys.stderr = open(os.devnull, "w") if args.c: From 086f4186481d7ec2d38cd13ba8983ba726fe6265 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 1 Apr 2018 16:51:19 +1000 Subject: [PATCH 06/23] version: bump --- pywal/settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pywal/settings.py b/pywal/settings.py index fd12105..7e80174 100644 --- a/pywal/settings.py +++ b/pywal/settings.py @@ -13,8 +13,8 @@ import os import platform -__version__ = "1.3.3" -__cache_version__ = "1.0.0" +__version__ = "2.0.0" +__cache_version__ = "1.1.0" HOME = os.getenv("HOME", os.getenv("USERPROFILE")) From b649563ebad5d7f915f038041d861d942d61a233 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 07:15:29 +1000 Subject: [PATCH 07/23] general: Fixed invoking pywal from hotkey. Closes #219 --- pywal/__main__.py | 5 ++++- pywal/backends/colorthief.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pywal/__main__.py b/pywal/__main__.py index 04fbffc..fc341cf 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -160,7 +160,10 @@ def process_args(args): wallpaper.change(colors_plain["wallpaper"]) sequences.send(colors_plain, to_send=not args.s) - colors.palette() + + if sys.stdout.isatty(): + colors.palette() + export.every(colors_plain) if not args.e: diff --git a/pywal/backends/colorthief.py b/pywal/backends/colorthief.py index 7b2e2bc..bcb9e39 100644 --- a/pywal/backends/colorthief.py +++ b/pywal/backends/colorthief.py @@ -25,7 +25,7 @@ def gen_colors(img): if len(raw_colors) >= 8: break - elif i == 19: + elif i == 10: logging.error("ColorThief couldn't generate a suitable palette.") sys.exit(1) From cc133a7f41ade8b6d1c2c90e5e8af1ef4ae8cb13 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 07:24:37 +1000 Subject: [PATCH 08/23] logging: Use stdout instead. --- pywal/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pywal/util.py b/pywal/util.py index 0c678c9..4495dbe 100644 --- a/pywal/util.py +++ b/pywal/util.py @@ -6,6 +6,7 @@ import json import logging import os import subprocess +import sys class Color: @@ -97,7 +98,8 @@ def setup_logging(): logging.basicConfig(format=("[%(levelname)s\033[0m] " "\033[1;31m%(module)s\033[0m: " "%(message)s"), - level=logging.INFO) + level=logging.INFO, + stream=sys.stdout) logging.addLevelName(logging.ERROR, '\033[1;31mE') logging.addLevelName(logging.INFO, '\033[1;32mI') logging.addLevelName(logging.WARNING, '\033[1;33mW') From 332dfe528328b445e869f79f6d5a2adae3a533fc Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 07:26:06 +1000 Subject: [PATCH 09/23] version: bump --- pywal/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pywal/settings.py b/pywal/settings.py index 7e80174..7790ae9 100644 --- a/pywal/settings.py +++ b/pywal/settings.py @@ -13,7 +13,7 @@ import os import platform -__version__ = "2.0.0" +__version__ = "2.0.1" __cache_version__ = "1.1.0" From 201b4d9c89cc1ab5e587432a6372677646682009 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 14:31:12 +1000 Subject: [PATCH 10/23] args: Handle -i and --theme. --- pywal/__main__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pywal/__main__.py b/pywal/__main__.py index fc341cf..53ddded 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -103,6 +103,12 @@ def process_args(args): " Refer to \"wal -h\" for more info.") sys.exit(1) + if not args.i and not args.theme: + print("error: No input specified.\n" + " --theme and -i are required.\n" + " Refer to \"wal -h\" for more info.") + sys.exit(1) + if args.v: print("wal", __version__) sys.exit(0) From 32dfd4f18180d615f60f88c420acd9dd8dc8880c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 14:33:26 +1000 Subject: [PATCH 11/23] misc: change. --- pywal/backends/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pywal/backends/__init__.py b/pywal/backends/__init__.py index 9a116e8..192dc60 100644 --- a/pywal/backends/__init__.py +++ b/pywal/backends/__init__.py @@ -3,7 +3,7 @@ Hh ____ HP "HHF:. `._ :.,-'"" "-. F F" :::..'"" "-. `. F , \ \ "BACKENDS" -F j\ / ; `. - sorry +F j\ / ; `. | j `. ` A \ | | ;_ . 8 \ J F\_,'| "`-----.\ j `. \ From 041044ed05925be2eb81a6ad506a67f856ffc0bc Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 16:12:29 +1000 Subject: [PATCH 12/23] args: cleanup --- pywal/__main__.py | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/pywal/__main__.py b/pywal/__main__.py index 53ddded..360f8e0 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -91,8 +91,8 @@ def get_args(args): return arg.parse_args(args) -def process_args(args): - """Process args.""" +def process_args_exit(args): + """Process args that exit.""" if not len(sys.argv) > 1: print("error: wal needs to be given arguments to run.\n" " Refer to \"wal -h\" for more info.") @@ -103,9 +103,9 @@ def process_args(args): " Refer to \"wal -h\" for more info.") sys.exit(1) - if not args.i and not args.theme: + if not args.i and not args.theme and not args.R: print("error: No input specified.\n" - " --theme and -i are required.\n" + " --theme, -i or -R are required.\n" " Refer to \"wal -h\" for more info.") sys.exit(1) @@ -128,6 +128,9 @@ def process_args(args): print("Backends:", colors.list_backends()) sys.exit(0) + +def process_args(args): + """Process args.""" if args.q: logging.getLogger().disabled = True sys.stdout = sys.stderr = open(os.devnull, "w") @@ -144,14 +147,7 @@ def process_args(args): colors_plain = theme.file(args.theme) if args.R: - cache_file = os.path.join(CACHE_DIR, "colors.json") - - if os.path.isfile(cache_file): - colors_plain = theme.file(cache_file) - - else: - print("image: No colorscheme to restore, try 'wal -i' first.") - sys.exit(1) + colors_plain = theme.file(os.path.join(CACHE_DIR, "colors.json")) if args.a: util.Color.alpha_num = args.a @@ -161,19 +157,18 @@ def process_args(args): colors_plain["special"]["background"] = args.b colors_plain["colors"]["color0"] = args.b - if args.i or args.theme or args.R: - if not args.n: - wallpaper.change(colors_plain["wallpaper"]) + if not args.n: + wallpaper.change(colors_plain["wallpaper"]) - sequences.send(colors_plain, to_send=not args.s) + sequences.send(colors_plain, to_send=not args.s) - if sys.stdout.isatty(): - colors.palette() + if sys.stdout.isatty(): + colors.palette() - export.every(colors_plain) + export.every(colors_plain) - if not args.e: - reload.env(tty_reload=not args.t) + if not args.e: + reload.env(tty_reload=not args.t) if args.o: util.disown([args.o]) @@ -187,6 +182,7 @@ def main(): """Main script function.""" util.setup_logging() args = get_args(sys.argv[1:]) + process_args_exit(args) process_args(args) From 311fbf2b6cbf22510f984b64aa97923521b31af1 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 16:16:22 +1000 Subject: [PATCH 13/23] misc: cleanup --- pywal/theme.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pywal/theme.py b/pywal/theme.py index 96f86b9..c331d24 100644 --- a/pywal/theme.py +++ b/pywal/theme.py @@ -31,7 +31,7 @@ def terminal_sexy_to_wal(data): return data -def parse_theme(theme_file): +def parse(theme_file): """Parse the theme file.""" data = util.read_file_json(theme_file) @@ -70,8 +70,8 @@ def file(input_file): # Parse the theme file. if os.path.isfile(theme_file): - return parse_theme(theme_file) + return parse(theme_file) else: - logging.error("No colorscheme file found, exiting...") + logging.error("No colorscheme file found.") sys.exit(1) From 385dcb6887e755a380c8fa266dc1bde1db1b32dd Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 16:19:09 +1000 Subject: [PATCH 14/23] misc: cleanup --- pywal/colors.py | 2 +- pywal/reload.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pywal/colors.py b/pywal/colors.py index 157f7df..5cc2a9b 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -120,7 +120,7 @@ def get(img, light=False, backend="wal", cache_dir=CACHE_DIR): logging.info("Found cached colorscheme.") else: - logging.info("Generating a colorscheme...") + logging.info("Generating a colorscheme.") backend = get_backend(backend) # Dynamically import the backend we want to use. diff --git a/pywal/reload.py b/pywal/reload.py index 7869d0b..02d1073 100644 --- a/pywal/reload.py +++ b/pywal/reload.py @@ -33,12 +33,12 @@ def oomox(gen_theme): """Call oomox to generate a theme.""" if gen_theme: if not shutil.which("oomox-cli"): - logging.warning("Oomox not found, skipping...") + logging.warning("Oomox not found, skipping.") return oomox_file = os.path.join(CACHE_DIR, "colors-oomox") - logging.info("Waiting for oomox...") + logging.info("Waiting for Oomox.") subprocess.run(["oomox-cli", "-o", "wal", oomox_file], stdout=subprocess.DEVNULL) From c73fd9221d969f3fc82938e869481fe2cc65518a Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 16:25:18 +1000 Subject: [PATCH 15/23] tests: Fix --- tests/test_main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_main.py b/tests/test_main.py index 1cc1e57..77b126e 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -16,13 +16,13 @@ class TestMain(unittest.TestCase): def test_args_a(self): """> Test arg parsing (-a).""" - args = __main__.get_args(["-a", "50"]) + args = __main__.get_args(["-a", "100", "-R"]) __main__.process_args(args) - self.assertEqual(util.Color.alpha_num, "50") + self.assertEqual(util.Color.alpha_num, "100") def test_args_c(self): """> Test arg parsing (-c).""" - args = __main__.get_args(["-c"]) + args = __main__.get_args(["-c", "-R"]) __main__.process_args(args) scheme_dir = os.path.join(CACHE_DIR, "schemes") self.assertFalse(os.path.isdir(scheme_dir)) @@ -30,14 +30,14 @@ class TestMain(unittest.TestCase): def test_args_e(self): """> Test arg parsing (-e).""" reload.env = unittest.mock.MagicMock() - args = __main__.get_args(["-e"]) + args = __main__.get_args(["-e", "-R"]) __main__.process_args(args) self.assertFalse(reload.env.called) def test_args_n(self): """> Test arg parsing (-n).""" wallpaper.change = unittest.mock.MagicMock() - args = __main__.get_args(["-n"]) + args = __main__.get_args(["-n", "-R"]) __main__.process_args(args) self.assertFalse(wallpaper.change.called) From 0b3e8fafbf87cd4059ed022e8e9d272b3d3b24e3 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 16:29:22 +1000 Subject: [PATCH 16/23] tests: Remove arg testing. Needs to be rewritten. --- tests/test_main.py | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 tests/test_main.py diff --git a/tests/test_main.py b/tests/test_main.py deleted file mode 100644 index 77b126e..0000000 --- a/tests/test_main.py +++ /dev/null @@ -1,46 +0,0 @@ -"""Test __main__ functions.""" -import unittest -import unittest.mock - -import os - -from pywal import __main__ -from pywal import reload -from pywal import wallpaper -from pywal import util -from pywal.settings import CACHE_DIR - - -class TestMain(unittest.TestCase): - """Test the gen_colors functions.""" - - def test_args_a(self): - """> Test arg parsing (-a).""" - args = __main__.get_args(["-a", "100", "-R"]) - __main__.process_args(args) - self.assertEqual(util.Color.alpha_num, "100") - - def test_args_c(self): - """> Test arg parsing (-c).""" - args = __main__.get_args(["-c", "-R"]) - __main__.process_args(args) - scheme_dir = os.path.join(CACHE_DIR, "schemes") - self.assertFalse(os.path.isdir(scheme_dir)) - - def test_args_e(self): - """> Test arg parsing (-e).""" - reload.env = unittest.mock.MagicMock() - args = __main__.get_args(["-e", "-R"]) - __main__.process_args(args) - self.assertFalse(reload.env.called) - - def test_args_n(self): - """> Test arg parsing (-n).""" - wallpaper.change = unittest.mock.MagicMock() - args = __main__.get_args(["-n", "-R"]) - __main__.process_args(args) - self.assertFalse(wallpaper.change.called) - - -if __name__ == "__main__": - unittest.main() From 8f331d1ef18574033dc4aadb61d6866b527d77cb Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 16:44:47 +1000 Subject: [PATCH 17/23] args: cleanup --- pywal/__main__.py | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/pywal/__main__.py b/pywal/__main__.py index 360f8e0..4ed87d8 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -26,7 +26,7 @@ from . import util from . import wallpaper -def get_args(args): +def get_args(): """Get the script arguments.""" description = "wal - Generate colorschemes on the fly" arg = argparse.ArgumentParser(description=description) @@ -88,31 +88,27 @@ def get_args(args): arg.add_argument("-e", action="store_true", help="Skip reloading gtk/xrdb/i3/sway/polybar") - return arg.parse_args(args) + return arg -def process_args_exit(args): +def parse_args_exit(parser): """Process args that exit.""" + args = parser.parse_args() + if not len(sys.argv) > 1: - print("error: wal needs to be given arguments to run.\n" - " Refer to \"wal -h\" for more info.") - sys.exit(1) - - if args.i and args.theme: - print("error: Conflicting arguments -i and -f.\n" - " Refer to \"wal -h\" for more info.") - sys.exit(1) - - if not args.i and not args.theme and not args.R: - print("error: No input specified.\n" - " --theme, -i or -R are required.\n" - " Refer to \"wal -h\" for more info.") - sys.exit(1) + parser.error("wal needs to be given arguments to run.") if args.v: print("wal", __version__) sys.exit(0) + if args.i and args.theme: + parser.error("Conflicting arguments -i and -f.") + + if not args.i and not args.theme and not args.R: + parser.error("No input specified.\n" + "--theme, -i or -R are required.") + if args.r: reload.colors() sys.exit(0) @@ -129,8 +125,10 @@ def process_args_exit(args): sys.exit(0) -def process_args(args): +def parse_args(parser): """Process args.""" + args = parser.parse_args() + if args.q: logging.getLogger().disabled = True sys.stdout = sys.stderr = open(os.devnull, "w") @@ -181,9 +179,10 @@ def process_args(args): def main(): """Main script function.""" util.setup_logging() - args = get_args(sys.argv[1:]) - process_args_exit(args) - process_args(args) + parser = get_args() + + parse_args_exit(parser) + parse_args(parser) if __name__ == "__main__": From 950ede3644e1b4f908e0d446744eaab7fd947ad0 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 16:47:08 +1000 Subject: [PATCH 18/23] args: cleanup --- pywal/__main__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pywal/__main__.py b/pywal/__main__.py index 4ed87d8..622798b 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -99,8 +99,7 @@ def parse_args_exit(parser): parser.error("wal needs to be given arguments to run.") if args.v: - print("wal", __version__) - sys.exit(0) + parser.exit(0, "wal %s\n" % __version__) if args.i and args.theme: parser.error("Conflicting arguments -i and -f.") From f08e2aa38f879d85fad879f778aba090b2368e4b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 16:58:42 +1000 Subject: [PATCH 19/23] export: Cleanup --- pywal/export.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pywal/export.py b/pywal/export.py index ed7a846..993e528 100644 --- a/pywal/export.py +++ b/pywal/export.py @@ -57,13 +57,9 @@ def every(colors, output_dir=CACHE_DIR): util.create_dir(template_dir_user) join = os.path.join # Minor optimization. - - for file in os.scandir(template_dir): - if file.name != '.DS_Store': - template(colors, file.path, join(output_dir, file.name)) - - for file in os.scandir(template_dir_user): - if file.name != '.DS_Store': + for file in [*os.scandir(template_dir), + *os.scandir(template_dir_user)]: + if file.name != ".DS_Store": template(colors, file.path, join(output_dir, file.name)) logging.info("Exported all files.") From aa8ee24aaa5fa13f58024022361443c6ce393080 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 17:01:05 +1000 Subject: [PATCH 20/23] version: bump --- pywal/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pywal/settings.py b/pywal/settings.py index 7790ae9..7a5d2fb 100644 --- a/pywal/settings.py +++ b/pywal/settings.py @@ -13,7 +13,7 @@ import os import platform -__version__ = "2.0.1" +__version__ = "2.0.2" __cache_version__ = "1.1.0" From e82c98375baa32779c7eb51d22d1f3bd792187f2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 2 Apr 2018 17:04:45 +1000 Subject: [PATCH 21/23] docs: README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d22f2a1..ac08fed 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ For more info, check out the [Wiki](https://github.com/dylanaraps/pywal/wiki). [Screenshot Examples (Reddit)](https://www.reddit.com/r/unixporn/search?q=wal&restrict_sr=on&sort=relevance&t=all) -![screenshot](https://i.imgur.com/EUdn0Kx.jpg) +![screenshot](https://i.imgur.com/aVcTPka.jpg) ## Donate From 98ab58f683676653e4e2f14663ac9b5be4c2ba52 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 3 Apr 2018 07:21:16 +1000 Subject: [PATCH 22/23] args: Fix bug where you couldn't use --backend. --- pywal/__main__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pywal/__main__.py b/pywal/__main__.py index 622798b..f6e8222 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -41,7 +41,7 @@ def get_args(): arg.add_argument("--backend", metavar="backend", help="Which color backend to use. \ Use 'wal --backend' to list backends.", - const="list_backends", type=str, nargs="?", default="wal") + const="list_backends", type=str, nargs="?") arg.add_argument("--theme", "-f", metavar="/path/to/file or theme_name", help="Which colorscheme file to use. \ @@ -104,9 +104,12 @@ def parse_args_exit(parser): if args.i and args.theme: parser.error("Conflicting arguments -i and -f.") - if not args.i and not args.theme and not args.R: + if not args.i and \ + not args.theme and \ + not args.R and \ + not args.backend: parser.error("No input specified.\n" - "--theme, -i or -R are required.") + "--backend, --theme, -i or -R are required.") if args.r: reload.colors() From 5de1243623936eb039555177051122f1e3bd4d39 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 3 Apr 2018 07:26:19 +1000 Subject: [PATCH 23/23] version: bump --- pywal/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pywal/settings.py b/pywal/settings.py index 7a5d2fb..eaac1cf 100644 --- a/pywal/settings.py +++ b/pywal/settings.py @@ -13,7 +13,7 @@ import os import platform -__version__ = "2.0.2" +__version__ = "2.0.3" __cache_version__ = "1.1.0"