Conky Support, Codes and Screenshots

VastOne

VSIDO      VSIDO Change Blog    

    I dev VSIDO

lwfitz

Don't Be A Dick!

McLovin

You know, that give me an idea of some things that I may be able to do with some of my setups, lets see what I can come up with teehee
Visit my DeviantArt page and My Blog

Sector11

#243
And yet another trip down memory lane.
- no voffsets like the original







   From these, to this ->   


Fonts:
  • Monofur
  • Woodbadge
  • LCDMono2
    And if you are interested, the conky:
    background no
    own_window yes
    own_window_type normal
    own_window_transparent yes
    own_window_hints undecorated,below,skip_taskbar,skip_pager
    # own_window_colour black
    own_window_title Conkymain
    double_buffer yes
    use_spacer left
    override_utf8_locale yes
    use_xft yes
    xftfont Monofur:bold:size=11
    xftalpha 2.5
    update_interval 1.0
    uppercase no  # set to yes if you want all text to be in uppercase
    stippled_borders 0
    # border_inner_margin 0
    # border_outer_margin 0
    border_width 0
    default_outline_color black
    default_shade_color black
    draw_borders no
    draw_outline no #yes  # amplifies text if yes
    draw_shades yes  # shadecolor black

    default_color DCDCDC #Gainsboro
    color0 7FFFD4 #Aquamarine
    color1 00CED1 #DarkTurquoise #FFA07A LightSalmon #00FFFF Cyan
    color2 DEB887 #BurlyWood
    color3 7FFF00 #Chartreuse
    color4 778899 #LightSlateGrey
    color5 FFDEAD #NavajoWhite
    color6 00BFFF #DeepSkyBlue
    color7 48D1CC #MediumTurquoise
    color8 FFFF00 #Yellow
    color9 CD5C5C #IndianRed FF0000 #Red

    alignment tr  # Aligned position on screen: tl, tr, tm, bl, br, bm, ml, mr
    gap_x 10
    gap_y 10
    text_buffer_size 512 # use 1024 for the forecast
    no_buffers yes  # Subtract file system buffers from used memory?
    short_units yes
    pad_percents 2

    #max_specials 512  ## new
    #max_user_text 20000  ## new
    minimum_size 260 0
    maximum_width 260

    TEXT
    ${font Woodbadge:size=15}${color2}Timeline:${color}${font WW Digital:size=15} ${uptime}${font}
    ${color7}${cpubar cpu0 1,255}${color}
    ${goto 115}${font LCDMono2:bold:size=15}:${time %S}${goto 35}${font LCDMono2:size=56}${time %R}${font}
    ${color7}${cpubar cpu0 1,255}${color}
    ${font LCDMono2:size=18}${goto 5}SU MO  ${color6}${time %b %y}${color}  FR SA
    ${goto 5}${execpi 3600 CPS=`date +%-d`; cal -h | sed '2d' | sed -e '1d' -e 's/\<'"$CPS"'\>/${color6}&${color}/'}${font}
    ${color7}${cpubar cpu0 1,255}${color}
    ${font Woodbadge:size=15}${color2}Kernel:${color}${font}
    ${alignc}${kernel}${font monofur:pixelsize=16}
    ${font Woodbadge:size=15}${color2}CPU Load:${color}${font}
    ${goto 20}${color3}CPU ${color}%${goto 84}${color3}1 ${color}${cpu cpu1}\
    ${goto 148}${color3}2 ${color}${cpu cpu2}\
    ${goto 212}${color3}3 ${color}${cpu cpu3}\
    ${goto 276}${color3}Avg ${color}${cpu cpu0}${font monofur:pixelsize=16}
    ${font Woodbadge:size=15}${color2}Temperatures:${color}${font}
    ${color3}CPU ${color}${platform f71882fg.2560 temp 1}°\
      ${color3}SDA ${color}${execi 15 hddtemp -n /dev/sda}°\
      ${color3}MB ${color}${platform f71882fg.2560 temp 2}°\
      ${color3}GPU ${color}${nvidia temp}°${color}${font monofur:pixelsize=16}
    ${font Woodbadge:size=15}${color2}Speeds:${font}
    ${color3}CPU ${color}${freq_g}GHz${goto 100}${color3}GPU ${color}${nvidia gpufreq}MHz${alignr 5}${color3}MEM ${color}${nvidia memfreq}MHz${font monofur:pixelsize=16}
    ${font Woodbadge:size=15}${color2}Processes:${color}${font} ${running_processes} of${processes}${color}
    ${color3}Load:${goto 70}${color}${loadavg 1}${goto 140}${loadavg 2}${alignr 5}${loadavg 3}${color}${font monofur:pixelsize=16}
    ${font Woodbadge:size=15}${color2}RAM:${font}  ${color}${memmax}${goto 140}${color3}Used ${color}${mem}${alignr 5}${memperc}%
    ${color3}Buffered: ${color}${buffers}${alignr 5}${color3}Cached:${color} ${cached}${font monofur:pixelsize=16}
    ${font Woodbadge:size=15}${color2}SWAP:${font}  ${color}${swapmax}${goto 140}${color3}Used ${color}${swap}${alignr 5}${swapperc}%${font monofur:pixelsize=16}
    ${font Woodbadge:size=15}${color2}HDD SDA:${color}${font}
         Total${goto 100}Used${goto 195}Free
    ${color}Root ${color7}${fs_size /}${goto 100}${color9}${fs_used /} ${fs_used_perc /}%${goto 195}${color3}${fs_free /} ${fs_free_perc /}%
    ${color}Home ${color7}${fs_size /home}${goto 100}${color9}${fs_used /home} ${fs_used_perc /home}%${goto 195}${color3}${fs_free /home} ${fs_free_perc /home}%
    ${color}M/5 ${color7}${fs_size /media/5}${goto 100}${color9}${fs_used /media/5} ${fs_used_perc /media/5}%${goto 195}${color3}${fs_free /media/5} ${fs_free_perc /media/5}%
    ${color}Swap ${color7}${swapmax}${goto 100}${color9}${swap} ${swapperc}%${goto 195}${color3}${swapfree}
    ${color7}${cpubar cpu0 1,255}${color}
    ${font Woodbadge:size=15}${color2}NET:${font} ${color}In ${tcp_portmon 1 32767 count}${goto 125}Out ${tcp_portmon 32768 61000 count}${alignr 5}Total: ${tcp_portmon 1 65535 count}${font monofur:pixelsize=16}
    ${font}${alignc}${color3}Dn     ${totaldown eth0}     ${downspeed eth0} k/s
    ${alignc}${color9}Up     ${totalup eth0}     ${upspeed eth0} k/s${color}${font monofur:pixelsize=16}
    ${font Woodbadge:size=15}${color2}VNSTATS:${font}
    ${color}       Down      Up         Total${font monofur:pixelsize=16}
    ${font}${color}${time %b %y} ${color3}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $3 $4}'}${goto 125}${color9}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $6 $7}'}${goto 200}${color}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $9 $10}'}${font monofur:pixelsize=16}
    ${font}${color}${exec date | awk '{print $3" "$2}'}${color3} ${execi 300 vnstat | grep "today" | awk '{print $2 $3}'}${goto 125}${color9}${execi 300 vnstat | grep "today" | awk '{print $5 $6}'}${goto 200}${color}${execi 300 vnstat | grep "today" | awk '{print $8 $9}'}
    ${color}${exec date --date="-1 day" | awk '{print $3" "$2}'}${color3} ${execi 300 vnstat | grep "yesterday" | awk '{print $2 $3}'}${goto 125}${color9}${execi 300 vnstat | grep "yesterday" | awk '{print $5 $6}'}${goto 200}${color}${execi 300 vnstat | grep "yesterday" | awk '{print $8 $9}'}
    ${color}Last 7 ${color3}${execi 300 vnstat -w | grep "last 7 days" | awk '{print $4 $5}'}${goto 125}${color9}${execi 300 vnstat -w | grep "last 7 days" | awk '{print $7 $8}'}${goto 200}${color}${execi 300 vnstat -w | grep "last 7 days" | awk '{print $10 $11}'}


    Still a work in progress - Like that SWAP above HDD SDA has to come out.  ;D
    Note - I got rid of the 'orange' for a more realistic colour for Woodbadge.
    falldown's wallpaper is a natural for this conky.
Stay Home

vrkalak

I know I have one of those 'old' Conky +--+-- Scripts on an external hard-drive somewhere.  :P

Gives me an excuse to look for it.

Sector11

#245
OPC use to mean Other People's Cigarettes, now it means Other Peoples Conkys, add that with MPOS (Modifying Other People's Stuff) and it can be quite interesting.

Personally for me these are kinda small but would sit well on a netbook I suppose - later I think I'll take that HUD2 and make it larger.

* clock_conky.tar.gz - on the top left (obvious)
* conky_HUD.tar.gz - bottom middle
* conky_HUD2.tar.gz - bottom left
Stay Home

VastOne

Excellent thread Sector11!  8)

And that scrot and setup is a perfect example of a great OPC... I really like the Age of VSIDO
VSIDO      VSIDO Change Blog    

    I dev VSIDO

Sector11

Yea but the OPC isn't the main thing it's the MOPS.  The clock in the top left came from another LUA script that had a bunch of rings (not the HUDs shown).  First time I tried it was a miserable failure, I missed some code.  OOPS! After getting it working it was personalized as shown.

The HUD (bottom middle) is modified from the original as well and then I took the clock and added it to the HUD to create something new on the bottom left.

The "Age of VSIDO" came from a screenshot of a B rated movie that never even made that on the scale of ratings.  Made on a shoestring, from penny loafers, budget and actors that took one lesson and failed that.  Worst movie I've seen in years!  But I rather like the screenshot  :D
Stay Home

jedi

Sector11, you truly are a "Conky Master"!   ;D
Forum Netiquette

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

jedi

An old sidebar Conky I found in my local Conky archive...



the conkyrc_sidebar;

## Conky Cairo Sidebar         ##
## by jpope                    ##
## version 1.0.2011.09.30      ##
##                             ##
#################################
# . Conky settings . #
background no
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
double_buffer yes
no_buffers yes
text_buffer_size 2048
imlib_cache_size 0
imlib_cache_flush_interval 60
max_specials 1024
max_user_text 1024
#temperature_unit fahrenheit

# . Window specifications . #
own_window yes
own_window_type desktop
own_window_argb_visual yes
own_window_argb_value 0
own_window_hints undecorated,sticky,skip_taskbar,skip_pager,below
own_window_title ConkySidebar
own_window_class ConkySidebar
border_inner_margin 0
border_outer_margin 0
minimum_size 568 568
maximum_width 180
alignment top_right #Choices are: top_left, top_right, top_middle, bottom_left, bottom_right, bottom_middle, middle_left, middle_middle,
middle_right
gap_x 8
gap_y 16

# . Graphics settings . #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# . Text settings . #
use_xft yes
xftfont droid sans:size=8
xftalpha 0
use_spacer left
uppercase no

# . Color settings . #
default_color ffffff

# . Lua Load . #
lua_load ~/conky/sidebar.lua
lua_draw_hook_pre widgets

TEXT
${execi 3600 aptitude search '~U' | wc -l | tail > ~/conky/upd}


The sidebar.lua;

--[[ CairoSideBar by jpope
    Most work here done by other conky masters with some slight modifications. ;)
    v1.0.2011.09.30
]]

--[[
Conky Widgets by londonali1010 (2009)

This script is meant to be a "shell" to hold a suite of widgets for use in Conky.

To configure:
+ Copy the widget's code block (will be framed by --(( WIDGET NAME )) and --(( END WIDGET NAME )), with "[" instead of "(") somewhere between
"require 'cairo'" and "function conky_widgets()", ensuring not to paste into another widget's code block
+ To call the widget, add the following between "cr = cairo_create(cs)" and "cairo_destroy(cr)" at the end of the script:
NAME_OF_FUNCTION(cr, OPTIONS)
+ Replace OPTIONS with the options for your widget (should be specified in the widget's code block)

Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/conky_widgets.lua):
lua_load ~/scripts/conky_widgets.lua
lua_draw_hook_pre widgets

Changelog:
+ v1.1 -- Simplified calls to widgets by implementing a global drawing surface, and included imlib2 by default (03.11.2009)
+ v1.0 -- Original release (17.10.2009)
]]

require 'cairo'
require 'imlib2'

usrhome = os.getenv("HOME")

--[[ USER OPTIONS ]]

clockface=3

color01=0x000000        --original 0x909090
color02=0xFFFFFF        --original 0xFFFFFF
color03=0xFF0000        --original 0xFF0000
color04=0x606060        --original 0x707070

--[[ END USER OPTIONS ]]
   
--[[ ROUNDED RECTANGLE WIDGET ]]
--[[ v1.0 by londonali1010 (2009) ]]
--[[ Options (x0, y0, width, height, radius, colour, alpha):
"x0" and "y0" are the coordinates (in pixels) of the top left of the rectangle, relative to the top left of the Conky window.
"width" and "height" are the width and height of the rectangle, respectively.
"radius" is the rounding radius of the corners, in pixels.
"colour" is the colour of the rectangle, in format 0xRRGGBB.
"alpha" is the transparency of the rectangle, from 0.0 (transparent) -> 1.0 (opaque) ]]

function round_rect(x0, y0, w, h, r, colour, alpha)
local function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
    if update_num>5 then

cairo_move_to(cr, x0, y0)
cairo_rel_move_to(cr, r, 0)
cairo_rel_line_to(cr, w-2*r, 0)
cairo_rel_curve_to(cr, r, 0, r, 0, r, r)
cairo_rel_line_to(cr, 0, h-2*r)
cairo_rel_curve_to(cr, 0, r, 0, r, -r, r)
cairo_rel_line_to(cr, -(w-2*r), 0)
cairo_rel_curve_to(cr, -r, 0, -r, 0, -r, -r)
cairo_rel_line_to(cr, 0, -(h-2*r))
cairo_rel_curve_to(cr, 0, -r, 0, -r, r, -r)
cairo_close_path(cr)

cairo_set_source_rgba(cr, rgb_to_r_g_b(colour, alpha))
cairo_fill(cr)
    end
end

--[[ END ROUNDED RECTANGLE WIDGET ]]

--[[ PRINT TEXT ]]
--[[ jpope 2011.09.30 ]]
--[[ based on SHINY CALENDAR PAGE WIDGET v1.0 by londonali1010 (2009) ]]
--[[ Options (xcc, ycc, size, bg_colour, fg_colour, alpha)
-- "xcc" and "ycc" are the x and y coordinates of the centre of the widget, in pixels, relative to the top left of the Conky window.
-- "size" is the width of the widget (which is square).
-- "bg_colour" is the colour, in format 0xRRGGBB, of the widget's background.
-- "fg_colour" is the colour of the widget's text.
-- "alpha" is the opacity (0.0 -> 1.0) of the widget. ]]

function printtext(xcc, ycc, size, bgc, fgc, alpha)
local function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
    if update_num>5 then

local function set_font_sizes()
day_size = 1.0
date_size = 1.0
month_size = 1.0
var_size = 1.0
data_size = 1.0

local extents = cairo_text_extents_t:create()
cairo_select_font_face(cr, "Droid Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
cairo_set_font_size(cr, day_size)
cairo_text_extents(cr, day, extents)
local w = math.abs(extents.width)
local h = math.abs(extents.y_bearing)
local scale_w = 0.8*size / w
local scale_h = 0.1*size / h
local scale
if scale_w < scale_h then scale = scale_w else scale = scale_h end
day_size = scale * day_size

cairo_set_font_size(cr, date_size)
cairo_text_extents(cr, date, extents)
w = math.abs(extents.width)
h = math.abs(extents.y_bearing)
scale_w = 0.6*size / w
scale_h = 0.6*size / h
if scale_w < scale_h then scale = scale_w else scale = scale_h end
date_size = scale * date_size

cairo_set_font_size(cr, month_size)
cairo_text_extents(cr, month, extents)
w = math.abs(extents.width)
h = math.abs(extents.y_bearing)
scale_w = 0.8*size / w
scale_h = 0.1*size / h
if scale_w < scale_h then scale = scale_w else scale = scale_h end
month_size = scale * month_size

cairo_set_font_size(cr, var_size)
cairo_text_extents(cr, var, extents)
w = math.abs(extents.width)
h = math.abs(extents.y_bearing)
scale_w = 0.9*size / w
scale_h = 0.09*size / h
if scale_w < scale_h then scale = scale_w else scale = scale_h end
var_size = scale * var_size

cairo_set_font_size(cr, data_size)
cairo_text_extents(cr, data, extents)
w = math.abs(extents.width)
h = math.abs(extents.y_bearing)
scale_w = 0.9*size / w
scale_h = 0.06*size / h
if scale_w < scale_h then scale = scale_w else scale = scale_h end
data_size = scale * data_size

return day_size, date_size, month_size, var_size, data_size
end

local function draw_text()
local extents = cairo_text_extents_t:create()
cairo_set_source_rgba(cr, rgb_to_r_g_b(fgc, alpha))

cairo_set_font_size(cr, day_size)
cairo_text_extents(cr, day, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 0.35*size)
cairo_show_text(cr, day)

cairo_set_font_size(cr, date_size)
cairo_text_extents(cr, date, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 0.5*size - extents.y_bearing/2)
cairo_show_text(cr, date)

cairo_set_font_size(cr, month_size)
cairo_text_extents(cr, month, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 0.70*size)
cairo_show_text(cr, month)

var = "CPU"
cairo_set_font_size(cr, var_size)
cairo_text_extents(cr, var, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 0.95*size)
cairo_show_text(cr, var)

data = conky_parse('${cpu cpu0}%')
cairo_set_font_size(cr, data_size)
cairo_text_extents(cr, data, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 1.02*size)
cairo_show_text(cr, data)

data = conky_parse('${hwmon temp 3}C')
cairo_set_font_size(cr, data_size)
cairo_text_extents(cr, data, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2 - 2, y0 + 1.09*size)
cairo_show_text(cr, data)

var = "MEM"
cairo_set_font_size(cr, var_size)
cairo_text_extents(cr, var, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 1.2*size)
cairo_show_text(cr, var)

data = conky_parse('${memperc}%')
cairo_set_font_size(cr, data_size)
cairo_text_extents(cr, data, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 1.27*size)
cairo_show_text(cr, data)

data = conky_parse('${mem}')
cairo_set_font_size(cr, data_size)
cairo_text_extents(cr, data, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2 - 2, y0 + 1.34*size)
cairo_show_text(cr, data)

var = "Battery"
cairo_set_font_size(cr, var_size)
cairo_text_extents(cr, var, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 1.57*size)
cairo_show_text(cr, var)

data = conky_parse('${battery_percent BAT1}%')
cairo_set_font_size(cr, data_size)
cairo_text_extents(cr, data, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 1.64*size)
cairo_show_text(cr, data)

data = conky_parse('${battery_time BAT1}')
cairo_set_font_size(cr, data_size)
cairo_text_extents(cr, data, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 1.71*size)
cairo_show_text(cr, data)

var = "Wireless"
cairo_set_font_size(cr, var_size)
cairo_text_extents(cr, var, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 1.82*size)
cairo_show_text(cr, var)

data = conky_parse('${wireless_link_qual_perc wlan0}%')
cairo_set_font_size(cr, data_size)
cairo_text_extents(cr, data, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2 - 2, y0 + 1.89*size)
cairo_show_text(cr, data)

data = conky_parse('u:${upspeed wlan0}|d:${downspeed wlan0}')
cairo_set_font_size(cr, data_size)
cairo_text_extents(cr, data, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 1.96*size)
cairo_show_text(cr, data)

var = "VSIDO XFCE"
cairo_set_font_size(cr, var_size)
cairo_text_extents(cr, var, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 2.19*size)
cairo_show_text(cr, var)

data = conky_parse("Updates: ${execi 1 cat ~/conky/upd}")
cairo_set_font_size(cr, data_size)
cairo_text_extents(cr, data, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 2.26*size)
cairo_show_text(cr, data)

cairo_select_font_face(cr, "OpenLogos", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
var = "J"
cairo_set_font_size(cr, var_size*2)
cairo_text_extents(cr, var, extents)
cairo_move_to(cr, x0 + size/2 - extents.x_advance/2, y0 + 2.44*size)
cairo_show_text(cr, var)
end

x0, y0 = xcc - size/2, ycc - size/2
day = os.date("%A")
date = os.date("%d")
month = os.date("%B")

day_size, date_size, month_size = set_font_sizes()
draw_text(day_size, date_size, month_size)
    end
end

--[[ END PRINT TEXT ]]

--[[ GUAGE CLOCK WIDGET VERSION 2 ]]
--[[ Options (xc, yc, size, rpt, clr, alp, hrt, mst, thck):
    "xc" and "yc" are the x and y coordinates of the centre of the clock, in pixels, relative to the top left of the Conky window
    "size" is the total size of the widget, in pixels
    "rpt" is the number of times to repeat the clock hands
    "clr" = color
    "alp" = alpha
    "hrt" is the amount of space between the repeating hands for the hours
    "mst" is the number of space between the repeating hands for seconds & minutes
    "thck" is the starting thickness ]]

function guage_clockv2(cr, xc, yc, size, rpt, clr, clr2, alp, hrt, mst, thck)
    local function rgb_to_r_g_b(colour,alpha)
        return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
    end
    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
    if update_num>5 then
        local offset = 0
        local clock_r = (size - 2 * offset) / (2 * 1.25)
        show_seconds=true
        -- Grab time
        local hours=os.date("%I")
        local mins=os.date("%M")
        local secs=os.date("%S")
        secs_arc=(2*math.pi/60)*secs
        mins_arc=(2*math.pi/60)*mins--+secs_arc/60
        hours_arc=(2*math.pi/12)*hours+mins_arc/12
        -- Background
            lp=0
            mark=(2*math.pi)/12
            repeat
                xss=xc+0.80*clock_r*math.sin(mark+mark*lp)
                yss=yc-0.80*clock_r*math.cos(mark+mark*lp)
                xs=xc+1.04*clock_r*math.sin(mark+mark*lp)
                ys=yc-1.04*clock_r*math.cos(mark+mark*lp)
                cairo_move_to(cr,xss,yss)
                cairo_line_to(cr,xs,ys)
                tck=thck
                cairo_set_line_width(cr,tck)
                cairo_set_source_rgba(cr,rgb_to_r_g_b(clr,(alp*0.1)))
                cairo_stroke(cr)
                lp = lp + 1
            until lp >= 12
            lp=0
            mark=(2*math.pi)/60
            repeat
                xss=xc+0.84*clock_r*math.sin(mark+mark*lp)
                yss=yc-0.84*clock_r*math.cos(mark+mark*lp)
                xs=xc+1*clock_r*math.sin(mark+mark*lp)
                ys=yc-1*clock_r*math.cos(mark+mark*lp)
                cairo_move_to(cr,xss,yss)
                cairo_line_to(cr,xs,ys)
                tck=thck
                cairo_set_line_width(cr,tck)
                cairo_set_source_rgba(cr,rgb_to_r_g_b(clr,(alp*0.1)))
                cairo_stroke(cr)
                lp = lp + 1
            until lp >= 60
        -- Draw hour hand
        th=2*math.pi/hrt
            xhs=xc+0*clock_r*math.sin(hours_arc-th)
            yhs=yc-0*clock_r*math.cos(hours_arc-th)
            xh=xc+0.70*clock_r*math.sin(hours_arc-th)
            yh=yc-0.70*clock_r*math.cos(hours_arc-th)
            cairo_move_to(cr,xhs,yhs)
            cairo_line_to(cr,xh,yh)
            cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
            cairo_set_line_width(cr,thck+thck*0.5)
            al=alp*0.5
            cairo_set_source_rgba(cr,rgb_to_r_g_b(clr,(al)))
            cairo_stroke(cr)
        -- Draw minute hand
        tm=(2*math.pi)/mst
            xms=xc+0*clock_r*math.sin(mins_arc-tm)
            yms=yc-0*clock_r*math.cos(mins_arc-tm)
            xm=xc+0.95*clock_r*math.sin(mins_arc-tm)
            ym=yc-0.95*clock_r*math.cos(mins_arc-tm)
            cairo_move_to(cr,xms,yms)
            cairo_line_to(cr,xm,ym)
            tk=thck/2
            cairo_set_line_width(cr,tk)
            cairo_set_source_rgba(cr,rgb_to_r_g_b(clr,(alp)))
            cairo_stroke(cr)
        -- Draw seconds hand
        if show_seconds then
            ts=(2*math.pi)/mst
                xss=xc+0*clock_r*math.sin(secs_arc-ts)
                yss=yc-0*clock_r*math.cos(secs_arc-ts)
                xs=xc+1.05*clock_r*math.sin(secs_arc-ts)
                ys=yc-1.05*clock_r*math.cos(secs_arc-ts)
                cairo_move_to(cr,xss,yss)
                cairo_line_to(cr,xs,ys)
                tck=thck/3
                cairo_set_line_width(cr,tck)
                cairo_set_source_rgba(cr,rgb_to_r_g_b(clr2,(alp)))
                cairo_stroke(cr)
        end
    end
end
--[[ END GUAGE CLOCK WIDGET VERSION 2 ]]

--[[ RING WIDGET ]]
--[[ v1.1 by londonali1010 (2009) ]]
--[[ Options (name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, xc, yc, radius, thickness, start_angle, end_angle):
"name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
"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 ring. If the Conky variable outputs a percentage, use 100.
"bg_colour" is the colour of the base ring.
"bg_alpha" is the alpha value of the base ring.
"fg_colour" is the colour of the indicator part of the ring.
"fg_alpha" is the alpha value of the indicator part of the ring.
"x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
"radius" is the radius of the ring.
"thickness" is the thickness of the ring, centred around the radius.
"start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
"end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be
larger (e.g. more clockwise) than start_angle. ]]

function ring(name, arg, max, bgc, bga, fgc, fga, xc, yc, r, t, sa, ea)
local function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

local function draw_ring(pct)
local angle_0 = sa * (2 * math.pi/360) - math.pi/2
local angle_f = ea * (2 * math.pi/360) - math.pi/2
local pct_arc = pct * (angle_f - angle_0)

-- Draw background ring

cairo_arc(cr, xc, yc, r, angle_0, angle_f)
cairo_set_source_rgba(cr, rgb_to_r_g_b(bgc, bga))
cairo_set_line_width(cr, t)
cairo_stroke(cr)

-- Draw indicator ring

cairo_arc(cr, xc, yc, r, angle_0, angle_0 + pct_arc)
cairo_set_source_rgba(cr, rgb_to_r_g_b(fgc, fga))
cairo_stroke(cr)
end

local function setup_ring()
local str = ''
local value = 0

str = string.format('${%s %s}', name, arg)
str = conky_parse(str)

value = tonumber(str)
if value == nil then value = 0 end
pct = value/max

draw_ring(pct)
end

local updates = conky_parse('${updates}')
update_num = tonumber(updates)

if update_num > 5 then setup_ring() end
end

--[[ END RING WIDGET ]]

--[[ RING (COUNTER-CLOCKWISE) WIDGET ]]
--[[ v1.1 by londonali1010 (2009) ]]
--[[ Options (name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, xc, yc, radius, thickness, start_angle, end_angle):
"name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
"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 ring. If the Conky variable outputs a percentage, use 100.
"bg_colour" is the colour of the base ring.
"bg_alpha" is the alpha value of the base ring.
"fg_colour" is the colour of the indicator part of the ring.
"fg_alpha" is the alpha value of the indicator part of the ring.
"x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
"radius" is the radius of the ring.
"thickness" is the thickness of the ring, centred around the radius.
"start_angle" is the starting angle of the ring, in degrees, counter-clockwise from top. Value can be either positive or negative.
"end_angle" is the ending angle of the ring, in degrees, counter-clockwise from top. Value can be either positive or negative, but must
be larger (e.g. more counter-clockwise) than start_angle. ]]

function ring_ccw(name, arg, max, bgc, bga, fgc, fga, xc, yc, r, t, sa, ea)
local function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

local function draw_ring(pct)
local angle_0 = sa * (2 * math.pi/360) - math.pi/2
local angle_f = ea * (2 * math.pi/360) - math.pi/2
local pct_arc = pct * (angle_f - angle_0)

-- Draw background ring

cairo_arc_negative(cr, xc, yc, r, angle_0, angle_f)
cairo_set_source_rgba(cr, rgb_to_r_g_b(bgc, bga))
cairo_set_line_width(cr, t)
cairo_stroke(cr)

-- Draw indicator ring

cairo_arc_negative(cr, xc, yc, r, angle_0, angle_0 - pct_arc)
cairo_set_source_rgba(cr, rgb_to_r_g_b(fgc, fga))
cairo_stroke(cr)
end

local function setup_ring()
local str = ''
local value = 0

str = string.format('${%s %s}', name, arg)
str = conky_parse(str)

value = tonumber(str)
if value == nil then value = 0 end
pct = value/max

draw_ring(pct)
end

local updates = conky_parse('${updates}')
update_num = tonumber(updates)

if update_num > 5 then setup_ring() end
end

--[[ END RING (COUNTER-CLOCKWISE) WIDGET ]]

function conky_widgets()
   
if conky_window == nil then return end

    if cs == nil or cairo_xlib_surface_get_width(cs) ~= conky_window.width or cairo_xlib_surface_get_height(cs) ~= conky_window.height then
        if cs then cairo_surface_destroy(cs) end
        cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width,
conky_window.height)
    end
    if cr then cairo_destroy(cr) end

    cr = cairo_create(cs)

round_rect(0, 0, 180, 568, 5, color01, 0.3)
round_rect(5, 5, 170, 170, 10, color01, 0.3)--(x0, y0, width, height, radius, colour, alpha)
round_rect(10, 10, 160, 160, 20, color04, 0.3)
round_rect(5, 180, 170, 100, 10, color01, 0.3)
round_rect(10, 185, 160, 90, 20, color04, 0.3)
round_rect(5, 285, 170, 100, 10, color01, 0.3)
round_rect(10, 290, 160, 90, 20, color04, 0.3)
round_rect(5, 390, 170, 100, 10, color01, 0.3)
round_rect(10, 395, 160, 90, 20, color04, 0.3)
round_rect(5, 495, 170, 68, 10, color01, 0.3)
round_rect(10, 500, 160, 58, 20, color04, 0.3)
guage_clockv2(cr, 90, 90, 170, 1, color02, color03, 0.98, 1, 1, 2)
printtext(90, 230, 170, color01, color02, 0.5)
    cairo_destroy(cr)
    cr = cairo_create(cs)
ring('cpu', 'cpu0', 100, color01, 0.1, color02, 0.2, 10, 336, 37, 5, 0, 180)
ring_ccw('memperc', '', 100, color01, 0.1, color02, 0.2, 170, 336, 37, 5, 0, 180)
ring('battery_percent', 'BAT1', 100, color01, 0.1, color02, 0.2, 10, 441, 37, 5, 0, 180)
ring_ccw('wireless_link_qual_perc', 'wlan0', 100, color01, 0.1, color02, 0.2, 170, 441, 37, 5, 0, 180)
    cairo_destroy(cr)
    cr = nil
end

function conky_cairo_cleanup()
    cairo_surface_destroy(cs)
    cs = nil
end


Cheers
Forum Netiquette

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

Sector11

Thank you Grasshopper.    ;)
Stay Home

Sector11

I gotta get more active in here.  Some really nice stuff going on.

Let me create something new first.   8)
Stay Home

jedi

#252
After a lot of tweaking and a little help from the master, Sector11, finally got it how I want it.  Credits to McLovin for the bargraph.lua used in the left hand Conky, and to mrpeachy, for his mounted.lua, and also on the right side his v9000 weather script.  Bottom right credits to VastOne, for the gmail parser and the awesome GMB Layouts!  And thanks also to jst_joe, for getting rid of the green and replacing it with blue, in my favorite wallpaper!  You'll need some fonts as well...  Google is your friend!



system conky;


######################
# - Conky settings - #
# -Based on a conky- #
# -by McLovins Bars- #
######################

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 1080
maximum_width 300

gap_x 15
gap_y 5
#####################
# - Text settings - #
#####################
use_xft yes
xftfont Santana:size=10
xftalpha .8

uppercase no

# Text alignment, other possible values are commented
#alignment middle_left
#alignment middle_middle
#alignment middle_right
#alignment top_middle
alignment top_left
#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_transparent yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_class conky-semi
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/draw-bg.lua
lua_load ~/conky/bargraph.lua
lua_draw_hook_pre main_bars
lua_load ~/conky/LUA/mounted.lua
TEXT
${lua get_mounted_data 3}#${lua conky_draw_bg 10 0 0 0 0 0x363636 0.4}
#${alignc}SYSTEM
${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}-VSIDO
${goto 6}${voffset 4}${color 547EC8}${font xspiralmental:size=14}Z${color}${font}${voffset -4}${goto 32}Kernel:${alignr}${kernel} (${execi 3600 uname -m})
${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=16}q${color}${font}${voffset -4}${goto 32}Processes:${alignr}${processes} ($running_processes running)
#${goto 6}${voffset 5}${font PizzaDude Bullets:size=14}J${font}${voffset -4}${goto 32}${voffset -4}Security updates: ${goto 285}${execi 600 /usr/lib/update-notifier/apt-check 2>&1 |cut -d ';' -f 1}
#${goto 32}Normal updates: ${goto 285}${execi 600 /usr/lib/update-notifier/apt-check 2>&1 |cut -d ';' -f 2}
${color 547EC8}${hr}${color}
${goto 6}${color 951C1C}${font Weather:size=22}x${color}${font}${goto 32}${voffset -2}Motherboard Temp: ${alignr}${hwmon temp 1}º C${font}
${goto 6}${color 951C1C}${font Weather:size=22}x${color}${font}${goto 32}${voffset -2}CPU Socket Temp: ${alignr}${hwmon temp 2}º C${font}
#${goto 6}${color 547EC8}${font PizzaDude Bullets:size=16}e${color}${font}${goto 32}${voffset -2}Physical CPU Temp: ${alignr}${hwmon temp 3}º C${font}
${color 547EC8}${hr}${color}
${goto 46}${color 547EC8}${font Poky:size=14}P${color}${voffset}${font}${voffset -4}${goto 28}${alignc}${execi 1000 cat /proc/cpuinfo | egrep -m '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=22}x${color}${font}${voffset -4}${goto 85}Physical CPU Temp: ${alignr}${goto 200}${hwmon temp 3}º C${font}
${alignc}Avg Usage of Quad Core CPU: ${cpu cpu0}%
${alignc}Load:  ${loadavg}
${goto 83}${color 951C1C}${font Weather:size=22}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=14}P${color}${font}${voffset -4}${goto 28}CPU1: ${freq_g 1}Gh ${alignr}${cpu cpu1}%
${goto 6}${color 547EC8}${font Poky:size=14}P${color}${font}${voffset -4}${goto 28}CPU2: ${freq_g 2}Gh ${alignr}${cpu cpu2}%
${goto 83}${color 951C1C}${font Weather:size=22}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=14}P${color}${font}${voffset -4}${goto 28}CPU3: ${freq_g 3}Gh ${alignr}${cpu cpu3}%
${goto 6}${color 547EC8}${font Poky:size=14}P${color}${font}${voffset -4}${goto 28}CPU4: ${freq_g 4}Gh ${alignr}${cpu cpu4}%
${goto 83}${color 951C1C}${font Weather:size=22}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=14}P${color}${font}${voffset -4}${goto 28}CPU5: ${freq_g 5}Gh ${alignr}${cpu cpu5}%
${goto 6}${color 547EC8}${font Poky:size=14}P${color}${font}${voffset -4}${goto 28}CPU6: ${freq_g 6}Gh ${alignr}${cpu cpu6}%
${goto 83}${color 951C1C}${font Weather:size=22}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=14}P${color}${font}${voffset -4}${goto 28}CPU7: ${freq_g 7}Gh ${alignr}${cpu cpu7}%
${goto 6}${color 547EC8}${font Poky:size=14}P${color}${font}${voffset -4}${goto 28}CPU8: ${freq_g 8}Gh ${alignr}${cpu cpu8}%

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

${goto 7.5}${voffset 4}${color 547EC8}${font Poky:size=15}a${color}${font}${goto 32}${voffset -10}Highest:${goto 153}CPU${alignr}RAM
${goto 32}${voffset -5.5}${color 547EC8}${hr}${color}
${voffset -1}${goto 32}${top name 1} ${goto 150}${top cpu 1}${alignr }${top mem 1}
${voffset -1}${goto 32}${top name 2} ${goto 150}${top cpu 2}${alignr }${top mem 2}
${voffset -1}${goto 32}${top name 3} ${goto 150}${top cpu 3}${alignr }${top mem 3}
${voffset -1}${goto 32}${top name 4} ${goto 150}${top cpu 4}${alignr }${top mem 4}

#${voffset -1}${alignc}   SSD
FSYS${color} = ${lua mount 1 total}${goto 100}${color8}SIZE${goto 150}${color7}FREE${goto 200}${color1}USED${goto 255}${color}MOUNT
${voffset -5} ${color 547EC8}${stippled_hr 5 1}${color}
${color6}${lua mount 1 fsys 9}${goto 100}${color8}${lua mount 1 size}${goto 150}${color7}${lua mount 1 free}${goto 200}${color1}${lua mount 1 use%}${goto 260}${color}${lua mount 1 mount}
${color6}${lua mount 2 fsys 9}${goto 100}${color8}${lua mount 2 size}${goto 150}${color7}${lua mount 2 free}${goto 200}${color1}${lua mount 2 use%}${goto 260}${color}${lua mount 2 mount}
${color6}${lua mount 3 fsys 9}${goto 100}${color8}${lua mount 3 size}${goto 150}${color7}${lua mount 3 free}${goto 200}${color1}${lua mount 3 use%}${goto 260}${color}${lua mount 3 mount}
${color6}${lua mount 4 fsys 9}${goto 100}${color8}${lua mount 4 size}${goto 150}${color7}${lua mount 4 free}${goto 200}${color1}${lua mount 4 use%}${goto 260}${color}${lua mount 4 mount}
${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=19}Q${color}${font}${goto 32}${voffset -9}Battery${alignr}${battery_percent BAT1}%
${alignc}${battery_time BAT1}
${color 547EC8}${stippled_hr 5 1}${color}
${color 547EC8}${font Poky:size=16}q${color}${font}${goto 32}${voffset -4}Updates${execpi 3600 ~/conky/header.sh}
${color 547EC8}${hr}${color}
${alignc}${color 547EC8}Live:  ${color}${execpi 900 conkyEmail --servertype=POP --servername=pop3.live.com --ssl --username=youremail --password=yourpassword --mailinfo=0}
${alignc}${color 547EC8}Hotmail:  ${color}${execpi 900 conkyEmail --servertype=POP --servername=pop3.live.com --ssl --username=youremail --password=yourpassword --mailinfo=0}



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


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 temp 1",
arg="hwmon 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=106,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for CPU Socket Temp ]--
name="hwmon temp 2",
arg="hwmon 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=133,
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},--color was 2a95b4
alarm_colour={0xff0000,0},
    alarm_led={0xff0000,1},
blocks=17,
x=187, y=275,
height=3,width=7,
angle=273,
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=185, y=268,
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=187, y=292,
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=185, y=285,
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=187, y=337,
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=185, y=330,
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=187, y=356,
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=185, y=349,
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=187, y=401,
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=185, y=394,
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=187, y=420,
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=185, y=413,
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=187, y=466,
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=185, y=459,
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=187, y=485,
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=185, y=478,
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=550,
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=62,
x=78, y=880,
height=2,width=10,
angle=90,
led_effect="e",
space=1,
cap="r",
},
{ --[ Graph for Battery power ]--
name="battery_percent",
arg="BAT1",
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=80, y=916,
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



header.sh

#!/bin/sh
# conkyheader.sh
# by Crinos512
# Usage:
#  ${execp ~/conky/Manuel318/conkyheader.sh}
#OSVer=""`lsb_release -i | cut -f 2| tr "[:upper:]" "[:lower:]"`" ( "`lsb_release -r | cut -f 2`" )"
#WMVer=`Xfwm --version`
Updates=`aptitude search "~U" | wc -l | tail`
#Conky=`\{conky_version\}}`

#echo "\${voffset -20}\${font Diamond Fantasy:style=Bold:pixelsize=20}\${alignc}\${color}\$nodename\${font}"
#echo "\${font Liberation Sans:style=Bold:pixelsize=11}\${alignc}~ \$kernel \$machine ~"
#echo "\${alignc}~ $OSVer ~ $WMVer ~"
echo "\${alignr} $Updates System Updates"
#echo "\${alignc}~ $Conky  ~"
#echo "\${alignc}~ Uptime: \$uptime_short ~\${color}\${font}"
#echo "\${voffset 0}  \${color}( Conky \${conky_version}\${alignr}\${exec conkyForecast -V} )\${color}   "
#echo "\${font Diamond Fantasy:style=Bold:pixelsize=14}\${offset 10}NUM: \${exec xset q | grep Num |awk '{print " "\$8}'}\${alignr}CAPS \${exec xset q | grep Caps |awk '{print " "\$4}'}\${font}   "
exit 0
Forum Netiquette

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

lwfitz

Wow! That looks awesome Jedi!
Don't Be A Dick!

lwfitz

#254
Ok heres my new one



Im now giving a ${voffset} AHEAD warning for Sector11  :D

Teos weather script to go along with conky_weather2 can be found here
Im using the Accuweather_Conky_USA_Images script w/ my edited images (included in the images download)

All the images can be found here


conky_system
max_specials 10000
max_user_text 15000
background no
use_xft yes
xftfont sans:size=9
xftalpha 1
total_run_times 0
own_window yes
own_window_argb_visual no
own_window_transparent yes
own_window_type desktop
own_window_title conky
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 1825 100
maximum_width 1825
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_shade_color black
default_outline_color white
alignment tl
gap_x 57
gap_y -10
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
text_buffer_size 100000
top_name_width 5
update_interval 1
default_color FFFFFF
temperature_unit fahrenheit

TEXT
${image /home/luke/Conky/amd_fx.png -s 75x75 -p 15,20}${image /home/luke/Conky/thermometer.png -s 68x83 -p 275,20}${image /home/luke/Conky/vengance.png -s 185x55 -p 365,35}${image /home/luke/Conky/ssd.png -s 90x65 -p 725,30}${image /home/luke/Conky/nvidia.png -s 70x75 -p 1340,27}${image /home/luke/Conky/router.png -s 90x65 -p 1500,25}

${voffset 8}${font WhiteRabbit:size=12}${goto 110}CPU1 ${goto 155}${cpu cpu1}% ${goto 200}CPU2 ${goto 245}${cpu cpu2}%
${voffset 5}${goto 110}CPU3 ${goto 155}${cpu cpu3}% ${goto 200}CPU4 ${goto 245}${cpu cpu4}%${voffset 6}${goto 335}${hwmon 3 temp 1}F${voffset -9}${goto 530}${mem}${goto 600} /${memmax}${voffset 12}${goto 850}/root${voffset -7}${goto 920}${fs_used /}${goto 1000} -Used${goto 1090}${voffset 7}/home${voffset -7}${goto 1165}${fs_used /home} ${goto 1242} -Used ${voffset 5}${goto 1425}${nvidia temp}F${voffset -5}${goto 1630}Download ${goto 1730}${downspeed eth0}
${voffset 3}${goto 110}CPU5 ${goto 155}${cpu cpu5}% ${goto 200}CPU6 ${goto 245}${cpu cpu6}%${voffset -3}${goto 530}${swap}${goto 600} /${swapmax}${voffset 3} ${font WhiteRabbit:size=18}${voffset -7}${font WhiteRabbit:size=12}${goto 920}${fs_size /}${goto 1000} -Total${voffset 2}${font WhiteRabbit:size=12}${goto 1165}${fs_size /home} ${goto 1242} -Total ${goto 1630}Upload ${goto 1730}${upspeed eth0}


conky_drives
max_specials 10000
max_user_text 15000
background no
use_xft yes
xftfont sans:size=9
xftalpha 1
total_run_times 0
own_window yes
own_window_argb_visual no
own_window_transparent yes
own_window_type normal
own_window_title conky
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 165 225
maximum_width 165
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_shade_color black
default_outline_color white
alignment middle_left
gap_x 10
gap_y 150
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
text_buffer_size 100000
top_name_width 5
update_interval 1
default_color FFFFFF
temperature_unit fahrenheit
short_units yes

TEXT
${image /home/luke/Conky/drive.png -s 40x45 -p 2,10}
${font WhiteRabbit:size=14}${goto 50}Software
${voffset 3}${font WhiteRabbit:size=12}${goto 50}${fs_used /media/sdb1} ${goto 108}/${fs_size /media/sdb1}${voffset -3}

${image /home/luke/Conky/drive.png -s 40x45 -p 2,65}
${font WhiteRabbit:size=14}${goto 50}External
${voffset 3}${font WhiteRabbit:size=12}${goto 50}${fs_used /media/sde5} ${goto 108}/${fs_size /media/sde5}${voffset -3}

${image /home/luke/Conky/drive.png -s 40x45 -p 2,120}
${font WhiteRabbit:size=14}${goto 50}Music
${voffset 3}${font WhiteRabbit:size=12}${goto 50}${fs_used /media/sde6} ${goto 108}/${fs_size /media/sde6}${voffset -3}

${image /home/luke/Conky/drive.png -s 40x45 -p 2,177}
${font WhiteRabbit:size=14}${goto 50}Storage
${voffset 3}${font WhiteRabbit:size=12}${goto 50}${fs_used /media/storage} ${goto 108}/${fs_size /media/storage}${voffset -3}

${image /home/luke/Conky/drive.png -s 40x45 -p 2,233}
${font WhiteRabbit:size=14}${goto 50}Videos
${voffset 3}${font WhiteRabbit:size=12}${goto 50}${fs_used /media/sdc1} ${goto 108}/${fs_size /media/sdc1}


conky_weather2
max_specials 10000
max_user_text 15000
background no
use_xft yes
xftfont sans:size=9
xftalpha 1
total_run_times 0
own_window yes
own_window_argb_visual no
own_window_transparent yes
own_window_type normal
own_window_title conky
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 350 360
maximum_width 350
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_shade_color black
default_outline_color white
alignment bottom_left
gap_x 10
gap_y 10
no_buffers yes
uppercase no
cpu_avg_samples 6
override_utf8_locale yes
text_buffer_size 100000
top_name_width 5
update_interval 1
default_color FFFFFF
temperature_unit fahrenheit
# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2
format_human_readable yes
short_units yes
update_interval 1
imlib_cache_size 0

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

# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
temperature_unit Fahrenheit

TEXT


${font WhiteRabbit:size=15}${goto 30}Temp ${goto 288}Feels${voffset 10}
${font WhiteRabbit:size=20}${goto 25}${execpi 600 sed -n '4p' $HOME/Accuweather_Conky_USA_Images/curr_cond}°F ${goto 286}${execpi 600 sed -n '5p' $HOME/Accuweather_Conky_USA_Images/curr_cond}°F
${font WhiteRabbit:size=11}${texeci 500 bash $HOME/Accuweather_Conky_USA_Images/acc_usa_images}${image $HOME/Accuweather_Conky_USA_Images/cc.png -p 75,10 -s 240x225}




${font WhiteRabbit:size=15}${goto 30}Dawn ${goto 285}Dusk
${voffset 10}${font WhiteRabbit:size=17}${goto 15}${execpi 600 sed -n '15p' $HOME/Accuweather_Conky_USA_Images/curr_cond}${goto 262}${execpi 600 sed -n '16p' $HOME/Accuweather_Conky_USA_Images/curr_cond}${voffset -10}

${font WhiteRabbit:size=13}${goto 30}${execpi 600 sed -n '6p' $HOME/Accuweather_Conky_USA_Images/tod_ton}${goto 145}${execpi 600 sed -n '11p' $HOME/Accuweather_Conky_USA_Images/tod_ton}${goto 265}${execpi 600 sed -n '16p' $HOME/Accuweather_Conky_USA_Images/tod_ton}

${font WhiteRabbit:size=10}${goto 100}${execpi 600 sed -n '9p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 215}${execpi 600 sed -n '14p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 330}${execpi 600 sed -n '19p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F
${voffset 5}${font WhiteRabbit:size=10}${goto 100}${execpi 600 sed -n '10p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 215}${execpi 600 sed -n '15p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 330}${execpi 600 sed -n '20p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${image $HOME/Accuweather_Conky_USA_Images/7.png -p 20,212 -s 80x67}${image $HOME/Accuweather_Conky_USA_Images/12.png -p 138,212 -s 80x67}${image $HOME/Accuweather_Conky_USA_Images/17.png -p 256,212 -s 80x67}${voffset -5}



${font WhiteRabbit:size=13}${goto 30}${execpi 600 sed -n '21p' $HOME/Accuweather_Conky_USA_Images/tod_ton}${goto 145}${execpi 600 sed -n '1p' $HOME/Accuweather_Conky_USA_Images/last_days}${goto 265}${execpi 600 sed -n '6p' $HOME/Accuweather_Conky_USA_Images/last_days}

${font WhiteRabbit:size=10}${goto 100}${execpi 600 sed -n '24p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 215}${execpi 600 sed -n '4p' $HOME/Accuweather_Conky_USA_Images/last_days}°F${goto 330}${execpi 600 sed -n '9p' $HOME/Accuweather_Conky_USA_Images/last_days}°F
${voffset 5}${font WhiteRabbit:size=10}${goto 100}${execpi 600 sed -n '25p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 215}${execpi 600 sed -n '5p' $HOME/Accuweather_Conky_USA_Images/last_days}°F${goto 330}${execpi 600 sed -n '10p' $HOME/Accuweather_Conky_USA_Images/last_days}°F${image $HOME/Accuweather_Conky_USA_Images/22.png -p 20,299 -s 80x67}${image $HOME/Accuweather_Conky_USA_Images/N2.png -p 138,299 -s 80x67}${image $HOME/Accuweather_Conky_USA_Images/N7.png -p 256,299 -s 80x67}${voffset -5}


conky_clock
max_specials 10000
max_user_text 15000
background no
use_xft yes
xftfont sans:size=9
xftalpha 1
total_run_times 0
own_window yes
own_window_argb_visual no
own_window_transparent yes
own_window_type normal
own_window_title conky
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 275 250
maximum_width 275
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_shade_color black
default_outline_color white
alignment middle_middle
gap_x 140
gap_y 250
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
text_buffer_size 100000
top_name_width 5
update_interval 1
default_color FFFFFF
temperature_unit fahrenheit

#### Load Lua #####
lua_load ~/Conky/chrono.lua
lua_draw_hook_pre main


TEXT
${image /home/luke/Conky/ClockFace.png -s 225x225 -p 0,0}


chrono.lua
--[[ multiple analogue clocks by mrpeachy - 18 Jun 2012
21 Jun 2012 - Chronograph modifications by Sector11
22 Jun 2012 - again with mrpeachy's help day names, numbers and month names
12 Nov 2012 - memory leak plugged - mrpeachy
14 Nov 2012 - Personnalisation - Didier-T (forum Ubuntu.fr)
26 Nov 2012 - The Clock - Sector11 (small version)

use in conkyrc

lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT

-- INDEX
-- ### CLOCK POSITION - AND DEFAULTS ###
-- ### SET BORDER OPTIONS FOR "CLOCKS" ### -- I don't know how to remove this - NOT NEEDED
--     See lines 39 to 41 for overall size changes
-- ### START DIAL B ### Day Names Dial ###
--     See Lines 84 - 87 and 131 for changes
-- ### START DIAL C ### Month Names Dial ###
--     See Lines 150 -153 and 198 for changes
-- ### START DIAL D ### Day Numbers Dial ###
--     See Lines 234 & 265 for  changes
-- ### START CLOCK A ###
--     See Lines  &  and 441 & 467 changes
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
-- CLOCK A HOUR HAND
-- CLOCK A MINUTE HAND SETUP
-- CLOCK A SECOND HAND SETUP

NOTE:  Putting ### CLOCK A ### last insures that it's functions are written
       over the other dials.
]]

require 'cairo'
-- ### CLOCK POSITION - AND DEFAULTS ##########################################
local init={
center_x=117,
center_y=112,
radius=80,
lang="English", -- English French Greek Spanish
hour=12, -- 12 | 24
second=true, --true | false - Seconds: dots and numbers IF 12HR
line=true, -- true | false - Part Second Hand
color=0xFF0000, --color for day, day number and month IF NO SECOND HAND
alpha=1 --alpha for day, day number and month IF NO SECOND HAND
}

-- ONLY NEED ONE COPY OF THIS FUNCTION
function rgb_to_r_g_b(col,alp)
  return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end
local colr, colg, colb, cola=rgb_to_r_g_b(init.color,init.alpha)

function conky_main()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)

-- ### CLOCK 12|24 HR SELECTOR ############################
local clock_type_A=init.hour
-- ############################ CLOCK 12|24 HR SELECTOR ###

-- ### SET BORDER OPTIONS FOR "CLOCKS" ####################
--local clock_border_width=0
-- set color and alpha for clock border
--local cbr,cbg,cbb,cba=1,1,1,1 -- full opaque white
-- gap from clock border to minute marks
local b_to_m=0
-- #################### SET BORDER OPTIONS FOR "CLOCKS" ###

-- ### START DIAL B ### Day Names Dial ####################
-- DIAL POSITION
local center_x=init.center_x
local center_y=init.center_y
local radius=22
-- FONT
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 14)
-- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Sun","Mon","Tue","Wed","Thr","Fri","Sat",} end
if init.lang == "French" then text_days={"dim","lun","mar","mer","jeu","ven","sam",} end
if init.lang == "Greek" then text_days={"ΔΕΥ","ΤΡΙ","ΤΕΤ","ΠΕΜ","ΠΑΡ","ΣΑΒ","ΚΥΡ",} end
if init.lang == "Spanish" then text_days={"dom","lun","mar","mie","jue","vie","sab",} end

local day_number=tonumber(os.date("%w"))
if init.handday == true then
  for i=1,7 do
-- work out points
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)   
  end
else
  for i=1,7 do -- working out points
    if day_number == i-1 then
      cairo_set_source_rgba (cr,0,1,1,0) -- active colour
    else
      cairo_set_source_rgba (cr,1,1,1,0.0) -- non-active day names
    end
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
-- INNER POINTS POSITION, radius smaller than text circle
  local radius=7
  for i=1,7 do
    if day_number == i-1 then
      cairo_set_source_rgba (cr,0,1,1,0) -- active colour
    else
      cairo_set_source_rgba (cr,1,1,1,0.0) -- non-active
    end
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
end
-- ######################################### END DIAL B ###

-- ### START DIAL C ### Month Names Dial ##################
-- DIAL POSITION
local center_x=init.center_x --(+85)
local center_y=init.center_y
local radius=53
-- FONT
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 14)
-- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",} end
if init.lang == "French" then text_days={"jan","fév","mar","avr","mai","jui","jul","aôu","sep","oct","nov","déc",} end
if init.lang == "Greek" then text_days={"ΙΑΝ","ΦΕΒ","ΜΑΡ","ΑΠΡ","ΜΑΙ","ΙΟΥ","ΙΟΥ","ΑΥΓ","ΣΕΠ","ΟΚΤ","ΝΟΕ","ΔΕΚ",} end
if init.lang == "Spanish" then text_days={"ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic",} end

local this_month=tonumber(os.date("%m"))
if init.handmonth == true then
  for i=1,12 do
-- OUTER POINTS POSTION FOR -- ### START DIAL D ## TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
else
  for i=1,12 do
    if this_month == i then
      cairo_set_source_rgba (cr,0,1,1,0) -- active month colour
    else
      cairo_set_source_rgba (cr,1,1,1,0.0) -- non-active month names
    end
-- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
-- INNER POINTS POSITION, radius smaller than text circle
  local radius=38
  for i=1,12 do
    if this_month == i then
      cairo_set_source_rgba (cr,0,1,1,0) -- active colour
else
      cairo_set_source_rgba (cr,1,1,1,0.0) -- dots for non-active month names
    end
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
end
-- ######################################### END DIAL C ###

-- ### START DIAL D ### Day Numbers Dial ##################
-- GET NUMBER OF DAYS IN CURRENT MONTH
-- calculate Feb, then set up table
year4num=os.date("%Y")
t1=os.time({year=year4num,month=03,day=01,hour=00,min=0,sec=0});
t2=os.time({year=year4num,month=02,day=01,hour=00,min=0,sec=0});
if init.hour == 12 then
  febdaynum=tonumber((os.difftime(t1,t2))/(12*60*60))
else
  febdaynum=tonumber((os.difftime(t1,t2))/(24*60*60))
end
-- MONTH TABLE
monthdays={31,febdaynum,31,30,31,30,31,31,30,31,30,31}
this_month=tonumber(os.date("%m"))
number_days=monthdays[this_month]
-- TEXT positioning
local center_x=init.center_x
local center_y=init.center_y
local radius=85
cairo_select_font_face (cr, "Liquid Crystal", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 20)
local this_day=tonumber(os.date("%d"))
  for i=1,number_days do
-- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/number_days)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
    --only print even numbers
    if math.mod(i, 2) == 0 and math.mod(this_day, 2)==0 then
    text=string.format("%02d",i) --formats numbers to double digits
    elseif math.mod(i, 2) ~= 0 and math.mod(this_day, 2)~=0 then
    text=string.format("%02d",i) --formats numbers to double digits
    else
    text=""
    end --odd even matching
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
if i==this_day then
     cairo_set_source_rgba (cr,0,1,1,0) -- active colour
else
cairo_set_source_rgba (cr,1,1,1,0) -- dim inactive numbers
end
     cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
     cairo_show_text (cr, text)
     cairo_stroke (cr)
  end
-- INNER POINTS POSITION, radius smaller than text circle
  local radius=70
  for i=1,number_days do
    local point=(math.pi/180)*((360/number_days)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
if i==this_day then
     cairo_set_source_rgba (cr,0,1,1,0) -- active colour
else
cairo_set_source_rgba (cr,0,0,1,.0) -- dim the points
end
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
-- ######################################### END DIAL D ###

-- ### START CLOCK A ######################################
-- SET MARKS ###
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
local number_marks_A=init.hour
-- set mark length
local m_length_A=0 -- doesn't work but can't delete
-- set mark width
local m_width_A=0 -- doesn't work but can't delete
-- set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
-- set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,1,0 -- opaque white -- doesn't work but can't delete
-- SETUP HOUR HANDS ###
-- CLOCK A HOUR HAND
hh_length_A=65
-- set hour hand width
hh_width_A=4
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
-- hhr,hhg,hhb,hha=1,0,1,0 -- fully opaque white --doesn't work
-- SETUP MINUTE HANDS ###
-- CLOCK A MINUTE HAND SETUP
-- set length of minute hand
mh_length_A=85
-- set minute hand width
mh_width_A=4
-- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
-- set minute hand color
--mhr,mhg,mhb,mha=1,1,1,0.5 -- fully opaque white --doesn't work

-- SETUP SECOND HAND ###
-- CLOCK A SECOND HAND SETUP -- DOESN'T WORK - Why ???????????????????????????
-- set length of seconds hand -- yes I know it is commented out!
--sh_length_A=150
-- set hour hand width
--sh_width_A=2
-- set hour hand line cap
--sh_cap=CAIRO_LINE_CAP_ROUND
-- set seconds hand color
--shr,shg,shb,sha=1,0,0,1 -- fully opaque red

-- PART SECOND HAND
--position
--get seconds value
local seconds=tonumber(os.date("%S"))
--calculate rotation of second hand in degrees
if init.line == true then
  local arc=(math.pi/180)*((360/60)*seconds)
  --calculate point 1
  local radius1=100
  local x1=0+radius1*math.sin(arc)
  local y1=0-radius1*math.cos(arc)
  --calculate point 2
  local radius2=107
  local x2=0+radius2*math.sin(arc)
  local y2=0-radius2*math.cos(arc)
  --draw line connecting points
  cairo_move_to (cr, center_x+x1,center_y+y1)
  cairo_line_to (cr, center_x+x2, center_y+y2)
  cairo_set_source_rgba (cr,255/255,255/255,255/255,1) -- PART SECOND HAND
  cairo_stroke (cr)
end

-- CLOCK A ### 12 HR TIME ###
-- CLOCK SETTINGS
clock_radius=0 --does not work
clock_centerx=init.center_x -- centre of Clock hands
clock_centery=init.center_y -- centre of Clock hands
-- DRAWING CODE
-- DRAW MARKS
-- stuff that can be moved outside of the loop, needs only be set once
-- calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length_A -- WHAT IS THIS??
-- set line cap type
cairo_set_line_cap  (cr, m_cap)
-- set line width
cairo_set_line_width (cr,m_width_A)
-- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
-- START LOOP FOR HOUR MARKS
for i=1,number_marks_A do
-- drawing code using the value of i to calculate degrees
-- calculate start point for 12/24 hour mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
-- calculate end point for 12/24 hour mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- draw the line
cairo_stroke (cr)
end -- of for loop
-- HOUR MARKS -- ???????????????????????????????????????????????????????????????
-- TIME CALCULATIONS CLOCK A
if clock_type_A==12 then
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
elseif clock_type_A==24 then
hours=tonumber(os.date("%H"))
-- convert hours to seconds
h_to_s=hours*60*60
end
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- DRAW HOUR HAND ###
-- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*clock_type_A)) -- use equation ~ eliminate decimals
-- set radius to calculate hand points
radius=hh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of hour hand
point=(math.pi/180)*hsec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,hh_width_A)
cairo_set_source_rgba (cr,1,1,1,.75) -- active colour Hour Hand ================
cairo_set_line_cap  (cr, hh_cap)
cairo_stroke (cr)
-- DRAW MINUTE HAND
-- get minutes and seconds just as seconds
msecs=m_to_s+seconds
-- calculate degrees for each second
msec_degs=msecs*0.1
-- set radius to calculate hand points
radius=mh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of minute hand
point=(math.pi/180)*msec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,mh_width_A)
cairo_set_source_rgba (cr,1,1,1,.75) -- active colour Minute Hand ==============
cairo_set_line_cap  (cr, mh_cap)
cairo_stroke (cr)
-- ### CLOCK A ###
local center_x=init.center_x -- Centre of the HR / Min Numbers
local center_y=init.center_y -- Centre of the HR / Min Numbers
local radius=init.radius -- 12/24 HR CLOCK Hours/Minutes radius -- seeline 42
cairo_select_font_face (cr, "WhiteRabbit", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 25)
cairo_set_source_rgba (cr,1,1,1,0) -- HR Clock numbers
-- TABLE OF TEXT -- in order
if init.hour == 12 then
  text_days={"12","01","02","03","04","05","06","07","08","09","10","11",}
  for i=1,12 do
-- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_set_source_rgba (cr,1,1,1,0)
    cairo_stroke (cr)
  end
-- INNER POINTS POSITION, radius smaller than text circle
  local radius=111 -- 12 HR Clock
  for i=1,12 do
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_set_source_rgba (cr,1,1,1,0)
    cairo_stroke (cr)
  end
end
if init.hour == 24 then
  text_days={"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23",}
  for i=1,24 do
-- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/24)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
-- INNER POINTS POSITION, radius smaller than text circle
  local radius=99 -- 24 HR Clock
  for i=1,24 do
    local point=(math.pi/180)*((360/24)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_set_source_rgba (cr,1,1,1,0)
    cairo_stroke (cr)
  end
end

-- ############################################################################
-- POSITION FOR TEXT HOUR NUMBERS
  if init.hour == 12 and init.second == true then
    text_days={"","01","02","03","04","","06","07","08","09","","11","12","13","14","","16","17","18","19","","21","22","23","24","","26","27","28","29","","31","32","33","34","","36","37","38","39","","41","42","43","44","","46","47","48","49","","51","52","53","54","","56","57","58","59","",}
-- INNER POINTS POSITION, radius smaller than text circle
    cairo_set_source_rgba (cr,1,1,1,.5) -- does not work -- settings moved
    cairo_select_font_face (cr, "WhiteRabbit", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
    for i=1,60 do
      local radius=99 -- dots for seconds A Clock
      local point=(math.pi/180)*((360/60)*(i-1))
      local x=0+radius*(math.sin(point))
      local y=0-radius*(math.cos(point))
      if seconds == i-1 then
        cairo_set_source_rgba (cr,255/255,0/255,0/255,0) -- does not work - settings moved
      else
        if i-1 == 0 or i-1 == 5 or i-1 == 10 or i-1 == 15 or i-1 == 25 or i-1 == 30 or i-1 == 35 or i-1 == 40 or i-1 == 45 or i-1 == 50 or i-1 == 55 then
          cairo_set_source_rgba (cr,1,1,1,0) -- active colour
        else
          cairo_set_source_rgba (cr,1,1,1,0) -- dots for seconds A Clock
        end
      end
      cairo_arc (cr,center_x+x,center_y+y,1/2,0,2*math.pi)
      cairo_stroke (cr)
    end
    radius=radius-3
    cairo_set_font_size (cr, 9)
    for i=1,60 do
-- OUTTER POINTS POSTION FOR TEXT
      local point=(math.pi/180)*((360/60)*(i-1))
      local x=0+radius*(math.sin(point))
      local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
      local text=text_days[i]--gets text from table
      if seconds == tonumber(text) then
      cairo_set_source_rgba (cr,1,1,1,0) -- active colour
      else
        cairo_set_source_rgba (cr,1,1,1,0) -- seconds numbers
      end
      cairo_text_extents(cr,text,extents)
      local width=extents.width
      local height=extents.height
      cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
      cairo_show_text (cr, text)
      cairo_stroke (cr)
    end
  end
-- ############################################################################
cairo_stroke (cr)
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end -- end main function
Don't Be A Dick!