From c79b0cdc921f86e4ca64367608a19ebbdb91bc4c Mon Sep 17 00:00:00 2001
From: ng0 <contact.ng0@cryptolab.net>
Date: Tue, 24 Jan 2017 15:57:13 +0000
Subject: [PATCH 2/2] gnu: Add i3lock-fancy.

* gnu/packages/wm.scm (i3lock-fancy): New variable.
---
 gnu/packages/wm.scm | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index 7ea5673bd..3d52caed6 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -41,6 +41,7 @@
   #:use-module (guix build-system perl)
   #:use-module (guix build-system python)
   #:use-module (gnu packages haskell)
+  #:use-module (gnu packages gawk)
   #:use-module (gnu packages base)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages perl)
@@ -410,6 +411,76 @@ i3lock, which is a simple screen locker like slock.  Features include:
 @end enumerate\n")
     (license license:bsd-3))))
 
+(define-public i3lock-fancy
+  (package
+    (name "i3lock-fancy")
+    (version "0.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/meskarune/i3lock-fancy/archive/"
+                           version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "020m7mnfq5cvir7p9v3hkb7cvb4cai33wppxl2zdwscwwjnchc5y"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ;No tests included
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (icons (string-append out "/share/i3lock-fancy/icons/"))
+                    (i3lock (string-append (assoc-ref inputs "i3lock-color")
+                                           "/bin/i3lock"))
+                    (wmctrl (string-append (assoc-ref inputs "wmctrl")
+                                           "/bin/wmctrl"))
+                    (mconvert (string-append (assoc-ref inputs "imagemagick")
+                                             "/bin/convert"))
+                    (mimport (string-append (assoc-ref inputs "imagemagick")
+                                            "/bin/import"))
+                    (awk (string-append (assoc-ref inputs "gawk")
+                                        "/bin/gawk")))
+
+               (substitute* "lock"
+                 (("if ! i3lock") (string-append "if ! " i3lock))
+                 (("i3lock -n") (string-append i3lock " -n"))
+                 (("$(which wmctrl)") wmctrl)
+                 (("convert") mconvert)
+                 (("shot=\\(import") (string-append "shot=\(" mimport))
+                 (("awk -F") (string-append awk " -F"))
+                 ((" awk") awk)
+                 (("\\$scriptpath/icons/") icons))
+               #t)))
+         (delete 'build)
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (icons (string-append out "/share/i3lock-fancy/icons/")))
+
+               (install-file "lock" bin)
+               (rename-file (string-append bin "/lock")
+                            (string-append bin "/i3lock-fancy"))
+               (copy-recursively "icons" icons)
+               #t))))))
+    (native-inputs
+     `(("imagemagick" ,imagemagick)
+       ("i3lock-color" ,i3lock-color)
+       ("wmctrl" ,wmctrl)
+       ("gawk" ,gawk)))
+    (home-page "https://github.com/meskarune/i3lock-fancy")
+    (synopsis "Screenlocker with screenshot function")
+    (description
+     "@code{i3lock-fancy} is a Bash script that takes a screenshot of
+the desktop, blurs the background and adds a lock icon and text.
+It makes use of @code{i3lock-color} and can optionally be passed any
+screenshot util like @code{scrot}.  This screenlocker can be used with
+any window manager or desktop environment.")
+    (license license:expat)))
+
 (define-public xmonad
   (package
     (name "xmonad")
-- 
2.13.0

