API: transform widgets namespace table to a directory

This commit is contained in:
Adrian C. (anrxc) 2010-03-14 01:55:33 +01:00
parent 9a82d4113a
commit 237470c8f4
26 changed files with 65 additions and 73 deletions

View File

@ -6,71 +6,27 @@
-- * (c) 2009, Lucas de Vries <lucas@glacicle.com>
---------------------------------------------------
-- {{{ 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 = {}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -12,7 +12,7 @@ local helpers = require("vicious.helpers")
-- Entropy: provides available system entropy
module("vicious.entropy")
module("vicious.widgets.entropy")
-- {{{ Entropy widget type

View File

@ -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

View File

@ -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

View File

@ -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

36
widgets/init.lua Normal file
View File

@ -0,0 +1,36 @@
---------------------------------------------------
-- Vicious widgets for the awesome window manager
---------------------------------------------------
-- Licensed under the GNU General Public License v2
-- * (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.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")

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -16,7 +16,7 @@ local os = {
-- Org: provides agenda statistics for Emacs org-mode
module("vicious.org")
module("vicious.widgets.org")
-- {{{ OrgMode widget type

View File

@ -17,7 +17,7 @@ local string = {
-- OS: provides operating system information
module("vicious.os")
module("vicious.widgets.os")
-- {{{ Operating system widget type

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -18,7 +18,7 @@ local string = {
-- Wifi: provides wireless information for a requested interface
module("vicious.wifi")
module("vicious.widgets.wifi")
-- {{{ Wireless widget type