Subject: stumpwm-contrib

From: Nam Nguyen <[email-masked]>
Date: Fri, 14 Dec 2018 18:50:31 -0800

I am trying to make stumpwm-contrib less of a "grab bag" and more modular
and well-tested by breaking all the stumpwm extensions/modules into
separate recipes.

stumpwm-contrib deletes the source code and child
recipes copies their source code from their directory to
$(out)/share/common-lisp/stumpwm-contrib.

To test this, install stumpwm and stumpwm-cpu.

~/.stumpwmrc
********************************************************************************
(set-module-dir "~/.guix-profile/share/common-lisp/sbcl-bundle-systems")
(load-module "cpu")

(setf *screen-mode-line-format* '("%c %C %t %f [%n] %W"))

;; %c (CPU usage as %)
;; %C (CPU usage as bar graph)
;; %t (CPU temperature)
;; %f (CPU frequency)
********************************************************************************

To toggle the mode-line:
C-t semicolon mode-line <RET>

I violated the "Don't Repeat Yourself" (DRY) principle and have
stumpwm-{battery-portable,cpu,mem,pinentry,winner-mode} all tested and
working. I will postpone submission of those until stumpwm-cpu has been
accepted. All these submodules are nearly identical with only different
cat and mod variables. pinentry has some additional inputs. This results
in a lot of repeated code that looks nearly identical to stumpwm-cpu.

Another concern I had was for ~/.stumpwmrc, including sbcl-bundle-systems
(which contains symlinks to the compiled code) is necessary for
stumpwm-pinentry to work correctly. The other plugins can just use the
stumpwm-contrib directory I created.

;; (set-module-dir "~/.guix-profile/share/common-lisp/stumpwm-contrib")
(set-module-dir "~/.guix-profile/share/common-lisp/sbcl-bundle-systems")

Documentation (org-mode files) can be found in the stumpwm-contrib
directory.

Here is the general directory structure:
********************************************************************************
/home/user/.guix-profile/share/common-lisp:
 .
 ..
 sbcl-bundle-systems
 stumpwm-contrib

/home/user/.guix-profile/share/common-lisp/sbcl-bundle-systems:
 .
 ..
 battery-portable.asd -> /gnu/store/...-stumpwm-battery-portable-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/battery-portable.asd
 cpu.asd -> /gnu/store/...-stumpwm-cpu-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/cpu.asd
 mem.asd -> /gnu/store/...-stumpwm-mem-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/mem.asd
 pinentry.asd -> /gnu/store/...-stumpwm-pinentry-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/pinentry.asd
 swm-gaps.asd -> /gnu/store/...-stumpwm-gaps-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/swm-gaps.asd
 winner-mode.asd -> /gnu/store/...-stumpwm-winner-mode-0.0.1-1.bd47cec/share/common-lisp/sbcl-bundle-systems/winner-mode.asd

/home/user/.guix-profile/share/common-lisp/stumpwm-contrib:
 .
 ..
 battery-portable -> /gnu/store/...-stumpwm-battery-portable-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/battery-portable
 cpu -> /gnu/store/...-stumpwm-cpu-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/cpu
 mem -> /gnu/store/...-stumpwm-mem-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/mem
 pinentry -> /gnu/store/...-stumpwm-pinentry-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/pinentry
 swm-gaps -> /gnu/store/...-stumpwm-gaps-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/swm-gaps
 winner-mode -> /gnu/store/...-stumpwm-winner-mode-0.0.1-1.bd47cec/share/common-lisp/stumpwm-contrib/winner-mode

/home/user/.guix-profile/share/common-lisp/stumpwm-contrib/cpu:
 .
 ..
 cpu.asd
 cpu.lisp
 package.lisp
 README.org
********************************************************************************

Summary of questions:
1. Should the entire repository be bundled together instead of breaking
it into individual modules?
2. Should asdf-build-system/source be used instead of sbcl?  I had initially
copied the entire repository with all the source code, and it still worked.
3. Is there a way to by more DRY?
4. Should the stumpwm-contrib directory be named sbcl-sources (can't
recall the default directory of asdf-build-system/source)?