mirror of https://github.com/lcpz/lain.git
silence warnings when battery is <15%, but charging
This commit is contained in:
parent
ab17a2d496
commit
82dd3effca
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue