Eww show charging status

This commit is contained in:
2024-05-13 00:08:41 +02:00
parent c887d19846
commit ce8d911622
2 changed files with 20 additions and 6 deletions

View File

@ -123,6 +123,15 @@ scale trough {
.battery-gauge { .battery-gauge {
color: $highlight1; color: $highlight1;
transition: all 0.5s;
}
.battery-gauge.low {
color: red;
}
.battery-gauge.charging {
color: purple;
} }
.calendar { .calendar {

View File

@ -99,15 +99,19 @@
(box :orientation "v" (box :orientation "v"
:valign "end" :valign "end"
:class "thingy" :class "thingy"
:visible {current_battery != ""} :visible {bat_charge != ""}
(label :text "BAT") (label :text "BAT")
(circular-progress (circular-progress
:thickness 4.0 :thickness 4.0
:value current_battery :value bat_charge
:class "battery-gauge" :class {
:style {current_battery < 15 ? "color: red;" : ""} bat_status == "Charging" ? "battery-gauge charging" :
bat_charge < 15 ? "battery-gauge low" :
"battery-gauge"
}
;:style {bat_charge < 15 ? "color: red;" : ""}
) )
;(label :text "${current_battery}%") ;(label :text "${bat_charge}%")
)) ))
(defwidget date [] (defwidget date []
@ -162,5 +166,6 @@
(defpoll current_hour :interval "1s" "date +%H") (defpoll current_hour :interval "1s" "date +%H")
(defpoll current_day :interval "60s" "date +%d") (defpoll current_day :interval "60s" "date +%d")
(defpoll current_month :interval "60s" "date +%b") (defpoll current_month :interval "60s" "date +%b")
(defpoll current_battery :interval "15s" "cat /sys/class/power_supply/BAT0/capacity") (defpoll bat_charge :interval "15s" "cat /sys/class/power_supply/BAT0/capacity")
(defpoll bat_status :interval "15s" "cat /sys/class/power_supply/BAT0/status")
(defpoll current_temp :interval "5s" "cat /sys/class/thermal/thermal_zone*/temp") (defpoll current_temp :interval "5s" "cat /sys/class/thermal/thermal_zone*/temp")