Created
February 8, 2012 17:06
-
-
Save akrito/1771092 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'cairo' | |
function conky_all () | |
if conky_window==nil then return end | |
local w=conky_window.width | |
local h=conky_window.height | |
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h) | |
cr=cairo_create(cs) | |
cairo_select_font_face (cr, "Deja Vu Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); | |
cairo_set_font_size (cr, 8.5); | |
cairo_rotate(cr, -math.pi/2); | |
-- CPU | |
local cpu = tonumber(conky_parse('${cpu cpu0}')) | |
cairo_move_to (cr, 346.0 - h, 14.0); | |
cairo_set_source_rgba (cr, cpu/50, cpu/50, cpu/50, 1); | |
cairo_show_text(cr, 'CPU: '); | |
cairo_set_source_rgba (cr, cpu/25, cpu/25, cpu/25, 1); | |
cairo_show_text(cr, conky_parse('${cpu cpu0}% ')); | |
-- Battery | |
local bat = conky_parse('${battery_short}') | |
if bat ~= 'F' then | |
cairo_move_to(cr, 406 - h, 14); | |
cairo_set_source_rgba (cr, 0.3, 0.3, 0.3, 1); | |
cairo_show_text(cr, 'Bat: '); | |
cairo_set_source_rgba (cr, 8.0, 8.0, 8.0, 1); | |
cairo_show_text (cr, bat) | |
end | |
-- Wireless SSID | |
local ssid = conky_parse('${wireless_essid wlan0}') | |
if ssid ~= 'off/any' and ssid ~= '' then | |
cairo_move_to (cr, 6.0 - h, 14.0); | |
cairo_set_source_rgba (cr, 0.3, 0.3, 0.3, 1); | |
cairo_show_text(cr, 'SSID: '); | |
cairo_set_source_rgba (cr, 8.0, 8.0, 8.0, 1); | |
cairo_show_text (cr, ssid) | |
end | |
-- Upspeed | |
local up = tonumber(conky_parse('${upspeedf wlan0}')) | |
if up > 1.0 then | |
cairo_set_source_rgba (cr, 0.3, 0.3, 0.3, 1); | |
cairo_show_text(cr, ' ↑'); | |
cairo_set_source_rgba (cr, 8.0, 8.0, 8.0, 1); | |
cairo_show_text (cr, up .. 'K'); | |
end | |
-- Downspeed | |
local down = tonumber(conky_parse('${downspeedf wlan0}')) | |
if down > 1.0 then | |
cairo_set_source_rgba (cr, 0.3, 0.3, 0.3, 1); | |
cairo_show_text(cr, ' ↓'); | |
cairo_set_source_rgba (cr, 8.0, 8.0, 8.0, 1); | |
cairo_show_text (cr, down .. 'K'); | |
end | |
-- Time and Date | |
cairo_move_to (cr, -75, 14.0); | |
cairo_set_source_rgba (cr, 8.0, 8.0, 8.0, 1); | |
cairo_show_text (cr, conky_parse('${time %-I:%M} ${time %-d %b}')); | |
return '' | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment