summaryrefslogtreecommitdiff
path: root/gerrit-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 /gerrit-widget
parenta127ffe8efc8ccb91b7a8495c23f67278609df25 (diff)
parent21150bd640f086f617c61b32cde5e45ecfb5158f (diff)
Merge pull request #188 from brucec5/widget-tweaks
Add customizable refresh timeouts to most widgets
Diffstat (limited to 'gerrit-widget')
-rw-r--r--gerrit-widget/README.md1
-rw-r--r--gerrit-widget/gerrit.lua3
2 files changed, 3 insertions, 1 deletions
diff --git a/gerrit-widget/README.md b/gerrit-widget/README.md
index d867896..62c89a1 100644
--- a/gerrit-widget/README.md
+++ b/gerrit-widget/README.md
@@ -23,6 +23,7 @@ It is possible to customize widget by providing a table with all or some of the
| `icon`| `/.config/awesome/awesome-wm-widgets/gerrit-widget/gerrit_icon.svg`| Path to the icon |
| `host` | Required | Ex https://gerrit.tmnt.com |
| `query` | `is:reviewer AND status:open AND NOT is:wip` | Query to retrieve reviews |
+| `timeout` | 10 | How often in seconds the widget refreshes |
## Prerequisite
diff --git a/gerrit-widget/gerrit.lua b/gerrit-widget/gerrit.lua
index 69036d0..ad5d7a6 100644
--- a/gerrit-widget/gerrit.lua
+++ b/gerrit-widget/gerrit.lua
@@ -38,6 +38,7 @@ local function worker(args)
text = 'Gerrit host is unknown'
}
local query = args.query or 'is:reviewer AND status:open AND NOT is:wip'
+ local timeout = args.timeout or 10
local current_number_of_reviews
local previous_number_of_reviews = 0
@@ -220,7 +221,7 @@ local function worker(args)
)
)
- watch(string.format(GET_CHANGES_CMD, host, query:gsub(" ", "+")), 10, update_widget, gerrit_widget)
+ watch(string.format(GET_CHANGES_CMD, host, query:gsub(" ", "+")), timeout, update_widget, gerrit_widget)
return gerrit_widget
end