From dcc2b60cd85dabd716e2bb8c49d9703f050eaff5 Mon Sep 17 00:00:00 2001 From: "Joerg T. (Mic92)" Date: Tue, 10 May 2011 00:47:58 +0200 Subject: [PATCH 1/2] 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) Signed-off-by: Adrian C. (anrxc) --- README | 6 +++--- contrib/init.lua | 21 +++++++-------------- helpers.lua | 9 +++++++++ widgets/init.lua | 33 +++++++-------------------------- 4 files changed, 26 insertions(+), 43 deletions(-) diff --git a/README b/README index 8f3b877..d136546 100644 --- a/README +++ b/README @@ -29,9 +29,9 @@ $XDG_CONFIG_HOME (usually ~/.config): $ mv vicious $XDG_CONFIG_HOME/awesome/ -If you want you can disable widgets you will not use, to avoid having -useless modules sitting in your memory. You can comment out any widget -type from the "Configure widgets" list in the widgets/init.lua file. +Vicious will only load modules for widget types you intend to use in +your awesome configuration, to avoid having useless modules sitting in +your memory. Then add the following to the top of your rc.lua: diff --git a/contrib/init.lua b/contrib/init.lua index a8c5ee6..7fee3b3 100644 --- a/contrib/init.lua +++ b/contrib/init.lua @@ -5,20 +5,13 @@ -- * (c) 2010, Adrian C. --------------------------------------------------- --- {{{ 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") --- }}} +-- {{{ Setup environment +local setmetatable = setmetatable +local wrequire = require("vicious.helpers").wrequire -- Vicious: widgets for the awesome window manager module("vicious.contrib") +-- }}} + +-- Load modules at runtime as needed +setmetatable(_M, { __index = wrequire }) 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 }, diff --git a/widgets/init.lua b/widgets/init.lua index c8af255..6ec6360 100644 --- a/widgets/init.lua +++ b/widgets/init.lua @@ -5,32 +5,13 @@ -- * (c) 2010, Adrian C. --------------------------------------------------- --- {{{ 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") --- }}} +-- {{{ Setup environment +local setmetatable = setmetatable +local wrequire = require("vicious.helpers").wrequire -- Vicious: widgets for the awesome window manager module("vicious.widgets") +-- }}} + +-- Load modules at runtime as needed +setmetatable(_M, { __index = wrequire }) From 324563e51bdb1f79ee7ed62fb44482a1faa9a933 Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Tue, 10 May 2011 22:40:34 +0200 Subject: [PATCH 2/2] Next release, tag 2.0.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Jörg Thalheim and his work on improving Vicious, we can make this tag. --- CHANGES | 13 +++++++++++++ TODO | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index abe1840..6f78ffe 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,19 @@ Full changelog is available online: http://git.sysphere.org/vicious/log/?showmsg=1 --------------------------------------------------- +dcc2b60 vicious: load widget modules only when needed +06e8f7c mpd: allow named keys or positional arguments +729ceb7 dio: import string.match() +c2f7fbc dio: provide stats for all devices, rewritten by Joerg +6522f58 cpu: another 10 percent optimization from Joerg +753ce61 cpu: calculation and optimization fixes by Joerg +f85d944 gmail: fixed misleading comment +31d7b2f bat: fixed "no such device" for current and power +d385843 helpers: properly handle magic characters +6ddad31 bat: added power_now support +fd0718e contrib: added a README with pulse.lua documented +9f4302c contrib: rewrite pulse module +5160cfe Next release, tag 2.0.2 add54f8 README: added missing register() documentation fe2e432 TODO: fix contrib/sensors for Ian 7625933 wifi: proper fix for SSID regexp diff --git a/TODO b/TODO index 5572be5..3eb3a3c 100644 --- a/TODO +++ b/TODO @@ -5,14 +5,14 @@ * Vicious +** TODO Implement intelligent multigraph support +** TODO Expand raid to grab data for all available devices ** TODO Consider commiting power drain support to bat.lua ** TODO Document contrib widgets in contrib/README -** TODO Consider multigraph, graph stacking, support ** TODO Complete the hddtemp fix - In certain setups regexp does not match all devices - The regexp catches the first device name, but last stats - Shortening the match introduced new problems IIRC -** TODO Expand raid to grab data for all available devices ** TODO Add fan speed to thermal.lua ** TODO Fix contrib/sensors for Ian - > it does work and provides the lm_sensors