diff options
| -rw-r--r-- | pywal/export.py | 8 | ||||
| -rw-r--r-- | pywal/settings.py | 8 | ||||
| -rw-r--r-- | pywal/util.py | 4 |
3 files changed, 17 insertions, 3 deletions
diff --git a/pywal/export.py b/pywal/export.py index 83dd15c..fb284bd 100644 --- a/pywal/export.py +++ b/pywal/export.py @@ -12,7 +12,13 @@ def template(colors, input_file, output_file=None): """Read template file, substitute markers and save the file elsewhere.""" template_data = util.read_file_raw(input_file) - template_data = "".join(template_data).format(**colors) + + try: + template_data = "".join(template_data).format(**colors) + except ValueError: + logging.error("Syntax error in template file '%s'. " + "Are non-marker braces escaped? '{{}}'?" % input_file) + return util.save_file(template_data, output_file) diff --git a/pywal/settings.py b/pywal/settings.py index 4adb249..3b81c9e 100644 --- a/pywal/settings.py +++ b/pywal/settings.py @@ -18,7 +18,11 @@ __cache_version__ = "1.1.0" HOME = os.getenv("HOME", os.getenv("USERPROFILE")) -CACHE_DIR = os.getenv("PYWAL_CACHE_DIR", os.path.join(HOME, ".cache", "wal")) +XDG_CACHE_DIR = os.getenv("XDG_CACHE_HOME", os.path.join(HOME, ".cache")) +XDG_CONF_DIR = os.getenv("XDG_CONFIG_HOME", os.path.join(HOME, ".config")) + +CACHE_DIR = os.getenv("PYWAL_CACHE_DIR", os.path.join(XDG_CACHE_DIR, "wal")) +CONF_DIR = os.path.join(XDG_CONF_DIR, "wal") MODULE_DIR = os.path.dirname(__file__) -CONF_DIR = os.path.join(HOME, ".config", "wal") + OS = platform.uname()[0] diff --git a/pywal/util.py b/pywal/util.py index de8eb09..a158da9 100644 --- a/pywal/util.py +++ b/pywal/util.py @@ -5,6 +5,7 @@ import colorsys import json import logging import os +import shutil import subprocess import sys @@ -178,6 +179,9 @@ def disown(cmd): def get_pid(name): """Check if process is running by name.""" + if not shutil.which("pidof"): + return False + try: subprocess.check_output(["pidof", "-s", name]) except subprocess.CalledProcessError: |