summaryrefslogtreecommitdiff
path: root/battery-widget
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@users.noreply.github.com>2020-09-21 20:53:22 -0400
committerGitHub <noreply@github.com>2020-09-21 20:53:22 -0400
commit31213af0082bef8344475dbeb84205f1a7e31c7d (patch)
tree2a8b4cad8363c5a0019466edf86d8ef99941d2f4 /battery-widget
parenta127ffe8efc8ccb91b7a8495c23f67278609df25 (diff)
parent21150bd640f086f617c61b32cde5e45ecfb5158f (diff)
Merge pull request #188 from brucec5/widget-tweaks
Add customizable refresh timeouts to most widgets
Diffstat (limited to 'battery-widget')
-rw-r--r--battery-widget/README.md1
-rw-r--r--battery-widget/battery.lua3
2 files changed, 3 insertions, 1 deletions
diff --git a/battery-widget/README.md b/battery-widget/README.md
index 4ea14d8..9af7a4c 100644
--- a/battery-widget/README.md
+++ b/battery-widget/README.md
@@ -28,6 +28,7 @@ It is possible to customize widget by providing a table with all or some of the
| `margin_left`|0| The left margin of the widget|
| `display_notification` | `false` | Display a notification on mouseover |
| `notification_position` | `top_right` | The notification position |
+| `timeout` | 10 | How often in seconds the widget refreshes |
| `warning_msg_title` | _Huston, we have a problem_ | Title of the warning popup |
| `warning_msg_text` | _Battery is dying_ | Text of the warning popup |
| `warning_msg_position` | `bottom_right` | Position of the warning popup |
diff --git a/battery-widget/battery.lua b/battery-widget/battery.lua
index 919fb60..9fa50ed 100644
--- a/battery-widget/battery.lua
+++ b/battery-widget/battery.lua
@@ -33,6 +33,7 @@ local function worker(args)
local display_notification = args.display_notification or false
local position = args.notification_position or "top_right"
+ local timeout = args.timeout or 10
local warning_msg_title = args.warning_msg_title or 'Huston, we have a problem'
local warning_msg_text = args.warning_msg_text or 'Battery is dying'
@@ -116,7 +117,7 @@ local function worker(args)
local last_battery_check = os.time()
local batteryType = "battery-good-symbolic"
- watch("acpi -i", 10,
+ watch("acpi -i", timeout,
function(widget, stdout, stderr, exitreason, exitcode)
local battery_info = {}
local capacities = {}