Add taglist to mowedline

This commit is contained in:
Tom Willemse 2015-07-29 13:37:37 +02:00
parent 8a0a2886c8
commit 4236a07922

View file

@ -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