Conky Support, Codes and Screenshots

Sector11

Stay Home

lwfitz

#361
New one Im working on



Long way to go but its coming along
Don't Be A Dick!

jedi

#362
My "System" Conky, based on McLovin's bars Conky.



The Conky;  .systemconkyrc

######################
# - Conky settings -   #
# -Based on a conky- #
# -by McLovins Bars- #
# -Tweaked by jedi - #
# -all mistakes by me...(jedi)
######################

background no
update_interval 1
cpu_avg_samples 2
total_run_times 0
override_utf8_locale yes

double_buffer yes
#no_buffers yes

text_buffer_size 10240
imlib_cache_size 10240

minimum_size 300 880
maximum_width 300

gap_x 15
gap_y 45
#####################
# - Text settings - #
#####################
use_xft yes
xftfont Santana:size=11
#xftalpha 0.8

uppercase no

# Text alignment, other possible values are commented
#alignment middle_left
#alignment middle_middle
#alignment middle_right
#alignment top_middle
alignment top_right
#alignment top_right
#alignment bottom_left
#alignment bottom_right
#alignment bottom_middle

######################
# - Color settings - #
######################
color0 c3c3c3 #mid gray
color1 FF0000 #red
color2 A4FFA4 #light green
color3 007EFF #bright blue
color4 E3E3E3 #very light gray
color5 c6771a #an orange shade
color6 CA8718 #a dust like color
color7 FFE500 #a darker yellow color
color8 C3FF00 #lime green
color9 227992 #bars-blue #another blue 48a3fd
default_color c3c3c3
default_shade_color gray
default_outline_color black
#############################
# - Window specifications - #
#############################
own_window yes
own_window_type normal #override
own_window_transparent yes
own_window_hints undecorated,sticky,below,skip_taskbar,skip_pager
own_window_colour gray
own_window_class Conky
own_window_title clicky
#own_window_argb_visual yes
#own_window_argb_value 255

border_inner_margin 0
border_outer_margin 0

#########################
# - Graphics settings - #
#########################
draw_shades no
draw_outline no
draw_borders no
stippled_borders 0
draw_graph_borders no

####
## Load Lua for bargraphs (required)
## Set the path to your script here.
#
lua_load ~/Conky/LUA/bargraph.lua
lua_draw_hook_pre main_bars
TEXT
${goto 6}${voffset 4}${color 547EC8}${font xspiralmental:size=14}G${color}${font}${voffset -4}${goto 32}Distro:${alignr}${execi 2600 cat /etc/issue.net}
${goto 6}${voffset 4}${color 547EC8}${font xspiralmental:size=14}Z${color}${font}${voffset -4}${goto 32}Kernel:${alignr}${kernel}
${goto 6}${voffset 4}${color 547EC8}${font StyleBats:size=14}o${color}${font}${voffset -4}${goto 32}Uptime:${alignr}${uptime}
${goto 6}${voffset 4}${color 547EC8}${font StyleBats:size=14}q${color}${font}${voffset -4}${goto 32}Processes:${alignr}${processes} ($running_processes running)
${color 547EC8}${hr}${color}
${goto 8}${color 951C1C}${font Weather:size=19}x${color}${font}${goto 32}${voffset -2}Motherboard Temp: ${alignr}${hwmon 2 temp 2}º C${font}
${goto 8}${color 951C1C}${font Weather:size=19}x${color}${font}${goto 32}${voffset -2}CPU Socket Temp: ${alignr}${hwmon 1 temp 1}º C${font}
${color 547EC8}${hr}${color}
${goto 46}${color 547EC8}${font Poky:size=16}P${color}${voffset}${font}${voffset -4}${goto 28}${alignc}${execi 1000 cat /proc/cpuinfo | egrep -m 1 'model name' | sed -e 's/model name.*: //' | cut -c41-47} ${exec cat /proc/cpuinfo | egrep -m 1 'model name' | sed -e 's/model name.*: //' | cut -c1-5} ${exec cat /proc/cpuinfo | egrep -m 1 'model name' | sed -e 's/model name.*: //' | cut -c10-13}-${exec cat /proc/cpuinfo | egrep -m 1 'model name' | sed -e 's/model name.*: //' | cut -c19-20} ${exec cat /proc/cpuinfo | egrep -m 1 'model name' | sed -e 's/model name.*: //' | cut -c28-49}
${goto 70}${color 951C1C}${font Weather:size=19}x${color}${font}${voffset -4}${goto 85}Physical CPU Temp: ${alignr}${goto 235}${hwmon temp 1}º C${font}
${alignc}Avg CPU use: ${cpu cpu0}%
${alignc}Load:  ${loadavg}
${goto 75}${color 951C1C}${font Weather:size=19}x${color}${font}${goto 32}${voffset -4}${alignc}Core 1 Temp: ${execi 10 sensors | grep "Core 1" | cut -d "+" -f2 | cut -c1-2}º C
${goto 6}${color 547EC8}${font Poky:size=16}P${color}${font}${voffset -4}${goto 28}CPU1: ${freq_g 1}Gh ${alignr}${cpu cpu1}%
${goto 6}${color 547EC8}${font Poky:size=16}P${color}${font}${voffset -4}${goto 28}CPU2: ${freq_g 2}Gh ${alignr}${cpu cpu2}%

${goto 75}${color 951C1C}${font Weather:size=19}x${color}${font}${goto 32}${voffset -4}${alignc}Core 2 Temp: ${execi 10 sensors | grep "Core 2" | cut -d "+" -f2 | cut -c1-2}º C
${goto 6}${color 547EC8}${font Poky:size=16}P${color}${font}${voffset -4}${goto 28}CPU3: ${freq_g 3}Gh ${alignr}${cpu cpu3}%
${goto 6}${color 547EC8}${font Poky:size=16}P${color}${font}${voffset -4}${goto 28}CPU4: ${freq_g 4}Gh ${alignr}${cpu cpu4}%

${goto 75}${color 951C1C}${font Weather:size=19}x${color}${font}${goto 32}${voffset -4}${alignc}Core 3 Temp: ${execi 10 sensors | grep "Core 3" | cut -d "+" -f2 | cut -c1-2}º C
${goto 6}${color 547EC8}${font Poky:size=16}P${color}${font}${voffset -4}${goto 28}CPU5: ${freq_g 5}Gh ${alignr}${cpu cpu5}%
${goto 6}${color 547EC8}${font Poky:size=16}P${color}${font}${voffset -4}${goto 28}CPU6: ${freq_g 6}Gh ${alignr}${cpu cpu6}%

${goto 75}${color 951C1C}${font Weather:size=19}x${color}${font}${goto 32}${voffset -4}${alignc}Core 4 Temp: ${execi 10 sensors | grep "Core 0" | cut -d "+" -f2 | cut -c1-2}º C
${goto 6}${color 547EC8}${font Poky:size=16}P${color}${font}${voffset -4}${goto 28}CPU7: ${freq_g 7}Gh ${alignr}${cpu cpu7}%
${goto 6}${color 547EC8}${font Poky:size=16}P${color}${font}${voffset -4}${goto 28}CPU8: ${freq_g 8}Gh ${alignr}${cpu cpu8}%

${goto 66}${voffset 4}${color 547EC8}${font Poky:size=11}M${color}${font}${voffset -8}${goto 32}${alignc}Used RAM: ${mem}${voffset -4}
${voffset 4}${goto 32}${alignc}Total RAM: ${memmax}

${alignc}${color5}GPU Temp:${color9} ${nvidia temp}º
${alignc}${color5}GPU Freq:${color1} ${nvidia gpufreq}MHz
${alignc}${color5}GPU Mem Freq:${color1} ${nvidia memFreq}MHz${color9}

${goto 3}${color 547EC8}${font Martin Vogel's Symbols:size=20}h${color}${font}${voffset -4}${goto 32}Disk I/O: ${diskio}${alignr}${voffset -10}${diskiograph 18,160 00D7FF FF452A -l -t}

${alignc}  NETWORK      ${alignr}${gw_iface} ${voffset -3}
${color 547EC8}${font PizzaDude Bullets:size=16}M${color}${font}${goto 32}${voffset -4}Upload Speed: ${upspeedf wlan0}${font}${alignr}Total: ${totalup wlan0}
${color 547EC8}${font PizzaDude Bullets:size=16}S${color}${font}${goto 32}${voffset -4}Download Speed: ${downspeedf wlan0}${font}${goto 32}${alignr}Total: ${totaldown wlan0}

${color 547EC8}${font Poky:size=16}w${color}${font}${goto 32}${voffset -20}Router IP: ${alignr}${gw_ip}
${goto 32}Local IP:  ${alignr}${addr wlan0}
${goto 32}Public IP: ${alignr}${execi 300 wget -q -O - checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'}
${goto 32}Signal : ${alignr}${wireless_link_qual_perc wlan0}%

${color 547EC8}${font Poky:size=16}Q${color}${font}${goto 32}${voffset -9}Battery :${alignr}${battery_percent BAT0}%
${alignc}${battery_time BAT0}


The lua;  bargraph.lua

--[[ BARGRAPH WIDGET
To call the script in a conky, use, before TEXT
lua_load /path/to/the/script/bargraph.lua
lua_draw_hook_pre main_rings
        and add one line (blank or not) after TEXT


Parameters are :
3 parameters are mandatory
name - the name of the conky variable to display, for example for {$cpu cpu0}, just write name="cpu"
arg - the argument of the above variable, for example for {$cpu cpu0}, just write arg="cpu0"
  arg can be a numerical value if name=""
max - the maximum value the above variable can reach, for example, for {$cpu cpu0}, just write max=100

Optional parameters:
x,y - coordinates of the starting point of the bar, default = middle of the conky window
cap - end of cap line, ossibles values are r,b,s (for round, butt, square), default="b"
  http://www.cairographics.org/samples/set_line_cap/
angle - angle of rotation of the bar in degress, default = 0 (i.e. a vertical bar)
  set to 90 for an horizontal bar
skew_x - skew bar around x axis, default = 0
skew_y - skew bar around y axis, default = 0
blocks  - number of blocks to display for a bar (values >0) , default= 10
height - height of a block, default=10 pixels
width - width of a block, default=20 pixels
space - space between 2 blocks, default=2 pixels
angle_bar - this angle is used to draw a bar on a circular way (ok, this is no more a bar !) default=0
radius - for cicular bars, internal radius, default=0
  with radius, parameter width has no more effect.

Colours below are defined into braces {colour in hexadecimal, alpha}
fg_colour - colour of a block ON, default= {0x00FF00,1}
bg_colour - colour of a block OFF, default = {0x00FF00,0.5}
alarm - threshold, values after this threshold will use alarm_colour colour , default=max
alarm_colour - colour of a block greater than alarm, default=fg_colour
smooth - (true or false), create a gradient from fg_colour to bg_colour, default=false
mid_colour - colours to add to gradient, with this syntax {position into the gradient (0 to1), colour hexa, alpha}
  for example, this table {{0.25,0xff0000,1},{0.5,0x00ff00,1},{0.75,0x0000ff,1}} will add
  3 colurs to gradient created by fg_colour and alarm_colour, default=no mid_colour
led_effect - add LED effects to each block, default=no led_effect
  if smooth=true, led_effect is not used
  possibles values : "r","a","e" for radial, parallelel, perdendicular to the bar (just try!)
  led_effect has to be used with theses colours :
fg_led - middle colour of a block ON, default = fg_colour
bg_led - middle colour of a block OFF, default = bg_colour
alarm_led - middle colour of a block > ALARM,  default = alarm_colour

reflection parameters, not avaimable for circular bars
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
reflection - position of reflection, relative to a vertical bar, default="b"
  possibles values are : "b","t","l","r" for bottom, top, left, right
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",
]]

require 'cairo'

----------------START OF PARAMETERS ----------
function conky_main_bars()
local bars_settings={
{ --[ Graph for MOBO Temp ]--
name="hwmon 2 temp 2",
arg="hwmon 2 temp 2",
max=100,
alarm=100,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=35,
x=158, y=97,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU Socket Temp ]--
name="hwmon 1 temp 1",
arg="hwmon 1 temp 1",
max=100,
alarm=100,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=35,
x=158, y=118,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
--[[ { --[ Graph for Physical CPU Temp ]--
name="hwmon temp 3",
arg="hwmon temp 3",
max=100,
alarm=100,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=35,
x=158, y=133,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
]] { --[ Graph for CPU1 Left]--
name="cpu",
arg="cpu1",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=192, y=252,
height=3,width=7,
angle=270,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU1 Right ]--
name="cpu",
arg="cpu1",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=190, y=245,
height=3,width=7,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU2 Left]--
name="cpu",
arg="cpu2",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=192, y=273,
height=3,width=7,
angle=270,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU2 Right]--
name="cpu",
arg="cpu2",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=190, y=266,
height=3,width=7,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU3 Left ]--
name="cpu",
arg="cpu3",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=192, y=327,
height=3,width=7,
angle=270,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU3 Right ]--
name="cpu",
arg="cpu3",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=190, y=320,
height=3,width=7,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU4 Left ]--
name="cpu",
arg="cpu4",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=192, y=348,
height=3,width=7,
angle=270,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU4 Right ]--
name="cpu",
arg="cpu4",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=190, y=341,
height=3,width=7,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU5 Left ]--
name="cpu",
arg="cpu5",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=192, y=403,
height=3,width=7,
angle=270,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU5 Right ]--
name="cpu",
arg="cpu5",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=190, y=396,
height=3,width=7,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU6 Left ]--
name="cpu",
arg="cpu6",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=192, y=424,
height=3,width=7,
angle=270,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU6 Right ]--
name="cpu",
arg="cpu6",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=190, y=417,
height=3,width=7,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU7 Left ]--
name="cpu",
arg="cpu7",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=192, y=479,
height=3,width=7,
angle=270,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU7 Right ]--
name="cpu",
arg="cpu7",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=190, y=472,
height=3,width=7,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU8 Left ]--
name="cpu",
arg="cpu8",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=192, y=501,
height=3,width=7,
angle=270,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU8 Right ]--
name="cpu",
arg="cpu8",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=190, y=494,
height=3,width=7,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for Memory ]--
name="memperc",
arg="",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
x=63,y=556,
blocks=89,
space=0,
height=2,width=12,
angle=90,
led_effect="e",
cap="r",
},
--[[ { --[ Graph for Root ]--
name="fs_used_perc",
arg="/",
max=100,
alarm=75,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=92,
x=65, y=500,
height=2,width=10,
angle=90,
led_effect="e",
space=0,
cap="r",
},
{ --[ Graph for Home ]--
name="fs_used_perc",
arg="/home",
max=100,
alarm=75,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=92,
x=65, y=557,
height=2,width=10,
angle=90,
led_effect="e",
space=0,
cap="r",
},
]] { --[ Graph for WiFi Signal strength ]--
name="wireless_link_qual_perc",
arg="wlan0",
max=100,
alarm=100,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=60,
x=86, y=796,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for Battery power ]--
name="battery_percent",
arg="BAT0",
max=100,
alarm=100,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=60,
x=86, y=827,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
}
-----------END OF PARAMETERS--------------


   
if conky_window == nil then return end

local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)

cr = cairo_create(cs)   
--prevent segmentation error when reading cpu state
    if tonumber(conky_parse('${updates}'))>3 then
        for i in pairs(bars_settings) do
       
        draw_multi_bar_graph(bars_settings[i])
       
        end
    end
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil

end



function draw_multi_bar_graph(t)
cairo_save(cr)
--check values
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
if t.name==nil and t.arg==nil then
print ("No input values ... use parameters 'name' with 'arg' or only parameter 'arg' ")
return
end
if t.max==nil then
print ("No maximum value defined, use 'max'")
return
end
if t.name==nil then t.name="" end
if t.arg==nil then t.arg="" end

--set default values
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.blocks == nil then t.blocks=10 end
if t.height == nil then t.height=10 end
if t.angle == nil then t.angle=0 end
t.angle = t.angle*math.pi/180
--line cap style
if t.cap==nil then t.cap = "b" end
local cap="b"
for i,v in ipairs({"s","r","b"}) do
if v==t.cap then cap=v end
end
local delta=0
if t.cap=="r" or t.cap=="s" then delta = t.height end
if cap=="s" then cap = CAIRO_LINE_CAP_SQUARE
elseif cap=="r" then
cap = CAIRO_LINE_CAP_ROUND
elseif cap=="b" then
cap = CAIRO_LINE_CAP_BUTT
end
--end line cap style
--if t.led_effect == nil then t.led_effect="r" end
if t.width == nil then t.width=20 end
if t.space == nil then t.space=2 end
if t.radius == nil then t.radius=0 end
if t.angle_bar == nil then t.angle_bar=0 end
t.angle_bar = t.angle_bar*math.pi/360 --halt angle

--colours
if t.bg_colour == nil then t.bg_colour = {0x00FF00,0.5} end
if #t.bg_colour~=2 then t.bg_colour = {0x00FF00,0.5} end
if t.fg_colour == nil then t.fg_colour = {0x00FF00,1} end
if #t.fg_colour~=2 then t.fg_colour = {0x00FF00,1} end
if t.alarm_colour == nil then t.alarm_colour = t.fg_colour end
if #t.alarm_colour~=2 then t.alarm_colour = t.fg_colour end

if t.mid_colour ~= nil then
for i=1, #t.mid_colour do   
    if #t.mid_colour[i]~=3 then
    print ("error in mid_color table")
    t.mid_colour[i]={1,0xFFFFFF,1}
    end
end
    end
   
if t.bg_led ~= nil and #t.bg_led~=2 then t.bg_led = t.bg_colour end
if t.fg_led ~= nil and #t.fg_led~=2 then t.fg_led = t.fg_colour end
if t.alarm_led~= nil and #t.alarm_led~=2 then t.alarm_led = t.fg_led end

if t.led_effect~=nil then
if t.bg_led == nil then t.bg_led = t.bg_colour end
if t.fg_led == nil then t.fg_led = t.fg_colour end
if t.alarm_led == nil  then t.alarm_led = t.fg_led end
end


if t.alarm==nil then t.alarm = t.max end --0.8*t.max end
if t.smooth == nil then t.smooth = false end

if t.skew_x == nil then
t.skew_x=0
else
t.skew_x = math.pi*t.skew_x/180
end
if t.skew_y == nil then
t.skew_y=0
else
t.skew_y = math.pi*t.skew_y/180
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

--end of default values


local function rgb_to_r_g_b(col_a)
return ((col_a[1] / 0x10000) % 0x100) / 255., ((col_a[1] / 0x100) % 0x100) / 255., (col_a[1] % 0x100) / 255., col_a[2]
end


--functions used to create patterns

local function create_smooth_linear_gradient(x0,y0,x1,y1)
local pat = cairo_pattern_create_linear (x0,y0,x1,y1)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
if t.mid_colour ~=nil then
for i=1, #t.mid_colour do
cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
end
end
return pat
end

local function create_smooth_radial_gradient(x0,y0,r0,x1,y1,r1)
local pat =  cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
if t.mid_colour ~=nil then
for i=1, #t.mid_colour do
cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
end
end
return pat
end

local function create_led_linear_gradient(x0,y0,x1,y1,col_alp,col_led)
local pat = cairo_pattern_create_linear (x0,y0,x1,y1) ---delta, 0,delta+ t.width,0)
cairo_pattern_add_color_stop_rgba (pat, 0.0, rgb_to_r_g_b(col_alp))
cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1.0, rgb_to_r_g_b(col_alp))
return pat
end

local function create_led_radial_gradient(x0,y0,r0,x1,y1,r1,col_alp,col_led,mode)
local pat = cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
if mode==3 then
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_alp))
cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))
else
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))
end
return pat
end






local function draw_single_bar()
--this fucntion is used for bars with a single block (blocks=1) but
--the drawing is cut in 3 blocks : value/alarm/background
--not zvzimzblr for circular bar
local function create_pattern(col_alp,col_led,bg)
local pat

if not t.smooth then
if t.led_effect=="e" then
pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
elseif t.led_effect=="a" then
pat = create_led_linear_gradient (t.width/2, 0,t.width/2,-t.height,col_alp,col_led)
elseif  t.led_effect=="r" then
pat = create_led_radial_gradient (t.width/2, -t.height/2, 0, t.width/2,-t.height/2,t.height/1.5,col_alp,col_led,2)
else
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(col_alp))
end
else
if bg then
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(t.bg_colour))
else
pat = create_smooth_linear_gradient(t.width/2, 0, t.width/2,-t.height)
end
end
return pat
end

local y1=-t.height*pct/100
local y2,y3
if pct>(100*t.alarm/t.max) then
y1 = -t.height*t.alarm/100
y2 = -t.height*pct/100
if t.smooth then y1=y2 end
end

if t.angle_bar==0 then

--block for fg value
local pat = create_pattern(t.fg_colour,t.fg_led,false)
cairo_set_source(cr,pat)
cairo_rectangle(cr,0,0,t.width,y1)
cairo_fill(cr)
cairo_pattern_destroy(pat)

-- block for alarm value
if not t.smooth and y2 ~=nil then
pat = create_pattern(t.alarm_colour,t.alarm_led,false)
cairo_set_source(cr,pat)
cairo_rectangle(cr,0,y1,t.width,y2-y1)
cairo_fill(cr)
y3=y2
cairo_pattern_destroy(pat)
else
y2,y3=y1,y1
end
-- block for bg value
cairo_rectangle(cr,0,y2,t.width,-t.height-y3)
pat = create_pattern(t.bg_colour,t.bg_led,true)
cairo_set_source(cr,pat)
cairo_pattern_destroy(pat)
cairo_fill(cr)
end
end  --end single bar






local function draw_multi_bar()
--function used for bars with 2 or more blocks
for pt = 1,t.blocks do
--set block y
local y1 = -(pt-1)*(t.height+t.space)
local light_on=false

--set colors
local col_alp = t.bg_colour
local col_led = t.bg_led
if pct>=(100/t.blocks) or pct>0 then --ligth on or not the block
if pct>=(pcb*(pt-1))  then
light_on = true
col_alp = t.fg_colour
col_led = t.fg_led
if pct>=(100*t.alarm/t.max) and (pcb*pt)>(100*t.alarm/t.max) then
col_alp = t.alarm_colour
col_led = t.alarm_led
end
end
end

--set colors
--have to try to create gradients outside the loop ?
local pat

if not t.smooth then
if t.angle_bar==0 then
if t.led_effect=="e" then
pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
elseif t.led_effect=="a" then
pat = create_led_linear_gradient (t.width/2, -t.height/2+y1,t.width/2,0+t.height/2+y1,col_alp,col_led)
elseif  t.led_effect=="r" then
pat = create_led_radial_gradient (t.width/2, y1, 0, t.width/2,y1,t.width/1.5,col_alp,col_led,2)
else
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(col_alp))
end
else
if t.led_effect=="a"  then
pat = create_led_radial_gradient (0, 0, t.radius+(t.height+t.space)*(pt-1),
0, 0, t.radius+(t.height+t.space)*(pt),
col_alp,col_led,3)
else
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(col_alp))
end

end
else

if light_on then
if t.angle_bar==0 then
pat = create_smooth_linear_gradient(t.width/2, t.height/2, t.width/2,-(t.blocks-0.5)*(t.height+t.space))
else
pat = create_smooth_radial_gradient(0, 0, (t.height+t.space),  0,0,(t.blocks+1)*(t.height+t.space),2)
end
else
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(t.bg_colour))
end
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)

--draw a block
if t.angle_bar==0 then
cairo_move_to(cr,0,y1)
cairo_line_to(cr,t.width,y1)
else
cairo_arc( cr,0,0,
t.radius+(t.height+t.space)*(pt)-t.height/2,
-t.angle_bar -math.pi/2 ,
t.angle_bar -math.pi/2)
end
cairo_stroke(cr)
end
end




local function setup_bar_graph()
--function used to retrieve the value to display and to set the cairo structure
if t.blocks ~=1 then t.y=t.y-t.height/2 end

local value = 0
if t.name ~="" then
value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
--$to_bytes doesn't work when value has a decimal point,
--https://garage.maemo.org/plugins/ggit/browse.php/?p=monky;a=commitdiff;h=174c256c81a027a2ea406f5f37dc036fac0a524b;hp=d75e2db5ed3fc788fb8514121f67316ac3e5f29f
--http://sourceforge.net/tracker/index.php?func=detail&aid=3000865&group_id=143975&atid=757310
--conky bug?
--value = (conky_parse(string.format('${%s %s}', t.name, t.arg)))
--if string.match(value,"%w") then
-- value = conky_parse(string.format('${to_bytes %s}',value))
--end
else
value = tonumber(t.arg)
end

if value==nil then value =0 end

pct = 100*value/t.max
pcb = 100/t.blocks

cairo_set_line_width (cr, t.height)
cairo_set_line_cap  (cr, cap)
cairo_translate(cr,t.x,t.y)
cairo_rotate(cr,t.angle)

local matrix0 = cairo_matrix_t:create()
tolua.takeownership(matrix0)
cairo_matrix_init (matrix0, 1,t.skew_y,t.skew_x,1,0,0)
cairo_transform(cr,matrix0)



--call the drawing function for blocks
if t.blocks==1 and t.angle_bar==0 then
draw_single_bar()
if t.reflection=="t" or t.reflection=="b" then cairo_translate(cr,0,-t.height) end
else
draw_multi_bar()
end

--dot for reminder
--[[
if t.blocks ~=1 then
cairo_set_source_rgba(cr,1,0,0,1)
cairo_arc(cr,0,t.height/2,3,0,2*math.pi)
cairo_fill(cr)
else
cairo_set_source_rgba(cr,1,0,0,1)
cairo_arc(cr,0,0,3,0,2*math.pi)
cairo_fill(cr)
end]]

--call the drawing function for reflection and prepare the mask used
if t.reflection_alpha>0 and t.angle_bar==0 then
local pat2
local matrix1 = cairo_matrix_t:create()
tolua.takeownership(matrix1)
if t.angle_bar==0 then
pts={-delta/2,(t.height+t.space)/2,t.width+delta,-(t.height+t.space)*(t.blocks)}
if t.reflection=="t" then
cairo_matrix_init (matrix1,1,0,0,-t.reflection_scale,0,-(t.height+t.space)*(t.blocks-0.5)*2*(t.reflection_scale+1)/2)
pat2 = cairo_pattern_create_linear (t.width/2,-(t.height+t.space)*(t.blocks),t.width/2,(t.height+t.space)/2)
elseif t.reflection=="r" then
cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,delta+2*t.width,0)
pat2 = cairo_pattern_create_linear (delta/2+t.width,0,-delta/2,0)
elseif t.reflection=="l" then
cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,-delta,0)
pat2 = cairo_pattern_create_linear (-delta/2,0,delta/2+t.width,-0)
else --bottom
cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(t.height+t.space)*(t.reflection_scale+1)/2)
pat2 = cairo_pattern_create_linear (t.width/2,(t.height+t.space)/2,t.width/2,-(t.height+t.space)*(t.blocks))
end
end
cairo_transform(cr,matrix1)

if t.blocks==1 and t.angle_bar==0 then
draw_single_bar()
cairo_translate(cr,0,-t.height/2)
else
draw_multi_bar()
end


cairo_set_line_width(cr,0.01)
cairo_pattern_add_color_stop_rgba (pat2, 0,0,0,0,1-t.reflection_alpha)
cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1)
if t.angle_bar==0 then
cairo_rectangle(cr,pts[1],pts[2],pts[3],pts[4])
end
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)

end --reflection
pct,pcb=nil
end --setup_bar_graph()

--start here !
setup_bar_graph()
cairo_restore(cr)
end


There's a lot here that will need some "tweaking" for it to work on your system.  I'll also include an attachment of the needed fonts!  It's a fun Conky to work on.  All the credit goes to McLovin, and also the help I received with the sensors info from Sector11...

Jedi
Forum Netiquette

"No matter how smart you are you can never convince someone stupid that they are stupid."  Anonymous

VastOne

Nice one jedi...

Good to see some McLovin love...

... and posts in the conky thread again
VSIDO      VSIDO Change Blog    

    I dev VSIDO

jedi

Yes, Sector11 pointed out a request for it on the buntu forums, so I was devious and posted it here with a link to it on the buntu forum.   ;)
Forum Netiquette

"No matter how smart you are you can never convince someone stupid that they are stupid."  Anonymous

McLovin

looks good, thank you for the creds, I haven't made a new one in a while, but I have modified the one i use daily a little bit, changed the record image that shows when I'm not playing any music, added backgrounds, edited the weather alerts code on MrPeachie's v9000 a little to fit what I wanted, and added a lua graph for the network activity.
Visit my DeviantArt page and My Blog

jedi

A question to the Conky guru's among us.  This is one of those times I'm not even sure how to ask the question, by-the-way.

First off, I have some flicker in the top Conky.  Nothing major, but every once in a while it will flicker for a few seconds.  (2-5 seconds)  I can live with it, but if it's an easy fix I'd like to fix it.  I'm running Fluxbox, and Compton as the composite mgr.

Second and more tricky, is the led graphs lua file I'm using.  I've noticed that I can't evenly space out the bars all the way across the top of the desktop.  I'm not even close to lua fluency, and when I try to make them all the same size, with the same spacing between them, some just disappear completely and no matter what (x) (y) coordinates I can't get them to work or appear.  The scrot below will show you the best I've gotten it to work.  I'm working with a 1920x1080 screen res.  The Conky I've been trying to make is just a remake of McLovins bars Conky except instead of it being vertical, I'd like to try something horizontal.  Is this possible?

I'll include the Conkyrc and lua files for perusal by someone a lot smarter than me!  Any help appreciated!  It's just Conky, so no emergency or "must have answers RIGHT NOW" required.  I've tried searching through the forum here and at #! and the buntu Conky thread as well.  I've also tried to "doctor" it up myself but to no avail.  So I'm breaking down and asking for help.  I just can't quite grasp why I can't put the bars where I want using the (x) and (y) coordinate statements in the lua file for each representative bar I want to display on the screen.  Like I said, any help appreciated but no emergency or hurry required.  Conky is just a really fun distraction for me!

Here's the scrot;



The Conky;


##################################################
# killall conky && conky -c /home/jed/Conky/sysledconkyrc &
##################################################
background yes
update_interval 1
double_buffer yes
no_buffers yes
imlib_cache_size 0
override_utf8_locale yes
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
own_window_class conky
own_window_title horizleds
border_inner_margin 0
border_outer_margin 0
minimum_size 1920 55
alignment tl
gap_x 5
gap_y 5
default_color 4B60B4
text_buffer_size 512
use_xft yes
xftfont monofur:bold:size=11
xftalpha 1
cpu_avg_samples 2
net_avg_samples 1

lua_load /home/jed/Conky/LUA/leds.lua
lua_draw_hook_post main_bars

TEXT


${goto 15}MOBO Temp ${color ff6100}${hwmon 2 temp 2}°C${color 4B60B4}${goto 135}|${goto 160}CPU Socket Temp ${color ff6100}${hwmon 1 temp 1}°C${voffset -15}${color 4B60B4} ${goto 1050}Kernel: ${kernel} ${goto 1420}Up:${color ff6100} ${uptime}${color 4B60B4}${goto 1630}${scroll 40 1${execi 2600 cat /etc/issue.net}-VSIDO}${goto 365}${color 4B60B4}${voffset 15}Avg CPU Use: ${color 3DBA2F}${cpu cpu0}% ${color 4B60B4}${goto 483}|${goto 500}${color 4B60B4}RAM Use:${color 3DBA2F}${mem} / ${memmax}${color 4B60B4}${goto 735}Bat:${color 3DBA2F}${battery_percent BAT0}% ${color ff6100}${battery_time BAT0}${color 4B60B4}${goto 875}|${goto 900}WiFi Signal: ${color 3DBA2F}${wireless_link_qual_perc wlan0}%


The leds.lua;


--[[ BARGRAPH WIDGET
v1.3 by wlourf (03 march 2010)
This widget draw a simple bar like (old) equalizers on hi-fi systems.
http://u-scripts.blogspot.com/
        Tweaked by McLovin, then borked by jedi
The arguments are :
- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'...
  or you can set it to "" if you want to display a numeric value with arg=numeric_value
    - "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument.
      If you would not use an argument in the Conky variable, use ''.
- "max" is the maximum value of the bar. If the Conky variable outputs a percentage, use 100.
- "nb_blocks" is the umber of block to draw
- "cap" id the cap of a block, possibles values are CAIRO_LINE_CAP_ROUND , CAIRO_LINE_CAP_SQUARE or CAIRO_LINE_CAP_BUTT
  see http://www.cairographics.org/samples/set_line_cap/
- "xb" and "yb" are the coordinates of the bottom left point of the bar, or the center of the circle if radius>0
- "w" and "h" are the width and the height of a block (without caps), w has no effect for "circle" bar
- "space" is the space betwwen two blocks, can be null or negative
- "bgc" and "bga" are background colors and alpha when the block is not LIGHT OFF
- "fgc" and "fga" are foreground colors and alpha when the block is not LIGHT ON
- "alc" and "ala" are foreground colors and alpha when the block is not LIGHT ON and ALARM ON
- "alarm" is the value where blocks LIGHT ON are in a different color (values from 0 to 100)
- "led_effect" true or false : to show a block with a led effect
- "led_alpha" alpha of the center of the led (values from 0 to 1)
- "smooth" true or false : colors in the bar has a smooth effect
- "mid_color",mid_alpha" : colors of the center of the bar (mid_color can to be set to nil)
- "rotation" : angle of rotation of the bar (values are 0 to 360 degrees). 0 = vertical bar, 90 = horizontal bar
- "radius" : draw the bar on a circle (it's no more a circle, radius = 0 to keep bars)
- "angle_bar"  : if radius>0 angle_bar is the angle of the bar
v1.0 (10 Feb. 2010) original release
v1.1 (13 Feb. 2010) numeric values can be passed instead conky stats with parameters name="", arg = numeric_value
v1.2 (28 Feb. 2010) just renamed the widget to bargraph
v1.3 (03 March 2010) added parameters radius & angle_bar to draw the bar in a circular way
]]

require 'cairo'

----------------START OF PARAMETERS ----------
function conky_main_bars()
local bars_settings={
{ --[ Graph for MOBO Temp ]--
name="hwmon 2 temp 2",
arg="hwmon 2 temp 2",
max=100,
alarm=40,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff6100,0},
    alarm_led={0xff6100,1},
blocks=35,
x=10, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU Socket Temp ]--
name="hwmon 1 temp 1",
arg="hwmon 1 temp 1",
max=100,
alarm=40,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff6100,0},
    alarm_led={0xff6100,1},
blocks=35,
x=175, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU Socket Temp ]--
name="cpu",
arg="cpu0",
max=100,
alarm=100,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=35,
x=366, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for Memory ]--
name="memperc",
arg="",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
x=510,y=20,
blocks=50,
space=1,
height=2,width=10,
angle=90,
led_effect="e",
cap="r",
},
--[[ { --[ Graph for Root ]--
name="fs_used_perc",
arg="/",
max=100,
alarm=75,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=35,
x=1260, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for Home ]--
name="fs_used_perc",
arg="/home",
max=100,
alarm=75,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=35,
x=610, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
]] { --[ Graph for WiFi Signal strength ]--
name="wireless_link_qual_perc",
arg="wlan0",
max=100,
alarm=100,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=40,
x=900, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for Battery power ]--
name="battery_percent",
arg="BAT0",
max=100,
alarm=100,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=35,
x=750, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
}
-----------END OF PARAMETERS--------------
if conky_window == nil then return end

local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)

cr = cairo_create(cs)
--prevent segmentation error when reading cpu state
    if tonumber(conky_parse('${updates}'))>3 then
        for i in pairs(bars_settings) do

        draw_multi_bar_graph(bars_settings[i])

        end
    end
cairo_destroy(cr)
cairo_surface_destroy(cs)

end



function draw_multi_bar_graph(t)
cairo_save(cr)
--check values
if t.name==nil and t.arg==nil then
print ("No input values ... use parameters 'name' with 'arg' or only parameter 'arg' ")
return
end
if t.max==nil then
print ("No maximum value defined, use 'max'")
return
end
if t.name==nil then t.name="" end
if t.arg==nil then t.arg="" end

--set default values
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.blocks == nil then t.blocks=10 end
if t.height == nil then t.height=10 end
if t.angle == nil then t.angle=0 end
t.angle = t.angle*math.pi/180
--line cap style
if t.cap==nil then t.cap = "b" end
local cap="b"
for i,v in ipairs({"s","r","b"}) do
if v==t.cap then cap=v end
end
delta=0
if t.cap=="r" or t.cap=="s" then delta = t.height end
if cap=="s" then cap = CAIRO_LINE_CAP_SQUARE
elseif cap=="r" then
cap = CAIRO_LINE_CAP_ROUND
elseif cap=="b" then
cap = CAIRO_LINE_CAP_BUTT
end
--end line cap style
--if t.led_effect == nil then t.led_effect="r" end
if t.width == nil then t.width=20 end
if t.space == nil then t.space=2 end
if t.radius == nil then t.radius=0 end
if t.angle_bar == nil then t.angle_bar=0 end
t.angle_bar = t.angle_bar*math.pi/360 --halt angle

--colours
if t.bg_colour == nil then t.bg_colour = {0xffffff,0.5} end
if #t.bg_colour~=2 then t.bg_colour = {0xffffff,0.5} end
if t.fg_colour == nil then t.fg_colour = {0xffffff,1} end
if #t.fg_colour~=2 then t.fg_colour = {0xffffff,1} end
if t.alarm_colour == nil then t.alarm_colour = t.fg_colour end
if #t.alarm_colour~=2 then t.alarm_colour = t.fg_colour end

if t.mid_colour ~= nil then
for i=1, #t.mid_colour do
    if #t.mid_colour[i]~=3 then
    print ("error in mid_color table")
    t.mid_colour[i]={1,0xFFFFFF,1}
    end
end
    end

if t.bg_led ~= nil and #t.bg_led~=2 then t.bg_led = t.bg_colour end
if t.fg_led ~= nil and #t.fg_led~=2 then t.fg_led = t.fg_colour end
if t.alarm_led~= nil and #t.alarm_led~=2 then t.alarm_led = t.fg_led end

if t.led_effect~=nil then
if t.bg_led == nil then t.bg_led = t.bg_colour end
if t.fg_led == nil then t.fg_led = t.fg_colour end
if t.alarm_led == nil  then t.alarm_led = t.fg_led end
end


if t.alarm==nil then t.alarm = t.max end --0.8*t.max end
if t.smooth == nil then t.smooth = false end

if t.skew_x == nil then
t.skew_x=0
else
t.skew_x = math.pi*t.skew_x/180
end
if t.skew_y == nil then
t.skew_y=0
else
t.skew_y = math.pi*t.skew_y/180
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

--end of default values


local function rgb_to_r_g_b(col_a)
return ((col_a[1] / 0x10000) % 0x100) / 255., ((col_a[1] / 0x100) % 0x100) / 255., (col_a[1] % 0x100) / 255., col_a[2]
end


--functions used to create patterns

local function create_smooth_linear_gradient(x0,y0,x1,y1)
local pat = cairo_pattern_create_linear (x0,y0,x1,y1)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
if t.mid_colour ~=nil then
for i=1, #t.mid_colour do
cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
end
end
return pat
end

local function create_smooth_radial_gradient(x0,y0,r0,x1,y1,r1)
local pat =  cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
if t.mid_colour ~=nil then
for i=1, #t.mid_colour do
cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
end
end
return pat
end

local function create_led_linear_gradient(x0,y0,x1,y1,col_alp,col_led)
local pat = cairo_pattern_create_linear (x0,y0,x1,y1) ---delta, 0,delta+ t.width,0)
cairo_pattern_add_color_stop_rgba (pat, 0.0, rgb_to_r_g_b(col_alp))
cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1.0, rgb_to_r_g_b(col_alp))
return pat
end

local function create_led_radial_gradient(x0,y0,r0,x1,y1,r1,col_alp,col_led,mode)
local pat = cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
if mode==3 then
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_alp))
cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))
else
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))
end
return pat
end






local function draw_single_bar()
--this fucntion is used for bars with a single block (blocks=1) but
--the drawing is cut in 3 blocks : value/alarm/background
--not zvzimzblr for circular bar
local function create_pattern(col_alp,col_led,bg)
local pat

if not t.smooth then
if t.led_effect=="e" then
pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
elseif t.led_effect=="a" then
pat = create_led_linear_gradient (t.width/2, 0,t.width/2,-t.height,col_alp,col_led)
elseif  t.led_effect=="r" then
pat = create_led_radial_gradient (t.width/2, -t.height/2, 0, t.width/2,-t.height/2,t.height/1.5,col_alp,col_led,2)
else
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(col_alp))
end
else
if bg then
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(t.bg_colour))
else
pat = create_smooth_linear_gradient(t.width/2, 0, t.width/2,-t.height)
end
end
return pat
end

local y1=-t.height*pct/100
local y2=nil
if pct>(100*t.alarm/t.max) then
y1 = -t.height*t.alarm/100
y2 = -t.height*pct/100
if t.smooth then y1=y2 end
end

if t.angle_bar==0 then

--block for fg value
pat = create_pattern(t.fg_colour,t.fg_led,false)
cairo_set_source(cr,pat)
cairo_rectangle(cr,0,0,t.width,y1)
cairo_fill(cr)

-- block for alarm value
if not t.smooth and y2 ~=nil then
pat = create_pattern(t.alarm_colour,t.alarm_led,false)
cairo_set_source(cr,pat)
cairo_rectangle(cr,0,y1,t.width,y2-y1)
cairo_fill(cr)
y3=y2
else
y2,y3=y1,y1
end
-- block for bg value
cairo_rectangle(cr,0,y2,t.width,-t.height-y3)
pat = create_pattern(t.bg_colour,t.bg_led,true)
cairo_set_source(cr,pat)
cairo_pattern_destroy(pat)
cairo_fill(cr)
end
end  --end single bar






local function draw_multi_bar()
--function used for bars with 2 or more blocks
for pt = 1,t.blocks do
--set block y
local y1 = -(pt-1)*(t.height+t.space)
local light_on=false

--set colors
local col_alp = t.bg_colour
local col_led = t.bg_led
if pct>=(100/t.blocks) or pct>0 then --ligth on or not the block
if pct>=(pcb*(pt-1))  then
light_on = true
col_alp = t.fg_colour
col_led = t.fg_led
if pct>=(100*t.alarm/t.max) and (pcb*pt)>(100*t.alarm/t.max) then
col_alp = t.alarm_colour
col_led = t.alarm_led
end
end
end

--set colors
--have to try to create gradients outside the loop ?
local pat

if not t.smooth then
if t.angle_bar==0 then
if t.led_effect=="e" then
pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
elseif t.led_effect=="a" then
pat = create_led_linear_gradient (t.width/2, -t.height/2+y1,t.width/2,0+t.height/2+y1,col_alp,col_led)
elseif  t.led_effect=="r" then
pat = create_led_radial_gradient (t.width/2, y1, 0, t.width/2,y1,t.width/1.5,col_alp,col_led,2)
else
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(col_alp))
end
else
if t.led_effect=="a"  then
pat = create_led_radial_gradient (0, 0, t.radius+(t.height+t.space)*(pt-1),
0, 0, t.radius+(t.height+t.space)*(pt),
col_alp,col_led,3)
else
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(col_alp))
end

end
else

if light_on then
if t.angle_bar==0 then
pat = create_smooth_linear_gradient(t.width/2, t.height/2, t.width/2,-(t.blocks-0.5)*(t.height+t.space))
else
pat = create_smooth_radial_gradient(0, 0, (t.height+t.space),  0,0,(t.blocks+1)*(t.height+t.space),2)
end
else
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(t.bg_colour))
end
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)

--draw a block
if t.angle_bar==0 then
cairo_move_to(cr,0,y1)
cairo_line_to(cr,t.width,y1)
else
cairo_arc( cr,0,0,
t.radius+(t.height+t.space)*(pt)-t.height/2,
-t.angle_bar -math.pi/2 ,
t.angle_bar -math.pi/2)
end
cairo_stroke(cr)
end
end




local function setup_bar_graph()
--function used to retrieve the value to display and to set the cairo structure
if t.blocks ~=1 then t.y=t.y-t.height/2 end

local value = 0
if t.name ~="" then
value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
else
value = tonumber(t.arg)
end

if value==nil then value =0 end

pct = 100*value/t.max
pcb = 100/t.blocks

cairo_set_line_width (cr, t.height)
cairo_set_line_cap  (cr, cap)
cairo_translate(cr,t.x,t.y)
cairo_rotate(cr,t.angle)

local matrix0 = cairo_matrix_t:create()
cairo_matrix_init (matrix0, 1,t.skew_y,t.skew_x,1,0,0)
cairo_transform(cr,matrix0)



--call the drawing function for blocks
if t.blocks==1 and t.angle_bar==0 then
draw_single_bar()
if t.reflection=="t" or t.reflection=="b" then cairo_translate(cr,0,-t.height) end
else
draw_multi_bar()
end

--dot for reminder
--[[
if t.blocks ~=1 then
cairo_set_source_rgba(cr,1,0,0,1)
cairo_arc(cr,0,t.height/2,3,0,2*math.pi)
cairo_fill(cr)
else
cairo_set_source_rgba(cr,1,0,0,1)
cairo_arc(cr,0,0,3,0,2*math.pi)
cairo_fill(cr)
end
]]
--call the drawing function for reflection and prepare the mask used
if t.reflection_alpha>0 and t.angle_bar==0 then
local pat2
local matrix1 = cairo_matrix_t:create()
if t.angle_bar==0 then
pts={-delta/2,(t.height+t.space)/2,t.width+delta,-(t.height+t.space)*(t.blocks)}
if t.reflection=="t" then
cairo_matrix_init (matrix1,1,0,0,-t.reflection_scale,0,-(t.height+t.space)*(t.blocks-0.5)*2*(t.reflection_scale+1)/2)
pat2 = cairo_pattern_create_linear (t.width/2,-(t.height+t.space)*(t.blocks),t.width/2,(t.height+t.space)/2)
elseif t.reflection=="r" then
cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,delta+2*t.width,0)
pat2 = cairo_pattern_create_linear (delta/2+t.width,0,-delta/2,0)
elseif t.reflection=="l" then
cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,-delta,0)
pat2 = cairo_pattern_create_linear (-delta/2,0,delta/2+t.width,-0)
else --bottom
cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(t.height+t.space)*(t.reflection_scale+1)/2)
pat2 = cairo_pattern_create_linear (t.width/2,(t.height+t.space)/2,t.width/2,-(t.height+t.space)*(t.blocks))
end
end
cairo_transform(cr,matrix1)

if t.blocks==1 and t.angle_bar==0 then
draw_single_bar()
cairo_translate(cr,0,-t.height/2)
else
draw_multi_bar()
end


cairo_set_line_width(cr,0.01)
cairo_pattern_add_color_stop_rgba (pat2, 0,0,0,0,1-t.reflection_alpha)
cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1)
if t.angle_bar==0 then
cairo_rectangle(cr,pts[1],pts[2],pts[3],pts[4])
end
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)

end --reflection


end --setup_bar_graph()


--start here !
setup_bar_graph()
cairo_restore(cr)
end
Forum Netiquette

"No matter how smart you are you can never convince someone stupid that they are stupid."  Anonymous

Sector11

#367
Good morning Jed ...

I'm up early, have to go out, but when I come back I will be looking at this.
What is your screen width? 1920?

EDIT: never mind.....
Quoteminimum_size 1920 55
DUH!!!

It'll give me something to play with.
Stay Home

Sector11

@ jedi ....

I ran into the same thing you did.  If the bars are too close, they loose the centre line (the blue bar).  Something weird going on with that script.

Anyway, I moved things around a bit, this gives you a space above ${kernel} to play with and I scrolled the date above your distro info.  You may not like it, sorry but it's the best I can do.  I'm no LUA expert either.

Also, I don't have battery nor wlan0 so the values shown are hard coded, your commands are commented our above TEXT and the bars above them are cpu1 and cpu2 in the LUA script.  The lua script still has your battery and wlan sections  ... just comment out the cpu1 and 2 sections and incomment the Battery and Wlan stuff, I 'think' I configured them correctly.

I added a white background so it can be seen on dark backgrounds.

The modified conky:
##################################################
# killall conky && conky -c /home/jed/Conky/sysledconkyrc &
# killall conky && conky -c ~/jed/Conky/sysledconkyrc &
##################################################
background yes
update_interval 0.5
double_buffer yes
no_buffers yes
imlib_cache_size 0
override_utf8_locale yes
own_window yes
own_window_type normal
own_window_transparent yes
## own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below ## Jed's Line
own_window_hints undecorate,skip_taskbar,skip_pager,below
own_window_class conky
own_window_title horizleds
border_inner_margin 0
border_outer_margin 0
minimum_size 1910 55 # testing with 500
## minimum_size 1910 55 ## Jed had 1920 but the 'gap_x 5' pushed it 5 pixels off the screen
maximum_width 1910
alignment tl
gap_x 30
gap_y -5
default_color 4B60B4
text_buffer_size 512
use_xft yes
xftfont monofur:bold:size=11
xftalpha 1
cpu_avg_samples 2
net_avg_samples 1

lua_load ~/jed/Conky/LUA/leds.lua
lua_draw_hook_post main_bars

#${goto 15}MOBO Temp ${color ff6100}${hwmon 2 temp 2}°C${color 4B60B4}${goto 135}|${goto 160}CPU Socket Temp ${color ff6100}${hwmon 1 temp 1}°C${voffset -15}${color 4B60B4} ${goto 1050}Kernel: ${kernel} ${goto 1420}Up:${color ff6100} ${uptime}${color 4B60B4}${goto 1630}${scroll 40 1${execi 2600 cat /etc/issue.net}-VSIDO}
#${goto 365}${color 4B60B4}Avg CPU Use: ${color 3DBA2F}${cpu cpu0}% ${color 4B60B4}${goto 483}|${goto 500}${color 4B60B4}RAM Use:${color 3DBA2F}${mem} / ${memmax}${color 4B60B4}${goto 735}Bat:${color 3DBA2F}${battery_percent BAT0}% ${color ff6100}${battery_time BAT0}${color 4B60B4}${goto 875}|${goto 900}WiFi Signal: ${color 3DBA2F}${wireless_link_qual_perc wlan0}%
lua_load /media/5/Conky/LUA/draw-bg.lua
TEXT
${lua conky_draw_bg 10 0 0 0 0 0xffffff 0.2}
${goto 165}|${goto 350}|${goto 525}|${goto 750}|${goto 920}${color 3DBA2F}${memperc}${goto 936}%${color} |${goto 1040}${time %T}${goto 1190}|${goto 1265}${scroll 23 1${time %A %e %b %Y} }${goto 1500}|${goto 1680}|
${goto 15}MOBO Temp ${color ff6100}${hwmon 2 temp 2}°C${color}\
${goto 165}|   CPU Socket Temp ${color ff6100}${hwmon 1 temp 1}°C${color}\
${goto 350}|   Avg CPU Use: ${color 3DBA2F}${cpu cpu0}%${color}\
${goto 525}|   ${kernel}${goto 750}\
${goto 750}| RAM Use: ${color 3DBA2F}${mem} / ${memmax}${color}\
${goto 950}|         Up:${color ff6100} ${uptime}${color}${goto 1190}|\
${goto 1210}${scroll 40 1${execi 86400 cat /etc/issue.net}-VSIDO}\
${goto 1500}|  Bat: ${color 3DBA2F}85%${goto 1610}${color ff6100}16:44:52${color}\
${goto 1680}|   WiFi Signal: ${color 3DBA2F}100%${color}


and the new leds.lua
--[[ BARGRAPH WIDGET
v1.3 by wlourf (03 march 2010)
This widget draw a simple bar like (old) equalizers on hi-fi systems.
http://u-scripts.blogspot.com/
        Tweaked by McLovin, then borked by jedi
The arguments are :
- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'...
  or you can set it to "" if you want to display a numeric value with arg=numeric_value
    - "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument.
      If you would not use an argument in the Conky variable, use ''.
- "max" is the maximum value of the bar. If the Conky variable outputs a percentage, use 100.
- "nb_blocks" is the umber of block to draw
- "cap" id the cap of a block, possibles values are CAIRO_LINE_CAP_ROUND , CAIRO_LINE_CAP_SQUARE or CAIRO_LINE_CAP_BUTT
  see http://www.cairographics.org/samples/set_line_cap/
- "xb" and "yb" are the coordinates of the bottom left point of the bar, or the center of the circle if radius>0
- "w" and "h" are the width and the height of a block (without caps), w has no effect for "circle" bar
- "space" is the space betwwen two blocks, can be null or negative
- "bgc" and "bga" are background colors and alpha when the block is not LIGHT OFF
- "fgc" and "fga" are foreground colors and alpha when the block is not LIGHT ON
- "alc" and "ala" are foreground colors and alpha when the block is not LIGHT ON and ALARM ON
- "alarm" is the value where blocks LIGHT ON are in a different color (values from 0 to 100)
- "led_effect" true or false : to show a block with a led effect
- "led_alpha" alpha of the center of the led (values from 0 to 1)
- "smooth" true or false : colors in the bar has a smooth effect
- "mid_color",mid_alpha" : colors of the center of the bar (mid_color can to be set to nil)
- "rotation" : angle of rotation of the bar (values are 0 to 360 degrees). 0 = vertical bar, 90 = horizontal bar
- "radius" : draw the bar on a circle (it's no more a circle, radius = 0 to keep bars)
- "angle_bar"  : if radius>0 angle_bar is the angle of the bar
v1.0 (10 Feb. 2010) original release
v1.1 (13 Feb. 2010) numeric values can be passed instead conky stats with parameters name="", arg = numeric_value
v1.2 (28 Feb. 2010) just renamed the widget to bargraph
v1.3 (03 March 2010) added parameters radius & angle_bar to draw the bar in a circular way
]]

require 'cairo'

----------------START OF PARAMETERS ----------
function conky_main_bars()
local bars_settings={
{ -- Graph for MOBO Temp
name="hwmon 2 temp 2",
arg="hwmon 2 temp 2",
max=100,
alarm=40,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff6100,0},
     alarm_led={0xff6100,1},
blocks=50, --35
x=10, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ -- Graph for CPU Socket Temp
name="hwmon 1 temp 1",
arg="hwmon 1 temp 1",
max=100,
alarm=40,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff6100,0},
     alarm_led={0xff6100,1},
blocks=50, --35,
x=190, y=20, --x=175, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ -- Graph for CPU Socket Temp
name="cpu",
arg="cpu0",
max=100,
alarm=100,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
     alarm_led={0xff0000,1},
blocks=50, --35,
x=370, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ -- Graph for Memory
name="memperc",
arg="",
max=100,
alarm=60,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
     alarm_led={0xff0000,1},
x=765, y=20, --x=510,y=70,
blocks=50,
space=1,
height=2,width=10,
angle=90,
led_effect="e",
cap="r",
},
{ -- Graph for WiFi Signal strength
name="cpu",
arg="cpu1",
max=100,
alarm=100,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
     alarm_led={0xff0000,1},
blocks=50,
x=1520, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ -- Graph for WiFi Signal strength
name="cpu",
arg="cpu2",
max=100,
alarm=100,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
     alarm_led={0xff0000,1},
blocks=50,
x=1700, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
--[[ { -- Graph for Battery power
name="battery_percent",
arg="BAT0",
max=100,
alarm=100,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
     alarm_led={0xff0000,1},
blocks=50,
x=1520, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ -- Graph for WiFi Signal strength
name="wireless_link_qual_perc",
arg="wlan0",
max=100,
alarm=100,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
     alarm_led={0xff0000,1},
blocks=50,
x=1700, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
]]
--[[ { -- Graph for Root
name="fs_used_perc",
arg="/",
max=100,
alarm=75,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=35,
x=1260, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ -- Graph for Home
name="fs_used_perc",
arg="/home",
max=100,
alarm=75,
bg_colour={0x000000,0.75},
bg_led={0x3c3c3c,0.5},
fg_colour={0x000000,1},
fg_led={0x48a3fd,1},
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=35,
x=610, y=20,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
]]
}
-----------END OF PARAMETERS--------------
if conky_window == nil then return end

local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)

cr = cairo_create(cs)
--prevent segmentation error when reading cpu state
    if tonumber(conky_parse('${updates}'))>3 then
        for i in pairs(bars_settings) do

        draw_multi_bar_graph(bars_settings[i])

        end
    end
cairo_destroy(cr)
cairo_surface_destroy(cs)

end



function draw_multi_bar_graph(t)
cairo_save(cr)
--check values
if t.name==nil and t.arg==nil then
print ("No input values ... use parameters 'name' with 'arg' or only parameter 'arg' ")
return
end
if t.max==nil then
print ("No maximum value defined, use 'max'")
return
end
if t.name==nil then t.name="" end
if t.arg==nil then t.arg="" end

--set default values
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.blocks == nil then t.blocks=10 end
if t.height == nil then t.height=10 end
if t.angle == nil then t.angle=0 end
t.angle = t.angle*math.pi/180
--line cap style
if t.cap==nil then t.cap = "b" end
local cap="b"
for i,v in ipairs({"s","r","b"}) do
if v==t.cap then cap=v end
end
delta=0
if t.cap=="r" or t.cap=="s" then delta = t.height end
if cap=="s" then cap = CAIRO_LINE_CAP_SQUARE
elseif cap=="r" then
cap = CAIRO_LINE_CAP_ROUND
elseif cap=="b" then
cap = CAIRO_LINE_CAP_BUTT
end
--end line cap style
--if t.led_effect == nil then t.led_effect="r" end
if t.width == nil then t.width=20 end
if t.space == nil then t.space=2 end
if t.radius == nil then t.radius=0 end
if t.angle_bar == nil then t.angle_bar=0 end
t.angle_bar = t.angle_bar*math.pi/360 --halt angle

--colours
if t.bg_colour == nil then t.bg_colour = {0xffffff,0.5} end
if #t.bg_colour~=2 then t.bg_colour = {0xffffff,0.5} end
if t.fg_colour == nil then t.fg_colour = {0xffffff,1} end
if #t.fg_colour~=2 then t.fg_colour = {0xffffff,1} end
if t.alarm_colour == nil then t.alarm_colour = t.fg_colour end
if #t.alarm_colour~=2 then t.alarm_colour = t.fg_colour end

if t.mid_colour ~= nil then
for i=1, #t.mid_colour do
    if #t.mid_colour[i]~=3 then
    print ("error in mid_color table")
    t.mid_colour[i]={1,0xFFFFFF,1}
    end
end
    end

if t.bg_led ~= nil and #t.bg_led~=2 then t.bg_led = t.bg_colour end
if t.fg_led ~= nil and #t.fg_led~=2 then t.fg_led = t.fg_colour end
if t.alarm_led~= nil and #t.alarm_led~=2 then t.alarm_led = t.fg_led end

if t.led_effect~=nil then
if t.bg_led == nil then t.bg_led = t.bg_colour end
if t.fg_led == nil then t.fg_led = t.fg_colour end
if t.alarm_led == nil  then t.alarm_led = t.fg_led end
end


if t.alarm==nil then t.alarm = t.max end --0.8*t.max end
if t.smooth == nil then t.smooth = false end

if t.skew_x == nil then
t.skew_x=0
else
t.skew_x = math.pi*t.skew_x/180
end
if t.skew_y == nil then
t.skew_y=0
else
t.skew_y = math.pi*t.skew_y/180
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

--end of default values


local function rgb_to_r_g_b(col_a)
return ((col_a[1] / 0x10000) % 0x100) / 255., ((col_a[1] / 0x100) % 0x100) / 255., (col_a[1] % 0x100) / 255., col_a[2]
end


--functions used to create patterns

local function create_smooth_linear_gradient(x0,y0,x1,y1)
local pat = cairo_pattern_create_linear (x0,y0,x1,y1)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
if t.mid_colour ~=nil then
for i=1, #t.mid_colour do
cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
end
end
return pat
end

local function create_smooth_radial_gradient(x0,y0,r0,x1,y1,r1)
local pat =  cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
if t.mid_colour ~=nil then
for i=1, #t.mid_colour do
cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
end
end
return pat
end

local function create_led_linear_gradient(x0,y0,x1,y1,col_alp,col_led)
local pat = cairo_pattern_create_linear (x0,y0,x1,y1) ---delta, 0,delta+ t.width,0)
cairo_pattern_add_color_stop_rgba (pat, 0.0, rgb_to_r_g_b(col_alp))
cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1.0, rgb_to_r_g_b(col_alp))
return pat
end

local function create_led_radial_gradient(x0,y0,r0,x1,y1,r1,col_alp,col_led,mode)
local pat = cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
if mode==3 then
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_alp))
cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))
else
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))
end
return pat
end






local function draw_single_bar()
--this fucntion is used for bars with a single block (blocks=1) but
--the drawing is cut in 3 blocks : value/alarm/background
--not zvzimzblr for circular bar
local function create_pattern(col_alp,col_led,bg)
local pat

if not t.smooth then
if t.led_effect=="e" then
pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
elseif t.led_effect=="a" then
pat = create_led_linear_gradient (t.width/2, 0,t.width/2,-t.height,col_alp,col_led)
elseif  t.led_effect=="r" then
pat = create_led_radial_gradient (t.width/2, -t.height/2, 0, t.width/2,-t.height/2,t.height/1.5,col_alp,col_led,2)
else
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(col_alp))
end
else
if bg then
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(t.bg_colour))
else
pat = create_smooth_linear_gradient(t.width/2, 0, t.width/2,-t.height)
end
end
return pat
end

local y1=-t.height*pct/100
local y2=nil
if pct>(100*t.alarm/t.max) then
y1 = -t.height*t.alarm/100
y2 = -t.height*pct/100
if t.smooth then y1=y2 end
end

if t.angle_bar==0 then

--block for fg value
pat = create_pattern(t.fg_colour,t.fg_led,false)
cairo_set_source(cr,pat)
cairo_rectangle(cr,0,0,t.width,y1)
cairo_fill(cr)

-- block for alarm value
if not t.smooth and y2 ~=nil then
pat = create_pattern(t.alarm_colour,t.alarm_led,false)
cairo_set_source(cr,pat)
cairo_rectangle(cr,0,y1,t.width,y2-y1)
cairo_fill(cr)
y3=y2
else
y2,y3=y1,y1
end
-- block for bg value
cairo_rectangle(cr,0,y2,t.width,-t.height-y3)
pat = create_pattern(t.bg_colour,t.bg_led,true)
cairo_set_source(cr,pat)
cairo_pattern_destroy(pat)
cairo_fill(cr)
end
end  --end single bar






local function draw_multi_bar()
--function used for bars with 2 or more blocks
for pt = 1,t.blocks do
--set block y
local y1 = -(pt-1)*(t.height+t.space)
local light_on=false

--set colors
local col_alp = t.bg_colour
local col_led = t.bg_led
if pct>=(100/t.blocks) or pct>0 then --ligth on or not the block
if pct>=(pcb*(pt-1))  then
light_on = true
col_alp = t.fg_colour
col_led = t.fg_led
if pct>=(100*t.alarm/t.max) and (pcb*pt)>(100*t.alarm/t.max) then
col_alp = t.alarm_colour
col_led = t.alarm_led
end
end
end

--set colors
--have to try to create gradients outside the loop ?
local pat

if not t.smooth then
if t.angle_bar==0 then
if t.led_effect=="e" then
pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
elseif t.led_effect=="a" then
pat = create_led_linear_gradient (t.width/2, -t.height/2+y1,t.width/2,0+t.height/2+y1,col_alp,col_led)
elseif  t.led_effect=="r" then
pat = create_led_radial_gradient (t.width/2, y1, 0, t.width/2,y1,t.width/1.5,col_alp,col_led,2)
else
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(col_alp))
end
else
if t.led_effect=="a"  then
pat = create_led_radial_gradient (0, 0, t.radius+(t.height+t.space)*(pt-1),
0, 0, t.radius+(t.height+t.space)*(pt),
col_alp,col_led,3)
else
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(col_alp))
end

end
else

if light_on then
if t.angle_bar==0 then
pat = create_smooth_linear_gradient(t.width/2, t.height/2, t.width/2,-(t.blocks-0.5)*(t.height+t.space))
else
pat = create_smooth_radial_gradient(0, 0, (t.height+t.space),  0,0,(t.blocks+1)*(t.height+t.space),2)
end
else
pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(t.bg_colour))
end
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)

--draw a block
if t.angle_bar==0 then
cairo_move_to(cr,0,y1)
cairo_line_to(cr,t.width,y1)
else
cairo_arc( cr,0,0,
t.radius+(t.height+t.space)*(pt)-t.height/2,
-t.angle_bar -math.pi/2 ,
t.angle_bar -math.pi/2)
end
cairo_stroke(cr)
end
end




local function setup_bar_graph()
--function used to retrieve the value to display and to set the cairo structure
if t.blocks ~=1 then t.y=t.y-t.height/2 end

local value = 0
if t.name ~="" then
value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
else
value = tonumber(t.arg)
end

if value==nil then value =0 end

pct = 100*value/t.max
pcb = 100/t.blocks

cairo_set_line_width (cr, t.height)
cairo_set_line_cap  (cr, cap)
cairo_translate(cr,t.x,t.y)
cairo_rotate(cr,t.angle)

local matrix0 = cairo_matrix_t:create()
cairo_matrix_init (matrix0, 1,t.skew_y,t.skew_x,1,0,0)
cairo_transform(cr,matrix0)



--call the drawing function for blocks
if t.blocks==1 and t.angle_bar==0 then
draw_single_bar()
if t.reflection=="t" or t.reflection=="b" then cairo_translate(cr,0,-t.height) end
else
draw_multi_bar()
end

--dot for reminder
--[[
if t.blocks ~=1 then
cairo_set_source_rgba(cr,1,0,0,1)
cairo_arc(cr,0,t.height/2,3,0,2*math.pi)
cairo_fill(cr)
else
cairo_set_source_rgba(cr,1,0,0,1)
cairo_arc(cr,0,0,3,0,2*math.pi)
cairo_fill(cr)
end
]]
--call the drawing function for reflection and prepare the mask used
if t.reflection_alpha>0 and t.angle_bar==0 then
local pat2
local matrix1 = cairo_matrix_t:create()
if t.angle_bar==0 then
pts={-delta/2,(t.height+t.space)/2,t.width+delta,-(t.height+t.space)*(t.blocks)}
if t.reflection=="t" then
cairo_matrix_init (matrix1,1,0,0,-t.reflection_scale,0,-(t.height+t.space)*(t.blocks-0.5)*2*(t.reflection_scale+1)/2)
pat2 = cairo_pattern_create_linear (t.width/2,-(t.height+t.space)*(t.blocks),t.width/2,(t.height+t.space)/2)
elseif t.reflection=="r" then
cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,delta+2*t.width,0)
pat2 = cairo_pattern_create_linear (delta/2+t.width,0,-delta/2,0)
elseif t.reflection=="l" then
cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,-delta,0)
pat2 = cairo_pattern_create_linear (-delta/2,0,delta/2+t.width,-0)
else --bottom
cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(t.height+t.space)*(t.reflection_scale+1)/2)
pat2 = cairo_pattern_create_linear (t.width/2,(t.height+t.space)/2,t.width/2,-(t.height+t.space)*(t.blocks))
end
end
cairo_transform(cr,matrix1)

if t.blocks==1 and t.angle_bar==0 then
draw_single_bar()
cairo_translate(cr,0,-t.height/2)
else
draw_multi_bar()
end


cairo_set_line_width(cr,0.01)
cairo_pattern_add_color_stop_rgba (pat2, 0,0,0,0,1-t.reflection_alpha)
cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1)
if t.angle_bar==0 then
cairo_rectangle(cr,pts[1],pts[2],pts[3],pts[4])
end
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)

end --reflection

end --setup_bar_graph()

--start here !
setup_bar_graph()
cairo_restore(cr)
end

Stay Home

jedi

Thanks Sector11, I finally found a wlourf script that was just a tad older that is doing what I want.  I simply made multiple Conky's that are pulling their own lua script.  (4 for the top!) Still not sure if I like the look yet, but hey, it was fun playing!  Going to dress it up with some color probably, but I think I have the basics of it done.  I like the looks of these bars better than what I was using and the script seems to run a little better.

Forum Netiquette

"No matter how smart you are you can never convince someone stupid that they are stupid."  Anonymous

jedi

And here it is semi-finished.  Total of 8 Conky's running.  The CPU is under duress due to manipulating my photo library in Shotwell.  This also accounts for the high CPU temps!  Thanks to Sector11, mrpeachy, wlourf and I know I'm missing someone!  Sorry for that, it's late!  Thanks to VastOne for the awesome gmusicbrowser work he does!

It's a little cluttered right now, but it is displaying about all the info I'd ever need to keep track of.  Conky can be really useful!!!  The tint2 bar will be updated to remove the clock and replace it with a launcher bar when I get a little sleep.

And here's the scrot;

Forum Netiquette

"No matter how smart you are you can never convince someone stupid that they are stupid."  Anonymous

jedi

Hey all...

Anyone noticed issues with v9000 as of the last 24 to 48 hours?  Specifically the v9000.lua file around line 748.  Attempt to perform arithmetic on a nil value.  The problem comes and goes.  It'll work sometimes for hours, then bang.  After a while it'll work again.  Just wondering if it's just me or if something borked Conky/Lua/jedi during the last dist-upgrade...
Forum Netiquette

"No matter how smart you are you can never convince someone stupid that they are stupid."  Anonymous

PackRat

That's the weather script isn't it?

My first guess would be that there is an interruption of service from whatever weather agency is providing the data. Have you tried to start that conky from a terminal and note any of the errors?

I know that the original conkyForecast script would stall every now and then because it couldn't connect to the weather service servers.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

jedi

It starts fine in terminal.  No errors, but eventually it will 'disappear' from the screen and the error will show up in terminal then.  It is the weirdest thing.  I've noticed some weird behavior with another Conky in this same time frame that uses a script to call the weekday names for a horizontal calendar Conky.  The days remain, (the numbers) but the weekday names disappear.  Strangeness like this has been happening since Friday or Saturday...
Forum Netiquette

"No matter how smart you are you can never convince someone stupid that they are stupid."  Anonymous

jedi

#374
Did I ever mention that I love Conky?  Changed it again.



A huge thank-you to Sector11 without whom I'd never have been able to get this far with Conky.  He is undoubtedly the most generous soul when it comes to helping anyone with a genuine interest in anything Conky related.  His patience and willingness to help, are part of why the Linux community can be so wonderful to work with.  Thank-you Sector11...

The weather is of course mrpeachy's v9000 which is here.  When you download his scripts it will have Sector11's weather template he designed as part of the tar file you'll need to download.  Just follow his very specific instructions and you'll be all set.  Sector11 has written/designed many other useful and beautiful weather templates for several of the most popular weather scripts out there!

The system info Conky on the right is based on a Conky by McLovin which is posted a few posts above this one, and which utilizes a bargraph lua script written by wlourf and heavily modified by McLovin.  Maybe one of the best bargraph's I've ever used.  Thanks McLovin!  (also a big thanks to wlourf)

The bottom extreme right is a lua script to show all mounted file systems also written by mrpeachy.  Just in case you weren't sure, mrpeachy is "The Man" when it comes to all things lua, and has helped me personally on more than one occasion.  In other words, ask nice and you'll be amazed at how generous some of the guys who do all this hard work will help you out!

conkymountrc

background yes
update_interval 1
cpu_avg_samples 2
total_run_times 0
override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 1024
imlib_cache_size 1024

minimum_size 370 0
maximum_width 370

gap_x 0
gap_y 35
#####################
# - Text settings - #
#####################
use_xft yes
xftfont monofur:bold:size=11
xftalpha 1

uppercase no

# Text alignment, other possible values are commented
alignment bottom_right

######################
# - Color settings - #
######################
color0 c3c3c3 #mid gray
color1 FF0000 #red
color2 A4FFA4 #light green
color3 007EFF #bright blue
color4 E3E3E3 #very light gray
color5 c6771a #an orange shade
color6 CA8718 #a dust like color
color7 FFE500 #a darker yellow color
color8 C3FF00 #lime green
color9 227992 #bars-blue #another blue 48a3fd
default_color c3c3c3
default_shade_color gray
default_outline_color black
#############################
# - Window specifications - #
#############################
own_window yes
own_window_transparent yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_class conky
own_window_title clicky
#own_window_argb_visual yes
#own_window_argb_value 255

border_inner_margin 0
border_outer_margin 0

#########################
# - Graphics settings - #
#########################
draw_shades no
draw_outline no
draw_borders no
stippled_borders 0
draw_graph_borders no

lua_load ~/Conky/LUA/mounted.lua

Text
${lua get_mounted_data 3}
${color 888888}FSYS${color 888888} = ${lua mount 1 total}${goto 100}${color 888888}Size${goto 150}${color D4741B}Free${goto 200}${color1}Used${goto 255}${color 888888}Mount Point
${voffset -5} ${color 547EC8}${stippled_hr 5 1}${color 888888}
${color 4B60B4}${lua mount 1 fsys 9}${goto 100}${color 888888}${lua mount 1 size}${goto 150}${color D4741B}${lua mount 1 free}${goto 200}${color1}${lua mount 1 use%}${goto 260}${color 888888}${lua mount 1 mount}
${color 4B60B4}${lua mount 5 fsys 9}${goto 100}${color 888888}${lua mount 5 size}${goto 150}${color D4741B}${lua mount 5 free}${goto 200}${color1}${lua mount 5 use%}${goto 260}${color 888888}${lua mount 5 mount}
${color 4B60B4}${lua mount 3 fsys 9}${goto 100}${color 888888}${lua mount 3 size}${goto 150}${color D4741B}${lua mount 3 free}${goto 200}${color1}${lua mount 3 use%}${goto 260}${color 888888}${lua mount 3 mount}
${color 4B60B4}${lua mount 4 fsys 9}${goto 100}${color 888888}${lua mount 4 size}${goto 150}${color D4741B}${lua mount 4 free}${goto 200}${color1}${lua mount 4 use%}${goto 260}${color 888888}${lua mount 4 mount}
${color 4B60B4}${lua mount 6 fsys 9}${goto 100}${color 888888}${lua mount 6 size}${goto 150}${color D4741B}${lua mount 6 free}${goto 200}${color1}${lua mount 6 use%}${goto 260}${color 888888}${lua mount 6 mount}
${color 4B60B4}${lua mount 8 fsys 9}${goto 100}${color 888888}${lua mount 8 size}${goto 150}${color D4741B}${lua mount 8 free}${goto 200}${color1}${lua mount 8 use%}${goto 260}${color 888888}${lua mount 8 mount}
${color 4B60B4}${lua mount 9 fsys 9}${goto 100}${color 888888}${lua mount 9 size}${goto 150}${color D4741B}${lua mount 9 free}${goto 200}${color1}${lua mount 9 use%}${goto 260}${color 888888}${lua mount 9 mount}
${color 4B60B4}${lua mount 7 fsys 9}${goto 100}${color 888888}${lua mount 7 size}${goto 150}${color D4741B}${lua mount 7 free}${goto 200}${color1}${lua mount 7 use%}${goto 260}${color 888888}${lua mount 7 mount}
${alignc}${execi 10 hddtemp /dev/sda}
${alignc}${execi 10 hddtemp /dev/sdb}


mounted.lua

--[[partitions for conky by mrpeachy

##instructions
##load script
lua_load ~/lua/mounted.lua
## first lua command below text:
## ${lua get_mounted_data interval}, where interval is a number.  This starts data gathering
## to get output:
## ${lua mount partition_number data_type text_length}, where partition number is a number
## text_length is optional, lets you specify the max number of characters the function returns. only affects fsys and mount data options
## data_type can be
## total - shows total number of partitions mounted, requires a partition_number also, use 1, could be used in an if_match
## fsys - shows filesystem
## size - shows space used in appropriate units
## free - shows free space in appropriate units
## use% - shows % used
## mount - shows mountpoint

TEXT
CPU %: ${cpu cpu0} ${lua get_mounted_data 10}
TOTAL PARTITIONS MOUNTED: ${lua mount 1 total}
FSYS${goto 100}SIZE${goto 200}USED%${goto 300}MOUNT
${lua mount 1 fsys}${goto 100}${lua mount 1 size}${goto 200}${lua mount 1 use%}${goto 300}${lua mount 1 mount 10}
${lua mount 2 fsys}${goto 100}${lua mount 2 size}${goto 200}${lua mount 2 use%}${goto 300}${lua mount 2 mount 10}
${lua mount 3 fsys}${goto 100}${lua mount 3 size}${goto 200}${lua mount 3 use%}${goto 300}${lua mount 3 mount 10}
${lua mount 4 fsys}${goto 100}${lua mount 4 size}${goto 200}${lua mount 4 use%}${goto 300}${lua mount 4 mount 10}

]]

conky_start=1
function conky_get_mounted_data(interval)
local updates=tonumber(conky_parse("${updates}"))
timer=(updates % interval)
if timer==0 or conky_start==1 then
fsys={}
size={}
used={}
avail={}
uperc={}
mount={}
local file = io.popen("df -h")
for line in file:lines() do
if string.find(line,"/dev/")~=nil then
local s,f,fs=string.find(line,"^([%d%a%p]*)%s")
table.insert(fsys,fs)
local s,f,sz=string.find(line,"%s*([%d%a%p]*)%s",f)
table.insert(size,sz)
local s,f,us=string.find(line,"%s*([%d%a%p]*)%s",f)
table.insert(used,us)
local s,f,av=string.find(line,"%s*([%d%a%p]*)%s",f)
table.insert(avail,av)
local s,f,up=string.find(line,"%s*([%d%a%p]*)%s",f)
table.insert(uperc,up)
local s,f,mn=string.find(line,"%s*([%d%a%p]*)%s*$",f)
table.insert(mount,mn)
end
end
file:close()
conky_start=nil
end--timed section
return ""
end

function conky_mount(n,d,c)--n=partition_number,d=data_type,c=number of characters to return
d=tostring(d)
n=tonumber(n)
c=tonumber(c) or 0
if d=="total" then
data=#fsys or 1
elseif d=="fsys" then
data=fsys[n] or ""
if c~=0 then
data=string.sub(data,1,c) or ""
end
elseif d=="size" then
data=size[n] or ""
elseif d=="used" then
data=used[n] or ""
elseif d=="free" then
data=avail[n] or ""
elseif d=="use%" then
data=uperc[n] or ""
elseif d=="mount" then
data=mount[n] or ""
if c~=0 then
data=string.sub(data,1,c) or ""
end
else
data="check data type"
end
return data
end--end main function


The network usage Conky I (cough-cough) 'borrowed' from Sector11.  I'm thinking he wrote this one with some help from dk75 over at #!.

vnstatconkyrc

# killall conky && conky -c ~/Conky/S11_VNS.conky &
# with help from dk75

###  Begin Window Settings  ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes

# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes

own_window_type normal #override
own_window_transparent yes
own_window_hints undecorated,sticky,below,skip_taskbar,skip_pager
# own_window_colour ffffff
own_window_class Conky
own_window_title Vnstats

### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
own_window_argb_visual yes

### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
own_window_argb_value 255

minimum_size 330 0 ## width, height
maximum_width 330  ## width, usually a good idea to equal minimum width

gap_x 380 ### left &right
gap_y 50  #295 ### up & down

alignment br
####################################################  End Window Settings  ###
###  Font Settings  ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont Anonymous Pro:size=9

# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes

### WARNING ### These do NOT play well with ~/Conky/LUA/draw-bg.lua
###################################################################
draw_shades no #### <<<--- yes --- To see it easier on light screens.
#default_shade_color black
draw_outline no #### <<<--- yes --- Amplifies text if yes
default_outline_color black

uppercase no
######################################################  End Font Settings  ###
###  Color Settings  #########################################################
default_shade_color gray
default_outline_color black

color0 c3c3c3 #mid gray
color1 FF0000 #red
color2 A4FFA4 #light green
color3 007EFF #bright blue
color4 E3E3E3 #very light gray
color5 c6771a #an orange shade
color6 CA8718 #a dust like color
color7 FFE500 #a darker yellow color
color8 C3FF00 #lime green
color9 28478D #bars-blue #another blue 227992 48a3fd 3881c7
default_color c3c3c3
#####################################################  End Color Settings  ###
###  Borders Section  ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders yes
#####################################################  End Borders Secton  ###
###  Miscellaneous Section  ##################################################

# yes
background yes

# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer right

# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 512

# Subtract (file system) buffers from used memory?
no_buffers yes

# change GiB to G and MiB to M
short_units yes

# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2

#   Maximum size of user text buffer, i.e. layout below TEXT line in config file
#  (default is 16384 bytes)
# max_user_text 16384

##############################################  End Miscellaneous Section  ###
###  LUA Settings  ###########################################################
## Above and After TEXT - requires a composite manager or blinks.
##
# lua_load ~/Conky/LUA/draw-bg.lua
#TEXT
#${lua conky_draw_bg 10 0 0 0 0 0x000000 0.6}
#
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
## OR Both above TEXT (No composite manager required - no blinking!)
#
#lua_load /home/jed/Conky/test/draw_bg.lua
#lua_draw_hook_pre draw_bg 75 0 0 0 0 0x000000 0.5
#
#######################################################  End LUA Settings  ###

#digiThe all important - How often conky refreshes.5
# If you have a "Crey" try: 0.2 - smokin' - but watch the CPU useage go UP!
update_interval 1 # in seconds

# stuff after 'TEXT' will be formatted on screen
TEXT
${color9}Network Usage Statistics${color} ${hr}
${downspeedgraph wlan0 24,150 A52A2A 0000FF -t -l}${goto 180}${upspeedgraph wlan0 24,150 0000FF A52A2A -t -l}
  Down: ${downspeedf wlan0}${goto 195}Up: ${upspeedf wlan0}

${color9}Transfer Totals${color} ${hr}
${color6}rx${goto 85}tx${goto 170}Total${goto 265}Avg Rate${color}
${color9}Today:${color}
${execpi 300 vnstat | grep "today" | awk '{print $2" "$3"\
${goto 85}"$5" "$6"\
${goto 170}"$8" "$9"\
${goto 265}"$11" "$12}'}
${color9}Yesterday:${color}
${execpi 300 vnstat | grep "yesterday" | awk '{print $2" "$3"\
${goto 85}"$5" "$6 "\
${goto 170}" $8" "$9 "\
${goto 265}" $11" "$12}'}
${color9}Last Week:${color}
${execpi 300 vnstat -w | grep "last week" | awk '{print $3" "$4"\
${goto 85}" $6" "$7 "\
${goto 170}" $9" "$10 "\
${goto 265}" $12" "$13}'}
${color9}Last 7 Days:${color}
${execpi 300 vnstat -w | grep "last 7 days" | awk '{print $4" "$5 "\
${goto 85}" $7" "$8 "\
${goto 170}" $10" "$11 "\
${goto 265}" $13" "$14}'}
${color9}Current Week:${color}
${execpi 300 vnstat -w | grep "current week" | awk '{print $3" "$4 "\
${goto 85}" $6" "$7 "\
${goto 170}" $9" "$10 "\
${goto 265}" $12" "$13}'}
${color9}${time %B %Y}:${color}
${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $3" "$4}'}\
${goto 85}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $6" "$7}'}\
${goto 170}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $9" "$10}'}\
${goto 265}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $12" "$13}'}

${color9}Monthly Transfer Totals${color} ${hr}
${color6}${goto 85}rx${goto 170}tx${goto 265}Total${color}
${execpi 300 vnstat -m |mawk -v last=5 '/[A-Z][a-z][a-z].+12/ {test[++i]=$0} END{i=0; while (test[++i]); --i; for (j=i-last; j<=i; j++) {$0=test[j]; print "${color6}"$1, $2 ":${color}${goto 85}"$3" "$4"${goto 170}"$6" "$7"${goto 265}"$9" "$10}}'}
${color0}${hr}${color}


The email Conky on the bottom left was pointed out to me by Sector11, and it was originally created by Mark Buck.

emailconkyrc

use_xft yes
xftfont 123:size=8
xftalpha 0.1
update_interval 1
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 250 0
maximum_width 600
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color 28478D
default_shade_color red
default_outline_color green
alignment bottom_left
gap_x 10
gap_y 50
no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 1
override_utf8_locale yes
use_spacer right

#lua_load /home/jed/Conky/LUA/draw_bg.lua
#lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.4

TEXT
${font Petita Bold:pixelsize=14}${color 28478D}gmail  -  ${color 525252}${execi 900 conkyEmail --servertype=POP --servername=pop.gmail.com --ssl --username=gmail.com --password=passwordhere --mailinfo=0} new email(s)

${color 28478D}vsido@gmail  -  ${color 525252}${execi 900 conkyEmail --servertype=POP --servername=pop.gmail.com --ssl --username=gmail.com --password=passwordhere --mailinfo=0} new email(s)

${color 28478D}live  -  ${color 525252}${execi 900 conkyEmail --servertype=POP --servername=pop3.live.com --ssl --username=@live.com --password=passwordhere --mailinfo=0} new email(s)

${color 28478D}hotmail  -  ${color 525252}${execi 900 conkyEmail --servertype=POP --servername=pop3.live.com --ssl --username=hotmail.com --password=passwordhere --mailinfo=0} new email(s)


The top left Conky I call the time Conky and again, was one pointed out to me by Sector11.  It was originally created by mobilediesel who has apparently dropped off of planet Earth!  All Conky folks everywhere certainly hope mobilediesel is doing wonderful, and would love to see more of his brilliant and very artistic work!

time

######################
# - Conky settings -
# based on original work by mobilediesel
######################

background yes
update_interval .3
cpu_avg_samples 2
total_run_times 0
override_utf8_locale yes

double_buffer yes
#no_buffers yes

text_buffer_size 1024
#imlib_cache_size 0

minimum_size 1250 0
maximum_width 1250

gap_x 10
gap_y 10
#####################
# - Text settings - #
#####################
use_xft yes
xftfont Santana:size=8
xftalpha .8
uppercase no
alignment top_left
#############################
# - Window specifications - #
#############################
own_window yes
own_window_transparent yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_class conky-semi
#own_window_argb_visual yes
#own_window_argb_value 255
border_inner_margin 0
border_outer_margin 0
#########################
# - Graphics settings - #
#########################
draw_shades no
#default_shade_color 292421
draw_outline no
draw_borders no
stippled_borders 0
draw_graph_borders no
TEXT
${execpi 36000 /home/jed/Conky/Scripts/horical.sh}
${font CaviarDreams:size=30}${goto 60}${color 949494}${voffset 10}${time %l:%M %P}
${font CaviarDreams:size=18}${goto 60}${color 3881C7}${voffset -10}${time %A %B %d %Y}
${goto 600}${color 3881C7}${font CaviarDreams:size=10}${execi 1 conkyForecast-SunsetSunriseCountdown  -t} in: ${color 949494}${execi 1 conkyForecast-SunsetSunriseCountdown -L}
${goto 600}${color 3881C7}Current Moon Phase: ${goto 720}${color 949494}${execi 300 conkyForecast --imperial --datatype=MP}
${execpi 1800 conkyForecast --location=USME0330 --imperial --template=$HOME/Conky/LUA/day-night.template}


The horical.sh script

#!/bin/bash
# a script to display a horizontal calendar on conky (hence the name horical :D)
# created by mobilediesel
#
TODAY=`date +%d`
TOPLINE=" "
OVER=" "
REST=" "
# -------- This part is to find out the number of days in a month to display-----------#
a=`date +%-Y`
e1=`expr $a % 400`
e2=`expr $a % 100`
e3=`expr $a % 4`
if [ $e1 == 0 ]
  then c=1
  elif [ $e2 == 0 ]
  then c=0
  elif [ $e3 == 0 ]
  then c=1
  else c=0
fi
p=`date +%-m`
# if the current year is not a leap one, c = 0
if [ $c == 0 ]
  then
if [ $p == 2 ]
then b=28 # this is the number of days in Febuary
elif [ $p == 11 ] || [ $p == 4 ] || [ $p == 6 ] ||  [ $p == 9 ]
then b=30
else b=31
fi
  else
if [ $p == 2 ]
then b=29 # the number of days in Febuary in a leap year
elif [ $p == 11 ] || [ $p == 4 ] || [ $p == 6 ] ||  [ $p == 9 ]
then b=30
else b=31
fi
fi
#--------------------- The bottom line which displays the days of month ----------#
i=1
if [ $TODAY -ne 1 ]
then
    while [ $i -lt $TODAY ]; do
        if [ $i -lt 10 ]
        then
            OVER="$OVER 0$i"
        else
            OVER="$OVER $i"
        fi
        i=$[$i+1]
    done
fi
i=$[$i+1]
if [ $TODAY -ne $b ]
then
    while [ $i -ne $[$b] ]; do
        if [ $i -lt 10 ]
        then
            REST="$REST 0$i"
        else
            REST="$REST $i"
        fi
        i=$[$i+1]
    done
    REST="$REST $b"
fi
#------------- the top line which displays the abbreviated weekday names-------#
k=`date +%u`
j=`date +%e`
f=`expr $j % 7`
if [$k -lt $f]
then
y=$[$k+8-$f]
else
y=$[$k-$f+1]
fi
while [ $b -gt 0 ]; do
    case "$y" in
    1) TOPLINE="$TOPLINE Mo";;
    2) TOPLINE="$TOPLINE Tu";;
    3) TOPLINE="$TOPLINE We";;
    4) TOPLINE="$TOPLINE Th";;
    5) TOPLINE="$TOPLINE Fr";;
    6) TOPLINE="$TOPLINE Sa";;
    7) TOPLINE="$TOPLINE Su";;
    esac
    b=$[$b-1]
    y=$[$y+1]
    if [ $y -eq 8 ]
    then
        y=1
    fi
done
echo '${goto 15}''${color 949494}${font Droid Sans Mono:size=12}'$TOPLINE | sed 's/Su/${color 48a3fd}Su${color 949494}/g' | sed 's/Su/${color 3881C7}Su/g'
echo '${goto 15}''${font Droid Sans Mono:bold:size=12}''${color 3c3c3c}'$OVER '${color 3881C7}'$TODAY'${color}${color 949494}'$REST


the day-night.template file

${image [--datatype=WI] -p 350,40 -s 100x100}${image [--datatype=MI] -p 555,40 -s 100x100}


The time Conky relies on having conkyForecast installed and configured correctly for your location.  Like I tell everyone all the time, I'm a copy/paste guy that knows enough to get myself in heaps of trouble on my own system.  That said, think twice before asking me for help!  Google and the forums are your friend.  My best advice, is to get rid of whatever distro your currently using and install VSIDO which you can get here at the VSIDO forums and was developed by VastOne.  It has none of the bloat and overhead installed that most major distro's come with by default, thus making it harder to break!

Everything here will need some specific tweaking to work on your personal system since it will be nothing at all like my own.

Hope I didn't mess up on the creds.  Someone over at that site that glows orange asked for all of this!  Sorry for such a long post...
Forum Netiquette

"No matter how smart you are you can never convince someone stupid that they are stupid."  Anonymous