dotfiles/de/home/.config/eww/modules/bar/battery.yuck
2026-02-17 20:15:01 -08:00

21 lines
1.1 KiB
Text

(defvar reveal_battery false)
(defwidget battery []
(revealer-on-hover :class "${reveal_battery} battery"
:revealvar reveal_battery
:revealvar-name "reveal_battery"
(label :class "revealer-preview ${(EWW_BATTERY == '' || jq(EWW_BATTERY,'.[].status?','r') == 'Charging') ? 'active' : '' }"
:tooltip `${(EWW_BATTERY == "" || jq(EWW_BATTERY,'.[].status?') == '"Charging"') ? "Charging" : "Discharging"}, ${(EWW_BATTERY == "") ? "" : "${round(jq(EWW_BATTERY,'.total_avg?'),1)}% of total average"}`
:text `${(EWW_BATTERY == "" || jq(EWW_BATTERY,'.[].status?') == '"Charging"') ? " " : "󰁹 "}${(EWW_BATTERY == "") ? "" : "${round(jq(EWW_BATTERY,'first(.[].capacity?)'),0)}%"}`)
(battery_children)))
(defwidget battery_children []
(box :class "reveal-children"
:orientation "h"
:space-evenly false
:halign "center"
(box
(progress :height 10
:valign "center"
:value {(EWW_BATTERY == "") ? 100 : jq(EWW_BATTERY,'first(.[].capacity?)')}
:orientation "h"))))