SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#5351 2013-05-15 01:04:56

damionhh
Member
Registered: 2012-10-11
Posts: 45

Re: Conky v1.9 Thread

i modified a bash script to return transmission torrent details.  instead of running the script for every variable i wanted to reduce the overhead a little bit and just run it once.  right now it runs a line like :

transmission-remote elvis:9091 --auth=user:password -l | sed -n -e '$b' -e '2,$p' | sort -n --key=2

which returns a list of torrent stats.  then they get parsed and the script uses the ECHO command to dump the formatted contents.

echo -e ${progress[$i]}%'\t'${name[$i]}

all i want to know how to do is embed color codes in the ECHO line.  i have tried what they mention here:
https://bbs.archlinux.org/viewtopic.php … 5#p1152435

but it doesnt work.  how can i embed color codes in the echo line of the bash script so conky formats it correctly?

Offline

Be excellent to each other!

#5352 2013-05-15 01:53:23

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

damionhh wrote:

i modified a bash script to return transmission torrent details.  instead of running the script for every variable i wanted to reduce the overhead a little bit and just run it once.  right now it runs a line like :

transmission-remote elvis:9091 --auth=user:password -l | sed -n -e '$b' -e '2,$p' | sort -n --key=2

which returns a list of torrent stats.  then they get parsed and the script uses the ECHO command to dump the formatted contents.

echo -e ${progress[$i]}%'\t'${name[$i]}

all i want to know how to do is embed color codes in the ECHO line.  i have tried what they mention here:
https://bbs.archlinux.org/viewtopic.php … 5#p1152435

but it doesnt work.  how can i embed color codes in the echo line of the bash script so conky formats it correctly?

put the color commands into the echo as you would in conky ${color red} then use execpi to call the script in conky the p means parse so that conky reads conky formatted variables and runs them as such

Offline

#5353 2013-05-15 02:00:03

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

lionhead wrote:

i can not show the status of vnstat (month). this my code:

function os_capture(cmd, raw) -- parse shell in lua
	local f = assert(io.popen(cmd, 'r'))
	local s = assert(f:read('*a'))
	f:close()
	if raw then return s end
	s = string.gsub(s, '^%s+', '')
	s = string.gsub(s, '%s+$', '')
	s = string.gsub(s, '[\n\r]+', ' ')
	return s
end

function command(value,device,del,se)
	local ms=nil
	
if value=="cpu" then
	cmd=[[cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'| uniq]]
	ms=os_capture(cmd, raw) -- excecute function (see above)
elseif value=="today" then
	cmd=[[vnstat -i ]]..device..[[ | grep "today" | awk '{print $2 $3}']]
	todayVnstat=os_capture(cmd, raw)
	ms=conky_parse("${if_up "..device.."}"..parse(todayVnstat,del,se).."${else}n/a${endif}")
elseif value=="week" then
	cmd=[[vnstat -i ]]..device..[[ -w | grep "current week" | awk '{print $3 $4}']]
	weekVnstat=os_capture(cmd, raw)
	ms=conky_parse("${if_up "..device.."}"..parse(weekVnstat,del,se).."${else}n/a${endif}")
elseif value=="month" then
	cmd=[[vnstat -i ]]..device..[[ -m | mawk '$0 ~ "'`date +"%b.+%y"`'" {print $3, $4}']]
	monthVnstat = os_capture(cmd, raw)
	ms=conky_parse("${if_up "..device.."}"..parse(monthVnstat,del,se).."${else}n/a${endif}")
end

return ms
end

i hope that it's 'only' a write error. do u see what's wrong?

i dont know why your month settings arent working, althoug i can tell you it wouldnt work on my computer because i changed the way that vnstat formats dates in the vnstat config.

If i was going to do something with vnstat i would take a v9000 appraoch... one of the vnstat ouputs gives you all the info  -dumpdb  then format it all into tables that can be accessed... actually now i come to think of it I may have done something like that in the past smile  have to look through my files at some point soon

Offline

#5354 2013-05-15 02:21:16

damionhh
Member
Registered: 2012-10-11
Posts: 45

Re: Conky v1.9 Thread

Mr. Peachy... thanks!  that did it.  its super sweet now. 

side question:  if i wanted to call the bash script once for each line and have the script return the percentage done so i could use the execigauge function to draw a bar, do you know how i would get the percentage returned out of the bash script?  using something like?

exit ${percent[$i]}

i cant find an example of anyone using execigauge.
thanks

Last edited by damionhh (2013-05-15 02:21:34)

Offline

#5355 2013-05-15 02:33:44

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

@damiohh
im not a big user of bash scripts and i havnt used execigauge either... if you are wanting graphical stuff based on script generated data then a quick lua script is probably the way to go to draws straight onto the conky window with cairo.... but then again not the easiest approach f you havnt used lua before

Offline

#5356 2013-05-15 06:05:46

Sir Stooper
New Member
Registered: 2013-05-14
Posts: 2

Re: Conky v1.9 Thread

@Sector11

Thanks for the help, but I think I stumbled onto a solution.  By entering:

${nvidia temp}

It prints out literally: ${nvidia temp}

So I found a work-around as:

${color2}${font led:size=10}GPU ${font}$hr
${color}GPU 0 Temp ${alignr} ${execi 60 nvidia-settings -q [gpu:0]/GPUCoreTemp | perl -ne 'print $1 if /GPUCoreTemp.*?: (\d+)./;'} °C
${color}GPU 1 Temp ${alignr} ${execi 60 nvidia-settings -q [gpu:1]/GPUCoreTemp | perl -ne 'print $1 if /GPUCoreTemp.*?: (\d+)./;'} °C

I now have a temp read-out of both GPUs.

Offline

#5357 2013-05-15 14:26:48

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

I did an horizontal conky with circlethings2 font functions that I found few times ago but I can't find the author of this great idea (sorry). I keep the text.lua playing with...
You will need the circlethings2 font
Conky:

##############################################
#  Ragamatrix modified circlethings2 conky   #
##############################################
background no
use_xft yes
#xftfont font Mono:style=Bold:size=7
xftfont font Mono:size=10
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_type override
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 1920 90
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
color1 FF4500#1E90FF(bleu)00FF00(vert)
color2 666666
color3 00FF00
color4 gold
color5 DarkOrchid
color6 DeepPink2
color7 fff00d
default_color FFFFFF
default_shade_color 282828
alignment tr
gap_x 0
gap_y 3
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# -- Lua Load -- #
# SET THE PATH TO THE SCRIPT HERE
lua_load ~/.conky/lanceur.lua
lua_draw_hook_pre main


TEXT
#CPU
${voffset 10}${goto 15}${font circlethings2:size=10}${goto 90}${if_match ${cpu} >0}${color7}${else}${color2}${endif}A${if_match ${cpu} >5}${color1}${else}${color2}${endif}a${if_match ${cpu} >10}${color7}${else}${color2}${endif}A${if_match ${cpu} >15}${color1}${else}${color2}${endif}a${if_match ${cpu} >20}${color4}${else}${color2}${endif}A${if_match ${cpu} >25}${color1}${else}${color2}${endif}a${if_match ${cpu} >30}${color7}${else}${color2}${endif}A${if_match ${cpu} >35}${color1}${else}${color2}${endif}a${if_match ${cpu} >40}${color7}${else}${color2}${endif}A${if_match ${cpu} >45}${color1}${else}${color2}${endif}a${if_match ${cpu} >50}${color7}${else}${color2}${endif}A${if_match ${cpu} >55}${color1}${else}${color2}${endif}a${if_match ${cpu} >60}${color7}${else}${color2}${endif}A${if_match ${cpu} >65}${color1}${else}${color2}${endif}a${if_match ${cpu} >70}${color4}${else}${color2}${endif}A${if_match ${cpu} >75}${color1}${else}${color2}${endif}a${if_match ${cpu} >80}${color7}${else}${color2}${endif}A${if_match ${cpu} >85}${color1}${else}${color2}${endif}a${if_match ${cpu} >90}${color7}${else}${color2}${endif}A${if_match ${cpu} >95}${color1}${else}${color2}${endif}a
#CPU1
${voffset -13}${goto 495}${font circlethings2:size=10}${if_match ${cpu cpu1} >0}${color7}${else}${color2}${endif}A${if_match ${cpu cpu1} >5}${color1}${else}${color2}${endif}a${if_match ${cpu cpu2} >10}${color7}${else}${color2}${endif}A${if_match ${cpu cpu1} >15}${color1}${else}${color2}${endif}a${if_match ${cpu cpu1} >20}${color7}${else}${color2}${endif}A${if_match ${cpu cpu1} >25}${color1}${else}${color2}${endif}a${if_match ${cpu cpu1} >30}${color7}${else}${color2}${endif}A${if_match ${cpu cpu1} >35}${color1}${else}${color2}${endif}a${if_match ${cpu cpu1} >40}${color7}${else}${color2}${endif}A${if_match ${cpu cpu1} >45}${color1}${else}${color2}${endif}a${if_match ${cpu cpu1} >50}${color7}${else}${color2}${endif}A${if_match ${cpu cpu1} >55}${color1}${else}${color2}${endif}a${if_match ${cpu cpu1} >60}${color7}${else}${color2}${endif}A${if_match ${cpu cpu1} >65}${color1}${else}${color2}${endif}a${if_match ${cpu cpu1} >70}${color7}${else}${color2}${endif}A${if_match ${cpu cpu1} >75}${color1}${else}${color2}${endif}a${if_match ${cpu cpu1} >80}${color7}${else}${color2}${endif}A${if_match ${cpu cpu1} >85}${color1}${else}${color2}${endif}a${if_match ${cpu cpu1} >90}${color7}${else}${color2}${endif}A${if_match ${cpu cpu1} >95}${color1}${else}${color2}${endif}a
#CPU2
${voffset -15}${goto 895}${font circlethings2:size=10}${if_match ${cpu cpu2} >0}${color7}${else}${color2}${endif}A${if_match ${cpu cpu2} >5}${color1}${else}${color2}${endif}a${if_match ${cpu cpu2} >10}${color7}${else}${color2}${endif}A${if_match ${cpu cpu2} >15}${color1}${else}${color2}${endif}a${if_match ${cpu cpu2} >20}${color7}${else}${color2}${endif}A${if_match ${cpu cpu2} >25}${color1}${else}${color2}${endif}a${if_match ${cpu cpu2} >30}${color7}${else}${color2}${endif}A${if_match ${cpu cpu2} >35}${color1}${else}${color2}${endif}a${if_match ${cpu cpu2} >40}${color7}${else}${color2}${endif}A${if_match ${cpu cpu2} >45}${color1}${else}${color2}${endif}a${if_match ${cpu cpu2} >50}${color7}${else}${color2}${endif}A${if_match ${cpu cpu2} >55}${color1}${else}${color2}${endif}a${if_match ${cpu cpu2} >60}${color7}${else}${color2}${endif}A${if_match ${cpu cpu2} >65}${color1}${else}${color2}${endif}a${if_match ${cpu cpu2} >70}${color7}${else}${color2}${endif}A${if_match ${cpu cpu2} >75}${color1}${else}${color2}${endif}a${if_match ${cpu cpu2} >80}${color7}${else}${color2}${endif}A${if_match ${cpu cpu2} >85}${color1}${else}${color2}${endif}a${if_match ${cpu cpu2} >90}${color7}${else}${color2}${endif}A${if_match ${cpu cpu2} >95}${color1}${else}${color2}${endif}a
#UL
${voffset 10}${goto 90}${font circlethings2:size=10}${if_match ${upspeedf eth0} >0}${color1}${else}${color2}${endif}a${if_match ${upspeedf eth0} >5}${color 00FF00}${else}${color2}${endif}A${if_match ${upspeedf eth0} >10}${color1}${else}${color2}${endif}a${if_match ${upspeedf eth0} >15}${color 00FF00}${else}${color2}${endif}A${if_match ${upspeedf eth0} >20}${color1}${else}${color2}${endif}a${if_match ${upspeedf eth0} >25}${color 00FF00}${else}${color2}${endif}A${if_match ${upspeedf eth0} >30}${color1}${else}${color2}${endif}a${if_match ${upspeedf eth0} >35}${color 00FF00}${else}${color2}${endif}A${if_match ${upspeedf eth0} >40}${color1}${else}${color2}${endif}a${if_match ${upspeedf eth0} >45}${color 00FF00}${else}${color2}${endif}A${if_match ${upspeedf eth0} >50}${color1}${else}${color2}${endif}a${if_match ${upspeedf eth0} >55}${color 00FF00}${else}${color2}${endif}A${if_match ${upspeedf eth0} >60}${color1}${else}${color2}${endif}a${if_match ${upspeedf eth0} >65}${color 00FF00}${else}${color2}${endif}A${if_match ${upspeedf eth0} >70}${color1}${else}${color2}${endif}a${if_match ${upspeedf eth0} >75}${color 00FF00}${else}${color2}${endif}A${if_match ${upspeedf eth0} >80}${color1}${else}${color2}${endif}a${if_match ${upspeedf eth0} >85}${color 00FF00}${else}${color2}${endif}A${if_match ${upspeedf eth0} >90}${color1}${else}${color2}${endif}a${if_match ${upspeedf eth0} >95}${color 00FF00}${else}${color2}${endif}A${font}${color}
#MEM
${voffset -43}${goto 1295}${font circlethings2:size=7}${if_match ${memperc} >0}${color5}${else}${color2}${endif}D${if_match ${memperc} >5}${color6}${else}${color2}${endif}d${if_match ${memperc} >10}${color5}${else}${color2}${endif}D${if_match ${memperc} >15}${color6}${else}${color2}${endif}d${if_match ${memperc} >20}${color5}${else}${color2}${endif}D${if_match ${memperc} >25}${color6}${else}${color2}${endif}d${if_match ${memperc} >30}${color5}${else}${color2}${endif}D${if_match ${memperc} >35}${color6}${else}${color2}${endif}d${if_match ${memperc} >40}${color5}${else}${color2}${endif}D${if_match ${memperc} >45}${color6}${else}${color2}${endif}d${if_match ${memperc} >50}${color5}${else}${color2}${endif}D${if_match ${memperc} >55}${color6}${else}${color2}${endif}d${if_match ${memperc} >60}${color5}${else}${color2}${endif}D${if_match ${memperc} >65}${color3}${else}${color2}${endif}d${if_match ${memperc} >70}${color1}${else}${color2}${endif}D${if_match ${memperc} >75}${color3}${else}${color2}${endif}d${if_match ${memperc} >80}${color1}${else}${color2}${endif}D${if_match ${memperc} >85}${color6}${else}${color2}${endif}d${if_match ${memperc} >90}${color5}${else}${color2}${endif}D${if_match ${memperc} >95}${color6}${else}${color2}${endif}d${font}${color}
#HD
${voffset -18}${goto 1595}${font circlethings2:size=10}${if_match ${fs_used_perc /} >0}${color1}${else}${color2}${endif}A${if_match ${fs_used_perc /} >5}${color3}${else}${color2}${endif}a${if_match ${fs_used_perc /} >10}${color1}${else}${color2}${endif}A${if_match ${fs_used_perc /} >15}${color3}${else}${color2}${endif}a${if_match ${fs_used_perc /} >20}${color1}${else}${color2}${endif}A${if_match ${fs_used_perc /} >25}${color3}${else}${color2}${endif}a${if_match ${fs_used_perc /} >30}${color1}${else}${color2}${endif}A${if_match ${fs_used_perc /} >35}${color3}${else}${color2}${endif}a${if_match ${fs_used_perc /} >40}${color1}${else}${color2}${endif}A${if_match ${fs_used_perc /} >45}${color3}${else}${color2}${endif}a${if_match ${fs_used_perc /} >50}${color1}${else}${color2}${endif}A${if_match ${fs_used_perc /} >55}${color3}${else}${color2}${endif}a${if_match ${fs_used_perc /} >60}${color1}${else}${color2}${endif}A${if_match ${fs_used_perc /} >65}${color3}${else}${color2}${endif}a${if_match ${fs_used_perc /} >70}${color1}${else}${color2}${endif}A${if_match ${fs_used_perc /} >75}${color3}${else}${color2}${endif}a${if_match ${fs_used_perc /} >80}${color1}${else}${color2}${endif}A${if_match ${fs_used_perc /} >85}${color3}${else}${color2}${endif}a${if_match ${fs_used_perc /} >90}${color1}${else}${color2}${endif}A${if_match ${fs_used_perc /} >95}${color3}${else}${color2}${endif}a${font}${color}
#DL
${voffset 10}${goto 1595}${font circlethings2:size=10}${if_match ${downspeedf eth0} >0}${color7}${else}${color2}${endif}A${if_match ${downspeedf eth0} >20}${color 00FF00}${else}${color2}${endif}a${if_match ${downspeedf eth0} >40}${color7}${else}${color2}${endif}A${if_match ${downspeedf eth0} >60}${color 00FF00}${else}${color2}${endif}a${if_match ${downspeedf eth0} >80}${color7}${else}${color2}${endif}A${if_match ${downspeedf eth0} >100}${color 00FF00}${else}${color2}${endif}a${if_match ${downspeedf eth0} >120}${color7}${else}${color2}${endif}A${if_match ${downspeedf eth0} >140}${color 00FF00}${else}${color2}${endif}a${if_match ${downspeedf eth0} >160}${color7}${else}${color2}${endif}A${if_match ${downspeedf eth0} >180}${color 00FF00}${else}${color2}${endif}a${if_match ${downspeedf eth0} >200}${color7}${else}${color2}${endif}A${if_match ${downspeedf eth0} >220}${color 00FF00}${else}${color2}${endif}a${if_match ${downspeedf eth0} >240}${color7}${else}${color2}${endif}A${if_match ${downspeedf eth0} >260}${color 00FF00}${else}${color2}${endif}a${if_match ${downspeedf eth0} >280}${color7}${else}${color2}${endif}A${if_match ${downspeedf eth0} >300}${color 00FF00}${else}${color2}${endif}a${if_match ${downspeedf eth0} >320}${color7}${else}${color2}${endif}A${if_match ${downspeedf eth0} >340}${color 00FF00}${else}${color2}${endif}a${if_match ${downspeedf eth0} >360}${color7}${else}${color2}${endif}A${if_match ${downspeedf eth0} >400}${color 00FF00}${else}${color2}${endif}a${font}${color}
${voffset 15}${goto 730}${font Andale Mono:size=10}${execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'| uniq}

lanceur.lua-->your right paths

function conky_main()
    dofile ('/home/YOU/.conky/info-sys.lua')
    --colors can be changed here or in the lua files above
    --more info in theses files
    --crunchbang logo
    col_logo={{0,0x999999,1},{0.75,0xFFFFFF,1},{1,0x000000,1}}
    --background
    col_bg={{0,0x434343,1},{0.75,0x121212,1},{1,0x000000,1}}
    --cpus
    col_cpu1={{0,0xFFFFFF,1},{0.75,0xFF0000,1},{1,0x5B202C,1}}
    col_cpu2={{0,0xFFFFFF,1},{0.75,0xFFFF00,1},{1,0x5B5A20,1}}
    col_cpu3={{0,0xFFFFFF,1},{0.75,0x00FF00,1},{1,0x205B25,1}}
    col_cpu4={{0,0xFFFFFF,1},{0.75,0x00FFFF,1},{1,0x205B5B,1}}
    --separator
    col_sep={{0.25,0xFFFFFF,0},{0.50,0xFFFFFF,0.7},{0.75,0xFFFFFF,0}}
    --file system /
    col_fs_sys={{0,0xFFFFFF,1},{0.75,0xFF00F4,1},{1,0x141950,1}}
    --file system /home    
    col_fs_home={{0,0xFFFFFF,1},{0.75,0xFED308,1},{1,0x6C602B,1}}
    --internet interface with maximun dl and ul speeds
    interface="eth0"
    max_up=200
    max_dl=2000
    --call of the two mains functions in the lua files
    conky_draw_info()
end

info-sys.lua

--[[TEXT WIDGET v1.42 by Wlourf 07 Feb. 2011

This widget can drawn texts set in the "text_settings" table with some parameters
http://u-scripts.blogspot.com/2010/06/text-widget.html

To call the script in a conky, use, before TEXT
	lua_load /path/to/the/script/graph.lua
	lua_draw_hook_pre main_graph
and add one line (blank or not) after TEXT

The parameters (all optionals) are :
text        - text to display, default = "Conky is good for you"
              it can be used with conky variables, i.e. text="my cpu1 is ${cpu cpu1} %")
            - coordinates below are relative to top left corner of the conky window
x           - x coordinate of first letter (bottom-left), default = center of conky window
y           - y coordinate of first letter (bottom-left), default = center of conky window
h_align		- horizontal alignement of text relative to point (x,y), default="l"
			  available values are "l": left, "c" : center, "r" : right
v_align		- vertical alignment of text relative to point (x,y), default="b"
			  available values "t" : top, "m" : middle, "b" : bottom
font_name   - name of font to use, default = Free Sans
font_size   - size of font to use, default = 14
italic      - display text in italic (true/false), default=false
oblique     - display text in oblique (true/false), default=false (I don' see the difference with italic!)
bold        - display text in bold (true/false), default=false
angle       - rotation of text in degrees, default = 0 (horizontal)
colour      - table of colours for text, default = plain white {{1,0xFFFFFF,1}}
			  this table contains one or more tables with format {P,C,A}
              P=position of gradient (0 = beginning of text, 1= end of text)
              C=hexadecimal colour 
              A=alpha (opacity) of color (0=invisible,1=opacity 100%)
              Examples :
              for a plain color {{1,0x00FF00,0.5}}
              for a gradient with two colours {{0,0x00FF00,0.5},{1,0x000033,1}}
              or {{0.5,0x00FF00,1},{1,0x000033,1}} -with this one, gradient will start in the middle of the text
              for a gradient with three colours {{0,0x00FF00,0.5},{0.5,0x000033,1},{1,0x440033,1}}
			  and so on ...
orientation	- in case of gradient, "orientation" defines the starting point of the gradient, default="ww"
			  there are 8 available starting points : "nw","nn","ne","ee","se","ss","sw","ww"
			  (n for north, w for west ...)
			  theses 8 points are the 4 corners + the 4 middles of text's outline
			  so a gradient "nn" will go from "nn" to "ss" (top to bottom, parallele to text)
			  a gradient "nw" will go from "nw" to "se" (left-top corner to right-bottom corner)
radial		- define a radial gradient (if present at the same time as "orientation", "orientation" will have no effect)
			  this parameter is a table with 6 numbers : {xa,ya,ra,xb,yb,rb}
			  they define two circle for the gradient :
			  xa, ya, xb and yb are relative to x and y values above
reflection_alpha    - add a reflection effect (values from 0 to 1) default = 0 = no reflection
                      other values = starting opacity
reflection_scale    - scale of the reflection (default = 1 = height of text)
reflection_length   - length of reflection, define where the opacity will be set to zero
					  calues from 0 to 1, default =1
skew_x,skew_y    - skew text around x or y axis
draw_me     - if set to false, text is not drawn (default = true or 1)
              it can be used with a conky string, if the string returns 1, the text is drawn :
              example : "${if_empty ${wireless_essid wlan0}}${else}1$endif",
              


v1.0	07/06/2010, Original release
v1.1	10/06/2010	Add "orientation" parameter
v1.2	15/06/2010  Add "h_align", "v_align" and "radial" parameters
v1.3	25/06/2010  Add "reflection_alpha", "reflection_length", "reflection_scale", 
                    "skew_x" et "skew_y"
v1.4    07/01/2011  Add draw_me parameter and correct memory leaks, thanks to "Creamy Goodness"
                    text is parsed inside the function, not in the array of settings
v1.41   26/01/2011  Correct bug for h_align="c"    
v1.42   09/02/2011  Correct bug for orientation="ee"                

--      This program is free software; you can redistribute it and/or modify
--      it under the terms of the GNU General Public License as published by
--      the Free Software Foundation version 3 (GPLv3)
--     
--      This program is distributed in the hope that it will be useful,
--      but WITHOUT ANY WARRANTY; without even the implied warranty of
--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--      GNU General Public License for more details.
--     
--      You should have received a copy of the GNU General Public License
--      along with this program; if not, write to the Free Software
--      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
--      MA 02110-1301, USA.		

]]
require 'cairo'


function conky_draw_info()
	--BEGIN OF PARAMETRES
	local ts=os.date("*t")
    local text_settings={
		{
			text=conky_parse"${cpu cpu0}%",
			font_name="Mono",
			font_size=14,
			h_align="l",
			y=28,
			x=43,
			colour=col_cpu2,
			orientation="ee"
		},
			{
			text=conky_parse"${cpu cpu1}%",
			font_name="Mono",
			font_size=14,
			h_align="l",
			y=28,
			x=463,
			colour=col_cpu2,
			orientation="ee"
		},
				
		{
			text=conky_parse"${cpu cpu2}%",
			font_name="Mono",
			font_size=14,
			h_align="l",
			y=28,
			x=860,
			colour=col_cpu2,
			orientation="ee"
		},					
		
		--[[{
			text=conky_parse".::${execi 120 wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]|.]//g'}::.",
			font_size=12,
			h_align="l",
			y=17,
			x=1425,
			colour=col_fs_home,
			orientation="ee"
		},--]]
		
		{
			text=conky_parse"DL:${downspeedf eth0}Kb",
			font_name="Mono",
			font_size=13,
			h_align="l",
			y=51,
			x=1510,
			colour={{0,col_cpu2[2][2],1},{1,0xfffffF,1}},
			orientation="nn"
		},
		{
			text=conky_parse"UL:${upspeedf eth0}Kb",
			font_name="Mono",
			font_size=13,
			h_align="l",
			y=51,
			x=5,
			colour=col_cpu3,
			
		},
		-----uptime-----Uptime
		{
			text=conky_parse":${uptime}",
			font_name="Andale Mono",
			font_size=15,
			h_align="c",
			y=65,
			x=900,
			colour=col_fs_home,
			orientation="nn"
			},
		
		{
			text=conky_parse"${kernel}",
			font_size=15,
			font_name="Andale Mono",
			h_align="c",
			y=65,
			x=789,
			colour=col_fs_home,
			orientation="nn"
		},

		{
			text="CPU: ",
			font_name="Mono",
			font_size=14,
			h_align="c",
			y=28,
			x=20,
			colour=col_cpu2,
		},	
		{
			text="CPU1: ",
			font_name="Mono",
			font_size=14,
			h_align="c",
			y=28,
			x=430,
			colour=col_cpu2,
		},
		{
			text="CPU2: ",
			font_name="Mono",
			font_size=14,
			h_align="c",
			y=28,
			x=830,
			colour=col_cpu2,
		},
			 
		{
			text="HD:",
			font_name="Mono",
			font_size=14,
			h_align="c",
			y=25,
			x=1545,
			colour=col_cpu3,
		},
		{
			text=conky_parse"${fs_used_perc /}%",
			font_name="Mono",
			font_size=14,
			h_align="c",
			y=25,
			x=1575,
			colour=col_cpu3,
			
		},					
		
		{
			text="MEM:",
			font_name="Mono",
			font_size=14,
			h_align="c",
			y=26,
			x=1235,
			colour=col_fs_sys,
		},
			{
			text=conky_parse"${memperc}%",
			font_name="Mono",
			font_size=14,
			h_align="l",
			y=26,
			x=1255,
			colour=col_fs_sys,
			orientation="ee"
		},

		{
			text=conky_parse"${top_mem name 1}${top_mem mem 1}%",
			font_name="White Rabbit",
			font_size=12,
			h_align="l",
			y=40,
			x=1220,
			colour=col_fs_sys,
			orientation="nn",
		},			

		{
			text=conky_parse"${top_mem name 2}${top_mem mem 2}%",
			font_name="White Rabbit",
			font_size=12,
			h_align="l",
			y=53,
			x=1220,
			colour=col_logo,
			orientation="nn",
		},
		{
			text=conky_parse"${top_mem name 3}${top_mem mem 3}%",
			font_name="White Rabbit",
			font_size=12,
			h_align="l",
			y=66,
			x=1220,
			colour={{0,col_logo[2][2],col_logo[2][3]},{1,col_logo[3][2],col_logo[3][3]},},
			orientation="nn",
		},
		{
			text=conky_parse"${top_mem name 4}${top_mem mem 4}%",
			font_name="White Rabbit",
			font_size=12,
			h_align="l",
			y=79,
			x=1220,
			colour={{0,col_logo[2][2],col_logo[2][3]},{1,col_logo[3][2],col_logo[3][3]},},
			orientation="nn",
		},
		{
			text=conky_parse"${top_mem name 5}${top_mem mem 5}%",
			font_name="White Rabbit",
			font_size=12,
			h_align="l",
			y=92,
			x=1220,
			colour={{0,col_logo[2][2],col_logo[2][3]},{1,col_logo[3][2],col_logo[3][3]},},
			orientation="nn",
		},

---cpu
{
			text=conky_parse"${top name 1}${top cpu 1}%",
			font_name="White Rabbit",
			font_size=12,
			h_align="l",
			y=45,
			x=413,
			colour=col_cpu2,
			orientation="nn",
		},			

		{
			text=conky_parse"${top name 2}${top cpu 2}%",
			font_name="White Rabbit",
			font_size=12,
			h_align="l",
			y=58,
			x=413,
			colour=col_logo,
			orientation="nn",
		},
		{
			text=conky_parse"${top name 3}${top cpu 3}%",
			font_name="White Rabbit",
			font_size=12,
			h_align="l",
			y=71,
			x=413,
			colour=col_logo,
			orientation="nn",
		},
			{
			text=conky_parse"${top name 4}${top cpu 4}%",
			font_name="White Rabbit",
			font_size=12,
			h_align="l",
			y=84,
			x=413,
			colour=col_logo,
			orientation="nn",
		},
			{
			text=conky_parse"${top name 5}${top cpu 5}%",
			font_name="White Rabbit",
			font_size=12,
			h_align="l",
			y=97,
			x=413,
			colour=col_logo,
			orientation="nn",
		},												
    }
    

	
 
           
    
    
--------------END OF PARAMETERES----------------

    if conky_window == nil then return end
    if tonumber(conky_parse("$updates"))<3 then return end
       
    local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
		
    for i,v in pairs(text_settings) do    
        cr = cairo_create (cs)
        display_text(v)
        cairo_destroy(cr)
	    cr = nil
    end
    
    cairo_surface_destroy(cs)
		
end

function rgb_to_r_g_b2(tcolour)
    local colour,alpha=tcolour[2],tcolour[3]
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function display_text(t)
    if t.draw_me==true then t.draw_me = nil end
    if t.draw_me~=nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end
    local function set_pattern(te)
        --this function set the pattern
        if #t.colour==1 then 
            cairo_set_source_rgba(cr,rgb_to_r_g_b2(t.colour[1]))
        else
            local pat
            
            if t.radial==nil then
                local pts=linear_orientation(t,te)
                pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
            else
                pat = cairo_pattern_create_radial (t.radial[1],t.radial[2],t.radial[3],t.radial[4],t.radial[5],t.radial[6])
            end
        
            for i=1, #t.colour do
                cairo_pattern_add_color_stop_rgba (pat, t.colour[i][1], rgb_to_r_g_b2(t.colour[i]))
            end
            cairo_set_source (cr, pat)
            cairo_pattern_destroy(pat)
        end
    end
    
    --set default values if needed
    if t.text==nil then t.text="Conky is good for you !" end
    if t.x==nil then t.x = conky_window.width/2 end
    if t.y==nil then t.y = conky_window.height/2 end
    if t.colour==nil then t.colour={{1,0xFFFFFF,1}} end
    if t.font_name==nil then t.font_name="Arial" end
    if t.font_size==nil then t.font_size=14 end
    if t.angle==nil then t.angle=0 end
    if t.italic==nil then t.italic=false end
    if t.oblique==nil then t.oblique=false end
    if t.bold==nil then t.bold=false end
    if t.radial ~= nil then
        if #t.radial~=6 then 
            print ("error in radial table")
            t.radial=nil 
        end
    end
    if t.orientation==nil then t.orientation="ww" end
    if t.h_align==nil then t.h_align="l" end
    if t.v_align==nil then t.v_align="b" end    
    if t.reflection_alpha == nil then t.reflection_alpha=0 end
    if t.reflection_length == nil then t.reflection_length=1 end
    if t.reflection_scale == nil then t.reflection_scale=1 end
    if t.skew_x==nil then t.skew_x=0 end
    if t.skew_y==nil then t.skew_y=0 end    
    cairo_translate(cr,t.x,t.y)
    cairo_rotate(cr,t.angle*math.pi/180)
    cairo_save(cr)       
     
    local slant = CAIRO_FONT_SLANT_NORMAL
    local weight = CAIRO_FONT_WEIGHT_NORMAL
    if t.italic then slant = CAIRO_FONT_SLANT_ITALIC end
    if t.oblique then slant = CAIRO_FONT_SLANT_OBLIQUE end
    if t.bold then weight = CAIRO_FONT_WEIGHT_BOLD end
    
    cairo_select_font_face(cr, t.font_name, slant,weight)
 
    for i=1, #t.colour do    
        if #t.colour[i]~=3 then 
            print ("error in color table")
            t.colour[i]={1,0xFFFFFF,1} 
        end
    end

    local matrix0 = cairo_matrix_t:create()
    tolua.takeownership(matrix0) 
    local skew_x,skew_y=t.skew_x/t.font_size,t.skew_y/t.font_size
    cairo_matrix_init (matrix0, 1,skew_y,skew_x,1,0,0)
    cairo_transform(cr,matrix0)
    cairo_set_font_size(cr,t.font_size)
    local te=cairo_text_extents_t:create()
    tolua.takeownership(te) 
    local text=conky_parse(t.text)
    if text~="" then t.text = text end
    cairo_text_extents (cr,t.text,te)
    set_pattern(te)
            
    local mx,my=0,0
    
    if t.h_align=="c" then
        mx=-te.width/2-te.x_bearing
    elseif t.h_align=="r" then
        mx=-te.width
    end
    if t.v_align=="m" then
        my=-te.height/2-te.y_bearing
    elseif t.v_align=="t" then
        my=-te.y_bearing
    end
    cairo_move_to(cr,mx,my)
    
    cairo_show_text(cr,t.text)

     
        
        
   if t.reflection_alpha ~= 0 then 
        local matrix1 = cairo_matrix_t:create()
		tolua.takeownership(matrix1)         
        cairo_set_font_size(cr,t.font_size)

        cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(te.height+te.y_bearing+my)*(1+t.reflection_scale))
        cairo_set_font_size(cr,t.font_size)
        te=nil
        local te=cairo_text_extents_t:create()
        tolua.takeownership(te) 
        cairo_text_extents (cr,t.text,te)
        
                
        cairo_transform(cr,matrix1)
        set_pattern(te)
        cairo_move_to(cr,mx,my)
        cairo_show_text(cr,t.text)

        local pat2 = cairo_pattern_create_linear (0,
                                        (te.y_bearing+te.height+my),
                                        0,
                                        te.y_bearing+my)
        cairo_pattern_add_color_stop_rgba (pat2, 0,1,0,0,1-t.reflection_alpha)
        cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1)    
        
        --line is not drawn but with a size of zero, the mask won't be nice
        cairo_set_line_width(cr,1)
        local dy=te.x_bearing
        if dy<0 then dy=dy*(-1) end
        cairo_rectangle(cr,mx+te.x_bearing,te.y_bearing+te.height+my,te.width+dy,-te.height*1.05)
        cairo_clip_preserve(cr)
        cairo_set_operator(cr,CAIRO_OPERATOR_CLEAR)
        --cairo_stroke(cr)
        cairo_mask(cr,pat2)
        cairo_pattern_destroy(pat2)
        cairo_set_operator(cr,CAIRO_OPERATOR_OVER)
        te=nil
    end
    
end


function linear_orientation(t,te)
    local w,h=te.width,te.height
    local xb,yb=te.x_bearing,te.y_bearing
    
    if t.h_align=="c" then
        xb=xb-w/2
    elseif t.h_align=="r" then
        xb=xb-w
       end    
    if t.v_align=="m" then
        yb=-h/2
    elseif t.v_align=="t" then
        yb=0
       end    
    local p=0
    if t.orientation=="nn" then
        p={xb+w/2,yb,xb+w/2,yb+h}
    elseif t.orientation=="ne" then
        p={xb+w,yb,xb,yb+h}
    elseif t.orientation=="ww" then
        p={xb,h/2,xb+w,h/2}
    elseif vorientation=="se" then
        p={xb+w,yb+h,xb,yb}
    elseif t.orientation=="ss" then
        p={xb+w/2,yb+h,xb+w/2,yb}
    elseif t.orientation=="ee" then
        p={xb+w,h/2,xb,h/2}        
    elseif t.orientation=="sw" then
        p={xb,yb+h,xb+w,yb}
    elseif t.orientation=="nw" then
        p={xb,yb,xb+w,yb+h}
    end
    return p
end

linkpic
zoomed

Last edited by ragamatrix (2013-05-15 14:30:37)

Offline

#5358 2013-05-15 18:05:51

damionhh
Member
Registered: 2012-10-11
Posts: 45

Re: Conky v1.9 Thread

in my .conkyrc i am using the following line

${font Webdings:size=8}6${font Mono:size=8}${color 417941}Network

and although other fonts work in conky, the webdings one shows only boxes.  i checked with FontMatrix and also with OpenOffice Write and the webdings font is installed and usable.  it just wont show up in conky.  i have updated my font cache, reinstalled webdings, scrolled through the forums here and searched the net.  any ideas?

heres my .conkyrc

#####################
# - Conky settings - #
######################
background yes
update_interval 1
 
cpu_avg_samples 2
net_avg_samples 2
 
override_utf8_locale no
 
double_buffer yes
no_buffers yes
 
text_buffer_size 1280
imlib_cache_size 0

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2
 
#############################
# - Window specifications - #
#############################
own_window_class Conky
own_window yes
own_window_type desktop
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
border_inner_margin 0
border_outer_margin 0
minimum_size 275 275
maximum_width 275
alignment tr
gap_x 10
gap_y 10
 
#########################
# - Graphics settings - #
#########################
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
use_xft yes
xftfont Liberation Sans:size=9
xftalpha 0.9
total_run_times 0
temperature_unit fahrenheit
if_up_strictness address
default_color 656667
default_shade_color 000000
default_outline_color 828282
alignment top_right
gap_x 12
gap_y 56
uppercase no
short_units yes
pad_percents 2


TEXT
S Y S T E M    I N F O   ${goto 150}${font LCDMono:bold:size=9}${color #ddaa00}DESK $desktop${font}${color #656667} 
${stippled_hr}
host:${color darkgrey}$alignr$nodename${color #656667}
sys:$alignr$kernel/$sysname
uptime:$alignr$uptime
ram:$alignr$mem/$memmax
temp: $alignr${hwmon 3 temp 1}°F/${hwmon 3 temp 2}°F  nvidia/${nvidia temp}°F
fan:$alignr${hwmon 3 fan 1}/${hwmon 3 fan 3}rpm
cpu usage:${alignr 125} ${cpu}% ${cpubar 8}
mem usage:${alignr 125} ${memperc}% ${membar 8}
load:$alignr$loadavg
processes: $alignr${running_processes} / ${processes}
${font Webdings:size=8}6${font Mono:size=8}${color 417941}Network
${if_up wlan0}wlan0: ${addr wlan0} ${color darkgrey}${goto 150}${wireless_essid wlan0}${color #656667}
Up: ${upspeed wlan0}/s Out: ${tcp_portmon 32768 61000 count} ${goto 140}Dn: ${downspeed wlan0}/s In: ${tcp_portmon 1 32767 count}
${upspeedgraph wlan0 35,135 407BD2 407BD2} ${downspeedgraph wlan0 35,135 417941 417941}
${else}${if_up eth0}etho: ${addr eth0}
Up: ${upspeed eth0}/s ${goto 90}Out: ${tcp_portmon 32768 61000 count} ${goto 140}Dn: ${downspeed eth0}/s ${goto 240}In: ${tcp_portmon 1 32767 count}
${upspeedgraph eth0 35,135 407BD2 407BD2} ${downspeedgraph eth0 35,135 417941 417941}${else}{$alignr}No Network${endif}${endif}
${color darkgrey}local:${goto 115}Free:${color}
${execpi 60 df | grep "/dev/" | cut -d% -f2 | while read line ; do
echo '${goto 5}'/$(echo $line | cut -d/ -f3)'${goto 100}${fs_free '$line'} ${alignr 125}${fs_bar 8 '$line'}' 
done }

${color darkgrey}shares:${goto 115}free:${color}
${execpi 60 df | grep "//" | cut -d% -f2 | while read line ; do
echo '${goto 5}'$(echo $line | cut -d/ -f3)'${goto 100}${fs_free '$line'} ${alignr 125}${fs_bar 8 '$line'}' 
done }

${color darkgrey}tasks             $alignr   pid  cpu%  mem%
# Name              $alignr   pid cpu% mem%
${color #ddaa00}${top name 1} $alignr${top pid 1}  ${top cpu 1}  ${top mem 1}
${color #656667}${top name 2} $alignr${top pid 2}  ${top cpu 2}  ${top mem 2}
${color #656667}${top name 3} $alignr${top pid 3}  ${top cpu 3}  ${top mem 3}
${color #656667}${top name 4} $alignr${top pid 4}  ${top cpu 4}  ${top mem 4}
${color #656667}${top name 5} $alignr${top pid 5}  ${top cpu 5}  ${top mem 5}

${color darkgrey}mem usage
${color #ddaa00}${top_mem name 1} $alignr${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}${color #656667}
${top_mem name 2} $alignr${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${top_mem name 3} $alignr${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
${top_mem name 4} $alignr${top_mem pid 4} ${top_mem cpu 4} ${top_mem mem 4}
${top_mem name 5} $alignr${top_mem pid 5} ${top_mem cpu 5} ${top_mem mem 5}

 

Last edited by damionhh (2013-05-15 18:06:57)

Offline

#5359 2013-05-15 18:07:18

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

Sir Stooper wrote:

@Sector11

Thanks for the help, but I think I stumbled onto a solution.  By entering:

${nvidia temp}

It prints out literally: ${nvidia temp}

So I found a work-around as:

${color2}${font led:size=10}GPU ${font}$hr
${color}GPU 0 Temp ${alignr} ${execi 60 nvidia-settings -q [gpu:0]/GPUCoreTemp | perl -ne 'print $1 if /GPUCoreTemp.*?: (\d+)./;'} °C
${color}GPU 1 Temp ${alignr} ${execi 60 nvidia-settings -q [gpu:1]/GPUCoreTemp | perl -ne 'print $1 if /GPUCoreTemp.*?: (\d+)./;'} °C

I now have a temp read-out of both GPUs.

Ohhhhhhhhhhhhh that's GOOD!

How do the other ${nvidia xxxxx} commands work/or not  smile

You are the first person I've seen using two GPU's
Good to know about your little HowTo - - Thank you  big_smile

A conky "nice to have" update for nvidia commands

GPU 1${goto 100}GPU 2
${nvidia temp 1}${goto 100}${nvidia temp 2}
${nvidia threshold 1}${goto 100}${nvidia threshold 2}
${nvidia ambient 1}${goto 100}${nvidia ambient 2}
${nvidia gpufreq 1}${goto 100}${nvidia gpufreq 2}
${nvidia memfreq 1}${goto 100}${nvidia memfreq 2}
${nvidia imagequality 1}${goto 100}${nvidia imagequality 2}

·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#5360 2013-05-15 18:14:00

Justin88
New Member
Registered: 2013-05-15
Posts: 4

Re: Conky v1.9 Thread

hello

I'm new here with crunchbang

got a question

found this nice conky config here

http://gnome-look.org/content/show.php/ … ent=137504

how do I make it default at startup? (I'm a noob so gonna need step by step instructions... sorry)

thank you

Offline

#5361 2013-05-15 19:33:52

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

damionhh wrote:

in my .conkyrc i am using the following line

${font Webdings:size=8}6${font Mono:size=8}${color 417941}Network

and although other fonts work in conky, the webdings one shows only boxes.  i checked with FontMatrix and also with OpenOffice Write and the webdings font is installed and usable.  it just wont show up in conky.  i have updated my font cache, reinstalled webdings, scrolled through the forums here and searched the net.  any ideas?

There is something afoot with fonts ... it's not you, it's not your conky.

dingbats and webdings - both popular with conky; don't work at all for me - anywhere.

acqhGENQ.jpg

Same as fonts with a " - " in them like Digital-7, the top is cut off. And "DS-Digital"  conky doesn't like them.

There is a work around for those though:

${font Digital\-7:size=16}
${font DS\-Digital:size=16}

adrayUEw.jpg

I have yet to find a fix for the "ding" fonts that do not work and to be honest it's not limited to those fonts.
I have other here that do not work as well, in an editor and/or conky.

Note the and/or

Frustrating to say the least


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#5362 2013-05-15 19:54:15

damionhh
Member
Registered: 2012-10-11
Posts: 45

Re: Conky v1.9 Thread

Sector11 wrote:

There is something afoot with fonts ... it's not you, it's not your conky.

dingbats and webdings - both popular with conky; don't work at all for me - anywhere.

thanks.  just knowing that its a known issue helps.  i just found another symbols font and it works fine.  strange.
but you saved me time.

Last edited by damionhh (2013-05-15 20:23:14)

Offline

#5363 2013-05-15 20:23:56

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

Justin88 wrote:

hello

I'm new here with crunchbang

got a question

found this nice conky config here

http://gnome-look.org/content/show.php/ … ent=137504

how do I make it default at startup? (I'm a noob so gonna need step by step instructions... sorry)

thank you

Not as easy a dropping it in and running it.

How many CPU's does your computer have?

The LUA script is using two CPU calls ... CPU0 and CPU1
CPU0 is the average usage for CPU's with multiple cores, and the conky file is set up for CPU1, 2 and 3 with no CPU0

It has:

xftfont caviar dreams:size=8

above TEXT and literally does not use that font at all.  It only uses: Ubuntu

That can be changed easily.  Do you have the font Ubuntu installed?

Do you have eth0 and wlan0?

With the colours it has it is only visible on light backgrounds.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#5364 2013-05-15 20:25:05

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

damionhh wrote:

thanks.  just knowing that its a known issue helps.  i just found another symbols font and it works fine.  strange.
but you saved me time.

Always glad to help.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#5365 2013-05-15 20:27:04

Justin88
New Member
Registered: 2013-05-15
Posts: 4

Re: Conky v1.9 Thread

Sector11 wrote:
Justin88 wrote:

hello

I'm new here with crunchbang

got a question

found this nice conky config here

http://gnome-look.org/content/show.php/ … ent=137504

how do I make it default at startup? (I'm a noob so gonna need step by step instructions... sorry)

thank you

Not as easy a dropping it in and running it.

How many CPU's does your computer have?

The LUA script is using two CPU calls ... CPU0 and CPU1
CPU0 is the average usage for CPU's with multiple cores, and the conky file is set up for CPU1, 2 and 3 with no CPU0

It has:

xftfont caviar dreams:size=8

above TEXT and literally does not use that font at all.  It only uses: Ubuntu

That can be changed easily.  Do you have the font Ubuntu installed?

Do you have eth0 and wlan0?

With the colours it has it is only visible on light backgrounds.

i do not have ubuntu font installed, I have 2 cpu cores, and wlan0

Offline

#5366 2013-05-15 20:43:43

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

my lua-script uses more then 50% of cpu-power. everything works but do u have tipps (hints) to optimize the script? is there a possibility to decrease the cpu-load? the script: http://crunchbang.org/forums/viewtopic. … 98#p307098

Last edited by lionhead (2013-05-15 21:16:43)

Offline

#5367 2013-05-15 23:16:45

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

Justin88 wrote:

i do not have ubuntu font installed, I have 2 cpu cores, and wlan0

OK, I changed the conky to use Arial - almost the same:

abmFIpdE.jpg

Step 1 - rename ~/.conkyrc  to ~/.conkyrc_orig
Step 2 - copy this conky to ~/.conkyrc

# killall conky && conky &
#==============================================================================
#                                  conkyrc_red
#
#  author  : SLK
#  version : v2011011601
#  license : Distributed under the terms of GNU GPL version 2 or later
#
#  edited for Justin88 by Sector11 - 15 May 2013
#
#==============================================================================

background yes
update_interval 1

cpu_avg_samples 2
net_avg_samples 2
temperature_unit celsius

double_buffer yes
no_buffers yes
text_buffer_size 256

gap_x 10
gap_y 30
minimum_size 190 450
maximum_width 190
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
alignment tl

draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

override_utf8_locale yes
use_xft yes
xftfont Arial:size=7
xftalpha 0.5
uppercase no

default_color 666666
color1 888888
color2 AAAAAA
color3 DDDDDD
color4 CC3333

lua_load ~/.conky/conky_red.lua
lua_draw_hook_post main

TEXT
${voffset 35}
${goto 95}${color4}${font Arial:size=22}${time %e}${color1}${offset -50}${font Arial:size=10}${time %A}${font}
${goto 85}${color2}${voffset -2}${font Arial:size=9}${time %b}${voffset -2} ${color3}${font Arial:size=12}${time %Y}${font}

${voffset 80}
${goto 90}${color}CPU
${goto 90}${color1}${top name 1}${alignr}${top cpu 1}%
${goto 90}${color2}${top name 2}${alignr}${top cpu 2}%
${goto 90}${color3}${top name 3}${alignr}${top cpu 3}%
${goto 90}${cpugraph 10,100 AAAAAA AAAAAA}
${goto 90}${voffset -10}${color}${threads} process

${voffset 20}
${goto 90}${font Arial:bold:size=7}${color}MEM${font}
${goto 90}${color1}${top_mem name 1}${alignr}${top_mem mem 1}%
${goto 90}${color2}${top_mem name 2}${alignr}${top_mem mem 2}%
${goto 90}${color3}${top_mem name 3}${alignr}${top_mem mem 3}%

${voffset 15}
${goto 90}${font Arial:bold:size=7}${color}DISKS${font}

${goto 90}${diskiograph 30,100 AAAAAA AAAAAA}${voffset -30}
${goto 90}${color}used: ${fs_used /home} /home
${goto 90}${color}used: ${fs_used /} /

${voffset 10}
${goto 70}${font Arial:bold:size=18}${color2}NET${alignr}${color2}${font}${color1}${if_up eth0}eth ${addr eth0}${else}wifi ${addr wlan0}${endif}${font}
${goto 90}${font Arial:bold:size=7}${color}open ports: ${alignr}${color2}${tcp_portmon 1 65535 count}${font}
${goto 90}${color}${offset 10}IP${alignr}DPORT${color1}
${goto 90}${tcp_portmon 1 65535 rip  0}${alignr 1}${tcp_portmon 1 65535 rport  0}
${goto 90}${tcp_portmon 1 65535 rip  1}${alignr 1}${tcp_portmon 1 65535 rport  1}
${goto 90}${tcp_portmon 1 65535 rip  2}${alignr 1}${tcp_portmon 1 65535 rport  2}
${goto 90}${tcp_portmon 1 65535 rip  3}${alignr 1}${tcp_portmon 1 65535 rport  3}
${goto 90}${tcp_portmon 1 65535 rip  4}${alignr 1}${tcp_portmon 1 65535 rport  4}
${goto 90}${tcp_portmon 1 65535 rip  5}${alignr 1}${tcp_portmon 1 65535 rport  5}
${goto 90}${tcp_portmon 1 65535 rip  6}${alignr 1}${tcp_portmon 1 65535 rport  6}
${goto 90}${tcp_portmon 1 65535 rip  7}${alignr 1}${tcp_portmon 1 65535 rport  7}
${goto 90}${tcp_portmon 1 65535 rip  8}${alignr 1}${tcp_portmon 1 65535 rport  8}
${goto 90}${tcp_portmon 1 65535 rip  9}${alignr 1}${tcp_portmon 1 65535 rport  9}
${goto 90}${tcp_portmon 1 65535 rip 10}${alignr 1}${tcp_portmon 1 65535 rport 10}
${goto 90}${tcp_portmon 1 65535 rip 11}${alignr 1}${tcp_portmon 1 65535 rport 11}
${goto 90}${tcp_portmon 1 65535 rip 12}${alignr 1}${tcp_portmon 1 65535 rport 12}
${goto 90}${tcp_portmon 1 65535 rip 13}${alignr 1}${tcp_portmon 1 65535 rport 13}
${goto 90}${tcp_portmon 1 65535 rip 14}${alignr 1}${tcp_portmon 1 65535 rport 14}

Step 3 - create a hidden directory: ~/.conky and copy conky_red.lua in there:
- - - it has been edited to use CPU 1 & 2 - I'll add a 3rd for CPU0 (average) IF you want it later.

--==============================================================================
--                                 conky_red.lua
--
--  author  : SLK
--  version : v2011062101
--  license : Distributed under the terms of GNU GPL version 2 or later
--
--==============================================================================

require 'cairo'

--------------------------------------------------------------------------------
--                                                                    clock DATA
-- HOURS
clock_h = {
    {
    name='time',                   arg='%H',                    max_value=12,
    x=110,                         y=80,
    graph_radius=53,
    graph_thickness=3,
    graph_unit_angle=30,           graph_unit_thickness=30,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.0,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.3,
    txt_radius=34,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0x444444,        txt_fg_alpha=0.6,
    graduation_radius=53,
    graduation_thickness=6,        graduation_mark_thickness=2,
    graduation_unit_angle=30,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.3,
    },
}
-- MINUTES
clock_m = {
    {
    name='time',                   arg='%M',                    max_value=60,
    x=110,                         y=80,
    graph_radius=57,
    graph_thickness=2,
    graph_unit_angle=6,            graph_unit_thickness=6,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.1,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.3,
    txt_radius=70,
    txt_weight=0,                  txt_size=9.0,
    txt_fg_colour=0x444444,        txt_fg_alpha=0.6,
    graduation_radius=57,
    graduation_thickness=0,        graduation_mark_thickness=2,
    graduation_unit_angle=30,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.3,
    },
}
-- SECONDS
clock_s = {
    {
    name='time',                   arg='%S',                    max_value=60,
    x=110,                         y=80,
    graph_radius=50,
    graph_thickness=2,
    graph_unit_angle=6,            graph_unit_thickness=2,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.0,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.2,
    txt_radius=40,
    txt_weight=0,                  txt_size=12.0,
    txt_fg_colour=0x444444,        txt_fg_alpha=0.3,
    graduation_radius=0,
    graduation_thickness=0,        graduation_mark_thickness=0,
    graduation_unit_angle=0,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.0,
    },
}

--------------------------------------------------------------------------------
--                                                                    gauge DATA
gauge = {
{
    name='cpu',                    arg='cpu1',                  max_value=100,
    x=85,                          y=200,
    graph_radius=24,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7,          graph_unit_thickness=2.7,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.1,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.2,
    hand_fg_colour=0xCC3333,       hand_fg_alpha=1.0,
    txt_radius=34,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xCC3333,        txt_fg_alpha=1.0,
    graduation_radius=28,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0x444444,    caption_fg_alpha=0.3,
},
{
    name='cpu',                    arg='cpu2',                  max_value=100,
    x=85,                          y=200,
    graph_radius=18,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7,          graph_unit_thickness=2.7,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.1,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.2,
    hand_fg_colour=0xCC3333,       hand_fg_alpha=1.0,
    txt_radius=10,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xCC3333,        txt_fg_alpha=1.0,
    graduation_radius=28,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0x444444,    caption_fg_alpha=0.3,
},
{
    name='memperc',                arg='',                      max_value=100,
    x=85,                          y=300,
    graph_radius=24,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7,          graph_unit_thickness=2.7,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.1,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.2,
    hand_fg_colour=0xCC3333,       hand_fg_alpha=1.0,
    txt_radius=10,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xCC3333,        txt_fg_alpha=1.0,
    graduation_radius=23,
    graduation_thickness=0,        graduation_mark_thickness=2,
    graduation_unit_angle=27,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.5,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0x444444,    caption_fg_alpha=0.3,
},
{
    name='fs_used_perc',           arg='/',                     max_value=100,
    x=85,                          y=380,
    graph_radius=24,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7,          graph_unit_thickness=2.7,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.1,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.2,
    hand_fg_colour=0xCC3333,       hand_fg_alpha=1.0,
    txt_radius=34,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xCC3333,        txt_fg_alpha=1.0,
    graduation_radius=28,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.3,
    caption='/',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0x444444,    caption_fg_alpha=0.5,
},
{
    name='fs_used_perc',           arg='/home/',                max_value=100,
    x=85,                          y=380,
    graph_radius=18,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7,          graph_unit_thickness=2.7,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.1,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.2,
    hand_fg_colour=0xCC3333,       hand_fg_alpha=1.0,
    txt_radius=10,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xCC3333,        txt_fg_alpha=1.0,
    graduation_radius=28,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.3,
    caption='/home',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0x444444,    caption_fg_alpha=0.5,
},
}

-------------------------------------------------------------------------------
--                                                                 rgb_to_r_g_b
-- converts color in hexa to decimal
--
function rgb_to_r_g_b(colour, alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

-------------------------------------------------------------------------------
--                                                            angle_to_position
-- convert degree to rad and rotate (0 degree is top/north)
--
function angle_to_position(start_angle, current_angle)
    local pos = current_angle + start_angle
    return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end

-------------------------------------------------------------------------------
--                                                              draw_clock_ring
-- displays clock
--
function draw_clock_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']

    -- background ring
    cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi)
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)

    -- arc of value
    local val = (value % max_value)
    local i = 1
    while i <= val do
        cairo_arc(display, x, y, graph_radius,(  ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360)  )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2))
        cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = (graph_unit_angle * i) - graph_unit_thickness

    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = 360 / graduation_unit_angle
        local i = 1
        while i <= nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end

    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * (math.cos((angle * 2 * math.pi / 360)-(math.pi/2)))
    local movey = txt_radius * (math.sin((angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight);
    cairo_set_font_size (display, txt_size);
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha));
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3);
    cairo_show_text (display, value);
    cairo_stroke (display);
end

-------------------------------------------------------------------------------
--                                                              draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_start_angle = data['graph_start_angle']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
    local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
    local graph_end_angle = (max_value * graph_unit_angle) % 360

    -- background ring
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)

    -- arc of value
    local val = value % (max_value + 1)
    local start_arc = 0
    local stop_arc = 0
    local i = 1
    while i <= val do
        start_arc = (graph_unit_angle * i) - graph_unit_thickness
        stop_arc = (graph_unit_angle * i)
        cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
        cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = start_arc

    -- hand
    start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
    stop_arc = (graph_unit_angle * val)
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
    cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
    cairo_stroke(display)

    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = graph_end_angle / graduation_unit_angle
        local i = 0
        while i < nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
            stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
            cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end

    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
    local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
    cairo_set_font_size (display, txt_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
    cairo_show_text (display, value)
    cairo_stroke (display)

    -- caption
    local caption = data['caption']
    local caption_weight, caption_size = data['caption_weight'], data['caption_size']
    local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
    local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
    cairo_set_font_size (display, caption_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
    cairo_move_to (display, x + tox + 5, y + toy + 1)
    -- bad hack but not enough time !
    if graph_start_angle < 105 then
        cairo_move_to (display, x + tox - 30, y + toy + 1)
    end
    cairo_show_text (display, caption)
    cairo_stroke (display)
end

-------------------------------------------------------------------------------
--                                                               go_clock_rings
-- loads data and displays clock
--
function go_clock_rings(display)
    local function load_clock_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_clock_ring(display, data, value)
    end
    
    for i in pairs(clock_h) do
        load_clock_rings(display, clock_h[i])
    end
    for i in pairs(clock_m) do
        load_clock_rings(display, clock_m[i])
    end
    for i in pairs(clock_s) do
        load_clock_rings(display, clock_s[i])
    end
end

-------------------------------------------------------------------------------
--                                                               go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
    local function load_gauge_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_gauge_ring(display, data, value)
    end
    
    for i in pairs(gauge) do
        load_gauge_rings(display, gauge[i])
    end
end

-------------------------------------------------------------------------------
--                                                                         MAIN
function conky_main()
    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 display = cairo_create(cs)
    
    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)
    
    if update_num > 5 then
        go_clock_rings(display)
        go_gauge_rings(display)
    end
    
    cairo_surface_destroy(cs)
    cairo_destroy(display)
end

Step 4 - in a terminal:

killall conky && conky &

... and it should start in 4 to 6 seconds and will be your default conky on boot..


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#5368 2013-05-15 23:23:40

Justin88
New Member
Registered: 2013-05-15
Posts: 4

Re: Conky v1.9 Thread

Sector11 wrote:
Justin88 wrote:

i do not have ubuntu font installed, I have 2 cpu cores, and wlan0

OK, I changed the conky to use Arial - almost the same:

http://t.imgbox.com/abmFIpdE.jpg

Step 1 - rename ~/.conkyrc  to ~/.conkyrc_orig
Step 2 - copy this conky to ~/.conkyrc

# killall conky && conky &
#==============================================================================
#                                  conkyrc_red
#
#  author  : SLK
#  version : v2011011601
#  license : Distributed under the terms of GNU GPL version 2 or later
#
#  edited for Justin88 by Sector11 - 15 May 2013
#
#==============================================================================

background yes
update_interval 1

cpu_avg_samples 2
net_avg_samples 2
temperature_unit celsius

double_buffer yes
no_buffers yes
text_buffer_size 256

gap_x 10
gap_y 30
minimum_size 190 450
maximum_width 190
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
alignment tl

draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

override_utf8_locale yes
use_xft yes
xftfont Arial:size=7
xftalpha 0.5
uppercase no

default_color 666666
color1 888888
color2 AAAAAA
color3 DDDDDD
color4 CC3333

lua_load ~/.conky/conky_red.lua
lua_draw_hook_post main

TEXT
${voffset 35}
${goto 95}${color4}${font Arial:size=22}${time %e}${color1}${offset -50}${font Arial:size=10}${time %A}${font}
${goto 85}${color2}${voffset -2}${font Arial:size=9}${time %b}${voffset -2} ${color3}${font Arial:size=12}${time %Y}${font}

${voffset 80}
${goto 90}${color}CPU
${goto 90}${color1}${top name 1}${alignr}${top cpu 1}%
${goto 90}${color2}${top name 2}${alignr}${top cpu 2}%
${goto 90}${color3}${top name 3}${alignr}${top cpu 3}%
${goto 90}${cpugraph 10,100 AAAAAA AAAAAA}
${goto 90}${voffset -10}${color}${threads} process

${voffset 20}
${goto 90}${font Arial:bold:size=7}${color}MEM${font}
${goto 90}${color1}${top_mem name 1}${alignr}${top_mem mem 1}%
${goto 90}${color2}${top_mem name 2}${alignr}${top_mem mem 2}%
${goto 90}${color3}${top_mem name 3}${alignr}${top_mem mem 3}%

${voffset 15}
${goto 90}${font Arial:bold:size=7}${color}DISKS${font}

${goto 90}${diskiograph 30,100 AAAAAA AAAAAA}${voffset -30}
${goto 90}${color}used: ${fs_used /home} /home
${goto 90}${color}used: ${fs_used /} /

${voffset 10}
${goto 70}${font Arial:bold:size=18}${color2}NET${alignr}${color2}${font}${color1}${if_up eth0}eth ${addr eth0}${else}wifi ${addr wlan0}${endif}${font}
${goto 90}${font Arial:bold:size=7}${color}open ports: ${alignr}${color2}${tcp_portmon 1 65535 count}${font}
${goto 90}${color}${offset 10}IP${alignr}DPORT${color1}
${goto 90}${tcp_portmon 1 65535 rip  0}${alignr 1}${tcp_portmon 1 65535 rport  0}
${goto 90}${tcp_portmon 1 65535 rip  1}${alignr 1}${tcp_portmon 1 65535 rport  1}
${goto 90}${tcp_portmon 1 65535 rip  2}${alignr 1}${tcp_portmon 1 65535 rport  2}
${goto 90}${tcp_portmon 1 65535 rip  3}${alignr 1}${tcp_portmon 1 65535 rport  3}
${goto 90}${tcp_portmon 1 65535 rip  4}${alignr 1}${tcp_portmon 1 65535 rport  4}
${goto 90}${tcp_portmon 1 65535 rip  5}${alignr 1}${tcp_portmon 1 65535 rport  5}
${goto 90}${tcp_portmon 1 65535 rip  6}${alignr 1}${tcp_portmon 1 65535 rport  6}
${goto 90}${tcp_portmon 1 65535 rip  7}${alignr 1}${tcp_portmon 1 65535 rport  7}
${goto 90}${tcp_portmon 1 65535 rip  8}${alignr 1}${tcp_portmon 1 65535 rport  8}
${goto 90}${tcp_portmon 1 65535 rip  9}${alignr 1}${tcp_portmon 1 65535 rport  9}
${goto 90}${tcp_portmon 1 65535 rip 10}${alignr 1}${tcp_portmon 1 65535 rport 10}
${goto 90}${tcp_portmon 1 65535 rip 11}${alignr 1}${tcp_portmon 1 65535 rport 11}
${goto 90}${tcp_portmon 1 65535 rip 12}${alignr 1}${tcp_portmon 1 65535 rport 12}
${goto 90}${tcp_portmon 1 65535 rip 13}${alignr 1}${tcp_portmon 1 65535 rport 13}
${goto 90}${tcp_portmon 1 65535 rip 14}${alignr 1}${tcp_portmon 1 65535 rport 14}

Step 3 - create a hidden directory: ~/.conky and copy conky_red.lua in there:
- - - it has been edited to use CPU 1 & 2 - I'll add a 3rd for CPU0 (average) IF you want it later.

--==============================================================================
--                                 conky_red.lua
--
--  author  : SLK
--  version : v2011062101
--  license : Distributed under the terms of GNU GPL version 2 or later
--
--==============================================================================

require 'cairo'

--------------------------------------------------------------------------------
--                                                                    clock DATA
-- HOURS
clock_h = {
    {
    name='time',                   arg='%H',                    max_value=12,
    x=110,                         y=80,
    graph_radius=53,
    graph_thickness=3,
    graph_unit_angle=30,           graph_unit_thickness=30,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.0,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.3,
    txt_radius=34,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0x444444,        txt_fg_alpha=0.6,
    graduation_radius=53,
    graduation_thickness=6,        graduation_mark_thickness=2,
    graduation_unit_angle=30,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.3,
    },
}
-- MINUTES
clock_m = {
    {
    name='time',                   arg='%M',                    max_value=60,
    x=110,                         y=80,
    graph_radius=57,
    graph_thickness=2,
    graph_unit_angle=6,            graph_unit_thickness=6,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.1,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.3,
    txt_radius=70,
    txt_weight=0,                  txt_size=9.0,
    txt_fg_colour=0x444444,        txt_fg_alpha=0.6,
    graduation_radius=57,
    graduation_thickness=0,        graduation_mark_thickness=2,
    graduation_unit_angle=30,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.3,
    },
}
-- SECONDS
clock_s = {
    {
    name='time',                   arg='%S',                    max_value=60,
    x=110,                         y=80,
    graph_radius=50,
    graph_thickness=2,
    graph_unit_angle=6,            graph_unit_thickness=2,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.0,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.2,
    txt_radius=40,
    txt_weight=0,                  txt_size=12.0,
    txt_fg_colour=0x444444,        txt_fg_alpha=0.3,
    graduation_radius=0,
    graduation_thickness=0,        graduation_mark_thickness=0,
    graduation_unit_angle=0,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.0,
    },
}

--------------------------------------------------------------------------------
--                                                                    gauge DATA
gauge = {
{
    name='cpu',                    arg='cpu1',                  max_value=100,
    x=85,                          y=200,
    graph_radius=24,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7,          graph_unit_thickness=2.7,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.1,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.2,
    hand_fg_colour=0xCC3333,       hand_fg_alpha=1.0,
    txt_radius=34,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xCC3333,        txt_fg_alpha=1.0,
    graduation_radius=28,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0x444444,    caption_fg_alpha=0.3,
},
{
    name='cpu',                    arg='cpu2',                  max_value=100,
    x=85,                          y=200,
    graph_radius=18,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7,          graph_unit_thickness=2.7,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.1,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.2,
    hand_fg_colour=0xCC3333,       hand_fg_alpha=1.0,
    txt_radius=10,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xCC3333,        txt_fg_alpha=1.0,
    graduation_radius=28,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0x444444,    caption_fg_alpha=0.3,
},
{
    name='memperc',                arg='',                      max_value=100,
    x=85,                          y=300,
    graph_radius=24,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7,          graph_unit_thickness=2.7,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.1,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.2,
    hand_fg_colour=0xCC3333,       hand_fg_alpha=1.0,
    txt_radius=10,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xCC3333,        txt_fg_alpha=1.0,
    graduation_radius=23,
    graduation_thickness=0,        graduation_mark_thickness=2,
    graduation_unit_angle=27,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.5,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0x444444,    caption_fg_alpha=0.3,
},
{
    name='fs_used_perc',           arg='/',                     max_value=100,
    x=85,                          y=380,
    graph_radius=24,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7,          graph_unit_thickness=2.7,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.1,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.2,
    hand_fg_colour=0xCC3333,       hand_fg_alpha=1.0,
    txt_radius=34,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xCC3333,        txt_fg_alpha=1.0,
    graduation_radius=28,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.3,
    caption='/',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0x444444,    caption_fg_alpha=0.5,
},
{
    name='fs_used_perc',           arg='/home/',                max_value=100,
    x=85,                          y=380,
    graph_radius=18,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7,          graph_unit_thickness=2.7,
    graph_bg_colour=0x444444,      graph_bg_alpha=0.1,
    graph_fg_colour=0x444444,      graph_fg_alpha=0.2,
    hand_fg_colour=0xCC3333,       hand_fg_alpha=1.0,
    txt_radius=10,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xCC3333,        txt_fg_alpha=1.0,
    graduation_radius=28,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0x444444, graduation_fg_alpha=0.3,
    caption='/home',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0x444444,    caption_fg_alpha=0.5,
},
}

-------------------------------------------------------------------------------
--                                                                 rgb_to_r_g_b
-- converts color in hexa to decimal
--
function rgb_to_r_g_b(colour, alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

-------------------------------------------------------------------------------
--                                                            angle_to_position
-- convert degree to rad and rotate (0 degree is top/north)
--
function angle_to_position(start_angle, current_angle)
    local pos = current_angle + start_angle
    return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end

-------------------------------------------------------------------------------
--                                                              draw_clock_ring
-- displays clock
--
function draw_clock_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']

    -- background ring
    cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi)
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)

    -- arc of value
    local val = (value % max_value)
    local i = 1
    while i <= val do
        cairo_arc(display, x, y, graph_radius,(  ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360)  )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2))
        cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = (graph_unit_angle * i) - graph_unit_thickness

    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = 360 / graduation_unit_angle
        local i = 1
        while i <= nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end

    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * (math.cos((angle * 2 * math.pi / 360)-(math.pi/2)))
    local movey = txt_radius * (math.sin((angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight);
    cairo_set_font_size (display, txt_size);
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha));
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3);
    cairo_show_text (display, value);
    cairo_stroke (display);
end

-------------------------------------------------------------------------------
--                                                              draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_start_angle = data['graph_start_angle']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
    local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
    local graph_end_angle = (max_value * graph_unit_angle) % 360

    -- background ring
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)

    -- arc of value
    local val = value % (max_value + 1)
    local start_arc = 0
    local stop_arc = 0
    local i = 1
    while i <= val do
        start_arc = (graph_unit_angle * i) - graph_unit_thickness
        stop_arc = (graph_unit_angle * i)
        cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
        cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = start_arc

    -- hand
    start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
    stop_arc = (graph_unit_angle * val)
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
    cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
    cairo_stroke(display)

    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = graph_end_angle / graduation_unit_angle
        local i = 0
        while i < nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
            stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
            cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end

    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
    local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
    cairo_set_font_size (display, txt_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
    cairo_show_text (display, value)
    cairo_stroke (display)

    -- caption
    local caption = data['caption']
    local caption_weight, caption_size = data['caption_weight'], data['caption_size']
    local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
    local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
    cairo_set_font_size (display, caption_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
    cairo_move_to (display, x + tox + 5, y + toy + 1)
    -- bad hack but not enough time !
    if graph_start_angle < 105 then
        cairo_move_to (display, x + tox - 30, y + toy + 1)
    end
    cairo_show_text (display, caption)
    cairo_stroke (display)
end

-------------------------------------------------------------------------------
--                                                               go_clock_rings
-- loads data and displays clock
--
function go_clock_rings(display)
    local function load_clock_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_clock_ring(display, data, value)
    end
    
    for i in pairs(clock_h) do
        load_clock_rings(display, clock_h[i])
    end
    for i in pairs(clock_m) do
        load_clock_rings(display, clock_m[i])
    end
    for i in pairs(clock_s) do
        load_clock_rings(display, clock_s[i])
    end
end

-------------------------------------------------------------------------------
--                                                               go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
    local function load_gauge_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_gauge_ring(display, data, value)
    end
    
    for i in pairs(gauge) do
        load_gauge_rings(display, gauge[i])
    end
end

-------------------------------------------------------------------------------
--                                                                         MAIN
function conky_main()
    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 display = cairo_create(cs)
    
    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)
    
    if update_num > 5 then
        go_clock_rings(display)
        go_gauge_rings(display)
    end
    
    cairo_surface_destroy(cs)
    cairo_destroy(display)
end

Step 4 - in a terminal:

killall conky && conky &

... and it should start in 4 to 6 seconds and will be your default conky on boot..

thank you very much.

great community!

Offline

#5369 2013-05-15 23:29:29

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

Justin88 wrote:

thank you very much.

great community!

You're welcome.  Let's see a screenshot.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#5370 2013-05-16 09:53:13

crunchmic
Member
Registered: 2010-08-26
Posts: 15

Re: Conky v1.9 Thread

Great! Could you make a version for 4 CPUs, please?

Sector11 wrote:

- - - it has been edited to use CPU 1 & 2 - I'll add a 3rd for CPU0 (average) IF you want it later.

mic


Mic

Offline

#5371 2013-05-16 16:37:40

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

crunchmic wrote:

Great! Could you make a version for 4 CPUs, please?

mic

Actually I think I have one "super similar" (by the same person) for my 3 core AMD let me look - my project for today.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#5372 2013-05-16 17:15:39

crunchmic
Member
Registered: 2010-08-26
Posts: 15

Re: Conky v1.9 Thread

Sector11 wrote:
crunchmic wrote:

Great! Could you make a version for 4 CPUs, please?

mic

Actually I think I have one "super similar" (by the same person) for my 3 core AMD let me look - my project for today.

Wonderful wink

I started to fiddle with that config myself, as I thought the lua wasn't working at all. At least I saw no circles, but in fact they were just very very faint. I fiddled with the alpha-values and made them visible finally, but I am not satisfied yet.

Also the vertical (and horizontal) offsets are somewhat weird. It does not look "round" yet...

Glad if you could help!

scrot conky

Last edited by crunchmic (2013-05-16 17:18:14)


Mic

Offline

#5373 2013-05-16 17:30:28

Justin88
New Member
Registered: 2013-05-15
Posts: 4

Re: Conky v1.9 Thread

this config with red number was barely visible...

tried the grey one from here very similar... tried to config script myself, changed fonts, position... looks better I think. could be a bit larger on my 1650 X 1080 resolution...

http://imageshack.us/a/img854/1196/2013 … 01680x.png

Last edited by Justin88 (2013-05-16 17:31:53)

Offline

#5374 2013-05-16 18:11:36

crunchmic
Member
Registered: 2010-08-26
Posts: 15

Re: Conky v1.9 Thread

Justin88 wrote:

this config with red number was barely visible...

tried the grey one from here very similar...

Oh yes, much better! Will have to tweak the size a little, but other than that it is great! wink

Last edited by crunchmic (2013-05-16 18:12:03)


Mic

Offline

Help fund CrunchBang, donate to the project!

#5375 2013-05-16 18:29:40

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

@ Justin88 and crunchmic

@ Justin88 - those look like the originals of the ones I got from a different location (I'm basing this on the date).  Either way mine are "tweaked" as usual.  None of these are really "mine" - just modified by me to my liking.

@ crunchmic - yea, I'm looking at my "Conky 05" and thinking now that I have a screen height of 1080 it could be increased quite nicely.

The screenshot which Calvin supervised the building of:
adiLF0Zp.jpg

Conky 03 - top centre
- - pretty solid oneliner will not move about as CPU usage increases from 9 to 10 or 99 to 100% usage adding a 4th CPU to that would be kindergarten easy.

Conky 05 - right
- - again already modified for my 3 core - easy to add a 4th.   Gotta make that bigger.

Conky 14-2 - below the top conky
- - again 3 CPUs with an average. I'd change that so the LUA shows CPU 1 to 4 and the number in the centre the average (CPU0)

Conky 11-3 - dead centre
- - just a digital time piece. 24hr time

Conky 06 - bottom centre
- - like the one Justin88 just saw and modified to 3 cores with an average - 4th core would be simple enough.

Conky 07 - bottom right
- - simple little conky with info the others miss.

Conky 05-2 - top left
- - just the clock from Conky 05

Conky 6-2 - bottom left
- - the clock from Bonky 05
- - add ed to Conky 06
- - again a 4th core would be easy but involve a tad more due to MB and CPU temps etc - but really doable.

Last edited by Sector11 (2013-05-16 18:32:59)


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo