it shows the current and, in this case, past 100 values for cpu as a transparent square on the 10 by 10 grid.
overlaying squares so that the brighter squares show you what % numbers your cpu has been at the most.
increasing the range of the recorded value will probably lead to something more colorful
this is with 250 saved numbers

here is what it looks like (poor quality vid from recordmydesktop) ...and having recordmydesktop running, and switching conky to 4 updates per second has pushed all the squares to the bottom few rows! But if you watch you will see the color change occurring as older cpu numbers change according to a gradient.
--[[conky squares by mrpeachy (2010) if you want more that 1 square from this script then there are some things to change.
I have done my best to provide adequate instructions through the script setup begins at line 150]]
require 'cairo'
function bg(hori, vert, thick, br, bg, bb, ba)
across=hori-(thick*9)
down=vert+block
block=thick*10
cairo_translate (cr, across, down)
cairo_set_line_width (cr, 1)
cairo_set_source_rgba (cr, br, bg, bb, 1)
cairo_rectangle (cr, 0,0,block,block)
cairo_stroke (cr)
cairo_translate (cr, -across, -down)
end
function squaredraw(cr, num, hori, vert, thick, red, green, blue, alpha)
block=thick
down=vert
start=hori
row=1
for i=((row*10)-9),(row*10) do
if num==i then
across=start+(i*block)-((10*row)*block)
down=down+(block*row)
cairo_translate (cr, across, down)
cairo_set_source_rgba (cr, red, green, blue, alpha)
cairo_rectangle (cr, 0,0,block,block)
cairo_fill (cr)
cairo_translate (cr, -across, -down)
end
end
row=2
for i=((row*10)-9),(row*10) do
if num==i then
across=start+(i*block)-((10*row)*block)
down=down+(block*row)
cairo_translate (cr, across, down)
cairo_set_source_rgba (cr, red, green, blue, alpha)
cairo_rectangle (cr, 0,0,block,block)
cairo_fill (cr)
cairo_translate (cr, -across, -down)
end
end
row=3
for i=((row*10)-9),(row*10) do
if num==i then
across=start+(i*block)-((10*row)*block)
down=down+(block*row)
cairo_translate (cr, across, down)
cairo_set_source_rgba (cr, red, green, blue, alpha)
cairo_rectangle (cr, 0,0,block,block)
cairo_fill (cr)
cairo_translate (cr, -across, -down)
end
end
row=4
for i=((row*10)-9),(row*10) do
if num==i then
across=start+(i*block)-((10*row)*block)
down=down+(block*row)
cairo_translate (cr, across, down)
cairo_set_source_rgba (cr, red, green, blue, alpha)
cairo_rectangle (cr, 0,0,block,block)
cairo_fill (cr)
cairo_translate (cr, -across, -down)
end
end
row=5
for i=((row*10)-9),(row*10) do
if num==i then
across=start+(i*block)-((10*row)*block)
down=down+(block*row)
cairo_translate (cr, across, down)
cairo_set_source_rgba (cr, red, green, blue, alpha)
cairo_rectangle (cr, 0,0,block,block)
cairo_fill (cr)
cairo_translate (cr, -across, -down)
end
end
row=6
for i=((row*10)-9),(row*10) do
if num==i then
across=start+(i*block)-((10*row)*block)
down=down+(block*row)
cairo_translate (cr, across, down)
cairo_set_source_rgba (cr, red, green, blue, alpha)
cairo_rectangle (cr, 0,0,block,block)
cairo_fill (cr)
cairo_translate (cr, -across, -down)
end
end
row=7
for i=((row*10)-9),(row*10) do
if num==i then
across=start+(i*block)-((10*row)*block)
down=down+(block*row)
cairo_translate (cr, across, down)
cairo_set_source_rgba (cr, red, green, blue, alpha)
cairo_rectangle (cr, 0,0,block,block)
cairo_fill (cr)
cairo_translate (cr, -across, -down)
end
end
row=8
for i=((row*10)-9),(row*10) do
if num==i then
across=start+(i*block)-((10*row)*block)
down=down+(block*row)
cairo_translate (cr, across, down)
cairo_set_source_rgba (cr, red, green, blue, alpha)
cairo_rectangle (cr, 0,0,block,block)
cairo_fill (cr)
cairo_translate (cr, -across, -down)
end
end
row=9
for i=((row*10)-9),(row*10) do
if num==i then
across=start+(i*block)-((10*row)*block)
down=down+(block*row)
cairo_translate (cr, across, down)
cairo_set_source_rgba (cr, red, green, blue, alpha)
cairo_rectangle (cr, 0,0,block,block)
cairo_fill (cr)
cairo_translate (cr, -across, -down)
end
end
row=10
for i=((row*10)-9),(row*10) do
if num==i then
across=start+(i*block)-((10*row)*block)
down=down+(block*row)
cairo_translate (cr, across, down)
cairo_set_source_rgba (cr, red, green, blue, alpha)
cairo_rectangle (cr, 0,0,block,block)
cairo_fill (cr)
cairo_translate (cr, -across, -down)
end
end
end--of function
function conky_square()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates==1 then
--------TABLE SETUP--------------
--to have more than 1 squares of this type running you will need to add more table sets to this section
length_cpugraph=100 --this is how many values to record
cpugraph={} --this is the table that will hold your data
cpured={} -- these tables hold the data for the color and alphga gradients
cpugreen={}
cpublue={}
cpualpha={}
--tables must be setup in the space above----
-------END TABLE SETUP-----------------------
end
if updates> 3 then
--square settings entered below---------------------------------------------
----------------------------------------------------------------
--You will need one square setup for each table set you used
----------------------------------------------------------------
length=length_cpugraph --from table setup above
----------------------------------------------------------------
hori=200
vert=100
--thick=block size
thick=20
--color 1 and alpha 1
linered=0
linegreen=1
lineblue=1
linealpha=0.1
--color 2 and alpha 2
linered2=1
linegreen2=0
lineblue2=1
linealpha2=0.1
----------------------------------------------------------------------------------------------------------------------------------------------------
--do not edit the below 4 lines
rd=(linered-linered2)/length
gd=(linegreen-linegreen2)/length
bd=(lineblue-lineblue2)/length
ad=(linealpha-linealpha2)/length
----------------------------------------------------------------------------------------------------------------------------------------------------
--CALCULATIONS -- you will have to edit this section and change all the instances
--of cpugraph, cpured, cpugreen etc, to whatever names you used in the table setup section
--you could cut this section to a blank document and do a find and replace.
for i = 1, tonumber(length) do
if cpugraph[i+1]==nil then cpugraph[i+1]=0 end
cpugraph[i]=cpugraph[i+1]
if i==length then
cpugraph[length]=tonumber(conky_parse('${cpu}'))
end
for i = 1, tonumber(length) do
cpured[i]=linered-(rd*i)
end
for i = 1, tonumber(length) do
cpugreen[i]=linegreen-(gd*i)
end
for i = 1, tonumber(length) do
cpublue[i]=lineblue-(bd*i)
end
for i = 1, tonumber(length) do
cpualpha[i]=linealpha-(ad*i)
end
--END OF CALCULATIONS
--------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------
--ENTER TABLE NAMES BELOW---------------------------------------------------------
---------------------------------------------------------------------------------
table1=cpugraph[i] --format should be nameoftable[i]
table2=cpured[i] --table that contains red data
table3=cpugreen[i]--table that contains green data
table4=cpublue[i]--table that contains blue data
table5=cpualpha[i]--table that contains alpha data
--call line drawing function
squaredraw(cr, table1, hori, vert, thick, table2, table3, table4, table5)
end
--square settings entered above----------------------------------------------------------------------------------------
--call background
bg(hori, vert, thick, linered, linegreen, lineblue, linealpha)
cairo_destroy(cr)
cairo_surface_destroy(cs)
end
end