summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2017-06-19 17:31:24 +1000
committerDylan Araps <dylan.araps@gmail.com>2017-06-19 17:31:24 +1000
commitb17ba1a4f2631ae64da8965d30b10555fb19b2b9 (patch)
tree7f8ddc8823fb6d3244ea305d16fd86ad88634876
parenteac365eff5ec78f51c7d42f1f787dccd7fe8fedb (diff)
Optimization: Run xrdb in the background
-rw-r--r--wal.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/wal.py b/wal.py
index e2a555b..0378944 100644
--- a/wal.py
+++ b/wal.py
@@ -159,12 +159,11 @@ def gen_colors(img):
"color palette, trying a larger palette size",
COLOR_COUNT + index)
- # Create a list of hex colors.
- colors = [re.search('#.{6}', str(col)).group(0) for col in magic_output]
-
# Remove the first element, which isn't a color.
- del colors[0]
+ del magic_output[0]
+ # Create a list of hex colors.
+ colors = [re.search('#.{6}', str(col)).group(0) for col in magic_output]
return colors
@@ -182,8 +181,11 @@ def get_colors(img):
with open(cache_file) as file:
colors = file.readlines()
+ # Strip newlines from each list element.
colors = [x.strip() for x in colors]
else:
+ print("colors: Generating a colorscheme...")
+
# Generate the colors.
colors = gen_colors(img)
@@ -384,7 +386,7 @@ def export_xrdb(colors):
file.write(x_colors)
# Merge the colors into the X db so new terminals use them.
- subprocess.call(["xrdb", "-merge", XRDB_FILE])
+ subprocess.Popen(["xrdb", "-merge", XRDB_FILE])
print("export: Exported xrdb colors.")