From f50cac635e3e7cb55bd0898985dea1b048120263 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 25 Aug 2017 19:39:47 +1000 Subject: [PATCH] OS: Added support for Windows --- .gitignore | 1 + pywal/colors.py | 2 +- pywal/reload.py | 2 +- pywal/settings.py | 2 +- pywal/util.py | 3 +-- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index f126d42..caa6570 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ subprocess re build/* .coverage +.vscode/* \ No newline at end of file diff --git a/pywal/colors.py b/pywal/colors.py index fd233c5..dd190e9 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -13,7 +13,7 @@ from . import util def imagemagick(color_count, img): """Call Imagemagick to generate a scheme.""" - colors = subprocess.Popen(["convert", img, "-resize", "25%", + colors = subprocess.Popen(["magick", "convert", img, "-resize", "25%", "+dither", "-colors", str(color_count), "-unique-colors", "txt:-"], stdout=subprocess.PIPE) diff --git a/pywal/reload.py b/pywal/reload.py index b16aec1..41283eb 100644 --- a/pywal/reload.py +++ b/pywal/reload.py @@ -15,7 +15,7 @@ def xrdb(xrdb_file=None): """Merge the colors into the X db so new terminals use them.""" xrdb_file = xrdb_file or os.path.join(CACHE_DIR, "colors.Xresources") - if shutil.which("xrdb") or OS != "Darwin": + if shutil.which("xrdb") and OS != "Darwin": subprocess.Popen(["xrdb", "-merge", xrdb_file], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).wait() diff --git a/pywal/settings.py b/pywal/settings.py index ce06347..b4ad3a5 100644 --- a/pywal/settings.py +++ b/pywal/settings.py @@ -16,7 +16,7 @@ import platform __version__ = "0.6.6" -HOME = os.environ["HOME"] +HOME = os.getenv("HOME", os.getenv("USERPROFILE")) CACHE_DIR = os.path.join(HOME, ".cache/wal/") MODULE_DIR = os.path.dirname(__file__) COLOR_COUNT = 16 diff --git a/pywal/util.py b/pywal/util.py index 55be6c2..894c049 100644 --- a/pywal/util.py +++ b/pywal/util.py @@ -113,8 +113,7 @@ def disown(cmd): disown it and hide it's output.""" subprocess.Popen(["nohup", *cmd], stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, - preexec_fn=os.setpgrp) + stderr=subprocess.DEVNULL) def msg(input_msg, notify):