more cleaning

This commit is contained in:
petrucci4prez 2017-07-16 22:07:13 -04:00
parent c5a28cc6b6
commit ba314917d6
1 changed files with 11 additions and 8 deletions

View File

@ -26,11 +26,14 @@ local _TABLE_HEIGHT_ = 114
local MEM_TOTAL_KB = tonumber(util.read_file('/proc/meminfo', 'MemTotal:%s+(%d+)')) local MEM_TOTAL_KB = tonumber(util.read_file('/proc/meminfo', 'MemTotal:%s+(%d+)'))
local TABLE_CONKY = {} local NUM_ROWS = 5
for c = 1, 3 do TABLE_CONKY[c] = {} end local TABLE_CONKY = {{}, {}, {}}
for r = 1, 5 do TABLE_CONKY[1][r] = '${top_mem name '..r..'}' end
for r = 1, 5 do TABLE_CONKY[2][r] = '${top_mem pid '..r..'}' end for r = 1, NUM_ROWS do
for r = 1, 5 do TABLE_CONKY[3][r] = '${top_mem mem '..r..'}' end TABLE_CONKY[1][r] = '${top_mem name '..r..'}'
TABLE_CONKY[2][r] = '${top_mem pid '..r..'}'
TABLE_CONKY[3][r] = '${top_mem mem '..r..'}'
end
local header = Widget.Header{ local header = Widget.Header{
x = _G_INIT_DATA_.RIGHT_X, x = _G_INIT_DATA_.RIGHT_X,
@ -135,7 +138,7 @@ local tbl = Widget.Table{
'Mem (%)' 'Mem (%)'
} }
local __update = function(cr) local update = function(cr)
local MEM_TOTAL_KB = MEM_TOTAL_KB local MEM_TOTAL_KB = MEM_TOTAL_KB
local round = util.round local round = util.round
@ -171,7 +174,7 @@ local __update = function(cr)
for c = 1, 3 do for c = 1, 3 do
local column = TABLE_CONKY[c] local column = TABLE_CONKY[c]
for r = 1, 5 do for r = 1, NUM_ROWS do
Table.set(tbl, cr, c, r, util.conky(column[r], '(%S+)')) Table.set(tbl, cr, c, r, util.conky(column[r], '(%S+)'))
end end
end end
@ -195,7 +198,7 @@ _RIGHT_X_ = nil
_PLOT_Y_ = nil _PLOT_Y_ = nil
local draw = function(cr, current_interface) local draw = function(cr, current_interface)
__update(cr) update(cr)
if current_interface == 0 then if current_interface == 0 then
Text.draw(header.text, cr) Text.draw(header.text, cr)