From 135f88f6cae9783355045378f9cdc5df132063a9 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Mon, 9 Mar 2026 08:52:50 -0400 Subject: battery widget config shows more info now --- widgets/battery.lua | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'widgets') diff --git a/widgets/battery.lua b/widgets/battery.lua index 873f1ba..1ca7892 100644 --- a/widgets/battery.lua +++ b/widgets/battery.lua @@ -5,16 +5,19 @@ local naughty = require("naughty") -- tooltip text function local tooltip_text_format = [[ %s (%s) -Status: %s -Charge: %.1f%% -Health: %.1f%% -Cycle Count: %d -Rated Capacity: %.0fmAh (%.1fWh) -Voltage Min: %.1fV -Voltage Now: %.1fV -Technology: %s -Manufacturer: %s -Serial Number: %s +Status: %s +Charge: %.1f%% +Remaining: %d minutes +Cycle Count: %d +Health: %.1f%% +Design Capacity: %.0fmAh (%.1fWh) +Actual Capacity: %.0fmAh (%.1fWh) +Voltage Min: %.1fV +Voltage Now: %.1fV +Power Now: %.1fW +Technology: %s +Manufacturer: %s +Serial Number: %s ]] function bat_uevents() @@ -35,18 +38,24 @@ function bat_uevents() if a.TYPE == "Battery" then local capacity = a.ENERGY_NOW * 100 / a.ENERGY_FULL local health = a.ENERGY_FULL * 100 / a.ENERGY_FULL_DESIGN - local mah = a.ENERGY_FULL_DESIGN * 1000 / a.VOLTAGE_MIN_DESIGN + local remaining = a.ENERGY_NOW * 60 / a.POWER_NOW + local mah_design = a.ENERGY_FULL_DESIGN * 1000 / a.VOLTAGE_MIN_DESIGN + local mah_actual = a.ENERGY_FULL * 1000 / a.VOLTAGE_MIN_DESIGN text = text .. tooltip_text_format:format( a.NAME, a.MODEL_NAME, a.STATUS, capacity, - health, + remaining, a.CYCLE_COUNT, - mah, + health, + mah_design, a.ENERGY_FULL_DESIGN / 1000000, + mah_actual, + a.ENERGY_FULL / 1000000, a.VOLTAGE_MIN_DESIGN / 1000000, a.VOLTAGE_NOW / 1000000, + a.POWER_NOW / 1000000, a.TECHNOLOGY, a.MANUFACTURER, a.SERIAL_NUMBER -- cgit v1.2.3