Make it possible to disable the low battery warning for battery-widget and batteryarc-widget
This commit is contained in:
parent
d2bbf765fa
commit
744045db10
|
@ -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 |
|
||||
| `disable_battery_warning` | `false` | Disable low battery warning |
|
||||
|
||||
*Note: the widget expects following icons be present in the folder:
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ 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 disable_battery_warning = args.disable_battery_warning or false
|
||||
|
||||
if not gfs.dir_readable(path_to_icons) then
|
||||
naughty.notify{
|
||||
|
@ -149,7 +150,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 (not disable_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()
|
||||
|
||||
|
|
|
@ -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 |
|
||||
| `disable_battery_warning` | `false` | Disable low battery warning |
|
||||
|
||||
## Requirements
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ 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 disable_battery_warning = args.disable_battery_warning or false
|
||||
|
||||
local text = wibox.widget {
|
||||
id = "txt",
|
||||
|
@ -124,7 +125,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 (not disable_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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue