diff options
author | streetturtle <streetturtle@users.noreply.github.com> | 2020-04-05 10:36:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-05 10:36:53 -0400 |
commit | 5d8de54de6546ab882b85f42cee9106433b5b02c (patch) | |
tree | 130085948afee78359a8dcdc8db8ec34aeaf8751 | |
parent | 3ecea9dcc23906d6804849f0eb80bc6d840b1776 (diff) | |
parent | a97d94bca05e6cd7dfcdfbeddd197fd693af4631 (diff) |
Merge pull request #127 from blackm0re/disable-battery-warning
Make it possible to disable the low battery warning
-rw-r--r-- | battery-widget/README.md | 1 | ||||
-rw-r--r-- | battery-widget/battery.lua | 6 | ||||
-rw-r--r-- | batteryarc-widget/README.md | 1 | ||||
-rw-r--r-- | batteryarc-widget/batteryarc.lua | 6 |
4 files changed, 12 insertions, 2 deletions
diff --git a/battery-widget/README.md b/battery-widget/README.md index d58c420..4ea14d8 100644 --- a/battery-widget/README.md +++ b/battery-widget/README.md @@ -32,6 +32,7 @@ It is possible to customize widget by providing a table with all or some of the | `warning_msg_text` | _Battery is dying_ | Text of the warning popup | | `warning_msg_position` | `bottom_right` | Position of the warning popup | | `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: diff --git a/battery-widget/battery.lua b/battery-widget/battery.lua index c066fcc..d84e591 100644 --- a/battery-widget/battery.lua +++ b/battery-widget/battery.lua @@ -38,6 +38,10 @@ local function worker(args) local warning_msg_text = args.warning_msg_text or 'Battery is dying' local warning_msg_position = args.warning_msg_position or 'bottom_right' local warning_msg_icon = args.warning_msg_icon or HOME .. '/.config/awesome/awesome-wm-widgets/batteryarc-widget/spaceman.jpg' + local enable_battery_warning = args.enable_battery_warning + if enable_battery_warning == nil then + enable_battery_warning = true + end if not gfs.dir_readable(path_to_icons) then naughty.notify{ @@ -147,7 +151,7 @@ local function worker(args) if (charge >= 0 and charge < 15) then batteryType = "battery-empty%s-symbolic" - if status ~= 'Charging' and os.difftime(os.time(), last_battery_check) > 300 then + 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 last_battery_check = os.time() diff --git a/batteryarc-widget/README.md b/batteryarc-widget/README.md index 6812dfa..96e1aeb 100644 --- a/batteryarc-widget/README.md +++ b/batteryarc-widget/README.md @@ -33,6 +33,7 @@ It is possible to customize widget by providing a table with all or some of the | `warning_msg_text` | _Battery is dying_ | Text of the warning popup | | `warning_msg_position` | `bottom_right` | Position of the warning popup | | `warning_msg_icon` | ~/.config/awesome/awesome-wm-widgets/batteryarc-widget/spaceman.jpg | Icon of the warning popup | +| `enable_battery_warning` | `true` | Display low battery warning | ## Requirements diff --git a/batteryarc-widget/batteryarc.lua b/batteryarc-widget/batteryarc.lua index d4a67c5..0bf6bc0 100644 --- a/batteryarc-widget/batteryarc.lua +++ b/batteryarc-widget/batteryarc.lua @@ -36,6 +36,10 @@ local function worker(args) local warning_msg_text = args.warning_msg_text or 'Battery is dying' local warning_msg_position = args.warning_msg_position or 'bottom_right' local warning_msg_icon = args.warning_msg_icon or HOME .. '/.config/awesome/awesome-wm-widgets/batteryarc-widget/spaceman.jpg' + local enable_battery_warning = args.enable_battery_warning + if enable_battery_warning == nil then + enable_battery_warning = true + end local text = wibox.widget { id = "txt", @@ -124,7 +128,7 @@ local function worker(args) if charge < 15 then widget.colors = { low_level_color } - if status ~= 'Charging' and os.difftime(os.time(), last_battery_check) > 300 then + 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 last_battery_check = os.time() |