aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--oni/home/config/pop-os.scm10
-rw-r--r--oni/home/services/stumpwm.scm44
-rw-r--r--oni/home/services/stumpwm/playerctl.lisp6
3 files changed, 57 insertions, 3 deletions
diff --git a/oni/home/config/pop-os.scm b/oni/home/config/pop-os.scm
index f6a798b..9283c34 100644
--- a/oni/home/config/pop-os.scm
+++ b/oni/home/config/pop-os.scm
@@ -33,7 +33,9 @@
home-stumpwm-gaps-service-type
home-stumpwm-gaps-configuration
home-stumpwm-stumptray-service-type
- home-stumpwm-stumptray-configuration))
+ home-stumpwm-stumptray-configuration
+ home-stumpwm-playerctl-service-type
+ home-stumpwm-playerctl-configuration))
#:use-module (oni home services zsh)
#:use-module ((oni packages emacs)
#:select (emacs-php-ts-mode))
@@ -156,4 +158,8 @@
(configurations
(list (mixed-text-file "config-stumptray"
"(require 'stumptray)\n"
- "(stumptray::stumptray)\n"))))))))
+ "(stumptray::stumptray)\n")))))
+ (service home-stumpwm-playerctl-service-type
+ (home-stumpwm-playerctl-configuration
+ (configurations
+ (list (local-file "../services/stumpwm/playerctl.lisp"))))))))
diff --git a/oni/home/services/stumpwm.scm b/oni/home/services/stumpwm.scm
index 3b60a03..56d1ae3 100644
--- a/oni/home/services/stumpwm.scm
+++ b/oni/home/services/stumpwm.scm
@@ -8,6 +8,8 @@
serialize-text-config))
#:use-module ((gnu packages lisp)
#:select (sbcl))
+ #:use-module ((gnu packages music)
+ #:select (playerctl))
#:use-module ((gnu packages wm)
#:select (stumpwm
stumpish
@@ -38,7 +40,10 @@
home-stumpwm-gaps-configuration
home-stumpwm-stumptray-service-type
- home-stumpwm-stumptray-configuration))
+ home-stumpwm-stumptray-configuration
+
+ home-stumpwm-playerctl-service-type
+ home-stumpwm-playerctl-configuration))
(define (serialize-integer field value)
"")
@@ -193,3 +198,40 @@
(compose identity)
(default-value (home-stumpwm-stumptray-configuration))
(description "Install and configure stumpwm-stumptray.")))
+
+(define-configuration/no-serialization home-stumpwm-playerctl-configuration
+ (package
+ (package playerctl)
+ "Package to use for setting playerctl in stumpwm.")
+ (configurations
+ (text-config '())
+ "Configuration for playerctl in stumpwm."))
+
+(define (add-stumpwm-playerctl-packages config)
+ (list (home-stumpwm-playerctl-configuration-package config)))
+
+(define (add-stumpwm-playerctl config)
+ (home-stumpwm-extension
+ (configurations
+ (append
+ (list
+ (mixed-text-file
+ "playerctl.lisp"
+ "(defvar *playerctl-program* \""
+ (home-stumpwm-playerctl-configuration-package config)
+ "/bin/playerctl\")\n"))
+ (home-stumpwm-playerctl-configuration-configurations config)))))
+
+(define home-stumpwm-playerctl-service-type
+ (service-type
+ (name 'home-stumpwm-playerctl)
+ (extensions
+ (list (service-extension
+ home-stumpwm-service-type
+ add-stumpwm-playerctl)
+ (service-extension
+ home-profile-service-type
+ add-stumpwm-playerctl-packages)))
+ (compose identity)
+ (default-value (home-stumpwm-playerctl-configuration))
+ (description "Install and configure playerctl in stumpwm.")))
diff --git a/oni/home/services/stumpwm/playerctl.lisp b/oni/home/services/stumpwm/playerctl.lisp
new file mode 100644
index 0000000..0e56454
--- /dev/null
+++ b/oni/home/services/stumpwm/playerctl.lisp
@@ -0,0 +1,6 @@
+(defvar *playerctl-bindings*
+ (let ((m (make-sparse-keymap)))
+ (define-key m (kbd "SPC") (format nil "exec ~a play-pause" *playerctl-program*))
+ m))
+
+(define-key *user-bindings* (kbd "p") '*playerctl-bindings*)