diff options
author | streetturtle <streetturtle@users.noreply.github.com> | 2017-10-09 14:23:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-09 14:23:24 -0400 |
commit | ecc10522591d4501533c968ba3e7d1c3e7b59a26 (patch) | |
tree | d2246b975160084f30f80e789816f98e14f63977 /battery-widget | |
parent | 64977a35fbe45a77bb4ce0242f402eccfe96670a (diff) | |
parent | 9159497bf5d242a436e1120db87ad4ed7fea55b3 (diff) |
Merge pull request #17 from Taddic/master
Only show warning if charger is not plugged in
Diffstat (limited to 'battery-widget')
-rw-r--r-- | battery-widget/battery.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/battery-widget/battery.lua b/battery-widget/battery.lua index 3a8b1b9..c23b4b9 100644 --- a/battery-widget/battery.lua +++ b/battery-widget/battery.lua @@ -10,10 +10,10 @@ local watch = require("awful.widget.watch") local PATH_TO_ICONS = "/usr/share/icons/Arc/status/symbolic/" local USERNAME = os.getenv("USER") -battery_widget = wibox.widget { +battery_widget = wibox.widget { { id = "icon", - widget = wibox.widget.imagebox, + widget = wibox.widget.imagebox, resize = false }, layout = wibox.container.margin(_, 0, 0, 3), @@ -29,8 +29,10 @@ watch( local _, status, charge_str, time = string.match(stdout, '(.+): (%a+), (%d?%d%d)%%,? ?.*') local charge = tonumber(charge_str) if (charge >= 0 and charge < 15) then - batteryType="battery-empty%s-symbolic" - show_battery_warning() + batteryType="battery-empty%s-symbolic" + if status ~= 'Charging' then + show_battery_warning() + end 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 >= 60 and charge < 80) then batteryType="battery-good%s-symbolic" |