summaryrefslogtreecommitdiffstats
path: root/mowedline/.config/mowedline/init.scm
blob: 1a9e2fe212e0a9adf1e7ce6d52a34228f26951d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
(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 1843
 '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))