2022-07-17 23:09:04 -04:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
-- startup - this is where the modules are compiled and arranged
|
|
|
|
|
2021-07-17 21:22:17 -04:00
|
|
|
local draw_dynamic
|
2019-10-11 21:52:10 -04:00
|
|
|
|
2022-07-19 18:11:46 -04:00
|
|
|
local __cairo_xlib_surface_create
|
|
|
|
local __cairo_create
|
|
|
|
local __cairo_surface_destroy
|
|
|
|
local __cairo_destroy
|
|
|
|
|
2022-07-19 19:15:26 -04:00
|
|
|
function conky_start(update_interval, config_path, path, cpath)
|
|
|
|
package.path = package.path..';'..path
|
|
|
|
package.cpath = package.cpath..';'..cpath
|
2022-07-19 18:11:46 -04:00
|
|
|
|
|
|
|
require 'cairo'
|
|
|
|
|
|
|
|
__cairo_xlib_surface_create = cairo_xlib_surface_create
|
|
|
|
__cairo_create = cairo_create
|
|
|
|
__cairo_surface_destroy = cairo_surface_destroy
|
|
|
|
__cairo_destroy = cairo_destroy
|
|
|
|
|
|
|
|
local compile = require 'compile'
|
|
|
|
|
2022-07-17 18:40:24 -04:00
|
|
|
conky_set_update_interval(update_interval)
|
|
|
|
|
2022-07-19 19:15:26 -04:00
|
|
|
draw_dynamic = compile(update_interval, config_path)
|
2022-07-17 18:40:24 -04:00
|
|
|
end
|
|
|
|
|
2022-07-17 23:09:04 -04:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
-- main loop - where all the drawing/updating happens
|
|
|
|
|
2021-07-17 21:22:17 -04:00
|
|
|
local updates = -2 -- this accounts for the first few spazzy iterations
|
|
|
|
|
2018-08-05 16:54:22 -04:00
|
|
|
function conky_main()
|
2018-08-05 04:05:38 -04:00
|
|
|
local _cw = conky_window
|
|
|
|
if not _cw then return end
|
2018-08-05 11:08:37 -04:00
|
|
|
|
2018-08-05 16:54:22 -04:00
|
|
|
local cs = __cairo_xlib_surface_create(_cw.display, _cw.drawable,
|
2022-07-17 23:09:04 -04:00
|
|
|
_cw.visual, _cw.width, _cw.height)
|
2018-08-05 04:05:38 -04:00
|
|
|
local cr = __cairo_create(cs)
|
|
|
|
updates = updates + 1
|
2019-09-01 15:34:10 -04:00
|
|
|
|
2021-07-17 21:22:17 -04:00
|
|
|
draw_dynamic(cr, updates)
|
2019-09-01 15:34:10 -04:00
|
|
|
|
2018-08-05 04:05:38 -04:00
|
|
|
__cairo_surface_destroy(cs)
|
|
|
|
__cairo_destroy(cr)
|
2016-08-11 23:25:56 -04:00
|
|
|
end
|