REF make pacman and system modules look pretty
This commit is contained in:
parent
81b6a6b2aa
commit
862967089f
|
@ -1,11 +1,12 @@
|
|||
local Common = require 'Common'
|
||||
local Geometry = require 'Geometry'
|
||||
|
||||
return function()
|
||||
local TEXT_SPACING = 20
|
||||
|
||||
local __string_match = string.match
|
||||
local __string_gmatch = string.gmatch
|
||||
|
||||
local _TEXT_SPACING_ = 20
|
||||
|
||||
local header = Common.Header(
|
||||
Geometry.RIGHT_X,
|
||||
Geometry.TOP_Y,
|
||||
|
@ -17,12 +18,10 @@ local rows = Common.initTextRows(
|
|||
Geometry.RIGHT_X,
|
||||
header.bottom_y,
|
||||
Geometry.SECTION_WIDTH,
|
||||
_TEXT_SPACING_,
|
||||
TEXT_SPACING,
|
||||
{'Total', 'Explicit', 'Outdated', 'Orphaned', 'Local'}
|
||||
)
|
||||
|
||||
_TEXT_SPACING_ = nil
|
||||
|
||||
local update = function(cr, pacman_stats)
|
||||
local stats = __string_match(pacman_stats, '%d+%s+[^%s]+%s+[^%s]+%s+(.*)$')
|
||||
if stats then
|
||||
|
@ -48,6 +47,5 @@ local draw_dynamic = function(cr, pacman_stats)
|
|||
Common.text_rows_draw_dynamic(rows, cr)
|
||||
end
|
||||
|
||||
return function()
|
||||
return {static = draw_static, dynamic = draw_dynamic}
|
||||
end
|
||||
|
|
|
@ -2,9 +2,10 @@ local Util = require 'Util'
|
|||
local Common = require 'Common'
|
||||
local Geometry = require 'Geometry'
|
||||
|
||||
local __string_match = string.match
|
||||
return function()
|
||||
local TEXT_SPACING = 20
|
||||
|
||||
local _TEXT_SPACING_ = 20
|
||||
local __string_match = string.match
|
||||
|
||||
local header = Common.Header(
|
||||
Geometry.LEFT_X,
|
||||
|
@ -17,12 +18,10 @@ local rows = Common.initTextRows(
|
|||
Geometry.LEFT_X,
|
||||
header.bottom_y,
|
||||
Geometry.SECTION_WIDTH,
|
||||
_TEXT_SPACING_,
|
||||
TEXT_SPACING,
|
||||
{'Kernel', 'Uptime', 'Last Upgrade', 'Last Sync'}
|
||||
)
|
||||
|
||||
_TEXT_SPACING_ = nil
|
||||
|
||||
local draw_static = function(cr)
|
||||
Common.drawHeader(cr, header)
|
||||
Common.text_rows_draw_static(rows, cr)
|
||||
|
@ -33,6 +32,7 @@ local draw_dynamic = function(cr, pacman_stats)
|
|||
if pacman_stats then
|
||||
last_update, last_sync = __string_match(pacman_stats, "^%d+%s+([^%s]+)%s+([^%s]+).*")
|
||||
end
|
||||
-- TODO this doesn't need to be update every time
|
||||
Common.text_rows_set(rows, cr, 1, Util.conky('$kernel'))
|
||||
Common.text_rows_set(rows, cr, 2, Util.conky('$uptime'))
|
||||
Common.text_rows_set(rows, cr, 3, last_update)
|
||||
|
@ -40,6 +40,5 @@ local draw_dynamic = function(cr, pacman_stats)
|
|||
Common.text_rows_draw_dynamic(rows, cr)
|
||||
end
|
||||
|
||||
return function()
|
||||
return {static = draw_static, dynamic = draw_dynamic}
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue