76 lines
2.2 KiB
Scheme
76 lines
2.2 KiB
Scheme
(use srfi-1 matchable)
|
|
|
|
(define (not-text? text)
|
|
(or (null? text) (and (not (pair? text)) (string-null? text))))
|
|
|
|
(define (string-maybe-pad-left text)
|
|
(if (not-text? text)
|
|
text
|
|
(L " " 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 (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-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 1890
|
|
'margin-bottom 15
|
|
'margin-left 15
|
|
'margin-right 15
|
|
'background 'transparent
|
|
(widget:text 'name "taglist"
|
|
'format (compose string-maybe-pad-left tag-list-formatter))
|
|
(widget:spacer 'width 5)
|
|
(widget:active-window-title)
|
|
(widget:spacer 'flex 1)
|
|
(widget:text 'name "mpd"
|
|
'format (add-fa-icon "")
|
|
'background-color "#111111")
|
|
(widget:spacer 'width 5)
|
|
(widget:text 'name "irclist"
|
|
'background-color "#111111")
|
|
(widget:spacer 'width 5)
|
|
(widget:text 'name "email"
|
|
'format (compose text-maybe-pad-both (add-fa-icon "")))
|
|
(widget:spacer 'width 5)
|
|
(widget:flags 'name "keychain"
|
|
'font "FontAwesome-10"
|
|
'flags '(("Unlocked" . "")
|
|
("Locked" . "")))
|
|
(widget:spacer 'width 5)
|
|
(widget:clock))
|