dotfiles/oni/home/services/polybar.scm

51 lines
1.5 KiB
Scheme
Raw Permalink Normal View History

2022-04-16 09:24:34 +02:00
(define-module (oni home services polybar)
#:use-module (gnu services configuration)
#:use-module (gnu packages wm)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
#:use-module (gnu home services utils)
#:use-module (guix packages)
#:use-module (guix gexp)
#:export (home-polybar-service-type
home-polybar-configuration))
(define-configuration home-polybar-configuration
(package
(package polybar)
"Package to use for setting polybar")
(bar
(string "default")
"Bar to use at startup")
(no-serialization))
(define (add-polybar-packages config)
(list (home-polybar-configuration-package config)))
(define (home-polybar-shepherd-service config)
(list
(shepherd-service
(documentation "Start polybar")
(provision '(polybar statusbar))
(auto-start? #t)
(start
#~(make-forkexec-constructor
(list #$(file-append (home-polybar-configuration-package config) "/bin/polybar")
#$(home-polybar-configuration-bar config))
#:log-file (format #f "~a/.local/var/log/polybar.log" (getenv "HOME"))))
(stop #~(make-kill-destructor)))))
(define home-polybar-service-type
(service-type
(name 'home-polybar)
(extensions
(list (service-extension
home-profile-service-type
add-polybar-packages)
(service-extension
home-shepherd-service-type
home-polybar-shepherd-service)))
(compose identity)
(default-value (home-polybar-configuration))
(description "Install and configure polybar.")))