+ cpu.widget = widget{ type = 'imagebox' }
+ cpu.update = function(cpu, value)
+ local color
+
+ if value < 25 then
+ color = beautiful.fg_focus
+ elseif value < 50 then
+ color = 'yellow'
+ elseif value < 75 then
+ color = 'orange'
+ else
+ color = 'red'
+ end
+
+ if cpu.color == color then return end
+ local img = image.argb32(11, 16, nil)
+ draw_dashes_h(img, 0, 4, 2, 1, 7, color)
+ draw_dashes_h(img, 0, 11, 2, 1, 7, color)
+ draw_dashes_v(img, 0, 4, 2, 1, 7, color)
+ draw_dashes_v(img, 7, 4, 2, 1, 7, color)
+ img:draw_rectangle(2, 6, 4, 4, true, color)
+ cpu.widget.image = img
+ cpu.percent = value
+ end
+ table.insert(mywidgets, cpu.widget)
+ cpuwidgets[i] = cpu
+end
+
+cputextwidget = widget{ type = 'textbox' }