Add basic polybar configuration

This commit is contained in:
Tom Willemse 2022-04-16 00:24:34 -07:00
parent 13991b6c3d
commit ecb63a646f
2 changed files with 57 additions and 2 deletions

View file

@ -16,7 +16,8 @@
#:use-module (oni home services compton)
#:use-module (oni home services xbindkeys)
#:use-module (oni home services zsh)
#:use-module (oni home services herbstluftwm))
#:use-module (oni home services herbstluftwm)
#:use-module (oni home services polybar))
(home-environment
(packages (list (specification->package+output "glibc-locales")))
@ -304,4 +305,8 @@
"keybind Mod4-apostrophe spawn dunstctl close"
"keybind Mod4-quotedbl spawn dunstctl close-all"
"keybind Mod4-Control-apostrophe spawn dunstctl history-pop"
"keybind Mod4-Mod1-apostrophe spawn dunstctl context")))))))
"keybind Mod4-Mod1-apostrophe spawn dunstctl context"))))
(service home-polybar-service-type
(home-polybar-configuration
(bar "data"))))))

View file

@ -0,0 +1,50 @@
(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.")))