wiki enhanced

This commit is contained in:
copycat-killer 2017-01-27 14:35:27 +01:00
parent 229d2545dd
commit ae4b9b2728
7 changed files with 13 additions and 15 deletions

View File

@ -108,7 +108,7 @@ function tpbat.register(args)
}) })
end end
function update() function tpbat.update()
bat_now = { bat_now = {
status = "Not present", status = "Not present",
perc = "N/A", perc = "N/A",
@ -151,12 +151,12 @@ function tpbat.register(args)
settings() settings()
end end
newtimer("tpbat-" .. bat.name, timeout, update) newtimer("tpbat-" .. bat.name, timeout, tpbat.update)
widget:connect_signal('mouse::enter', function () tpbat.show() end) widget:connect_signal('mouse::enter', function () tpbat.show() end)
widget:connect_signal('mouse::leave', function () tpbat.hide() end) widget:connect_signal('mouse::leave', function () tpbat.hide() end)
return tpbat.widget return tpbat
end end
return setmetatable(tpbat, { __call = function(_, ...) return tpbat.register(...) end }) return setmetatable(tpbat, { __call = function(_, ...) return tpbat.register(...) end })

View File

@ -26,7 +26,7 @@ local function worker(args)
cpu.widget = wibox.widget.textbox() cpu.widget = wibox.widget.textbox()
function update() function cpu.update()
-- Read the amount of time the CPUs have spent performing -- Read the amount of time the CPUs have spent performing
-- different kinds of work. Read the first line of /proc/stat -- different kinds of work. Read the first line of /proc/stat
-- which is the sum of all CPUs. -- which is the sum of all CPUs.
@ -74,7 +74,7 @@ local function worker(args)
settings() settings()
end end
helpers.newtimer("cpu", timeout, update) helpers.newtimer("cpu", timeout, cpu.update)
return cpu return cpu
end end

View File

@ -25,7 +25,7 @@ local function worker(args)
mem.widget = wibox.widget.textbox() mem.widget = wibox.widget.textbox()
function update() function mem.update()
mem_now = {} mem_now = {}
for line in lines("/proc/meminfo") do for line in lines("/proc/meminfo") do
for k, v in gmatch(line, "([%a]+):[%s]+([%d]+).+") do for k, v in gmatch(line, "([%a]+):[%s]+([%d]+).+") do
@ -48,7 +48,7 @@ local function worker(args)
settings() settings()
end end
helpers.newtimer("mem", timeout, update) helpers.newtimer("mem", timeout, mem.update)
return mem return mem
end end

View File

@ -97,12 +97,10 @@ local function worker(args)
helpers.set_map(dev, true) helpers.set_map(dev, true)
end end
-- Old api compatibility
net_now.carrier = dev_now.carrier net_now.carrier = dev_now.carrier
net_now.state = dev_now.state net_now.state = dev_now.state
-- And new api
net_now.devices[dev] = dev_now net_now.devices[dev] = dev_now
-- With the new api new_now.sent and net_now.received will be the -- new_now.sent and net_now.received will be the
-- totals across all specified devices -- totals across all specified devices
end end

View File

@ -24,7 +24,7 @@ local function worker(args)
sysload.widget = wibox.widget.textbox() sysload.widget = wibox.widget.textbox()
function update() function sysload.update()
local f = io.open("/proc/loadavg") local f = io.open("/proc/loadavg")
local ret = f:read("*all") local ret = f:read("*all")
f:close() f:close()
@ -35,7 +35,7 @@ local function worker(args)
settings() settings()
end end
helpers.newtimer("sysload", timeout, update) helpers.newtimer("sysload", timeout, sysload.update)
return sysload return sysload
end end

View File

@ -24,7 +24,7 @@ local function worker(args)
temp.widget = wibox.widget.textbox() temp.widget = wibox.widget.textbox()
function update() function temp.update()
local f = io.open(tempfile) local f = io.open(tempfile)
if f then if f then
coretemp_now = tonumber(f:read("*all")) / 1000 coretemp_now = tonumber(f:read("*all")) / 1000
@ -37,7 +37,7 @@ local function worker(args)
settings() settings()
end end
helpers.newtimer("coretemp", timeout, update) helpers.newtimer("coretemp", timeout, temp.update)
return temp return temp
end end

2
wiki

@ -1 +1 @@
Subproject commit ed824beb75262f9f78e49baa6e1a591220ca5249 Subproject commit 425169b35b105e5a240997ff8f5aa12bec6099cb