(use srfi-1 matchable) (define (not-text? text) (or (null? text) (and (not (pair? text)) (string-null? text)))) (define (text-maybe-pad-both text) (if (not-text? text) text (L " " text " "))) (define (add-fa-icon icon) (lambda (text) (if (not-text? text) text (list (list 'font "FontAwesome-10" (string-append " " icon " ")) text)))) (define (split-tag-list str) (map string->list (string-split str "\t"))) (define tag-display (match-lambda ((#\# n) (L (L 'color "#ececec" 'font "FontAwesome-10" "") " ")) ((#\- n) (L (L 'color "#bfbfbf" 'font "FontAwesome-10" "") " ")) ((#\. n) (L (L 'color "#969696" 'font "FontAwesome-10" "") " ")) ((#\: n) (L (L 'color "#969696" 'font "FontAwesome-10" "") " ")) ((#\! n) (L (L 'color "#a85454" 'font "FontAwesome-10" "") " ")))) (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 text-maybe-pad-both) (window 'position 'bottom 'width 1859 'margin-bottom 15 'margin-left 46 'margin-right 15 'background 'transparent (widget:text 'name "taglist" 'format tag-list-formatter) (widget:active-window-title 'format text-maybe-pad-left) (widget:spacer 'flex 1) (widget:text 'name "mpd" 'format (add-fa-icon "")) (widget:text 'name "irclist" 'format identity) (widget:text 'name "email" 'format (compose text-maybe-pad-both (add-fa-icon ""))) (widget:flags 'name "cam-status" 'font "FontAwesome-10" 'flags '(("suspended" color "#a88654" "") ("active" color "#65a854" "") ("unplugged" color "#a85454" ""))) (widget:flags 'name "keychain" 'font "FontAwesome-10" 'flags '(("Unlocked" color "#65a854" "") ("Locked" color "#a85454" ""))) (widget:clock))