aboutsummaryrefslogtreecommitdiff
path: root/roles/home/desktop/eww/panels/cpu.yuck
blob: ef57fa6a7e7f480baa9ec9755b01ab7989ce2d02 (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
(defwidget cpu []
    (box :class "panel"
        :orientation "h"
        :spacing 8
        :space-evenly false

        (tooltip :class "cutout"
            {round(EWW_CPU.avg, 2) + "%"}
            (graph
                :value {EWW_CPU.avg}
                :time-range "30s"
                :width 76
                :height 76
                :hexpand true
            )
        )

        (box :orientation "v"
            :spacing 8
            :space-evenly false
            :hexpand true

            (label :halign "start" :markup {"<b>" + cpu-name + "</b>"})

            (stat :key "Temperature" :value {round(EWW_TEMPS.K10TEMP_TCTL, 2) + "°C"})
            (stat :key "Frequency" :value {round(cpu-max-freq * cpu-freq/100, 0) + " MHz"})
            (stat :key "Usage" :value {round(EWW_CPU.avg, 2) + "%"})
        )
    )
)

(defpoll cpu-freq
    :interval "2s"
    `lscpu | sed -n '/CPU(s) scaling MHz/ s/.*:\\s*\\(.*\\)%/\\1/p'`
)

(defpoll cpu-max-freq
    :interval "9999s"
    `lscpu | sed -n '/CPU max MHz/ s/.*:\\s*\\(.*\\)/\\1/p'`
)

(defpoll cpu-name
    :interval "9999s"
    `lscpu | sed -n '/Model name/ s/.*:\\s*\\(.*\\)/\\1/p'`
)