Subject: add xftwidth displayed textwidth calculator package
From: Kyle Andrews <[email-masked]>
To: [email-masked]
Date: Thu, 19 Sep 2019 20:25:42 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello,

I'd like to provide a package definition for the xftwidth calculator
utility so that it may be included into guix. Please see the attached
patch. 

Regards,

Kyle Andrews

From 60deaa526b4a6ca5a66f3b67ba77aa353409d542 Mon Sep 17 00:00:00 2001
From: Kyle Andrews <[email-masked]>
Date: Thu, 19 Sep 2019 20:16:28 -0400
Subject: [PATCH] gnu: Add xftwidth.

* gnu/packages/wm.scm: added xftwidth package.
---
 gnu/packages/wm.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index e19c6c1438..3e321eeb1c 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -209,6 +209,45 @@ or musca).
     (home-page "https://herbstluftwm.org")
     (license license:bsd-2)))
 
+(define-public xftwidth
+  (package
+    (name "xftwidth")
+    (version "20170402")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+	     (url "https://github.com/vixus0/xftwidth")
+	     (commit "35ff963908d41a8a6a7101c434c88255728025ee")))
+       (sha256
+	(base32
+	 "1jwl25785li24kbp0m1wxfwk4dgxkliynn03nsj813cjr34kq16h"))
+       (file-name (string-append name "-" version "-checkout"))))
+    (build-system gnu-build-system)
+    (inputs `(("freetype"    ,freetype)
+              ("libx11"      ,libx11)
+              ("fontconfig"  ,fontconfig)
+              ("libxft"      ,libxft)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-makefile ; /usr/bin doesn't show up in PATH
+           (lambda _ (substitute* "Makefile" (("usr/") "")) #t))
+         (delete 'check) ; no check included in Makefile
+         (delete 'configure))
+       #:make-flags
+       (let ((out (assoc-ref %outputs "out")))
+         (list (string-append "DESTDIR=" out)))))
+    (synopsis "Calculator for determining displayed text widths using Xft fonts.")
+    (description "A small C program to calculate pixel widths for displayed
+text using Xft fonts (given a specific font name and size). It is ideal for
+scripts including text into the custom (e.g. dzen and xmobar based) panels
+often used in conjunction with minimalistic window managers.")
+    (home-page "http://github.com/vixus0/xftwidth")
+    (license license:expat)))
+
 (define-public i3status
   (package
     (name "i3status")
-- 
2.23.0