diff --git a/init.lua b/init.lua index 73d382d..7eb0159 100644 --- a/init.lua +++ b/init.lua @@ -6,71 +6,27 @@ -- * (c) 2009, Lucas de Vries --------------------------------------------------- --- {{{ Grab environment +-- {{{ Setup environment local type = type local pairs = pairs local tonumber = tonumber -local helpers = require("vicious.helpers") local capi = { timer = timer } local os = { time = os.time } local table = { insert = table.insert, remove = table.remove } --- }}} - - --- {{{ Configure widgets -require("vicious.cpu") -require("vicious.cpuinf") -require("vicious.cpufreq") -require("vicious.thermal") -require("vicious.uptime") -require("vicious.bat") -require("vicious.mem") -require("vicious.os") -require("vicious.fs") -require("vicious.dio") -require("vicious.hddtemp") -require("vicious.net") -require("vicious.wifi") -require("vicious.mbox") -require("vicious.mboxc") -require("vicious.mdir") -require("vicious.gmail") -require("vicious.entropy") -require("vicious.org") -require("vicious.pkg") -require("vicious.mpd") -require("vicious.volume") -require("vicious.weather") -require("vicious.date") --- }}} +require("vicious.helpers") +require("vicious.widgets") -- Vicious: widgets for the awesome window manager module("vicious") --- {{{ Initialize tables +-- Initialize tables local timers = {} local registered = {} local widget_cache = {} - --- Initialize the function table -widgets = {} --- }}} - --- {{{ Widget types -for i, w in pairs(_M) do - -- Ensure we don't call ourselves - if w and w ~= _M and type(w) == "table" then - -- Ignore the function table and helpers - if i ~= "widgets" and i ~= "helpers" then - -- Place widgets in the namespace table - widgets[i] = w - end - end -end -- }}} @@ -173,7 +129,7 @@ end -- }}} --- {{{ Exposed functions +-- {{{ Global functions -- {{{ Register a widget function register(widget, wtype, format, timer, warg) local reg = {} diff --git a/bat.lua b/widgets/bat.lua similarity index 98% rename from bat.lua rename to widgets/bat.lua index e728155..d6e3e6b 100644 --- a/bat.lua +++ b/widgets/bat.lua @@ -16,7 +16,7 @@ local math = { -- Batsys: provides state, charge, and remaining time for a requested battery -module("vicious.bat") +module("vicious.widgets.bat") -- {{{ Battery widget type diff --git a/cpu.lua b/widgets/cpu.lua similarity index 98% rename from cpu.lua rename to widgets/cpu.lua index 7c4907c..3dfc22f 100644 --- a/cpu.lua +++ b/widgets/cpu.lua @@ -18,7 +18,7 @@ local string = { -- Cpu: provides CPU usage for all available CPUs/cores -module("vicious.cpu") +module("vicious.widgets.cpu") -- Initialise function tables diff --git a/cpufreq.lua b/widgets/cpufreq.lua similarity index 97% rename from cpufreq.lua rename to widgets/cpufreq.lua index aa36151..7f60f5a 100644 --- a/cpufreq.lua +++ b/widgets/cpufreq.lua @@ -12,7 +12,7 @@ local helpers = require("vicious.helpers") -- Cpufreq: provides freq, voltage and governor info for a requested CPU -module("vicious.cpufreq") +module("vicious.widgets.cpufreq") -- {{{ CPU frequency widget type diff --git a/cpuinf.lua b/widgets/cpuinf.lua similarity index 97% rename from cpuinf.lua rename to widgets/cpuinf.lua index f9df451..8bee530 100644 --- a/cpuinf.lua +++ b/widgets/cpuinf.lua @@ -12,7 +12,7 @@ local string = { gmatch = string.gmatch } -- Cpuinf: provides speed and cache information for all available CPUs/cores -module("vicious.cpuinf") +module("vicious.widgets.cpuinf") -- {{{ CPU Information widget type diff --git a/date.lua b/widgets/date.lua similarity index 95% rename from date.lua rename to widgets/date.lua index f6295ec..68a803d 100644 --- a/date.lua +++ b/widgets/date.lua @@ -11,7 +11,7 @@ local setmetatable = setmetatable -- Date: provides access to os.date with optional custom formatting -module("vicious.date") +module("vicious.widgets.date") -- {{{ Date widget type diff --git a/dio.lua b/widgets/dio.lua similarity index 98% rename from dio.lua rename to widgets/dio.lua index 33f1f34..9731d57 100644 --- a/dio.lua +++ b/widgets/dio.lua @@ -13,7 +13,7 @@ local helpers = require("vicious.helpers") -- Disk I/O: provides I/O statistics for requested storage devices -module("vicious.dio") +module("vicious.widgets.dio") -- Initialise function tables diff --git a/entropy.lua b/widgets/entropy.lua similarity index 96% rename from entropy.lua rename to widgets/entropy.lua index 8ca0c30..395d5d9 100644 --- a/entropy.lua +++ b/widgets/entropy.lua @@ -12,7 +12,7 @@ local helpers = require("vicious.helpers") -- Entropy: provides available system entropy -module("vicious.entropy") +module("vicious.widgets.entropy") -- {{{ Entropy widget type diff --git a/fs.lua b/widgets/fs.lua similarity index 98% rename from fs.lua rename to widgets/fs.lua index 87aa243..a85b903 100644 --- a/fs.lua +++ b/widgets/fs.lua @@ -14,7 +14,7 @@ local helpers = require("vicious.helpers") -- FS: provides file system disk space usage -module("vicious.fs") +module("vicious.widgets.fs") -- Variable definitions diff --git a/gmail.lua b/widgets/gmail.lua similarity index 98% rename from gmail.lua rename to widgets/gmail.lua index b4bd081..b2f0d8c 100644 --- a/gmail.lua +++ b/widgets/gmail.lua @@ -17,7 +17,7 @@ local string = { -- Gmail: provides count of new and subject of last e-mail on Gmail -module("vicious.gmail") +module("vicious.widgets.gmail") -- {{{ Variable definitions diff --git a/hddtemp.lua b/widgets/hddtemp.lua similarity index 96% rename from hddtemp.lua rename to widgets/hddtemp.lua index 7c1e1e0..6fcd05f 100644 --- a/hddtemp.lua +++ b/widgets/hddtemp.lua @@ -12,7 +12,7 @@ local string = { gmatch = string.gmatch } -- Hddtemp: provides hard drive temperatures using the hddtemp daemon -module("vicious.hddtemp") +module("vicious.widgets.hddtemp") -- {{{ HDD Temperature widget type diff --git a/widgets/init.lua b/widgets/init.lua new file mode 100644 index 0000000..5b8ae04 --- /dev/null +++ b/widgets/init.lua @@ -0,0 +1,36 @@ +--------------------------------------------------- +-- Vicious widgets for the awesome window manager +--------------------------------------------------- +-- Licensed under the GNU General Public License v2 +-- * (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.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.entropy") +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 +module("vicious.widgets") diff --git a/mbox.lua b/widgets/mbox.lua similarity index 97% rename from mbox.lua rename to widgets/mbox.lua index bc815ae..eca5403 100644 --- a/mbox.lua +++ b/widgets/mbox.lua @@ -13,7 +13,7 @@ local helpers = require("vicious.helpers") -- Mbox: provides the subject of last e-mail in a mbox file -module("vicious.mbox") +module("vicious.widgets.mbox") -- {{{ Mailbox widget type diff --git a/mboxc.lua b/widgets/mboxc.lua similarity index 98% rename from mboxc.lua rename to widgets/mboxc.lua index ff8ff65..c5f694c 100644 --- a/mboxc.lua +++ b/widgets/mboxc.lua @@ -11,7 +11,7 @@ local string = { find = string.find } -- Mboxc: provides the count of total, old and new messages in mbox files -module("vicious.mboxc") +module("vicious.widgets.mboxc") -- {{{ Mbox count widget type diff --git a/mdir.lua b/widgets/mdir.lua similarity index 97% rename from mdir.lua rename to widgets/mdir.lua index 0e0b27b..858a9b1 100644 --- a/mdir.lua +++ b/widgets/mdir.lua @@ -11,7 +11,7 @@ local setmetatable = setmetatable -- Mdir: provides the number of new and unread messages in Maildir structures/dirs -module("vicious.mdir") +module("vicious.widgets.mdir") -- {{{ Maildir widget type diff --git a/mem.lua b/widgets/mem.lua similarity index 98% rename from mem.lua rename to widgets/mem.lua index 7c18c89..c2f5886 100644 --- a/mem.lua +++ b/widgets/mem.lua @@ -13,7 +13,7 @@ local string = { gmatch = string.gmatch } -- Mem: provides RAM and Swap usage statistics -module("vicious.mem") +module("vicious.widgets.mem") -- {{{ Memory widget type diff --git a/mpd.lua b/widgets/mpd.lua similarity index 98% rename from mpd.lua rename to widgets/mpd.lua index 0764e53..009ae7d 100644 --- a/mpd.lua +++ b/widgets/mpd.lua @@ -13,7 +13,7 @@ local helpers = require("vicious.helpers") -- Mpd: provides Music Player Daemon information -module("vicious.mpd") +module("vicious.widgets.mpd") -- {{{ MPD widget type diff --git a/net.lua b/widgets/net.lua similarity index 98% rename from net.lua rename to widgets/net.lua index 0550557..9fd221f 100644 --- a/net.lua +++ b/widgets/net.lua @@ -15,7 +15,7 @@ local helpers = require("vicious.helpers") -- Net: provides usage statistics for all network interfaces -module("vicious.net") +module("vicious.widgets.net") -- Initialise function tables diff --git a/org.lua b/widgets/org.lua similarity index 98% rename from org.lua rename to widgets/org.lua index 6b034cc..8764e3a 100644 --- a/org.lua +++ b/widgets/org.lua @@ -16,7 +16,7 @@ local os = { -- Org: provides agenda statistics for Emacs org-mode -module("vicious.org") +module("vicious.widgets.org") -- {{{ OrgMode widget type diff --git a/os.lua b/widgets/os.lua similarity index 98% rename from os.lua rename to widgets/os.lua index eb0a2b1..8b1d11e 100644 --- a/os.lua +++ b/widgets/os.lua @@ -17,7 +17,7 @@ local string = { -- OS: provides operating system information -module("vicious.os") +module("vicious.widgets.os") -- {{{ Operating system widget type diff --git a/pkg.lua b/widgets/pkg.lua similarity index 97% rename from pkg.lua rename to widgets/pkg.lua index 014bb86..fa2375b 100644 --- a/pkg.lua +++ b/widgets/pkg.lua @@ -11,7 +11,7 @@ local setmetatable = setmetatable -- Pkg: provides number of pending updates on GNU/Linux -module("vicious.pkg") +module("vicious.widgets.pkg") -- {{{ Packages widget type diff --git a/thermal.lua b/widgets/thermal.lua similarity index 97% rename from thermal.lua rename to widgets/thermal.lua index d7e98fc..9768c57 100644 --- a/thermal.lua +++ b/widgets/thermal.lua @@ -13,7 +13,7 @@ local helpers = require("vicious.helpers") -- Thermal: provides temperature levels of ACPI and coretemp thermal zones -module("vicious.thermal") +module("vicious.widgets.thermal") -- {{{ Thermal widget type diff --git a/uptime.lua b/widgets/uptime.lua similarity index 97% rename from uptime.lua rename to widgets/uptime.lua index fdf45ea..ebc5af8 100644 --- a/uptime.lua +++ b/widgets/uptime.lua @@ -13,7 +13,7 @@ local helpers = require("vicious.helpers") -- Uptime: provides system uptime and load information -module("vicious.uptime") +module("vicious.widgets.uptime") -- {{{ Uptime widget type diff --git a/volume.lua b/widgets/volume.lua similarity index 97% rename from volume.lua rename to widgets/volume.lua index 070f3bf..42f72e4 100644 --- a/volume.lua +++ b/widgets/volume.lua @@ -12,7 +12,7 @@ local string = { match = string.match } -- Volume: provides volume levels and state of requested ALSA mixers -module("vicious.volume") +module("vicious.widgets.volume") -- {{{ Volume widget type diff --git a/weather.lua b/widgets/weather.lua similarity index 98% rename from weather.lua rename to widgets/weather.lua index 8e78e8b..effa138 100644 --- a/weather.lua +++ b/widgets/weather.lua @@ -14,7 +14,7 @@ local helpers = require("vicious.helpers") -- Weather: provides weather information for a requested station -module("vicious.weather") +module("vicious.widgets.weather") -- {{{ Weather widget type diff --git a/wifi.lua b/widgets/wifi.lua similarity index 98% rename from wifi.lua rename to widgets/wifi.lua index fc3d52e..65ffb79 100644 --- a/wifi.lua +++ b/widgets/wifi.lua @@ -18,7 +18,7 @@ local string = { -- Wifi: provides wireless information for a requested interface -module("vicious.wifi") +module("vicious.widgets.wifi") -- {{{ Wireless widget type