mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
home: services: home-sway-service-type: Enable extensions.
* gnu/home/services/sway.scm (%empty-sway-configuration): New value. (sway-combine): New procedure. (sway-compose): New procedure. (sway-extend): New procedure. (home-sway-service-type) [compose/extend]: New fields. * doc/guix.texi (Sway window manager): Document this. Change-Id: I548a18a6a273380be90c9b5b365f65a93cc02416 Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
0b0f8702ea
commit
aec2a05e35
2 changed files with 82 additions and 1 deletions
|
@ -50,7 +50,10 @@
|
|||
%sway-default-modes
|
||||
%sway-default-keybindings
|
||||
%sway-default-startup-programs
|
||||
%sway-default-packages))
|
||||
%sway-default-packages
|
||||
|
||||
;; Convenient value to inherit for extensions.
|
||||
%empty-sway-configuration))
|
||||
|
||||
;; Helper function.
|
||||
(define (flatmap f l)
|
||||
|
@ -894,9 +897,70 @@
|
|||
;;; Definition of the Home Service.
|
||||
;;;
|
||||
|
||||
(define %empty-sway-configuration
|
||||
(sway-configuration
|
||||
(variables '())
|
||||
(keybindings '())
|
||||
(gestures '())
|
||||
(packages '())
|
||||
(inputs '())
|
||||
(outputs '())
|
||||
(modes '())
|
||||
(startup+reload-programs '())
|
||||
(startup-programs '())))
|
||||
|
||||
(define (sway-configuration->files sway-conf)
|
||||
`((".config/sway/config" ,(sway-configuration->file sway-conf))))
|
||||
|
||||
(define (sway-combine config1 config2)
|
||||
(sway-configuration
|
||||
(keybindings (append (sway-configuration-keybindings config1)
|
||||
(sway-configuration-keybindings config2)))
|
||||
(gestures (append (sway-configuration-gestures config1)
|
||||
(sway-configuration-gestures config2)))
|
||||
(packages (append (sway-configuration-packages config1)
|
||||
(sway-configuration-packages config2)))
|
||||
(variables (append (sway-configuration-variables config1)
|
||||
(sway-configuration-variables config2)))
|
||||
(inputs (append (sway-configuration-inputs config1)
|
||||
(sway-configuration-inputs config2)))
|
||||
(outputs (append (sway-configuration-outputs config1)
|
||||
(sway-configuration-outputs config2)))
|
||||
(bar (let ((bar1 (sway-configuration-bar config1))
|
||||
(bar2 (sway-configuration-bar config2)))
|
||||
(if (eq? bar1 %unset-value)
|
||||
bar2
|
||||
(if (eq? bar2 %unset-value)
|
||||
bar1
|
||||
(throw "[Sway configuration] Too many bar configurations \
|
||||
have been found.")))))
|
||||
(modes (append (sway-configuration-modes config1)
|
||||
(sway-configuration-modes config2)))
|
||||
(startup+reload-programs
|
||||
(append (sway-configuration-startup+reload-programs config1)
|
||||
(sway-configuration-startup+reload-programs config2)))
|
||||
(startup-programs
|
||||
(append (sway-configuration-startup-programs config1)
|
||||
(sway-configuration-startup-programs config2)))
|
||||
(extra-content
|
||||
(append (sway-configuration-extra-content config1)
|
||||
(sway-configuration-extra-content config2)))))
|
||||
|
||||
(define (sway-compose lst)
|
||||
"Naive composition procedure for @code{home-sway-service-type}. Most fields
|
||||
of above configuration records are lists. The composition procedure simply
|
||||
concatenates them."
|
||||
(match lst
|
||||
(() %unset-value)
|
||||
((h) h)
|
||||
((h . t)
|
||||
(fold sway-combine h t))))
|
||||
|
||||
(define (sway-extend ini res)
|
||||
(if (eq? res %unset-value)
|
||||
ini
|
||||
(sway-combine ini res)))
|
||||
|
||||
(define home-sway-service-type
|
||||
(service-type
|
||||
(name 'home-sway-config)
|
||||
|
@ -905,6 +969,8 @@
|
|||
sway-configuration->files)
|
||||
(service-extension home-profile-service-type
|
||||
sway-configuration-packages)))
|
||||
(compose sway-compose)
|
||||
(extend sway-extend)
|
||||
(description "Configure Sway by providing a file
|
||||
@file{~/.config/sway/config}.")
|
||||
(default-value (sway-configuration))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue