mirror of
https://github.com/streetturtle/awesome-wm-widgets.git
synced 2024-11-17 07:49:09 +01:00
Only show warning if charger is not plugged in
This commit is contained in:
parent
64977a35fb
commit
14c81d51d7
1 changed files with 6 additions and 4 deletions
|
@ -29,8 +29,10 @@ watch(
|
||||||
local _, status, charge_str, time = string.match(stdout, '(.+): (%a+), (%d?%d%d)%%,? ?.*')
|
local _, status, charge_str, time = string.match(stdout, '(.+): (%a+), (%d?%d%d)%%,? ?.*')
|
||||||
local charge = tonumber(charge_str)
|
local charge = tonumber(charge_str)
|
||||||
if (charge >= 0 and charge < 15) then
|
if (charge >= 0 and charge < 15) then
|
||||||
batteryType="battery-empty%s-symbolic"
|
batteryType="battery-empty%s-symbolic"
|
||||||
show_battery_warning()
|
if status ~= 'Charging' then
|
||||||
|
show_battery_warning()
|
||||||
|
end
|
||||||
elseif (charge >= 15 and charge < 40) then batteryType="battery-caution%s-symbolic"
|
elseif (charge >= 15 and charge < 40) then batteryType="battery-caution%s-symbolic"
|
||||||
elseif (charge >= 40 and charge < 60) then batteryType="battery-low%s-symbolic"
|
elseif (charge >= 40 and charge < 60) then batteryType="battery-low%s-symbolic"
|
||||||
elseif (charge >= 60 and charge < 80) then batteryType="battery-good%s-symbolic"
|
elseif (charge >= 60 and charge < 80) then batteryType="battery-good%s-symbolic"
|
||||||
|
|
Loading…
Reference in a new issue