silence warnings when battery is <15%, but charging

This commit is contained in:
Conor Heine 2013-09-26 16:01:09 -04:00
parent ab17a2d496
commit 82dd3effca
2 changed files with 54 additions and 48 deletions

View File

@ -74,6 +74,8 @@ local function worker(args)
bat_now.watt = string.format("%.2fW", (rate * ratev) / 1e12) bat_now.watt = string.format("%.2fW", (rate * ratev) / 1e12)
-- notifications for low and critical states -- notifications for low and critical states
if bat_new.status == "Discharging"
then
if bat_now.perc <= 5 if bat_now.perc <= 5
then then
bat.id = naughty.notify({ bat.id = naughty.notify({
@ -99,6 +101,7 @@ local function worker(args)
replaces_id = bat.id replaces_id = bat.id
}).id }).id
end end
end
bat_now.perc = string.format("%d", bat_now.perc) bat_now.perc = string.format("%d", bat_now.perc)
end end

View File

@ -113,12 +113,14 @@ function tpbat.register(args)
if bat:installed() if bat:installed()
then then
bat_now.status = bat:status() bat_now.status = bat:status() or "N/A"
bat_now.perc = bat:percent() bat_now.perc = bat:percent()
bat_now.time = bat:remaining_time() bat_now.time = bat:remaining_time()
-- bat_now.watt = string.format("%.2fW", (VOLTS * AMPS) / 1e12) -- bat_now.watt = string.format("%.2fW", (VOLTS * AMPS) / 1e12)
-- notifications for low and critical states -- notifications for low and critical states (when discharging)
if bat_now.status == "discharging"
then
if bat_now.perc <= 5 if bat_now.perc <= 5
then then
tpbat.id = naughty.notify({ tpbat.id = naughty.notify({
@ -144,6 +146,7 @@ function tpbat.register(args)
replaces_id = tpbat.id replaces_id = tpbat.id
}).id }).id
end end
end
bat_now.perc = tostring(bat_now.perc) bat_now.perc = tostring(bat_now.perc)
end end