dotfiles/dotconfig/eww/perf_widget/perf.yuck
2024-03-25 00:50:41 +00:00

283 lines
7.6 KiB
Text

(defpoll cpu_avg :interval "0.5s"
:initial "0"
`cpu_calcul`)
(defpoll bat_avg :interval "0.5s"
:initial "0"
`cat /sys/class/power_supply/BAT1/capacity`)
(defpoll ram_avg :interval "0.5s"
:initial "0"
`echo $(free | grep Mem | awk '{print $7/$2 * 100.0}') | cut -d '.' -f 1 `)
(defpoll swap_avg :interval "0.5s"
:initial "0"
`echo $(free | grep Swap | awk '{print $4/$2 * 100.0}') | cut -d '.' -f 1 `)
(defpoll all_disks :interval "1s"
:initial ""
`print_yuck_disks_mounted`)
;(defvar all_disks
; "(box :orientation 'v'
; (label :text 'Jaaj 1')
; (label :text 'Jaaj 2'))" )
(defwidget perf []
(box
:space-evenly false
:orientation "v"
(box
:space-evenly false
:orientation "h"
:class "perf_bars"
(box
:space-evenly false
:orientation "v"
(box
:space-evenly false
:height 499
:orientation "h"
:class "proc_box"
(progress
:flipped true
:value "${(100 - cpu_avg) * 3.25}"
:orientation "v"
:class "perf_bar")
(progress
:flipped true
:value "${(100 - cpu_avg) * 3.25 - 25}"
:orientation "v"
:class "perf_bar")
(progress
:flipped true
:value "${(100 - cpu_avg) * 3.25 - 50}"
:orientation "v"
:class "perf_bar")
(progress
:flipped true
:value "${(100 - cpu_avg) * 3.25 - 75}"
:orientation "v"
:class "perf_bar")
(progress
:flipped true
:value "${(100 - cpu_avg) * 3.25 - 100}"
:orientation "v"
:class "perf_bar")
(progress
:flipped true
:value "${(100 - cpu_avg) * 3.25 - 125}"
:orientation "v"
:class "perf_bar")
(progress
:flipped true
:value "${(100 - cpu_avg) * 3.25 - 150}"
:orientation "v"
:class "perf_bar")
(progress
:flipped true
:value "${(100 - cpu_avg) * 3.25 - 175}"
:orientation "v"
:class "perf_bar")
(progress
:flipped true
:value "${(100 - cpu_avg) * 3.25 - 200}"
:orientation "v"
:class "perf_bar")
(progress
:flipped true
:value "${(100 - cpu_avg) * 3.25 - 225}"
:orientation "v"
:class "perf_bar"))
(label
:class "perf_label"
:text "${cpu_avg} %")
)
(box
:space-evenly true
:height 500
:orientation "v"
(box
:space-evenly false
:orientation "v"
(box
:space-evenly false
:orientation "h"
:height 143
:class "perf_box"
(progress
:flipped true
:value "${bat_avg * 2.75}"
:orientation "v"
:class "bat_bar")
(progress
:flipped true
:value "${bat_avg * 2.75 - 25}"
:orientation "v"
:class "bat_bar")
(progress
:flipped true
:value "${bat_avg * 2.75 - 50}"
:orientation "v"
:class "bat_bar")
(progress
:flipped true
:value "${bat_avg * 2.75 - 75}"
:orientation "v"
:class "bat_bar")
(progress
:flipped true
:value "${bat_avg * 2.75 - 100}"
:orientation "v"
:class "bat_bar")
(progress
:flipped true
:value "${bat_avg * 2.75 - 125}"
:orientation "v"
:class "bat_bar")
(progress
:flipped true
:value "${bat_avg * 2.75 - 150}"
:orientation "v"
:class "bat_bar")
(progress
:flipped true
:value "${bat_avg * 2.75 - 175}"
:orientation "v"
:class "bat_bar")
)
(label
:class "val_label"
:text "${bat_avg} %")
)
(box
:space-evenly false
:orientation "v"
(box
:space-evenly false
:orientation "h"
:height 143
:class "perf_box"
(progress
:flipped true
:value "${ram_avg * 2.75}"
:orientation "v"
:class "ram_bar")
(progress
:flipped true
:value "${ram_avg * 2.75 - 25}"
:orientation "v"
:class "ram_bar")
(progress
:flipped true
:value "${ram_avg * 2.75 - 50}"
:orientation "v"
:class "ram_bar")
(progress
:flipped true
:value "${ram_avg * 2.75 - 75}"
:orientation "v"
:class "ram_bar")
(progress
:flipped true
:value "${ram_avg * 2.75 - 100}"
:orientation "v"
:class "ram_bar")
(progress
:flipped true
:value "${ram_avg * 2.75 - 125}"
:orientation "v"
:class "ram_bar")
(progress
:flipped true
:value "${ram_avg * 2.75 - 150}"
:orientation "v"
:class "ram_bar")
(progress
:flipped true
:value "${ram_avg * 2.75 - 175}"
:orientation "v"
:class "ram_bar")
)
(label
:class "val_label"
:text "${100 - ram_avg} %")
)
(box
:space-evenly false
:orientation "v"
(box
:space-evenly false
:orientation "h"
:height 143
:class "perf_box"
(progress
:flipped true
:value "${swap_avg * 2.75}"
:orientation "v"
:class "swap_bar")
(progress
:flipped true
:value "${swap_avg * 2.75 - 25}"
:orientation "v"
:class "swap_bar")
(progress
:flipped true
:value "${swap_avg * 2.75 - 50}"
:orientation "v"
:class "swap_bar")
(progress
:flipped true
:value "${swap_avg * 2.75 - 75}"
:orientation "v"
:class "swap_bar")
(progress
:flipped true
:value "${swap_avg * 2.75 - 100}"
:orientation "v"
:class "swap_bar")
(progress
:flipped true
:value "${swap_avg * 2.75 - 125}"
:orientation "v"
:class "swap_bar")
(progress
:flipped true
:value "${swap_avg * 2.75 - 150}"
:orientation "v"
:class "swap_bar")
(progress
:flipped true
:value "${swap_avg * 2.75 - 175}"
:orientation "v"
:class "swap_bar")
)
(label
:class "val_label"
:text "${100 - swap_avg} %")
)
)
)
(literal :content all_disks)
)
)
(defwindow perf
:monitor 0
:geometry (geometry
:x "5%"
:y "8%"
:height "500px"
:anchor "top left")
:stacking "bg"
:exclusive true
:focusable false
:namespaces "perf_widget"
(perf))