aboutsummaryrefslogtreecommitdiff
path: root/helpers.lua
diff options
context:
space:
mode:
authorJoerg T. (Mic92) <jthalheim@gmail.com>2011-05-10 00:47:58 +0200
committerAdrian C. (anrxc) <anrxc@sysphere.org>2011-05-10 00:50:41 +0200
commitdcc2b60cd85dabd716e2bb8c49d9703f050eaff5 (patch)
tree6c353bda6f107ba0445a420097eeffe20d1d9116 /helpers.lua
parent06e8f7c68ae8f880203911b2991c6103803227f9 (diff)
downloadvicious-legacy-dcc2b60cd85dabd716e2bb8c49d9703f050eaff5.tar.xz
vicious: load widget modules only when needed
There's no more need to edit init files and manually disable widgets. Signed-off-by: Joerg T. (Mic92) <jthalheim@gmail.com> Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Diffstat (limited to 'helpers.lua')
-rw-r--r--helpers.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/helpers.lua b/helpers.lua
index ef92bfa..223c5f1 100644
--- a/helpers.lua
+++ b/helpers.lua
@@ -9,6 +9,8 @@
-- {{{ Grab environment
local pairs = pairs
+local rawget = rawget
+local require = require
local tonumber = tonumber
local io = { open = io.open }
local setmetatable = setmetatable
@@ -29,6 +31,13 @@ local scroller = {}
-- }}}
-- {{{ Helper functions
+-- {{{ Loader of vicious modules
+function wrequire(table, key)
+ local module = rawget(table, key)
+ return module or require(table._NAME .. "." .. key)
+end
+-- }}}
+
-- {{{ Expose path as a Lua table
function pathtotable(dir)
return setmetatable({ _path = dir },