2017-07-19 00:43:44 -04:00
|
|
|
local Util = require 'Util'
|
2021-07-05 23:27:43 -04:00
|
|
|
local Common = require 'Common'
|
2021-07-16 23:25:44 -04:00
|
|
|
local Geometry = require 'Geometry'
|
2017-07-19 00:36:15 -04:00
|
|
|
|
|
|
|
local __string_match = string.match
|
|
|
|
|
|
|
|
local _TEXT_SPACING_ = 20
|
|
|
|
|
2021-07-05 23:27:43 -04:00
|
|
|
local header = Common.Header(
|
2021-07-16 23:25:44 -04:00
|
|
|
Geometry.LEFT_X,
|
|
|
|
Geometry.TOP_Y,
|
|
|
|
Geometry.SECTION_WIDTH,
|
2021-07-05 23:27:43 -04:00
|
|
|
'SYSTEM'
|
|
|
|
)
|
|
|
|
|
|
|
|
local rows = Common.initTextRows(
|
2021-07-16 23:25:44 -04:00
|
|
|
Geometry.LEFT_X,
|
2021-07-05 23:27:43 -04:00
|
|
|
header.bottom_y,
|
2021-07-16 23:25:44 -04:00
|
|
|
Geometry.SECTION_WIDTH,
|
2021-07-05 23:27:43 -04:00
|
|
|
_TEXT_SPACING_,
|
|
|
|
{'Kernel', 'Uptime', 'Last Upgrade', 'Last Sync'}
|
|
|
|
)
|
2017-07-19 00:36:15 -04:00
|
|
|
|
|
|
|
_TEXT_SPACING_ = nil
|
|
|
|
|
2021-07-17 00:17:22 -04:00
|
|
|
local draw_static = function(cr)
|
2021-07-05 23:27:43 -04:00
|
|
|
Common.drawHeader(cr, header)
|
|
|
|
Common.text_rows_draw_static(rows, cr)
|
2018-08-05 11:22:07 -04:00
|
|
|
end
|
|
|
|
|
2021-07-17 00:17:22 -04:00
|
|
|
local draw_dynamic = function(cr, pacman_stats)
|
2021-07-05 23:27:43 -04:00
|
|
|
local last_update, last_sync = "N/A", "N/A"
|
2019-10-11 21:52:10 -04:00
|
|
|
if pacman_stats then
|
2021-07-05 23:27:43 -04:00
|
|
|
last_update, last_sync = __string_match(pacman_stats, "^%d+%s+([^%s]+)%s+([^%s]+).*")
|
2018-08-05 11:08:37 -04:00
|
|
|
end
|
2021-07-05 23:27:43 -04:00
|
|
|
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)
|
|
|
|
Common.text_rows_set(rows, cr, 4, last_sync)
|
|
|
|
Common.text_rows_draw_dynamic(rows, cr)
|
2017-07-19 00:36:15 -04:00
|
|
|
end
|
|
|
|
|
2021-07-17 00:17:22 -04:00
|
|
|
return function()
|
|
|
|
return {static = draw_static, dynamic = draw_dynamic}
|
|
|
|
end
|