summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2018-01-02 13:46:31 +1100
committerDylan Araps <dylan.araps@gmail.com>2018-01-02 13:46:31 +1100
commit30ea15b0e2c3e7152b6b09e214e37973e43f5133 (patch)
tree10e5e7befb2dbacb7ab47239655f448ec51ed273
parent55503fbc6030752de8d38122ad7ba7375a7731e9 (diff)
misc: changes.
-rw-r--r--pywal/colors.py10
-rw-r--r--pywal/export.py6
-rw-r--r--pywal/reload.py4
-rw-r--r--pywal/sequences.py4
4 files changed, 11 insertions, 13 deletions
diff --git a/pywal/colors.py b/pywal/colors.py
index 1c3db42..b4ad444 100644
--- a/pywal/colors.py
+++ b/pywal/colors.py
@@ -13,13 +13,11 @@ from . import util
def imagemagick(color_count, img, magick_command):
"""Call Imagemagick to generate a scheme."""
- colors = subprocess.run([*magick_command, img,
- "-resize", "25%", "+dither",
- "-colors", str(color_count),
- "-unique-colors", "txt:-"],
- stdout=subprocess.PIPE)
+ flags = ["-resize", "25%", "-colors", str(color_count),
+ "-unique-colors", "txt:-"]
- return colors.stdout.splitlines()
+ return subprocess.check_output([*magick_command,
+ img, *flags]).splitlines()
def has_im():
diff --git a/pywal/export.py b/pywal/export.py
index a53a2e3..8f252f9 100644
--- a/pywal/export.py
+++ b/pywal/export.py
@@ -53,11 +53,13 @@ def every(colors, output_dir=CACHE_DIR):
template_dir_user = os.path.join(CONF_DIR, "templates")
util.create_dir(template_dir_user)
+ join = os.path.join # Minor optimization.
+
for file in os.scandir(template_dir):
- template(colors, file.path, os.path.join(output_dir, file.name))
+ template(colors, file.path, join(output_dir, file.name))
for file in os.scandir(template_dir_user):
- template(colors, file.path, os.path.join(output_dir, file.name))
+ template(colors, file.path, join(output_dir, file.name))
print("export: Exported all files.")
print("export: Exported all user files.")
diff --git a/pywal/reload.py b/pywal/reload.py
index 40f5900..65b43bb 100644
--- a/pywal/reload.py
+++ b/pywal/reload.py
@@ -18,9 +18,7 @@ def xrdb(xrdb_files=None):
if shutil.which("xrdb") and OS != "Darwin":
for file in xrdb_files:
- subprocess.Popen(["xrdb", "-merge", "-nocpp", file],
- stdout=subprocess.DEVNULL,
- stderr=subprocess.DEVNULL).wait()
+ subprocess.run(["xrdb", "-merge", "-nocpp", file])
def gtk():
diff --git a/pywal/sequences.py b/pywal/sequences.py
index 259d6ad..069298a 100644
--- a/pywal/sequences.py
+++ b/pywal/sequences.py
@@ -73,14 +73,14 @@ def create_sequences(colors):
def send(colors, cache_dir=CACHE_DIR):
"""Send colors to all open terminals."""
- sequences = create_sequences(colors)
-
if OS == "Darwin":
tty_pattern = "/dev/ttys00[0-9]*"
else:
tty_pattern = "/dev/pts/[0-9]*"
+ sequences = create_sequences(colors)
+
# Writing to "/dev/pts/[0-9] lets you send data to open terminals.
for term in glob.glob(tty_pattern):
util.save_file(sequences, term)