~abcdw/rde-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH] gnu: home-services: wm: Add XMonad service.

Details
Message ID
<f1bd666d73140e9cc7de77f898484b2f8226bbfc.1621965349.git.public@yoctocell.xyz>
DKIM signature
pass
Download raw message
Patch: +75 -1
* wm.scm (home-xmonad-configuration): New record type
(xmonad-profile-service, xmonad-files-service,
xmonad-environment-variables-service,
generate-home-xmonad-documentation): New procedures.
(home-xmonad-service-type): New service type
---
 gnu/home-services/wm.scm | 76 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 75 insertions(+), 1 deletion(-)

diff --git a/gnu/home-services/wm.scm b/gnu/home-services/wm.scm
index 26b74f0..a61958c 100644
--- a/gnu/home-services/wm.scm
+++ b/gnu/home-services/wm.scm
@@ -14,7 +14,10 @@
  #:use-module (ice-9 match)

  #:export (home-sway-service-type
	    home-sway-configuration))
	    home-sway-configuration

            home-xmonad-service-type
            home-xmonad-configuration))

;;; Commentary:
;;;
@@ -173,3 +176,74 @@ Install and configure Sway, a Wayland compositor compatible with i3.")))
   `((home-sway-configuration
      ,home-sway-configuration-fields))
   'home-sway-configuration))


;;;
;;; XMonad.
;;;

(define-configuration/no-serialization home-xmonad-configuration
  (package
    (package xmonad)
    "The XMonad package to use.")
  (xmonad-contrib?
   (boolean #f)
   "Whether to install the @code{ghc-xmonad-contrib} package, which
contains many third-party extensions for XMonad.")
  (xdg-flavor?
   (boolean #t)
   "Whether to respect XDG base directory, this will set the relevant
environment variables if enabled.")
  (config
   (text-config '())
   "List of strings or gexps containing the XMonad configuration, see
the @uref{https://xmonad.org/documentation.html, official XMonad
documentation} for how to configure it."))

(define xmonad-profile-service
  (match-lambda
    (($ <home-xmonad-configuration> _ package xmonad-contrib?)
     (if xmonad-contrib?
         (list package ghc-xmonad-contrib)
         (list package)))))

(define xmonad-files-service
  (match-lambda
    (($ <home-xmonad-configuration> _ package xmonad-contrib?
                                    xdg-flavor? config)
     (if (eq? config 'disabled)
         '()
         `((,(string-append (if xdg-flavor? "config/" "") "xmonad/xmonad.hs")
            ,(mixed-text-file "xmonad-config"
                              (serialize-text-config #f config))))))))

(define xmonad-environment-variables-service
  (match-lambda
    (($ <home-xmonad-configuration> _ package xmonad-contrib?
                                    xdg-flavor? config)
     (optional xdg-flavor?
               '(("XMONAD_CONFIG_DIR" . "$XDG_CONFIG_HOME/xmonad")
                 ("XMONAD_DATA_DIR" . "$XDG_DATA_HOME/xmonad")
                 ("XMONAD_CACHE_DIR" . "$XDG_CACHE_HOME/xmonad"))))))

(define home-xmonad-service-type
  (service-type (name 'home-xmonad)
                (extensions
                 ;; TODO: Extend `on-change' service.
                 (list (service-extension
                        home-profile-service-type
                        xmonad-profile-service)
                       (service-extension
                        home-files-service-type
                        xmonad-files-service)
                       (service-extension
                        home-environment-variables-service-type
                        xmonad-environment-variables-service)))
                (description "\
Install and configure XMonad, a window manager written in Haskell.")))

(define (generate-home-xmonad-documentation)
  (generate-documentation
   `((home-xmonad-configuration
      ,home-xmonad-configuration-fields))
   'home-xmonad-configuration))

base-commit: ad070db2339873b7bcae11d5b565a518ece27a46
-- 
2.31.1
Details
Message ID
<87cztbapu1.fsf@trop.in>
In-Reply-To
<f1bd666d73140e9cc7de77f898484b2f8226bbfc.1621965349.git.public@yoctocell.xyz> (view parent)
DKIM signature
missing
Download raw message
Seems Xmonad already supports XDG base directories, no need to set
environment variables.

https://github.com/xmonad/xmonad/blob/master/src/XMonad/Core.hs#L502

I didn't test those changes, but the code looks good to me.  Applied.
Thank you for the patch)
Details
Message ID
<87v972ejkj.fsf@yoctocell.xyz>
In-Reply-To
<87cztbapu1.fsf@trop.in> (view parent)
DKIM signature
pass
Download raw message
On Fri, May 28 2021, Andrew Tropin wrote:

> Seems Xmonad already supports XDG base directories, no need to set
> environment variables.
>
> https://github.com/xmonad/xmonad/blob/master/src/XMonad/Core.hs#L502

Ah, good catch, I will remove the relevant parts.
Reply to thread Export thread (mbox)