Here's the latest conky I've been working on
Code:
# Conky sample configuration
#USAZ0233, USHI0026
# the list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.
# set to yes if you want Conky to be forked in the background
background yes
# X font when Xft is disabled, you can pick one with program xfontsel
#font 5x7
#font 6x10
#font 7x13
#font 8x13
#font 9x15
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
# Use Xft?
use_xft yes
# Xft font when Xft is enabled
xftfont Deja Vu Sans Mono:size=18
# Text alpha when using Xft
xftalpha 0.8
# Print everything to stdout?
# out_to_console no
# MPD host/port
# mpd_host localhost
# mpd_port 6600
# mpd_password tinker_bell
# Print everything to console?
# out_to_console no
# mail spool
mail_spool $MAIL
# Update interval in seconds
update_interval 1
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0
# Create own window instead of using desktop (required in nautilus)
own_window no
# If own_window is yes, you may use type normal, desktop or override
own_window_type desktop
# Use pseudo transparency with own_window?
own_window_transparent yes
# If own_window_transparent is set to no, you can set the background colour here
own_window_colour black
# If own_window is yes, these window manager hints may be used
#own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Minimum size of text area
minimum_size 280 5
# Maximum width
maximum_width 10000
# Draw shades?
draw_shades no
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
# Draw borders around graphs
draw_graph_borders no
# Stippled borders?
stippled_borders 8
# border margins
border_inner_margin 4
# border width
border_width 1
# Default colors and also border colors
default_color black
#default_shade_color black
#default_outline_color black
# Text alignment, other possible values are commented
alignment top_left
#alignment top_right
#alignment bottom_left
#alignment bottom_right
#alignment top_middle
#alignment bottom_middle
#alignment none
# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 20
gap_y 1
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2
# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2
# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes
# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer none
# Shows the maximum value in scaled graphs.
show_graph_scale no
# Shows the time range covered by a graph.
show_graph_range no
# Allow each port monitor to track at most this many connections (if 0 or not set, default is 256)
#max_port_monitor_connections 256
# Maximum number of special things, e.g. fonts, offsets, aligns, etc.
#max_specials 512
# Maximum size of buffer for user text, i.e. below TEXT line.
max_user_text 16384
# Timing interval for music player thread, e.g. mpd, audacious
#music_player_interval (update_interval is default)
# Strictness of if_up. One of: up, link or address. The later ones imply the further ones.
# Defaults to up.
#if_up_strictness address
#-d DATATYPE, --datatype=DATATYPE
#[default: HT] The data type options are: DW (Day of
#Week), WF (Weather Font output), WI (Weather Icon
#Path), LT (Forecast:Low Temp,Current:Feels Like Temp),
#HT (Forecast:High Temp,Current:Current Temp), CC
#(Current Conditions), CT (Conditions Text), PC
#(Precipitation Chance), HM (Humidity), VI
#(Visibility), WD (Wind Direction), WA (Wind Angle - in
#degrees), WS (Wind Speed), WG (Wind Gusts), BF
#(Bearing Font), BI (Bearing Icon Path), BS (Bearing
#font with Speed), CN (City Name), CO (Country), OB
#(Observatory), SR (SunRise), SS (SunSet), DL
#(DayLight), MP (Moon Phase), MF (Moon Font), MI (Moon
#Icon Path), BR (Barometer Reading), BD (Barometer
#Description), UI (UV Index), UT (UV Text), DP (Dew
#Point), LU (Last Update at weather.com), LF (Last
#Fetch from weather.com). Not applicable at command
#line when using templates.
# variable is given either in format $variable or in ${variable}. Latter
# allows characters right after the variable and must be used in network
# stuff because of an argument
# stuff after 'TEXT' will be formatted on screen
# -- Lua Load -- #
lua_load ~/conky/Cloudconky/luasideway
lua_draw_hook_pre draw_text
lua_load ~/conky/Cloudconky/luaring
lua_draw_hook_post ring_stats
TEXT
luasideway
Code:
--[[
Conky Widgets by londonali1010 (2009)
Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/conky_widgets.lua):
lua_load ~/Scripts/conky_widgets.lua
lua_draw_hook_pre draw_text
]]
require 'cairo'
function conky_draw_text()
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)
-- Font
cairo_select_font_face (cr, "Cloudlike", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
-- font size
cairo_set_font_size (cr, 30.0);
--font color
cairo_set_source_rgba (cr, 1, 1, 1, 1);
cairo_translate (cr, 690.0, -410.0);
-- angle
cairo_rotate(cr, 0.75);
-- text position
cairo_move_to (cr, 669.0, -42.0);
-- shown text
cairo_show_text (cr, conky_parse('${time %H:%M}'))
cairo_rotate(cr, -0.43);
cairo_set_font_size (cr, 20.0);
cairo_move_to (cr, -210.0, 518.0);
cairo_show_text (cr, conky_parse('${time %A %B %d %Y}'))
cairo_rotate(cr, 0.0);
cairo_set_font_size (cr, 20.0);
cairo_move_to (cr, 30.0, 518.0);
cairo_show_text (cr, conky_parse('${if_match ${acpitemp} > 60}${color red}${acpitemp}$color$else${acpitemp}$endif C'))
cairo_rotate(cr, 0.0);
cairo_set_font_size (cr, 20.0);
cairo_move_to (cr, 80.0, 518.0);
cairo_show_text (cr, conky_parse('${totalup eth1}'))
cairo_rotate(cr, 0.0);
cairo_set_font_size (cr, 20.0);
cairo_move_to (cr, 170.0, 518.0);
cairo_show_text (cr, conky_parse('${totaldown eth1}'))
cairo_rotate(cr, 0.0);
cairo_set_font_size (cr, 20.0);
cairo_move_to (cr, 260.0, 518.0);
cairo_show_text (cr, conky_parse('${exec rhythmbox-client --no-start --print-playing}'))
cairo_stroke (cr);
end
luarings
Code:
--[[
Ring Meters by londonali1010 (2009)
This script draws percentage meters as rings. It is fully customisable; all options are described in the script.
IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 145 uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num > 5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num > 3; conversely if you update Conky every 0.5s, you should use update_num > 10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.
To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
lua_load ~/scripts/rings-v1.2.1.lua
lua_draw_hook_pre ring_stats
Changelog:
+ v1.2.1 -- Fixed minor bug that caused script to crash if conky_parse() returns a nil value (20.10.2009)
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)
]]
settings_table = {
{
name='cpu',
arg='cpu1',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0xffffff,
fg_alpha=0.6,
x=1279, y=0,
radius=80,
thickness=5,
start_angle=180,
end_angle=270
},
{
name='cpu',
arg='cpu2',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0xffffff,
fg_alpha=0.6,
x=1279, y=0,
radius=86,
thickness=5,
start_angle=180,
end_angle=270
},
{
name='battery_percent',
arg='BAT0',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0xffffff,
fg_alpha=0.6,
x=1279, y=0,
radius=92,
thickness=5,
start_angle=180,
end_angle=270
},
{
name='memperc',
arg='',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0xffffff,
fg_alpha=0.6,
x=1279, y=0,
radius=98,
thickness=5,
start_angle=180,
end_angle=270
},
{
name='fs_used_perc',
arg='/',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0xffffff,
fg_alpha=0.6,
x=1279, y=0,
radius=104,
thickness=5,
start_angle=180,
end_angle=270
},
{
name='fs_used_perc',
arg='/home/djyoung4/',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0xffffff,
fg_alpha=0.6,
x=1279, y=0,
radius=110,
thickness=5,
start_angle=180,
end_angle=270
},
}
require 'cairo'
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function draw_ring(cr,t,pt)
local w,h=conky_window.width,conky_window.height
local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']
local angle_0=sa*(2*math.pi/360)-math.pi/2
local angle_f=ea*(2*math.pi/360)-math.pi/2
local t_arc=t*(angle_f-angle_0)
-- Draw background ring
cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
cairo_set_line_width(cr,ring_w)
cairo_stroke(cr)
-- Draw indicator ring
cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
cairo_stroke(cr)
end
function conky_ring_stats()
local function setup_rings(cr,pt)
local str=''
local value=0
str=string.format('${%s %s}',pt['name'],pt['arg'])
str=conky_parse(str)
value=tonumber(str)
if value == nil then value = 0 end
pct=value/pt['max']
draw_ring(cr,pct,pt)
end
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)
local cr=cairo_create(cs)
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num>5 then
for i in pairs(settings_table) do
setup_rings(cr,settings_table[i])
end
end
end
Bookmarks