guile-wm.scm 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2016 Alex ter Weele <alex.ter.weele@gmail.com>
  4. ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
  5. ;;; Copyright © 2017 Nils Gillmann <ng0@n0.is>
  6. ;;;
  7. ;;; This file is part of GNU Guix.
  8. ;;;
  9. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  10. ;;; under the terms of the GNU General Public License as published by
  11. ;;; the Free Software Foundation; either version 3 of the License, or (at
  12. ;;; your option) any later version.
  13. ;;;
  14. ;;; GNU Guix is distributed in the hope that it will be useful, but
  15. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;;; GNU General Public License for more details.
  18. ;;;
  19. ;;; You should have received a copy of the GNU General Public License
  20. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  21. (define-module (gnu packages guile-wm)
  22. #:use-module (guix licenses)
  23. #:use-module (gnu packages)
  24. #:use-module (gnu packages xorg)
  25. #:use-module (gnu packages guile)
  26. #:use-module (gnu packages pkg-config)
  27. #:use-module (gnu packages texinfo)
  28. #:use-module (guix packages)
  29. #:use-module (guix download)
  30. #:use-module (guix git-download)
  31. #:use-module (guix build-system gnu))
  32. (define-public guile-xcb
  33. (let ((commit "db7d5a393cc37a56f66541b3f33938b40c6f35b3")
  34. (revision "1"))
  35. (package
  36. (name "guile-xcb")
  37. (version (git-version "1.3" revision commit))
  38. (source (origin
  39. (method git-fetch)
  40. (uri (git-reference
  41. (url "https://github.com/mwitmer/guile-xcb")
  42. (commit commit)))
  43. (file-name (git-file-name name version))
  44. (sha256
  45. (base32
  46. "16w4vgzbmnwih4bgfn8rw85ryfvzhc6hyly6bic9sd7hhc82rcnd"))))
  47. (build-system gnu-build-system)
  48. (arguments '(;; Parallel builds fail.
  49. #:parallel-build? #f
  50. #:configure-flags (list (string-append
  51. "--with-guile-site-dir="
  52. (assoc-ref %outputs "out")
  53. "/share/guile/site/2.2")
  54. (string-append
  55. "--with-guile-site-ccache-dir="
  56. (assoc-ref %outputs "out")
  57. "/lib/guile/2.2/site-ccache"))))
  58. (native-inputs `(("pkg-config" ,pkg-config)
  59. ("texinfo" ,texinfo)))
  60. (inputs `(("guile" ,guile-2.2)
  61. ("xcb" ,xcb-proto)))
  62. (home-page "https://github.com/mwitmer/guile-xcb")
  63. (synopsis "XCB bindings for Guile")
  64. (description
  65. "Guile-XCB implements the XCB protocol and provides all the tools
  66. necessary to write X client code in Guile Scheme without any external
  67. dependencies.")
  68. (license gpl3+))))
  69. (define-public guile-wm
  70. (let ((commit "f3c7b3be719f425ffb87265d34855a73366351be")
  71. (revision "1"))
  72. (package
  73. (name "guile-wm")
  74. (version (git-version "1.0" revision commit))
  75. (synopsis "X11 window manager toolkit in Scheme")
  76. (source (origin
  77. (method git-fetch)
  78. (uri (git-reference
  79. (url "https://github.com/mwitmer/guile-wm")
  80. (commit commit)))
  81. (file-name (git-file-name name version))
  82. (sha256
  83. (base32
  84. "086dijnpl5dpglf70d6f9sizyakr313y7blpdjrmbi687j1x3qcl"))))
  85. (build-system gnu-build-system)
  86. (arguments
  87. `( ;; The '.scm' files go to $(datadir), so set that to the
  88. ;; standard value.
  89. #:configure-flags (list (string-append "--datadir="
  90. (assoc-ref %outputs "out")
  91. "/share/guile/site/2.2"))
  92. #:phases
  93. (modify-phases %standard-phases
  94. (add-before 'configure 'set-go-directory
  95. (lambda* (#:key outputs #:allow-other-keys)
  96. ;; Install .go files to $out/share/guile/site/2.2.
  97. (let ((out (assoc-ref outputs "out")))
  98. (substitute* "module/Makefile.in"
  99. (("^wmdir = .*$")
  100. (string-append "wmdir = " out
  101. "/share/guile/site/2.2\n"))))
  102. #t))
  103. (add-after 'install 'set-load-path
  104. (lambda* (#:key inputs outputs #:allow-other-keys)
  105. ;; Put Guile-XCB's and Guile-WM's modules in the
  106. ;; search path of PROG.
  107. (let* ((out (assoc-ref outputs "out"))
  108. (prog (string-append out "/bin/guile-wm"))
  109. (mods (string-append
  110. out "/share/guile/site/2.2"))
  111. (xcb (string-append
  112. (assoc-ref inputs "guile-xcb")
  113. "/share/guile/site/2.2")))
  114. (wrap-program
  115. prog
  116. `("GUILE_LOAD_PATH" ":" prefix (,mods ,xcb))
  117. `("GUILE_LOAD_COMPILED_PATH" ":" prefix
  118. (,mods ,xcb))))
  119. #t))
  120. (add-after 'install 'install-xsession
  121. (lambda* (#:key outputs #:allow-other-keys)
  122. ;; add a .desktop file to xsessions
  123. (let ((xsessions (string-append
  124. %output "/share/xsessions")))
  125. (mkdir-p xsessions)
  126. (call-with-output-file (string-append
  127. xsessions "/guile-wm.desktop")
  128. (lambda (port)
  129. (format port
  130. "[Desktop Entry]~@
  131. Name=~a~@
  132. Comment=~a~@
  133. Exec=~a/bin/guile-wm~@
  134. Type=Application~%"
  135. ,name ,synopsis %output))))
  136. #t)))))
  137. (native-inputs `(("pkg-config" ,pkg-config)
  138. ("texinfo" ,texinfo)))
  139. (inputs `(("guile" ,guile-2.2)
  140. ("guile-xcb" ,guile-xcb)))
  141. (home-page "https://github.com/mwitmer/guile-wm/releases")
  142. (description
  143. "Guile-WM is a simple window manager that's completely customizable—you
  144. have total control of what it does by choosing which modules to include.
  145. Included with it are a few modules that provide basic TinyWM-like window
  146. management, some window record-keeping, multi-monitor support, and emacs-like
  147. keymaps and minibuffer. At this point, it's just enough to get you started.")
  148. (license gpl3+))))