mirror of
https://codeberg.org/hako/Rosenthal.git
synced 2026-04-14 22:04:33 +00:00
home: services: gtk[234]: Set up environment variables and files only when needed.
* modules/rosenthal/home/services/gtk.scm (home-gtk2-environment-variables) (home-gtk2-xdg-configuration-files, home-gtk3-xdg-configuration-files) (home-gtk4-xdg-configuration-files): Return empty list when there's no configuration. Fixes: #53
This commit is contained in:
parent
4811a4f315
commit
6517fe1c32
@ -14,37 +14,45 @@
|
||||
home-gtk3-service-type
|
||||
home-gtk4-service-type))
|
||||
|
||||
(define home-gtk2-environment-variables
|
||||
;; https://wiki.archlinux.org/title/XDG_Base_Directory
|
||||
'(("GTK2_RC_FILES" . "$XDG_CONFIG_HOME/gtk-2.0/gtkrc")))
|
||||
(define (home-gtk2-environment-variables config)
|
||||
(if (null? config)
|
||||
'()
|
||||
;; https://wiki.archlinux.org/title/XDG_Base_Directory
|
||||
'(("GTK2_RC_FILES" . "$XDG_CONFIG_HOME/gtk-2.0/gtkrc"))))
|
||||
|
||||
(define (home-gtk2-xdg-configuration-files config)
|
||||
`(("gtk-2.0/gtkrc"
|
||||
,(computed-file "gtkrc"
|
||||
#~(begin
|
||||
(use-modules (ice-9 match))
|
||||
(call-with-output-file #$output
|
||||
(lambda (port)
|
||||
(for-each (match-lambda
|
||||
((key . val)
|
||||
(format port "~a = ~a~%" key val)))
|
||||
'#$config))))
|
||||
#:options '(#:substitutable? #f)))))
|
||||
(if (null? config)
|
||||
'()
|
||||
`(("gtk-2.0/gtkrc"
|
||||
,(computed-file "gtkrc"
|
||||
#~(begin
|
||||
(use-modules (ice-9 match))
|
||||
(call-with-output-file #$output
|
||||
(lambda (port)
|
||||
(for-each (match-lambda
|
||||
((key . val)
|
||||
(format port "~a = ~a~%" key val)))
|
||||
'#$config))))
|
||||
#:options '(#:substitutable? #f))))))
|
||||
|
||||
(define (home-gtk3-xdg-configuration-files config)
|
||||
`(("gtk-3.0/settings.ini"
|
||||
,(ini-file "settings.ini" #~'(("Settings" #$@config))))))
|
||||
(if (null? config)
|
||||
'()
|
||||
`(("gtk-3.0/settings.ini"
|
||||
,(ini-file "settings.ini" #~'(("Settings" #$@config)))))))
|
||||
|
||||
(define (home-gtk4-xdg-configuration-files config)
|
||||
`(("gtk-4.0/settings.ini"
|
||||
,(ini-file "settings.ini" #~'(("Settings" #$@config))))))
|
||||
(if (null? config)
|
||||
'()
|
||||
`(("gtk-4.0/settings.ini"
|
||||
,(ini-file "settings.ini" #~'(("Settings" #$@config)))))))
|
||||
|
||||
(define home-gtk2-service-type
|
||||
(service-type
|
||||
(name 'home-gtk2)
|
||||
(extensions
|
||||
(list (service-extension home-environment-variables-service-type
|
||||
(const home-gtk2-environment-variables))
|
||||
home-gtk2-environment-variables)
|
||||
(service-extension home-xdg-configuration-files-service-type
|
||||
home-gtk2-xdg-configuration-files)))
|
||||
(compose concatenate)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user