Load widgets as needed instead of all at startup

This commit is contained in:
Joerg T. (Mic92) 2011-05-09 19:13:04 +02:00
parent 80da3d6b40
commit 2e461f101d
3 changed files with 21 additions and 40 deletions

View File

@ -5,20 +5,12 @@
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
---------------------------------------------------
-- {{{ Configure widgets
require("vicious.contrib.batacpi")
require("vicious.contrib.batpmu")
require("vicious.contrib.batproc")
require("vicious.contrib.dio")
require("vicious.contrib.mpc")
require("vicious.contrib.netcfg")
require("vicious.contrib.net")
require("vicious.contrib.ossvol")
require("vicious.contrib.pop")
require("vicious.contrib.pulse")
require("vicious.contrib.rss")
require("vicious.contrib.sensors")
-- }}}
local setmetatable = setmetatable
local require_once = require("vicious.helpers").require_once
-- Vicious: widgets for the awesome window manager
module("vicious.contrib")
-- Load modules at runtime as needed
setmetatable(_M, {__index = require_once} )

View File

@ -13,6 +13,8 @@ local tonumber = tonumber
local io = { open = io.open }
local setmetatable = setmetatable
local getmetatable = getmetatable
local require = require
local rawget = rawget
local string = {
upper = string.upper,
format = string.format
@ -29,6 +31,14 @@ local scroller = {}
-- }}}
-- {{{ Helper functions
-- {{{ Require a submodule once
function require_once(t, key)
local module = rawget(t, key)
return module or require(t._NAME.."."..key)
end
-- }}}
-- {{{ Expose path as a Lua table
function pathtotable(dir)
return setmetatable({ _path = dir },

View File

@ -5,32 +5,11 @@
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
---------------------------------------------------
-- {{{ Configure widgets
require("vicious.widgets.cpu")
require("vicious.widgets.cpuinf")
require("vicious.widgets.cpufreq")
require("vicious.widgets.thermal")
require("vicious.widgets.uptime")
require("vicious.widgets.bat")
require("vicious.widgets.mem")
require("vicious.widgets.os")
require("vicious.widgets.fs")
require("vicious.widgets.dio")
require("vicious.widgets.raid")
require("vicious.widgets.hddtemp")
require("vicious.widgets.net")
require("vicious.widgets.wifi")
require("vicious.widgets.mbox")
require("vicious.widgets.mboxc")
require("vicious.widgets.mdir")
require("vicious.widgets.gmail")
require("vicious.widgets.org")
require("vicious.widgets.pkg")
require("vicious.widgets.mpd")
require("vicious.widgets.volume")
require("vicious.widgets.weather")
require("vicious.widgets.date")
-- }}}
local setmetatable = setmetatable
local require_once = require("vicious.helpers").require_once
-- Vicious: widgets for the awesome window manager
module("vicious.widgets")
-- Load modules at runtime as needed
setmetatable(_M, {__index = require_once} )