guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] gnu: wm: Add quickswitch-i3.


From: Ivan Vilata i Balaguer
Subject: [PATCH 2/2] gnu: wm: Add quickswitch-i3.
Date: Wed, 21 Sep 2016 11:19:20 +0200
User-agent: Mutt/1.7.0 (2016-08-17)

Thanks to Brendan Tildesley, Leo Famulari, Hartmut Goebel and Alex Kost for
testing and advice.

* gnu/packages/wm.scm (quickswitch-i3): New variable.
---
 .../patches/quickswitch-fix-dmenu-check.patch      | 32 +++++++++++++++
 gnu/packages/wm.scm                                | 45 ++++++++++++++++++++++
 2 files changed, 77 insertions(+)
 create mode 100644 gnu/packages/patches/quickswitch-fix-dmenu-check.patch

diff --git a/gnu/packages/patches/quickswitch-fix-dmenu-check.patch 
b/gnu/packages/patches/quickswitch-fix-dmenu-check.patch
new file mode 100644
index 0000000..9c6cca4
--- /dev/null
+++ b/gnu/packages/patches/quickswitch-fix-dmenu-check.patch
@@ -0,0 +1,32 @@
+Fix check for dmenu (open file mode, dependency on which).
+
+See <https://github.com/proxypoke/quickswitch-for-i3/pull/24>.
+
+--- quickswitch-i3-2.2/quickswitch.py  2016-09-18 19:59:10.257765542 +0200
++++ quickswitch-i3-2.2/quickswitch.py  2016-09-21 10:43:01.277577819 +0200
+@@ -24,9 +24,10 @@
+ 
+ import argparse
+ import subprocess
+-import os
+ import re
+ 
++from distutils.spawn import find_executable
++
+ try:
+     import i3
+ except ImportError:
+@@ -37,11 +38,8 @@
+ 
+ def check_dmenu():
+     '''Check if dmenu is available.'''
+-    devnull = open(os.devnull)
+-    retcode = subprocess.call(["which", "dmenu"],
+-                              stdout=devnull,
+-                              stderr=devnull)
+-    return True if retcode == 0 else False
++    executable = find_executable("dmenu")
++    return executable != None
+ 
+ 
+ def dmenu(options, dmenu):
diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index ea73d26..af29c6e 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -59,6 +59,7 @@
   #:use-module (gnu packages gperf)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages lua)
+  #:use-module (gnu packages suckless)
   #:use-module (guix download)
   #:use-module (guix git-download))
 
@@ -245,6 +246,50 @@ subscribe to events.")
 (define-public python2-i3-py
   (package-with-python2 python-i3-py))
 
+(define-public quickswitch-i3
+  (let ((commit "ed692b1e8f43b95bd907ced26238ce8ccb2ed28f")
+        (revision "1")) ; Guix package revision
+      (package
+        (name "quickswitch-i3")
+        (version (string-append "2.2-" revision "."
+                                (string-take commit 7)))
+        (source
+         (origin
+           ;; The latest commit is a few years old and just a couple commits
+           ;; after the last tagged release, so we use that latest commit
+           ;; instead of the release.
+           (method git-fetch)
+           (uri (git-reference
+                 (url "https://github.com/proxypoke/quickswitch-for-i3.git";)
+                 (commit commit)))
+           (sha256
+            (base32
+             "0447077sama80jcdg5p64zjsvafmz5rbdrirhm1adcdjhkh6iqc5"))
+           (patches (search-patches "quickswitch-fix-dmenu-check.patch"))
+           (file-name (string-append name "-" version "-checkout"))))
+        (build-system python-build-system)
+        (arguments
+         `(#:tests? #f ; no tests yet
+           #:phases (modify-phases %standard-phases
+                      (add-after 'install 'install-doc
+                        ;; Copy readme file to documentation directory.
+                        (lambda* (#:key outputs #:allow-other-keys)
+                          (let ((doc (string-append (assoc-ref outputs "out")
+                                                    "/share/doc/" ,name)))
+                            (install-file "README.rst" doc)
+                            ;; Avoid unspecified return value.
+                            #t))))))
+        (propagated-inputs
+         `(("python-i3-py" ,python-i3-py)
+           ("dmenu" ,dmenu)))
+        (home-page "https://github.com/proxypoke/quickswitch-for-i3";)
+        (synopsis "Quickly change to and locate windows in the i3 window 
manager")
+        (description "This utility for the i3 window manager allows you to 
quickly
+switch to and locate windows on all your workspaces, using an interactive
+dmenu prompt.  It has since gained a lot of other functionality to make
+working with i3 even more efficient.")
+        (license (license:non-copyleft "http://www.wtfpl.net/txt/copying/";)))))
+
 (define-public xmonad
   (package
     (name "xmonad")
-- 
2.10.0


-- 
Ivan Vilata i Balaguer -- https://elvil.net/

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]