about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pywal
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/pywal')
-rw-r--r--nixpkgs/pkgs/development/python-modules/pywal/convert.patch21
-rw-r--r--nixpkgs/pkgs/development/python-modules/pywal/default.nix36
-rw-r--r--nixpkgs/pkgs/development/python-modules/pywal/feh.patch39
3 files changed, 96 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/pywal/convert.patch b/nixpkgs/pkgs/development/python-modules/pywal/convert.patch
new file mode 100644
index 000000000000..999bc1abeaf1
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pywal/convert.patch
@@ -0,0 +1,21 @@
+diff --git a/pywal/backends/wal.py b/pywal/backends/wal.py
+index a75fdc5..4339680 100644
+--- a/pywal/backends/wal.py
++++ b/pywal/backends/wal.py
+@@ -21,15 +21,7 @@ def imagemagick(color_count, img, magick_command):
+
+ def has_im():
+     """Check to see if the user has im installed."""
+-    if shutil.which("magick"):
+-        return ["magick", "convert"]
+-
+-    if shutil.which("convert"):
+-        return ["convert"]
+-
+-    logging.error("Imagemagick wasn't found on your system.")
+-    logging.error("Try another backend. (wal --backend)")
+-    sys.exit(1)
++    return ["@convert@"]
+
+
+ def gen_colors(img):
diff --git a/nixpkgs/pkgs/development/python-modules/pywal/default.nix b/nixpkgs/pkgs/development/python-modules/pywal/default.nix
new file mode 100644
index 000000000000..ccc862f8aa47
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pywal/default.nix
@@ -0,0 +1,36 @@
+{ lib, buildPythonPackage, fetchPypi, imagemagick, feh, isPy3k }:
+
+buildPythonPackage rec {
+  pname = "pywal";
+  version = "3.3.0";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1drha9kshidw908k7h3gd9ws2bl64ms7bjcsa83pwb3hqa9bkspg";
+  };
+
+  preCheck = ''
+    mkdir tmp
+    HOME=$PWD/tmp
+  '';
+
+  patches = [
+    ./convert.patch
+    ./feh.patch
+  ];
+
+  # Invalid syntax
+  disabled = !isPy3k;
+
+  postPatch = ''
+    substituteInPlace pywal/backends/wal.py --subst-var-by convert "${imagemagick}/bin/convert"
+    substituteInPlace pywal/wallpaper.py --subst-var-by feh "${feh}/bin/feh"
+  '';
+
+  meta = with lib; {
+    description = "Generate and change colorschemes on the fly. A 'wal' rewrite in Python 3";
+    homepage = "https://github.com/dylanaraps/pywal";
+    license = licenses.mit;
+    maintainers = with maintainers; [ Fresheyeball ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/python-modules/pywal/feh.patch b/nixpkgs/pkgs/development/python-modules/pywal/feh.patch
new file mode 100644
index 000000000000..985e601d6257
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pywal/feh.patch
@@ -0,0 +1,39 @@
+commit c31faa212e09aa62c232d9008e05976b1cdc9ee5
+Author: Frederik Rietdijk <fridh@fridh.nl>
+Date:   Wed Dec 26 12:54:32 2018 +0100
+
+    nix: hardcode feh
+
+diff --git a/pywal/wallpaper.py b/pywal/wallpaper.py
+index ba61e66..fad34f7 100644
+--- a/pywal/wallpaper.py
++++ b/pywal/wallpaper.py
+@@ -47,27 +47,7 @@ def xfconf(path, img):
+ 
+ def set_wm_wallpaper(img):
+     """Set the wallpaper for non desktop environments."""
+-    if shutil.which("feh"):
+-        util.disown(["feh", "--bg-fill", img])
+-
+-    elif shutil.which("nitrogen"):
+-        util.disown(["nitrogen", "--set-zoom-fill", img])
+-
+-    elif shutil.which("bgs"):
+-        util.disown(["bgs", "-z", img])
+-
+-    elif shutil.which("hsetroot"):
+-        util.disown(["hsetroot", "-fill", img])
+-
+-    elif shutil.which("habak"):
+-        util.disown(["habak", "-mS", img])
+-
+-    elif shutil.which("display"):
+-        util.disown(["display", "-backdrop", "-window", "root", img])
+-
+-    else:
+-        logging.error("No wallpaper setter found.")
+-        return
++    return util.disown(["@feh@", "--bg-fill", img])
+ 
+ 
+ def set_desktop_wallpaper(desktop, img):