2021-08-08 15:58:53 -04:00
|
|
|
local i_o = require 'i_o'
|
2021-07-29 22:18:29 -04:00
|
|
|
local common = require 'common'
|
|
|
|
local geometry = require 'geometry'
|
2017-07-19 00:36:15 -04:00
|
|
|
|
2021-07-18 00:06:49 -04:00
|
|
|
return function()
|
|
|
|
local TEXT_SPACING = 20
|
|
|
|
|
|
|
|
local __string_match = string.match
|
|
|
|
|
2021-07-29 23:04:39 -04:00
|
|
|
local header = common.make_header(
|
2021-07-29 22:18:29 -04:00
|
|
|
geometry.LEFT_X,
|
|
|
|
geometry.TOP_Y,
|
|
|
|
geometry.SECTION_WIDTH,
|
2021-07-18 00:06:49 -04:00
|
|
|
'SYSTEM'
|
|
|
|
)
|
|
|
|
|
2021-07-29 23:04:39 -04:00
|
|
|
local rows = common.make_text_rows(
|
2021-07-29 22:18:29 -04:00
|
|
|
geometry.LEFT_X,
|
2021-07-18 00:06:49 -04:00
|
|
|
header.bottom_y,
|
2021-07-29 22:18:29 -04:00
|
|
|
geometry.SECTION_WIDTH,
|
2021-07-18 00:06:49 -04:00
|
|
|
TEXT_SPACING,
|
|
|
|
{'Kernel', 'Uptime', 'Last Upgrade', 'Last Sync'}
|
|
|
|
)
|
|
|
|
|
2021-07-27 23:47:26 -04:00
|
|
|
local update = function(pacman_stats)
|
2021-07-18 00:06:49 -04:00
|
|
|
local last_update, last_sync = "N/A", "N/A"
|
|
|
|
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
|
2021-08-08 15:58:53 -04:00
|
|
|
common.text_rows_set(rows, 1, i_o.conky('$kernel'))
|
|
|
|
common.text_rows_set(rows, 2, i_o.conky('$uptime'))
|
2021-07-29 22:18:29 -04:00
|
|
|
common.text_rows_set(rows, 3, last_update)
|
|
|
|
common.text_rows_set(rows, 4, last_sync)
|
2021-07-27 23:47:26 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
local draw_static = function(cr)
|
2021-07-29 23:04:39 -04:00
|
|
|
common.draw_header(cr, header)
|
2021-07-29 22:18:29 -04:00
|
|
|
common.text_rows_draw_static(rows, cr)
|
2021-07-27 23:47:26 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
local draw_dynamic = function(cr)
|
2021-07-29 22:18:29 -04:00
|
|
|
common.text_rows_draw_dynamic(rows, cr)
|
2018-08-05 11:08:37 -04:00
|
|
|
end
|
2017-07-19 00:36:15 -04:00
|
|
|
|
2021-07-27 23:47:26 -04:00
|
|
|
return {static = draw_static, dynamic = draw_dynamic, update = update}
|
2021-07-17 00:17:22 -04:00
|
|
|
end
|