diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2010-10-19 21:23:06 +0200 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2010-10-19 21:23:06 +0200 |
commit | 32a7be1d6dd25eb47937789b8cb689b67d2fbb84 (patch) | |
tree | 14327ae97499c61dbe9cf83659ff5b64a2f7025e /widgets/wifi.lua | |
parent | c532c0b0803c98a26d56875f0955ed43132bfed2 (diff) | |
download | vicious-legacy-32a7be1d6dd25eb47937789b8cb689b67d2fbb84.tar.xz |
wifi: provide link quality in percent
Diffstat (limited to 'widgets/wifi.lua')
-rw-r--r-- | widgets/wifi.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/widgets/wifi.lua b/widgets/wifi.lua index 5801bd5..9e8583a 100644 --- a/widgets/wifi.lua +++ b/widgets/wifi.lua @@ -5,6 +5,7 @@ -- {{{ Grab environment local tonumber = tonumber +local math = { ceil = math.ceil } local setmetatable = setmetatable local io = { open = io.open, @@ -28,6 +29,7 @@ local winfo = { ["{chan}"] = 0, ["{rate}"] = 0, ["{link}"] = 0, + ["{linp}"] = 0, ["{sign}"] = 0 } @@ -67,6 +69,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 -- }}} |