aboutsummaryrefslogtreecommitdiffstats
path: root/oni/home/services/stumpwm.scm
diff options
context:
space:
mode:
Diffstat (limited to 'oni/home/services/stumpwm.scm')
-rw-r--r--oni/home/services/stumpwm.scm45
1 files changed, 44 insertions, 1 deletions
diff --git a/oni/home/services/stumpwm.scm b/oni/home/services/stumpwm.scm
index 5f1a298..3b60a03 100644
--- a/oni/home/services/stumpwm.scm
+++ b/oni/home/services/stumpwm.scm
@@ -19,6 +19,9 @@
home-profile-service-type
home-xdg-configuration-files-service-type
home-run-on-change-service-type))
+ #:use-module ((gnu home services shepherd)
+ #:select (home-shepherd-service-type
+ shepherd-service))
#:use-module ((guix gexp)
#:select (local-file
gexp
@@ -37,6 +40,9 @@
home-stumpwm-stumptray-service-type
home-stumpwm-stumptray-configuration))
+(define (serialize-integer field value)
+ "")
+
(define-configuration/no-serialization home-stumpwm-extension
(configurations
(text-config '())
@@ -49,6 +55,9 @@
(configurations
(text-config '())
"The configuration to apply.")
+ (startup-delay
+ (integer 10)
+ "The number of seconds to wait for stumpwm to start up.")
(stumpish-package
(package stumpish)
"Package to use for setting Stumpish"))
@@ -75,6 +84,36 @@
`(("files/.config/stumpwm/config"
,#~(system* #$(file-append stumpish "/bin/stumpish") "reload"))))
+;; (define (stumpwm-mode-line-service config)
+;; (list (shepherd-service
+;; (documentation "Try and find out if the stumpwm mode line is enabled.")
+;; (provision '(stumpwm-mode-line statusbar))
+;; (modules '((ice-9 textual-ports)
+;; (srfi srfi-1)))
+;; (start
+;; #~(lambda ()
+;; (let loop ((attempts #$(home-stumpwm-configuration-startup-delay config)))
+;; (let* ((input+output (pipe))
+;; ;; Use the timeout command here to stop it.
+;; (pid (spawn "timeout" '("timeout" "1" "stumpish" "eval" "(print (let ((ml (stumpwm::head-mode-line (current-head)))) (and ml (not (eq (stumpwm::mode-line-mode ml) :hidden)))))")
+;; #:output (cdr input+output))))
+;; (let ((result (string= "T" (string-trim-right (get-string-all (car input+output))))))
+;; (close-port (car input+output))
+;; (close-port (cdr input+output))
+;; (waitpid pid)
+;; (if result
+;; result
+;; (if (zero? attempts)
+;; (begin
+;; (format (current-error-port)
+;; "Stumpwm mode line did not show up; giving up.\n")
+;; #f)
+;; (begin
+;; (sleep 1)
+;; (loop (- attemps 1))))))))))
+;; (stop #~(lambda (_) #f))
+;; (respawn? #f))))
+
(define home-stumpwm-service-type
(service-type
(name 'home-stumpwm)
@@ -87,7 +126,11 @@
home-stumpwm-config-files)
(service-extension
home-run-on-change-service-type
- reload-stumpwm-config-gexp)))
+ reload-stumpwm-config-gexp)
+ ;; (service-extension
+ ;; home-shepherd-service-type
+ ;; stumpwm-mode-line-service)
+ ))
(compose identity)
(extend home-stumpwm-extensions)
(default-value (home-stumpwm-configuration))