Subject: Re: [bug#27083] screen-lockers: i3lock-color and i3lock-fancy

From: ng0 <[email-masked]>
Date: Sun, 19 Nov 2017 11:04:00 +0000

ng0 transcribed 35K bytes:
> ng0 transcribed 25K bytes:
> > ng0 transcribed 23K bytes:
> > > ng0 transcribed 22K bytes:
> > > > New version appended. i3lock-fancy needs some fixes, but I can confirm
> > > > that i3lock-color works!
> > > 
> > > in i3lock-fancy script:
> > > 
> > > # try to use a forked version of i3lock with prepared parameters
> > > if ! /gnu/store/kfymvwgm4g0avs3b97micq8477sa0if6-i3lock-color-2.9.1-c/bin/i3lock "${param_add[@]}" "${param[@]}" -i "$image" > /dev/null 2>&1; then
> > >     # We have failed, lets get back to stock one
> > >     i3lock "${param_add[@]}" -i "$image"
> > > fi
> > > 
> > > 
> > > Would /run/current-system/profile/bin/i3lock-fancy be better?
> > > The most realistic scenario I see is to just set 'i3lock' and
> > > propagate i3lock-color with i3lock-fancy.
> 
> I've changed my mind. As there's also 'i3lock' (without the -color suffix)
> but we don't package it (yet), it would take away the freedom to
> decide which i3lock you want to use.
> The author of i3lock-fancy wantsus to use i3lock-color, but there's
> also a check and it falls back to the normal i3lock.
> 
> Therefore I think it must be up to people using i3lock-fancy to
> install i3lock-color AND i3lock-fancy in their system profile
> (or just i3lock-color in systemprofile + suid it, and i3lock-fancy
> in the user profile).
> 
> 3rd version of patches appended.
> 
> > I have just copied /run/current-system/profile/bin/i3lock-fancy to $HOME/i3lock-fancy
> > and changed the /gnu/store/kfymvwgm4g0avs3b97micq8477sa0if6-i3lock-color-2.9.1-c/bin/i3lock
> > bit to read just "i3lock". This way i3lock-fancy works for me.
> > There's a general 'lag' in both i3lock-color and i3lock-fancy, but
> > I blame my Desktop.
> > 
> > I'll send an update soon.
> > 

> From ba2a83195afb10ca7c65833f81cdc10748212873 Mon Sep 17 00:00:00 2001
> From: ng0 <[email-masked]>
> Date: Tue, 24 Jan 2017 13:03:42 +0000
> Subject: [PATCH 1/2] gnu: Add i3lock-color.
> 
> * gnu/packages/wm.scm (i3lock-color): New variable.
> ---
>  gnu/local.mk        |  1 +
>  gnu/packages/wm.scm | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 69 insertions(+)
> 
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 54d1ac91c..2ec5844dc 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -744,6 +744,7 @@ dist_patch_DATA =						\
>    %D%/packages/patches/hubbub-sort-entities.patch		\
>    %D%/packages/patches/hurd-fix-eth-multiplexer-dependency.patch        \
>    %D%/packages/patches/hydra-disable-darcs-test.patch		\
> +  %D%/packages/patches/i3lock-color-fix-makefile.patch          \
>    %D%/packages/patches/icecat-avoid-bundled-libraries.patch	\
>    %D%/packages/patches/icecat-bug-1348660-pt5.patch		\
>    %D%/packages/patches/icecat-bug-1415133.patch			\
> diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
> index 62a5b5460..e4db72a6f 100644
> --- a/gnu/packages/wm.scm
> +++ b/gnu/packages/wm.scm
> @@ -68,6 +68,7 @@
>    #:use-module (gnu packages gperf)
>    #:use-module (gnu packages imagemagick)
>    #:use-module (gnu packages lua)
> +  #:use-module (gnu packages linux)
>    #:use-module (gnu packages suckless)
>    #:use-module (guix download)
>    #:use-module (guix git-download))
> @@ -335,6 +336,73 @@ and locate windows on all your workspaces, using an interactive dmenu
>  prompt.")
>        (license (license:non-copyleft "http://www.wtfpl.net/txt/copying/")))))
>  
> +(define-public i3lock-color
> +  (package
> +    (name "i3lock-color")
> +    (version "2.9.1-c")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (string-append "https://github.com/chrjguill/i3lock-color/"
> +                           "archive/" version ".tar.gz"))
> +       (file-name (string-append name "-" version ".tar.gz"))
> +       (sha256
> +        (base32
> +         "18ql0kb24qlqsijs6j99algf2lprl78mzsz53b1hshmc8jjd4m27"))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:tests? #f ; No tests included.
> +       #:make-flags (list "CC=gcc")
> +       #:phases
> +       (modify-phases %standard-phases
> +         (replace 'configure
> +           (lambda* (#:key outputs inputs #:allow-other-keys)
> +             (let* ((out (assoc-ref outputs "out"))
> +                    (etc (string-append out "/etc"))
> +                    (man (string-append out "/share/man"))
> +                    (xkb (assoc-ref inputs "libxkbcommon"))
> +                    (xkbheader (string-append xkb
> +                                              "/include/xkbcommon/"
> +                                              "xkbcommon-compose.h")))
> +               (substitute* "Makefile"
> +                 (("PKG_CONFIG=pkg-config")
> +                  (string-append "PKG_CONFIG="
> +                                 (which "pkg-config")))
> +                 (("/usr/include/xkbcommon/xkbcommon-compose.h")
> +                  xkbheader)
> +                 (("PREFIX=/usr")
> +                  (string-append "PREFIX=" out))
> +                 (("SYSCONFDIR=/etc")
> +                  (string-append "SYSCONFDIR=" etc))
> +                 (("MANDIR=/usr/share/man")
> +                  (string-append "MANDIR=" man)))
> +               #t))))))
> +    (inputs
> +     `(("xcb-util-image" ,xcb-util-image)
> +       ("xcb-util-keysyms" ,xcb-util-keysyms)
> +       ("xcb-util" ,xcb-util)
> +       ("libxcb" ,libxcb)
> +       ("linux-pam" ,linux-pam)
> +       ("libev" ,libev)
> +       ("libx11" ,libx11)
> +       ("cairo" ,cairo)))
> +    (native-inputs
> +     `(("libxkbcommon" ,libxkbcommon)
> +       ("pkg-config" ,pkg-config)
> +       ("which" ,which)))
> +    (home-page "https://github.com/chrjguill/i3lock-color")
> +    (synopsis "Screenlocker with color configuration support")
> +    (description
> +     "I3lock-color is a screen locker.  It is a re-patched version of
> +i3lock, which is a simple screen locker like slock.  Features include:
> +
> +@enumerate
> +@item forking process, the locked screen is preserved when you suspend from RAM
> +@item specify background color or PNG image to be displayed in the lock screen
> +@item many additional color options
> +@end enumerate\n")
> +    (license license:bsd-3)))
> +
>  (define-public xmonad
>    (package
>      (name "xmonad")
> -- 
> 2.15.0
> 

> From 63e4eff6e954361a7b30fb4c060bdecbfee56da3 Mon Sep 17 00:00:00 2001
> From: ng0 <[email-masked]>
> 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 | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 67 insertions(+)
> 
> diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
> index e4db72a6f..01faf8149 100644
> --- a/gnu/packages/wm.scm
> +++ b/gnu/packages/wm.scm
> @@ -44,6 +44,7 @@
>    #:use-module (gnu packages haskell)
>    #:use-module (gnu packages haskell-check)
>    #:use-module (gnu packages haskell-web)
> +  #:use-module (gnu packages gawk)
>    #:use-module (gnu packages base)
>    #:use-module (gnu packages pkg-config)
>    #:use-module (gnu packages perl)
> @@ -403,6 +404,72 @@ 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/"))
> +                    (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"
> +                 (("$(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)

i3lock-color should be removed before commiting this patch,
and we should add a note about this to the description. Like:
"You will need to install i3lock or one of its variants (like
i3lock-color) to make use of i3lock-fancy."

> +       ("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.15.0
> 

I'll contribute a Makefile upstream so that we can shorten the package definition.

-- 
GnuPG: A88C8ADD129828D7EAC02E52E22F9BBFEE348588
GnuPG: https://dl.n0.is/dist/keys/
  WWW: https://we.make.ritual.n0.is