begin static cairo rendering with panel
This commit is contained in:
parent
c6b68e7edc
commit
e8784b46ed
91
main.lua
91
main.lua
|
@ -154,42 +154,59 @@ end
|
||||||
-- will be useful
|
-- will be useful
|
||||||
local current_interface = 0
|
local current_interface = 0
|
||||||
|
|
||||||
function conky_main()
|
local cs_p
|
||||||
local _cw = conky_window
|
local uninit = 1
|
||||||
if not _cw then return end
|
|
||||||
local cs = __cairo_xlib_surface_create(_cw.display, _cw.drawable, _cw.visual, 1920, 1080)
|
|
||||||
local cr = __cairo_create(cs)
|
|
||||||
|
|
||||||
updates = updates + 1
|
conky_startup = function()
|
||||||
|
cs_p = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1920, 1080)
|
||||||
local t1 = updates % (UPDATE_FREQUENCY * 10)
|
local cr = __cairo_create(cs_p)
|
||||||
|
Panel(cr)
|
||||||
local t2
|
uninit = nil
|
||||||
local is_using_ac = using_ac()
|
end
|
||||||
if is_using_ac then
|
|
||||||
t2 = updates % (UPDATE_FREQUENCY * 60)
|
function conky_main()
|
||||||
else
|
if uninit then return end
|
||||||
t2 = updates % (UPDATE_FREQUENCY * 300)
|
local _cw = conky_window
|
||||||
end
|
if not _cw then return end
|
||||||
|
local cs = __cairo_xlib_surface_create(_cw.display, _cw.drawable, _cw.visual, 1920, 1080)
|
||||||
local log_is_changed = false
|
local cr = __cairo_create(cs)
|
||||||
if t2 == 0 then log_is_changed = check_if_log_changed() end
|
|
||||||
|
cairo_set_source_surface(cr, cs_p, 0, 0)
|
||||||
Panel(cr)
|
cairo_paint(cr)
|
||||||
|
|
||||||
System(cr, current_interface, log_is_changed)
|
updates = updates + 1
|
||||||
Graphics(cr, current_interface)
|
|
||||||
Processor(cr, current_interface)
|
local t1 = updates % (UPDATE_FREQUENCY * 10)
|
||||||
|
|
||||||
ReadWrite(cr, current_interface, UPDATE_FREQUENCY)
|
local t2
|
||||||
Network(cr, current_interface, UPDATE_FREQUENCY)
|
local is_using_ac = using_ac()
|
||||||
|
if is_using_ac then
|
||||||
Pacman(cr, current_interface, log_is_changed)
|
t2 = updates % (UPDATE_FREQUENCY * 60)
|
||||||
FileSystem(cr, current_interface, t1)
|
else
|
||||||
Power(cr, current_interface, UPDATE_FREQUENCY, is_using_ac)
|
t2 = updates % (UPDATE_FREQUENCY * 300)
|
||||||
Memory(cr, current_interface)
|
end
|
||||||
|
|
||||||
__cairo_surface_destroy(cs)
|
local log_is_changed = false
|
||||||
__cairo_destroy(cr)
|
if t2 == 0 then log_is_changed = check_if_log_changed() end
|
||||||
__collectgarbage()
|
|
||||||
|
-- local pt1 = os.clock()
|
||||||
|
|
||||||
|
System(cr, current_interface, log_is_changed)
|
||||||
|
Graphics(cr, current_interface)
|
||||||
|
Processor(cr, current_interface)
|
||||||
|
|
||||||
|
ReadWrite(cr, current_interface, UPDATE_FREQUENCY)
|
||||||
|
Network(cr, current_interface, UPDATE_FREQUENCY)
|
||||||
|
|
||||||
|
Pacman(cr, current_interface, log_is_changed)
|
||||||
|
FileSystem(cr, current_interface, t1)
|
||||||
|
Power(cr, current_interface, UPDATE_FREQUENCY, is_using_ac)
|
||||||
|
Memory(cr, current_interface)
|
||||||
|
|
||||||
|
-- local pt2 = os.clock() - pt1
|
||||||
|
-- print(pt2)
|
||||||
|
|
||||||
|
__cairo_surface_destroy(cs)
|
||||||
|
__cairo_destroy(cr)
|
||||||
|
__collectgarbage()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue