conky-config/main.lua

48 lines
1.3 KiB
Lua
Raw Normal View History

--------------------------------------------------------------------------------
-- startup - this is where the modules are compiled and arranged
2021-07-17 21:22:17 -04:00
local draw_dynamic
2022-07-19 18:11:46 -04:00
local __cairo_xlib_surface_create
local __cairo_create
local __cairo_surface_destroy
local __cairo_destroy
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'
conky_set_update_interval(update_interval)
draw_dynamic = compile(update_interval, config_path)
end
--------------------------------------------------------------------------------
-- 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()
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,
_cw.visual, _cw.width, _cw.height)
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
__cairo_surface_destroy(cs)
__cairo_destroy(cr)
2016-08-11 23:25:56 -04:00
end