Reworked some variables in entropy, load, mpd, net, init
This commit is contained in:
parent
643ecb0287
commit
724366c038
|
@ -25,7 +25,7 @@ local function worker(format, poolsize)
|
||||||
f:close()
|
f:close()
|
||||||
|
|
||||||
-- Calculate percentage
|
-- Calculate percentage
|
||||||
ent_avail_percent = math.ceil(ent_avail * 100 / poolsize)
|
local ent_avail_percent = math.ceil(ent_avail * 100 / poolsize)
|
||||||
|
|
||||||
return {ent_avail, ent_avail_percent}
|
return {ent_avail, ent_avail_percent}
|
||||||
end
|
end
|
||||||
|
|
17
init.lua
17
init.lua
|
@ -7,21 +7,16 @@
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
|
|
||||||
-- {{{ Grab environment
|
-- {{{ Grab environment
|
||||||
require("awful")
|
local type = type
|
||||||
require("vicious.helpers")
|
|
||||||
|
|
||||||
local type = type
|
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local awful = awful
|
|
||||||
local tonumber = tonumber
|
local tonumber = tonumber
|
||||||
local os = { time = os.time }
|
local helpers = require("vicious.helpers")
|
||||||
|
local capi = { timer = timer }
|
||||||
|
local os = { time = os.time }
|
||||||
local table = {
|
local table = {
|
||||||
insert = table.insert,
|
insert = table.insert,
|
||||||
remove = table.remove
|
remove = table.remove
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Grab C API
|
|
||||||
local capi = { timer = timer }
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
|
||||||
|
|
5
load.lua
5
load.lua
|
@ -20,10 +20,9 @@ local function worker(format)
|
||||||
local line = f:read("*line")
|
local line = f:read("*line")
|
||||||
f:close()
|
f:close()
|
||||||
|
|
||||||
local avg1, avg5, avg15 =
|
local l1, l5, l15 = line:match("([%d]*%.[%d]*)%s([%d]*%.[%d]*)%s([%d]*%.[%d]*)")
|
||||||
line:match("([%d]*%.[%d]*)%s([%d]*%.[%d]*)%s([%d]*%.[%d]*)")
|
|
||||||
|
|
||||||
return {avg1, avg5, avg15}
|
return {l1, l5, l15}
|
||||||
end
|
end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
|
4
mpd.lua
4
mpd.lua
|
@ -28,10 +28,10 @@ local function worker(format)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Sanitize the song name
|
-- Sanitize the song name
|
||||||
nowplaying = helpers.escape(np)
|
local nowplaying = helpers.escape(np)
|
||||||
|
|
||||||
-- Don't abuse the wibox, truncate
|
-- Don't abuse the wibox, truncate
|
||||||
nowplaying = helpers.truncate(nowplaying, 30)
|
local nowplaying = helpers.truncate(nowplaying, 30)
|
||||||
|
|
||||||
return {nowplaying}
|
return {nowplaying}
|
||||||
end
|
end
|
||||||
|
|
12
net.lua
12
net.lua
|
@ -29,11 +29,11 @@ local function worker(format)
|
||||||
for line in f:lines() do
|
for line in f:lines() do
|
||||||
-- Match wmaster0 as well as rt0 (multiple leading spaces)
|
-- Match wmaster0 as well as rt0 (multiple leading spaces)
|
||||||
if line:match("^[%s]?[%s]?[%s]?[%s]?[%w]+:") then
|
if line:match("^[%s]?[%s]?[%s]?[%s]?[%w]+:") then
|
||||||
name = line:match("^[%s]?[%s]?[%s]?[%s]?([%w]+):")
|
local name = line:match("^[%s]?[%s]?[%s]?[%s]?([%w]+):")
|
||||||
-- Received bytes, first value after the name
|
-- Received bytes, first value after the name
|
||||||
recv = tonumber(line:match(":[%s]*([%d]+)"))
|
local recv = tonumber(line:match(":[%s]*([%d]+)"))
|
||||||
-- Transmited bytes, 7 fields from end of the line
|
-- Transmited bytes, 7 fields from end of the line
|
||||||
send = tonumber(line:match("([%d]+)%s+%d+%s+%d+%s+%d+%s+%d+%s+%d+%s+%d+%s+%d$"))
|
local send = tonumber(line:match("([%d]+)%s+%d+%s+%d+%s+%d+%s+%d+%s+%d+%s+%d+%s+%d$"))
|
||||||
|
|
||||||
args["{"..name.." rx_b}"] = math.floor(recv*10)/10
|
args["{"..name.." rx_b}"] = math.floor(recv*10)/10
|
||||||
args["{"..name.." tx_b}"] = math.floor(send*10)/10
|
args["{"..name.." tx_b}"] = math.floor(send*10)/10
|
||||||
|
@ -68,11 +68,11 @@ local function worker(format)
|
||||||
nets[name].time = os.time()
|
nets[name].time = os.time()
|
||||||
else
|
else
|
||||||
-- Net stats are absolute, substract our last reading
|
-- Net stats are absolute, substract our last reading
|
||||||
interval = os.time() - nets[name].time
|
local interval = os.time() - nets[name].time
|
||||||
nets[name].time = os.time()
|
nets[name].time = os.time()
|
||||||
|
|
||||||
down = (recv - nets[name][1])/interval
|
local down = (recv - nets[name][1])/interval
|
||||||
up = (send - nets[name][2])/interval
|
local up = (send - nets[name][2])/interval
|
||||||
|
|
||||||
args["{"..name.." down_b}"] = math.floor(down*10)/10
|
args["{"..name.." down_b}"] = math.floor(down*10)/10
|
||||||
args["{"..name.." up_b}"] = math.floor(up*10)/10
|
args["{"..name.." up_b}"] = math.floor(up*10)/10
|
||||||
|
|
Loading…
Reference in New Issue