eww rework, add battery

This commit is contained in:
Trevor Vallender 2024-03-24 14:30:16 +00:00
parent 76c5b36e93
commit c1c454612f
2 changed files with 19 additions and 6 deletions

View File

@ -45,3 +45,7 @@
.current {
color: #D65D0E;
}
.battery, .ram, .disk {
padding-right: 20px;
}

View File

@ -6,15 +6,15 @@
(defwidget sidestuff []
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
(box :class "battery" :orientation "h" :space-evenly false
{battery != "" ? "󰁹 ${battery}" : ""})
(box :class "ram" :orientation "h"
"󰍛 ${ram}%")
(box :class "disk" :orientation "h"
" ${disk}")
(metric :label "󰕾"
:value { volume * 100 }
:onchange "VOL=$(bc -l <<<\"scale=2; {} / 100\") ; wpctl set-volume @DEFAULT_AUDIO_SINK@ $VOL")
(metric :label "󰍛"
:value {EWW_RAM.used_mem_perc}
:onchange "")
(metric :label ""
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
:onchange "")
time))
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces")
@ -61,6 +61,15 @@
(defpoll volume :interval "1s"
"scripts/getvol")
(defpoll battery :interval "1s"
"upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | awk '{print $2}'")
(defpoll ram :interval "1s"
"MEM=$(free | grep Mem | awk '{print $3/$2 * 100.0}') ; echo \${MEM%.*}")
(defpoll disk :interval "1s"
"df | grep '/$' | awk '{print $5}'")
(defpoll time :interval "10s"
"date '+%H:%M %F'")