diff --git a/mowedline/.config/mowedline/init.scm b/mowedline/.config/mowedline/init.scm index 03c4605..6056f61 100644 --- a/mowedline/.config/mowedline/init.scm +++ b/mowedline/.config/mowedline/init.scm @@ -1,3 +1,5 @@ +(use srfi-1 matchable) + (define (string-maybe-pad-left text) (if (string-null? text) text @@ -11,6 +13,27 @@ (string-append " " icon " ")) text)))) +(define (merge . lists) + (flatten (apply zip lists))) + +(define (split-tag-list str) + (map string->list (string-split str "\t"))) + +(define tag-display + (match-lambda + ((#\# n) (L (L 'color "#ececec" 'font "FontAwesome-12" "") " ")) + ((#\- n) (L (L 'color "#bfbfbf" 'font "FontAwesome-12" "") " ")) + ((#\. n) (L (L 'color "#969696" 'font "FontAwesome-12" "") " ")) + ((#\: n) (L (L 'color "#969696" 'font "FontAwesome-12" "") " ")) + ((#\! n) (L (L 'color "#a85454" 'font "FontAwesome-12" "") " ")))) + +(define (tag-list-display tag-list) + (map tag-display tag-list)) + +(define (tag-list-formatter text) + (let ((tag-list (split-tag-list text))) + (tag-list-display tag-list))) + (text-widget-font "Fantasque Sans Mono-13:bold") (text-widget-color "#ededed") (text-widget-format string-maybe-pad-left) @@ -23,7 +46,7 @@ 'margin-left 15 'margin-right 15 (widget:spacer 'width 5) - (widget:text 'name "title" 'text "drd") + (widget:text 'name "taglist" 'format tag-list-formatter) (widget:spacer 'width 10) (widget:text 'name "mpd" 'format (add-fa-icon "") 'flex 1) (widget:flags