aboutsummaryrefslogtreecommitdiff
path: root/roles/home/desktop/eww/widgets/meter.yuck
blob: af2c3f3f411a024a458d6fb8485380bd4877cb2c (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
(defwidget meter [value label]
    (overlay :class {"meter"
            + (value >= 90 ? " almost-full" : "")
            + (value >= 99 ? " full" : "")
            + (value <= 10 ? " almost-empty" : "")
            + (value <= 1  ? " empty" : "")
        }

        :width 100

        (circular-progress :class "background"
            :value 80
            :start-at 35
            :thickness 10
            :width 100
        )

        (circular-progress :class "progress"
            :value {value*0.8}
            :start-at 35
            :thickness 10
            :width 100
        )

        (box
            :orientation "v"
            :valign "center"
            :space-evenly false
            :spacing 2

            (children)
            
            {round(value, 2)+"%"}
        )

        (transform
            :translate-y "44px"
            (label :markup {"<b>"+label+"</b>"})
        )
    )
)