summaryrefslogtreecommitdiff
path: root/battery-widget
diff options
context:
space:
mode:
Diffstat (limited to 'battery-widget')
-rw-r--r--battery-widget/README.md3
-rw-r--r--battery-widget/battery.lua4
2 files changed, 4 insertions, 3 deletions
diff --git a/battery-widget/README.md b/battery-widget/README.md
index 9af7a4c..b15aac6 100644
--- a/battery-widget/README.md
+++ b/battery-widget/README.md
@@ -35,7 +35,7 @@ It is possible to customize widget by providing a table with all or some of the
| `warning_msg_icon` | ~/.config/awesome/awesome-wm-widgets/battery-widget/spaceman.jpg | Icon of the warning popup |
| `enable_battery_warning` | `true` | Display low battery warning |
-*Note: the widget expects following icons be present in the folder:
+*Note: the widget expects following icons to be present in the folder:
- battery-caution-charging-symbolic.svg
- battery-empty-charging-symbolic.svg
@@ -53,6 +53,7 @@ It is possible to customize widget by providing a table with all or some of the
## Installation
This widget reads the output of acpi tool.
+
- install `acpi` and check the output:
```bash
diff --git a/battery-widget/battery.lua b/battery-widget/battery.lua
index fc8c56f..452d7ef 100644
--- a/battery-widget/battery.lua
+++ b/battery-widget/battery.lua
@@ -125,7 +125,7 @@ local function worker(user_args)
local battery_info = {}
local capacities = {}
for s in stdout:gmatch("[^\r\n]+") do
- local status, charge_str, _ = string.match(s, '.+: (%a+), (%d?%d?%d)%%,?(.*)')
+ local status, charge_str, _ = string.match(s, '.+: ([%a%s]+), (%d?%d?%d)%%,?(.*)')
if status ~= nil then
table.insert(battery_info, {status = status, charge = tonumber(charge_str)})
else
@@ -157,7 +157,7 @@ local function worker(user_args)
level_widget.text = string.format('%d%%', charge)
end
- if (charge >= 0 and charge < 15) then
+ if (charge >= 1 and charge < 15) then
batteryType = "battery-empty%s-symbolic"
if enable_battery_warning and status ~= 'Charging' and os.difftime(os.time(), last_battery_check) > 300 then
-- if 5 minutes have elapsed since the last warning