(deflisten gpu :initial '{"gfx_pct":0,"mem_pct":0,"media_pct":0,"sclk":0,"mclk":0,"sclk_pct":0,"mclk_pct":0,"vclk":0,"vclk_pct":0,"temp":0,"power":0,"vram_used":0,"vram_total":1}' "scripts/sys/gpu")
(deflisten memory :initial '{"human":{"used":"0G","total":"0G","cached":"0G"},"used":0.0,"total":1.0,"cached":0.0}' "scripts/sys/memory")

(deflisten battery :initial '{"visible":false,"percentage":0.0,"color":"#FFFFFF"}' "scripts/sys/battery")

(defwidget sys-mod []
  (module
    (eventbox
      :onclick "(sleep 0.1 && scripts/panel-toggle sys)"
      (box :orientation "v"
        (circular-progress
          :value {EWW_CPU.avg}
          :class "cpubar"
          :width 28 :height 28 :thickness 6
          :tooltip "CPU ${round(EWW_CPU.avg, 0)}%")
        (circular-progress
          :value {gpu.gfx_pct}
          :class "gpubar"
          :width 28 :height 28 :thickness 6
          :tooltip "GPU ${round(gpu.gfx_pct, 0)}%")
        (circular-progress
          :value {100*memory.used/memory.total}
          :class "membar"
          :width 28 :height 28 :thickness 6
          :tooltip "RAM ${memory.human.used} / ${memory.human.total}")
        (circular-progress
          :value {battery.percentage}
          :class "batbar"
          :visible {battery.visible}
          :style "color: ${battery.color};"
          :width 28 :height 28 :thickness 6
          :tooltip "Bat ${round(battery.percentage, 0)}% · ${battery.status} @ ${battery.wattage}")))))
