Load widgets as needed instead of all at startup
This commit is contained in:
parent
80da3d6b40
commit
2e461f101d
|
@ -5,20 +5,12 @@
|
||||||
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
|
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|
||||||
-- {{{ Configure widgets
|
|
||||||
require("vicious.contrib.batacpi")
|
local setmetatable = setmetatable
|
||||||
require("vicious.contrib.batpmu")
|
local require_once = require("vicious.helpers").require_once
|
||||||
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")
|
|
||||||
-- }}}
|
|
||||||
|
|
||||||
-- Vicious: widgets for the awesome window manager
|
-- Vicious: widgets for the awesome window manager
|
||||||
module("vicious.contrib")
|
module("vicious.contrib")
|
||||||
|
|
||||||
|
-- Load modules at runtime as needed
|
||||||
|
setmetatable(_M, {__index = require_once} )
|
||||||
|
|
10
helpers.lua
10
helpers.lua
|
@ -13,6 +13,8 @@ local tonumber = tonumber
|
||||||
local io = { open = io.open }
|
local io = { open = io.open }
|
||||||
local setmetatable = setmetatable
|
local setmetatable = setmetatable
|
||||||
local getmetatable = getmetatable
|
local getmetatable = getmetatable
|
||||||
|
local require = require
|
||||||
|
local rawget = rawget
|
||||||
local string = {
|
local string = {
|
||||||
upper = string.upper,
|
upper = string.upper,
|
||||||
format = string.format
|
format = string.format
|
||||||
|
@ -29,6 +31,14 @@ local scroller = {}
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Helper functions
|
-- {{{ 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
|
-- {{{ Expose path as a Lua table
|
||||||
function pathtotable(dir)
|
function pathtotable(dir)
|
||||||
return setmetatable({ _path = dir },
|
return setmetatable({ _path = dir },
|
||||||
|
|
|
@ -5,32 +5,11 @@
|
||||||
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
|
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|
||||||
-- {{{ Configure widgets
|
local setmetatable = setmetatable
|
||||||
require("vicious.widgets.cpu")
|
local require_once = require("vicious.helpers").require_once
|
||||||
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")
|
|
||||||
-- }}}
|
|
||||||
|
|
||||||
-- Vicious: widgets for the awesome window manager
|
-- Vicious: widgets for the awesome window manager
|
||||||
module("vicious.widgets")
|
module("vicious.widgets")
|
||||||
|
|
||||||
|
-- Load modules at runtime as needed
|
||||||
|
setmetatable(_M, {__index = require_once} )
|
||||||
|
|
Loading…
Reference in New Issue