aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README6
-rw-r--r--init.lua12
2 files changed, 18 insertions, 0 deletions
diff --git a/README b/README
index 21d9f89..3e0dd98 100644
--- a/README
+++ b/README
@@ -82,6 +82,12 @@ Enable caching of a widget type:
- enable caching of values returned by a widget type
+Force update of widgets:
+ vicious.force({ widget, })
+
+ - widget argument is a table with one or more widgets that will be
+ updated
+
Power and Caching
-----------------
diff --git a/init.lua b/init.lua
index aec420e..b4f38f3 100644
--- a/init.lua
+++ b/init.lua
@@ -72,6 +72,7 @@ for i, w in pairs(_M) do
end
-- }}}
+
-- {{{ Local functions
-- {{{ Update a widget
local function update(widget, reg, disablecache)
@@ -170,6 +171,7 @@ end
-- }}}
-- }}}
+
-- {{{ Exposed functions
-- {{{ Register a widget
function register(widget, wtype, format, timer, warg)
@@ -245,6 +247,16 @@ function cache(type)
end
-- }}}
+-- {{{ Force update of widgets
+function force(widgets)
+ if type(widgets) == "table" then
+ for _, w in pairs(widgets) do
+ update(w, nil, true)
+ end
+ end
+end
+-- }}}
+
-- {{{ Suspend all widgets
function suspend()
for w, i in pairs(registered) do