This commit is contained in:
Joerg T. (Mic92) 2010-12-05 11:56:24 +01:00
commit 0a37ac66d1
6 changed files with 55 additions and 16 deletions

24
CHANGES
View File

@ -2,6 +2,30 @@
Full changelog is available online:
http://git.sysphere.org/vicious/log/?showmsg=1
---------------------------------------------------
add54f8 README: added missing register() documentation
fe2e432 TODO: fix contrib/sensors for Ian
7625933 wifi: proper fix for SSID regexp
7f7a94d gmail: inbox is now default
82eb67b wifi: removed spurious bracket from SSID regexp
304fa33 wifi: properly handle disconnects
32a7be1 wifi: provide link quality in percent
c532c0b contrib: fixed email of pulse widget author
49b0913 wifi: improved SSID regular expression
932bd8d init: emit timeout instead of forced update
fbd2af7 init: add set_markup support
e51d8ac date: turn time widget argument into an offset
c6085ee date: accept time as a widget argument
a9d6ea2 init: add connect_signal support, patch by Uli
86a1394 README: update contrib information
fbfcc49 init: comment connect_signal for users of awesome master
1d7f646 pkg: description updated
88c3d0c contrib: use pcall for luasocket in pop
b200a80 contrib: dont import pop - requires luasocket
0350ec9 TODO: document contrib widgets
f8a8696 contrib: imported POP3 widget from Boris
1a443cd init: import contrib widgets, commented
26b0395 contrib: imported contrib widgets
0d6333e Next release, tag 2.0.1
1534951 mpd: added some optional stats, commented
4113d37 pkg: include FreeBSD support
fc46e7a TODO: solid multigraph support needed

12
README
View File

@ -38,7 +38,7 @@ Then add the following to the top of your rc.lua:
require("vicious")
Once you create a widget (a textbox, graph or a progressbar) call
vicious.register() to register it with vicious:
vicious.register() to register it with Vicious:
vicious.register(widget, wtype, format, interval, warg)
@ -198,7 +198,7 @@ vicious.widgets.wifi
- provides wireless information for a requested interface
- takes the network interface as an argument, i.e. "wlan0"
- returns a table with string keys: {ssid}, {mode}, {chan}, {rate},
{link} and {sign}
{link}, {linp} and {sign}
vicious.widgets.mbox
- provides the subject of last e-mail in a mbox file
@ -270,7 +270,7 @@ vicious.widgets.date
- takes optional time offset, in seconds, as an argument for example
to calculate time zone differences, otherwise current time is
formatted
- returns the output of os.date(), formatted by provided sequences
- returns the output of os.date, formatted by provided sequences
Custom widget types
@ -292,6 +292,12 @@ branch. If you are also a BSD user you can find his work here:
- http://git.sigil.org/vicious-fbsd/
Some users would like to avoid writing new modules. For them Vicious
kept the old Wicked functionality, possibility to register their own
functions as widget types. By providing them as the second argument to
vicious.register. Your function can accept "format" and "warg"
arguments, just like workers.
Power and Caching
-----------------

3
TODO
View File

@ -16,6 +16,9 @@
- 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
> information but only for one cpu core.
** TODO Return values of type number in NET and FS
- Note: tonumber() strips decimal points
** MAYBE Simplify scrolling using negative margins + fixed width

View File

@ -1,6 +1,6 @@
---------------------------------------------------
-- Licensed under the GNU General Public License v2
-- * (c) 2010, MrMagne <MrMagne@cerv.fr>
-- * (c) 2010, MrMagne <mr.magne@yahoo.fr>
---------------------------------------------------
-- Usage example
--

View File

@ -37,7 +37,7 @@ local rss = {
}
-- Default is all unread
local feed = rss.unread
local feed = rss.inbox
local mail = {
["{count}"] = 0,
["{subject}"] = "N/A"

View File

@ -5,7 +5,9 @@
-- {{{ Grab environment
local tonumber = tonumber
local math = { ceil = math.ceil }
local setmetatable = setmetatable
local helpers = require("vicious.helpers")
local io = {
open = io.open,
popen = io.popen
@ -21,20 +23,21 @@ local string = {
module("vicious.widgets.wifi")
-- Initialize function tables
local winfo = {
["{ssid}"] = "N/A",
["{mode}"] = "N/A",
["{chan}"] = 0,
["{rate}"] = 0,
["{link}"] = 0,
["{sign}"] = 0
}
-- {{{ Wireless widget type
local function worker(format, warg)
if not warg then return end
-- Default values
local winfo = {
["{ssid}"] = "N/A",
["{mode}"] = "N/A",
["{chan}"] = 0,
["{rate}"] = 0,
["{link}"] = 0,
["{linp}"] = 0,
["{sign}"] = 0
}
-- Get data from iwconfig where available
local iwconfig = "/sbin/iwconfig"
local f = io.open(iwconfig, "rb")
@ -55,7 +58,7 @@ local function worker(format, warg)
-- Output differs from system to system, some stats can be
-- separated by =, and not all drivers report all stats
winfo["{ssid}"] = -- SSID can have almost anything in it
string.match(iw, 'ESSID[=:]"([%w%p]+[%s%w%p]*]*)"') or winfo["{ssid}"]
helpers.escape(string.match(iw, 'ESSID[=:]"(.-)"') or winfo["{ssid}"])
winfo["{mode}"] = -- Modes are simple, but also match the "-" in Ad-Hoc
string.match(iw, "Mode[=:]([%w%-]*)") or winfo["{mode}"]
winfo["{chan}"] = -- Channels are plain digits
@ -67,6 +70,9 @@ local function worker(format, warg)
winfo["{sign}"] = -- Signal level can be a negative value, don't display decibel notation
tonumber(string.match(iw, "Signal level[=:]([%-]?[%d]+)") or winfo["{sign}"])
-- Link quality percentage if quality was available
if winfo["{link}"] ~= 0 then winfo["{linp}"] = math.ceil(winfo["{link}"] / 0.7) end
return winfo
end
-- }}}