diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2010-08-29 00:49:57 +0200 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2010-08-29 00:49:57 +0200 |
commit | 26b0395ba988948a7cc8b79d08faf6a57058886a (patch) | |
tree | ae475623e8b249aa8b8d29b57878737f09c165f5 /contrib/netcfg.lua | |
parent | 0d6333ed61a305c8a18fd4eb42ad33a353627bc9 (diff) | |
download | vicious-legacy-26b0395ba988948a7cc8b79d08faf6a57058886a.tar.xz |
contrib: imported contrib widgets
Diffstat (limited to 'contrib/netcfg.lua')
-rw-r--r-- | contrib/netcfg.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/contrib/netcfg.lua b/contrib/netcfg.lua new file mode 100644 index 0000000..fc22e8d --- /dev/null +++ b/contrib/netcfg.lua @@ -0,0 +1,34 @@ +--------------------------------------------------- +-- Licensed under the GNU General Public License v2 +-- * (c) 2010, Radu A. <admiral0@tuxfamily.org> +--------------------------------------------------- + +-- {{{ Grab environment +local io = { popen = io.popen } +local setmetatable = setmetatable +local table = { insert = table.insert } +-- }}} + + +-- Netcfg: provides active netcfg network profiles +module("vicious.contrib.netcfg") + + +-- {{{ Netcfg widget type +local function worker(format) + -- Initialize counters + local profiles = {} + + local f = io.popen("ls -1 /var/run/network/profiles") + for line in f:lines() do + if line ~= nil then + table.insert(profiles, line) + end + end + f:close() + + return profiles +end +-- }}} + +setmetatable(_M, { __call = function(_, ...) return worker(...) end }) |