SEARCH

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

You are not logged in.

#7426 2014-04-24 22:17:26

Marenbraga
Member
Registered: 2013-11-14
Posts: 40

Re: Conky v1.9 Thread

Sector11 wrote:

And being a CAALI    (Conky Addict And Loving It) I had to play with it.

default_bar_size 0 12
TEXT
${alignc}${membar 1,30} use execbar ${membar 1,30}
20  ${execbar echo 20}
40  ${execbar echo 40}${goto 150}${voffset -1}${color5}pvsage's idea${color}${voffset 1}
60  ${execbar echo 60}
80  ${execbar echo 80}
100 ${execbar echo 100}${goto 50}${voffset -1}${color 000000}pvsage's idea${color}${voffset 1}
${hr 10}${goto 20}${voffset 2}${color 000000}and great one too!${color}${voffset -2}

http://s20.postimg.org/jpvcp5k0d/2014_04_24_19_04_39_300x809_Sector11.jpg

Now that's a keeper pvsage, Thank you!

Already I have ideas forming in my head ....

kkkkkkkkkkkkkkkkkkkkkk
LOL!
ConkyManiac!!!!

Offline

Be excellent to each other!

#7427 2014-04-24 22:29:02

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

Re: Conky v1.9 Thread

Marenbraga wrote:

WOW... do you have the conky's code from that photo?

Sure ... it's my "test" conky ... never the same for long so the 'code' is a real mess - but I think you are interested in what is below TEXT.

# conky -c /media/5/conky/test.conky &
# pkill -xf "conky -c /media/5/conky/test.conky" &

###  Begin Window Settings  ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager
#own_window_colour gray
own_window_class Conky
own_window_title A blank test

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

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

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

#minimum_size 1900 0  # w|h
maximum_width 300

gap_x 20	# l|r
gap_y 20	# u|d

alignment tl
####################################################  End Window Settings  ###
###  Font Settings  ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont monofur:bold:size=10
#xftfont Anonymous Pro:bold:size=9
#xftfont Anonymous Pro:size=9
# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1.0

#font monofur:size=9

# Force UTF8? requires XFT ###
override_utf8_locale yes

uppercase no
######################################################  End Font Settings  ###
###  Color Settings  #########################################################
draw_shades yes ##yes
default_shade_color 000000
draw_outline no
default_outline_color 000000

default_color DCDCDC #220 220 220	Gainsboro
#default_color C0C0C0 #192 192 192 Silver
#default_color B0E0E6 #176 224 230 PowderBlue
#default_color D8BFD8 #216 191 216 Thistle
color0 8FBC8F #DarkSeaGreen
#color1 C0C0C0 # Silver
#color1 D3D3D3 #LightGrey
color1 778899 #LightSlateGray
color2 F5F5DC #Beige
color3 87CEFA #LightSkyBlue
#color3 87CEFA #E0FFFF #LightCyan
color4 48D1CC #MediumTurquoise
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 B0E0E6 #PowderBlue
#color7 5F9EA0 #CadetBlue
#color8 FFFFE0 #LightYellow
color8 FFD700 #Gold
#color8 F0E68C #Khaki
color9 FFA07A #LightSalmon
#color9 CD5C5C #IndianRed
#color9 FF0000 #Red
#####################################################  End Color Settings  ###
###  Borders Section  ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 05
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders yes #no
#default_graph_size 15 40
#####################################################  End Borders Secton  ###
###  Miscellaneous Section  ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background yes

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

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

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

# change GiB to G and MiB to M
short_units yes

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

# Imlib2 image cache size, in bytes. Default 4MiB Increase this value if you use
# $image lots. Set to 0 to disable th0e image cache.
imlib_cache_size 0

#default_bar_size 0 10

#   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
##############################################  End Miscellaneous Section  ###
###  LUA Settings  ###########################################################
## Above and After TEXT - requires a composite manager or blinks.
##
# lua_load /media/5/Conky/LUA/draw-bg.lua
#TEXT
# ${lua conky_draw_bg 125 0 0 0 0 0x000000 0.2}
#
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
## OR Both above TEXT (No composite manager required - no blinking!)
#
#--------------------------------
lua_load /media/5/Conky/LUA/draw-bg.lua
lua_draw_hook_pre draw_bg 10 0 0 0 0 0xffffff 0.05
#lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.5

#lua_draw_hook_post draw_bg 10 0 0 0 0 0xffffff 0.5
#lua_draw_hook_post draw_bg 10 0 0 0 0 0x000000 0.5
#
# TEXT
# ${lua conky_draw_bg 20 0 0 0 0 0x000000 0.2}
##
#
############### V9000 ########################################################
#starts the lua weather data gathering function, call once at top of conkyrc
#lua_load ~/v9000/v9000.lua
#lua_draw_hook_post weather
#lua_load /media/5/Conky/templates/cF-2013.template.lua
#lua_load /media/5/Conky/LUA/4clocks.lua
#lua_draw_hook_pre main
#######################################################  End LUA Settings  ###

##OS: ${pre_exec lsb_release -sd}
##OS: ${pre_exec lsb_release -si} ${pre_exec lsb_release -sr} ${pre_exec lsb_release -sc}

update_interval 1

default_bar_size 0 12
TEXT
${time %T}        ${if_match ${desktop}==1}${color6}${endif}•${color} ${if_match ${desktop}==2}${color6}${endif}•${color} ${if_match ${desktop}==3}${color6}${endif}•${color} ${if_match ${desktop}==4}${color6}${endif}•${color} ${if_match ${desktop}==5}${color6}${endif}•${color}        ${time %x}
${alignc}CPU % Usage:
${alignc}1  |  2  |  3  |  A
${alignc}${if_match ${cpu cpu1}<10}00${cpu cpu1}\
${else}${if_match ${cpu cpu1}<100}0${cpu cpu1}\
${else}${color9}${cpu cpu1}${endif}${endif}\
 | ${if_match ${cpu cpu2}<10}00${cpu cpu2}\
${else}${if_match ${cpu cpu2}<100}0${cpu cpu2}\
${else}${color9}${cpu cpu2}${endif}${endif}\
 | ${if_match ${cpu cpu3}<10}00${cpu cpu3}\
${else}${if_match ${cpu cpu3}<100}0${cpu cpu3}\
${else}${color9}${cpu cpu3}${endif}${endif}\
 | ${if_match ${cpu cpu0}<10}00${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100}0${cpu cpu0}\
${else}${cpu cpu0}${endif}${endif}

${alignc}${if_match ${desktop}==1}${color6}${endif}•${color} ${if_match ${desktop}==2}${color6}${endif}•${color} ${if_match ${desktop}==3}${color6}${endif}•${color} ${if_match ${desktop}==4}${color6}${endif}•${color} ${if_match ${desktop}==5}${color6}${endif}•${color}

=== The conky weather command ===
${color7}Temperature:    ${color}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE temperature}°C
${color7}Cloud Cover:    ${color}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE cloud_cover}
${color7}Pressure        ${color}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE pressure} mb
${color7}Wind Speed:     ${color}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE wind_speed} km/h
${color7}Wind Direction: ${color}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE wind_dir} @ ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE wind_dir_DEG}${color}°
${color7}Humidity:       ${color}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE humidity}%
${color7}Last Update:    ${color}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE last_update}${font}

   ${exec /media/5/conky/binary-time.sh}
   ${time %k}${goto 79}:${time %M}${goto 134}:${time %S}
# see alias wd500
${execi 86400 lsblk -o name,mountpoint,size}


${alignc}${membar 1,30} use membar ${membar 1,30}
${font :size=1}${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}${font}

${font :size=1}${color}${membar 1,0}
${membar 1,0}
${membar 1,0}${color 000000}
${membar 1,0}
${membar 1,0}${color}
${membar 1,0}
${membar 1,0}${color 000000}
${membar 1,0}
${membar 1,0}${color}
${membar 1,0}
${membar 1,0}${color 000000}
${membar 1,0}
${membar 1,0}${color}
${membar 1,0}
${membar 1,0}${font}

${membar 0,100}
${membar 0,0}

${membar 1,100}
${membar 1,0}

${membar 2,100}
${membar 2,0}

${alignc}${membar 1,30} use execbar ${membar 1,30}
20  ${execbar echo 20}
40  ${execbar echo 40}${goto 150}${voffset -1}${color5}pvsage's idea${color}${voffset 1}
60  ${execbar echo 60}
80  ${execbar echo 80}
100 ${execbar echo 100}${goto 50}${voffset -1}${color 000000}pvsage's idea${color}${voffset 1}
${hr 10}${goto 20}${voffset 2}${color 000000}and great one too!${color}${voffset -2}

draw-bg.lua

--[[Background originally by londonali1010 (2009)
    ability to set any size for background mrpeachy 2011
    ability to set variables for bg in conkyrc dk75

  the change is that if you set width and/or height to 0
  then it assumes the width and/or height of the conky window

so:

Above and After TEXT  (requires a composite manager or it blinks!)

 lua_load ~/wea_conky/draw_bg.lua
 TEXT
 ${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}

OR Both above TEXT (no composite manager required - no blinking!)

 lua_load ~/wea_conky/draw_bg.lua
 lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.2
 TEXT

Note
${lua conky_draw_bg 20 0 0 0 0 0x000000 0.2}
  See below:        1  2 3 4 5 6        7

${lua conky_draw_bg corner_radius x_position y_position width height color alpha}

covers the whole window and will change if you change the minimum_size setting

1 = 20             corner_radius
2 = 0             x_position
3 = 0             y_position
4 = 0             width
5 = 0             height
6 = 0x000000      color
7 = 0.4           alpha

######### calendar function ##################################################

then to use it, you activate the calendar function BELOW TEXT like this

${lua luacal {settings}}

#${lua luacal {x=,y=,tf="",tfs=,tc=,ta=,bf="",bfs=,bc=,ba=,hf="",hfs=,hc=,ha=,sp="",gh=,gt=,gv=,sd=}}
#    x=x position top left
#    y=y position top left
#    tf=title font, eg "mono" must be in quotes
#    tfs=title font size
#    tc=title color
#    ta=title alpha
#    bf=body font, eg "mono" must be in quotes
#    bfs=body font size
#    bc=body color
#    ba=body alpha
#    hf=highlight font, eg "mono" must be in quotes
#    hfs=highlight font size
#    hc=highlight color
#    ha=highlight alpha
#    sp=spacer, eg " " or sp="0"... 0,1 or 2 spaces can help with positioning of non-monospaced fonts

#    gt=gap from title to body
#    gh=gap horizontal between columns
#    gv=gap vertical between rows
#    sd=start day, 0=Sun, 1=Mon

#    hstyle = heading style, 0=just days, 1=date insert
#    tdf=title date font, eg "mono" must be in quotes
#    tdfs=title date font size
#    tdc=title date color
#    tda=title date alpha

# test line
-- ${lua luacal {x=40,y=40,tf="Monofur",tfs=24,tc=0xFFDEAD,ta=1,bf="Monofur",bfs=24,bc=0xFFDEAD,ba=1,hf="Monofur",hfs=24,hc=0x00BFFF,ha=1,sp=" ",gh=40,gt=25,gv=20,sd=0,hstyle=1,tdf="Monofur",tdfs=24,tdc=0x00BFFF,tda=1}}


]]

require 'cairo'
local    cs, cr = nil
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function conky_draw_bg(r,x,y,w,h,color,alpha)
if conky_window == nil then return end
if cs == nil then cairo_surface_destroy(cs) end
if cr == nil then cairo_destroy(cr) end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
w=w
h=h
if w=="0" then w=tonumber(conky_window.width) end
if h=="0" then h=tonumber(conky_window.height) end
cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
--top left mid circle
local xtl=x+r
local ytl=y+r
--top right mid circle
local xtr=(x+r)+((w)-(2*r))
local ytr=y+r
--bottom right mid circle
local xbr=(x+r)+((w)-(2*r))
local ybr=(y+r)+((h)-(2*r))
--bottom right mid circle
local xbl=(x+r)
local ybl=(y+r)+((h)-(2*r))
-----------------------------
cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_fill (cr)
------------------------------------------------------------
cairo_surface_destroy(cs)
cairo_destroy(cr)
return ""
end
-- ###### calendar function ##################################################
function conky_luacal(caltab) -- {x=,y=,tf="",tfs=,tc=,ta=,bf="",bfs=,bc=,ba=,hf="",hfs=,hc=,ha=,sp="",gt=,gh=,gv=,sd=,hstyle=,tdf=,tdfs=,tdc=,tda=}
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
--############################################################################
if caltab.x==nil then
caltab=loadstring("return" .. caltab)()
end
local cal_x=caltab.x
local cal_y=caltab.y
local tfont=caltab.tf		or "mono"
local tfontsize=caltab.tfs	or 12
local tc=caltab.tc			or 0xffffff
local ta=caltab.ta			or 1
local bfont=caltab.bf		or "mono"
local bfontsize=caltab.bfs	or 12
local bc=caltab.bc			or 0xffffff
local ba=caltab.ba			or 1
local hfont=caltab.hf		or "mono"
local hfontsize=caltab.hfs	or 12
local hc=caltab.hc			or 0xff0000
local ha=caltab.ha			or 1
local spacer=caltab.sp		or " "
local gaph=caltab.gh		or 20
local gapt=caltab.gt		or 15
local gapl=caltab.gv		or 15
local sday=caltab.sd		or 0
local hstyle=caltab.hstyle	or 0
--convert colors
--local font=string.gsub(font,"_"," ")
local tred,tgreen,tblue,talpha=rgb_to_r_g_b(tc,ta)
--main body text color
local bred,bgreen,bblue,balpha=rgb_to_r_g_b(bc,ba)
--highlight text color
local hred,hgreen,hblue,halpha=rgb_to_r_g_b(hc,ha)
--############################################################################
--calendar calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time( {    year=year,month=03,day=01,hour=00,min=0,sec=0} );
local t2 = os.time( {    year=year,month=02,day=01,hour=00,min=0,sec=0} );
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={ 31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
local day=tonumber(os.date("%w"))+1-sday
local day_num = today
local remainder=day_num % 7
local start_day=day-(day_num % 7)
if start_day<0 then start_day=7+start_day end
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
local x=mdays+start_day
local dnum={}
local dnumh={}
if mdays+start_day<36 then
dlen=35
plen=29
else
dlen=42
plen=36
end
for i=1,dlen do
    if i<=start_day then
    dnum[i]="  "
    else
    dn=i-start_day
        if dn=="nil" then dn=0 end
        if dn<=9 then dn=(spacer .. dn) end
        if i>x then dn="" end
        dnum[i]=dn
        dnumh[i]=dn
        if dn==(spacer .. today) or dn==today then
        dnum[i]=""
        end
        if dn==(spacer .. today) or dn==today then
        dnumh[i]=dn
        place=i
        else dnumh[i]="  "
        end
    end
end--for
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
if hstyle==0 then
    if tonumber(sday)==0 then
    dys={"SU","MO","TU","WE","TH","FR","SA"}
    else
    dys={"MO","TU","WE","TH","FR","SA","SU"}
    end
    --draw calendar titles
elseif hstyle==1 then
    if tonumber(sday)==0 then
    dys={"SU","MO"," ","  ","  ","FR","SA"}
    cairo_text_extents(cr,"MO",extents)
    local s=extents.x_advance+gaph
    local f=gaph*5
    local tdfont=caltab.tdf        or "mono"
    local tdfontsize=caltab.tdfs    or 12
    local tdc=caltab.tdc        or 0xffffff
    local tda=caltab.tda        or 1
    cairo_select_font_face (cr, tdfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (cr, tdfontsize);
    local tdred,tdgreen,tdblue,tdalpha=rgb_to_r_g_b(tdc,tda)
    cairo_set_source_rgba (cr,tdred,tdgreen,tdblue,tdalpha)
    local insert=os.date("%b %y")
    cairo_text_extents(cr,insert,extents)
    local w=extents.x_advance
    cairo_move_to (cr, cal_x+((s+f)/2)-(w/2), cal_y)
    cairo_show_text (cr,insert)
    cairo_stroke (cr)
    else
    dys={"MO","TU"," ","  ","  ","SA","SU"}
    cairo_text_extents(cr,"TU",extents)
    local s=extents.x_advance+gaph
    local f=gaph*5
    local tdfont=caltab.tdf        or "mono"
    local tdfontsize=caltab.tdfs    or 12
    local tdc=caltab.tdc        or 0xffffff
    local tda=caltab.tda        or 1
    cairo_select_font_face (cr, tdfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (cr, tdfontsize);
    local tdred,tdgreen,tdblue,tdalpha=rgb_to_r_g_b(tdc,tda)
    cairo_set_source_rgba (cr,tdred,tdgreen,tdblue,tdalpha)
    local insert=os.date("%b %y")
    cairo_text_extents(cr,insert,extents)
    local w=extents.x_advance
    cairo_move_to (cr, cal_x+((s+f)/2)-(w/2), cal_y)
    cairo_show_text (cr,insert)
    cairo_stroke (cr)
    end
end
--draw calendar titles
for i=1,7 do
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
cairo_move_to (cr, cal_x+(gaph*(i-1)), cal_y)
cairo_show_text (cr, dys[i])
cairo_stroke (cr)
end
--draw calendar body
cairo_select_font_face (cr, bfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, bfontsize);
cairo_set_source_rgba (cr,bred,bgreen,bblue,balpha)
for i=1,plen,7 do
local fn=i
    for i=fn,fn+6 do
    cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
    cairo_show_text (cr, dnum[i])
    cairo_stroke (cr)
    end
end
--highlight
cairo_select_font_face (cr, hfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, hfontsize);
cairo_set_source_rgba (cr,hred,hgreen,hblue,halpha)
for i=1,plen,7 do
local fn=i
    for i=fn,fn+6 do
    cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
    cairo_show_text (cr, dnumh[i])
    cairo_stroke (cr)
    end
end
--############################################################################
caltab=nil
dlen=nil
plen=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end
-- end main function #########################################################

2014_04_24_19_16_34_342x854_Sector11.jpg

A few things to take note of:

1. this setup requires a 'mono' font for most of it, I use monofur
2. ${time %T} = 24 hour time | ${time %X} uses the system default -> 02:36 or 14:36 or 02.36 or 14.36 or whatever.  big_smile
3. ${time %x} uses system default for date.

Enjoy


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

Offline

#7428 2014-04-24 22:30:41

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

Re: Conky v1.9 Thread

Marenbraga wrote:

kkkkkkkkkkkkkkkkkkkkkk
LOL!
ConkyManiac!!!!

Yup, that's me, and proud of it too!


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

Offline

#7429 2014-04-26 20:32:22

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

Re: Conky v1.9 Thread

With my thanks to Marenbraga for asking and getting some sparks flying and to pvsage for fanning the flames the "bar-text-bar" page at Conky PitStop has been updated.
Bar_TXT_Bar.jpg «- click to enlarge
All the code to do this is up at CPS.

I need to get more active over there.


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

Offline

#7430 2014-04-27 05:25:54

chepioq
#! Member
Registered: 2013-01-09
Posts: 79

Re: Conky v1.9 Thread

Thank Marenbraga for your bar-text-bar.

I update my conky with that and it's look better: 1398576228.jpg


background no
font 6x10
use_xft yes
xftfont MgOpen Modata L:size=7:bold
update_interval 1
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_argb_visual yes
own_window_hints undecorate,skip_taskbar,skip_pager,below
double_buffer yes
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
#stippled_borders 8
#border_inner_margin 4
#border_width 1
default_color white
default_shade_color black
default_outline_color black
alignment top_right
gap_x 12
gap_y 250
no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
use_spacer right
text_buffer_size 1024

color7 00FF00
color8 FF8000
color9 FF0000

TEXT
${font Waltograph UI:size=12:bold} ${alignc} ${color cf1c00}${execi 1800 lsb_release -irs} ${execi 1800 lsb_release -d | awk '{print $5,$6}' | tr -d "[()]"}

${font} ${alignc} ${color #cd5555}Kernel : ${color #11B3F8}${execi 1800 uname -r}
${alignc}${color #cd5555}Démarrage : ${color #11B3F8}${execi 1800 systemd-analyze time | awk '{print $13}'}
#${alignc}${color #cd5555}Système de fichiers ouvert depuis: ${color #11B3F8}$uptime
${color cf1c00}${alignc}${membar 0,170} ${color #11B3F8}CPU ${color cf1c00}${membar 0,170}
${alignc}${color #cd5555}Processeur : ${color #11B3F8}${execi 1800 grep -i -m 1 'Model name' /proc/cpuinfo |sed  's/^.*: //'| sed -e 's/([^()]*)//g' }
${alignc}${color #cd5555}Pilote : ${color #11B3F8}${execi 1800 cpupower frequency-info |grep pilote | awk '{print $3}'}
${color #cd5555}Fréquence CPU 1 : ${color #11B3F8}${freq 1} MHz ${goto 200}${color #cd5555}Fréquence CPU 2 : ${color #11B3F8}${freq 2} MHz
${color #cd5555}Fréquence CPU 3 : ${color #11B3F8}${freq 3} MHz ${goto 200}${color #cd5555}Fréquence CPU 4 : ${color #11B3F8}${freq 4} MHz
${color #0000ff}${cpugraph cpu1 20,181 00ff00 ff0004 -t} ${color #0000ff}${cpugraph cpu2 20,181 00ff00 ff0004 -t}
${color #0000ff}${cpugraph cpu3 20,181 00ff00 ff0004 -t} ${color #0000ff}${cpugraph cpu4 20,181 00ff00 ff0004 -t}
${color #cd5555}Utilisation Core 1 :          ${color #11B3F8}${cpu cpu1}%${goto 200}${color #cd5555}Utilisation Core 2 :          ${color #11B3F8}${cpu cpu2}%
${color #cd5555}Utilisation Core 3 :          ${color #11B3F8}${cpu cpu3}%${goto 200}${color #cd5555}Utilisation Core 4 :          ${color #11B3F8}${cpu cpu4}%
${color #cd5555}Température Core 1 :    ${execpi 6 sensors | awk '/Core 0/ {gsub(/\+/,"",$3); gsub(/\..+/,"",$3); print $3}' | xargs /home/dominique/.conkyrc/colorizeCPU.sh}°C${goto 200}${color #cd5555}Température Core 2 :    ${color #11B3F8}${execpi 6 sensors | awk '/Core 1/ {gsub(/\+/,"",$3); gsub(/\..+/,"",$3); print $3}' | xargs /home/dominique/.conkyrc/colorizeCPU.sh}°C
${color cf1c00}${alignc}${membar 0,170} ${color #11B3F8}GPU ${color cf1c00}${membar 0,170}
${alignc}${color #cd5555}Carte Graphique :  ${color #11B3F8}${execi 1800 nvidia-settings -q gpus |grep '0] (' | cut -d '(' -f 2,2 | sed -e 's/.\{1\}$//'}
${alignc}${color #cd5555}Pilote NVidia : ${color #11B3F8}${execi 1800 nvidia-settings -q NvidiaDriverVersion | grep gpu |  awk '{print $4}'}
${alignc}${color #cd5555}Température GPU :     ${color #11B3F8}${execpi 6 nvidia-settings -q all | grep GPUCoreTemp | grep gpu:0 | awk '{print $4}' | cut -c 1-2 | xargs /home/dominique/.conkyrc/colorizeGpu.sh}°C 
${color cf1c00}${alignc}${membar 0,170} ${color #11B3F8}DD ${color cf1c00}${membar 0,170}
${alignc}${color #cd5555} Disque dur : ${color #11B3F8} Samsung SSD 840 PRO 256 Go
${alignc}${color #cd5555}Accès disque
${color #cd5555}${goto 70}Lecture : ${color #11B3F8}${diskio_read} ${color #cd5555}${goto 250}Ecriture : ${color #11B3F8}${diskio_write} 
${diskiograph_read 20,181 00ff00 ff0000 -t} ${diskiograph_write 20,181 00ff00 ff0000 -t}
${color cf1c00}${alignc}${membar 0,170} ${color #11B3F8}RAM ${color cf1c00}${membar 0,170}
${color #cd5555}Utilisation RAM ${color #176e88}${alignc}             Totale              Utilisée          Pourcentage
${alignc} ${color #11B3F8}${goto 120}$memmax${goto 195}$mem${goto 290}$memperc%
${color #0000ff}${memgraph 20,364 00ff00 ff0004 -t}
${color #cd5555}Utilisation Swap :   ${color #11B3F8} $swap/$swapmax - $swapperc% ${color #00f5ff} ${swapbar 8,165}
${color cf1c00}${alignc}${membar 0,160} ${color #11B3F8}RESEAU ${color cf1c00}${membar 0,160}
${color #cd5555}Internet :
${color #176e88}Reception:${color #ff4500} ${downspeedf p5p1} k/s${goto 200}${color #11B3F8}Envoi: ${color #ff4500}${upspeedf p5p1} k/s
${color #176e88}Total :       ${color #ff4500} ${totaldown p5p1}${goto 200}${color #11B3F8}Total:${color #ff4500} ${totalup p5p1}
${color #0000ff}${downspeedgraph p5p1 20,181 00ff00 ff0004 -t} ${color #22ccff}${upspeedgraph p5p1 20,181 00ff00 ff0004 -t}
${color cf1c00}${alignc}${membar 0,130} ${color #11B3F8}SYSTEME DE FICHIERS ${color cf1c00}${membar 0,120}
${color #cd5555}Système ${color #11B3F8} ${fs_used /} / ${fs_size /} : ${goto 160}${color #00f5ff}${fs_bar 6,208 /}
${color #cd5555}Home      ${color #11B3F8} ${fs_used /home} / ${fs_size /home} : ${goto 160}${color #00f5ff}${fs_bar 6,208 /home}
${color cf1c00}${alignc}${membar 0,170} ${color #11B3F8}TOP ${color cf1c00}${membar 0,170}
${color #cd5555}${alignc}Processus : ${color #11B3F8}$processes       ${color #11B3F8}En cours: ${color #ff4500}$running_processes
${color #176e88}En cours :       ${alignc}       PID      ${goto 180}CPU%      MEM%
${color #ff4500} ${top name 1}  ${alignc}  ${top pid 1}      ${goto 180}${top cpu 1}      ${top mem 1}
${color #11B3F8} ${top name 2}  ${alignc}  ${top pid 2}      ${goto 180}${top cpu 2}      ${top mem 2}
${color #11B3F8} ${top name 3}  ${alignc}  ${top pid 3}      ${goto 180}${top cpu 3}      ${top mem 3}
${color #176e88}En mémoire :
${color #ff4500} ${top_mem name 1} ${alignc}   ${top_mem pid 1}      ${goto 180}${top_mem cpu 1}      ${top_mem mem 1}
${color #11B3F8} ${top_mem name 2} ${alignc}   ${top_mem pid 2}      ${goto 180}${top_mem cpu 2}      ${top_mem mem 2}
${color #11B3F8} ${top_mem name 3} ${alignc}   ${top_mem pid 3}      ${goto 180}${top_mem cpu 3}      ${top_mem mem 3}

Offline

#7431 2014-04-27 15:26:55

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

Re: Conky v1.9 Thread

I just had a thought about drawing lines
Seems to me that execbar and echo to draw a line, while it clearly works, might not be the most efficient way

If you are using the background lua script, you should be able to set it up to give you a line which might be cheaper smile

Offline

#7432 2014-04-27 15:39:56

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

Re: Conky v1.9 Thread

mrpeachy wrote:

I just had a thought about drawing lines
Seems to me that execbar and echo to draw a line, while it clearly works, might not be the most efficient way

If you are using the background lua script, you should be able to set it up to give you a line which might be cheaper smile

OH!!!  Yea, that's a good one.  Especially if you are using it as a background.  Probably not as easy though.  And wouldn't work with conky-standard or conky-cli.  But yea...

Of course you realize now I'll have to test it wink wink    ... later, I have to go out.   8.(  8.(


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

Offline

#7433 2014-04-27 17:47:33

Nili
#! Die Hard
From: 127.0.0.1
Registered: 2013-03-20
Posts: 811
Website

Re: Conky v1.9 Thread

Hello Sector11,

I really like the idea of using lsblk on conky,

${execi 86400 lsblk -o name,mountpoint,size}

is there a possible to output df -h on conky like lsblk above?


# Debian GNU/Linux 8:8.2 (netinst/stable)
# Packages Installed: 541
# Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt11-1+deb8u4 (2015-09-19) i686 GNU/Linux
# Startup finished in 2.850s (kernel) + 6.473s (userspace) = 9.324s

Offline

#7434 2014-04-27 20:21:57

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

Re: Conky v1.9 Thread

Nili wrote:

Hello Sector11,

I really like the idea of using lsblk on conky,

${execi 86400 lsblk -o name,mountpoint,size}

is there a possible to output df -h on conky like lsblk above?

Sure is ... it's a little more complicated to set up - but a LOT more configurable - stolen from one of PetroDawg's conkies, over on Ubuntu forum, and tweaked for my system:

  FS${goto 50}Size${goto 95}Used${goto 140}Avail${goto 180}Use%${goto 220}Mnt Point
${execi 86400 df -h | grep 'sda6' | cut -c5-10}${execp df -h | awk '/sda6/ {print $2"${goto 95}"$3"${goto 140}"$4"${goto 180}"$5"${goto 220}"$6}'}
${execi 86400 df -h | grep 'sda7' | cut -c5-10}${execp df -h | awk '/sda7/ {print $2"${goto 95}"$3"${goto 140}"$4"${goto 180}"$5"${goto 220}"$6}'}
${execi 86400 df -h | grep 'sda5' | cut -c5-10}${execp df -h | awk '/sda5/ {print $2"${goto 95}"$3"${goto 140}"$4"${goto 180}"$5"${goto 220}"$6}'}
${execi 86400 df -h | grep 'sda8' | cut -c5-10}${execp df -h | awk '/sda8/ {print $2"${goto 95}"$3"${goto 140}"$4"${goto 180}"$5"${goto 220}"$6}'}
${execi 86400 df -h | grep 'sda1' | cut -c5-10}${execp df -h | awk '/sda1/ {print $2"${goto 95}"$3"${goto 140}"$4"${goto 180}"$5"${goto 220}"$6}'}
${execi 86400 df -h | grep 'sda2' | cut -c5-10}${execp df -h | awk '/sda2/ {print $2"${goto 95}"$3"${goto 140}"$4"${goto 180}"$5"${goto 220}"$6}'}

2014_04_27_17_17_26_752x283_Sector11.jpg


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

Offline

#7435 2014-04-27 21:14:20

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

Re: Conky v1.9 Thread

OK, I did the draw-bg.lua bar-line thing ... like the "df -h" code above a little more work required, but some nice results.

Top bar - solid black
Second bar - transparent red
with a light transparent white background:

lua_load /media/5/Conky/LUA/draw-bg.lua
lua_draw_hook_pre draw_bg 10 0 0 0 0 0xffffff 0.05
default_bar_size 0 12
TEXT
${lua conky_draw_bg 0 0 20 0 50 0x000000 1}\
${lua conky_draw_bg 0 0 90 0 30 0xff0000 0.2}\
${time %T}

And lower down:

${lua conky_draw_bg 0 20 405 30 2 0x00BFFF 0.9}\
${lua conky_draw_bg 0 250 405 30 2 0x00BFFF 0.9}\
${alignc}draw-bg lua lines and bars

2014_04_27_18_08_47_300x810_Sector11.jpg

Good suggestion mrpeachy ... that's going to the same page at CPS.


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

Offline

#7436 2014-04-28 12:56:43

Nili
#! Die Hard
From: 127.0.0.1
Registered: 2013-03-20
Posts: 811
Website

Re: Conky v1.9 Thread

Wow, thank you Sector11, the above code works like a charm.
Regarding lua draw i have something from my conky and i am using it.

Edit: Well Done sir!

Thanks a lot for your code effort.

Last edited by Nili (2014-04-28 13:31:11)


# Debian GNU/Linux 8:8.2 (netinst/stable)
# Packages Installed: 541
# Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt11-1+deb8u4 (2015-09-19) i686 GNU/Linux
# Startup finished in 2.850s (kernel) + 6.473s (userspace) = 9.324s

Offline

#7437 2014-05-05 10:46:00

wagmic1
#! CrunchBanger
Registered: 2013-11-15
Posts: 119

Re: Conky v1.9 Thread

hy i'll give you the code for this conky
you can download source,image and code here
1397722053.png

# Default Fonts
use_xft yes
xftfont Ubuntu:size=8
override_utf8_locale yes

# Performance Settings
update_interval 1
total_run_times 0
double_buffer yes
no_buffers yes
net_avg_samples 2
text_buffer_size 1024

# Window Settings
own_window_class Conky
own_window yes
#own_window_transparent yes
own_window_type desktop
own_window_hints below,skip_taskbar,skip_pager


# Window border
draw_borders no
draw_shades no
draw_graph_borders no

# Default Color
#own_window_colour 000000
own_window_argb_visual yes
own_window_argb_value 50

# Color Title.
color0 DD3A21

# Size and position
minimum_size 1200 300
gap_x 0
gap_y 30
alignment top_middle
use_spacer true

TEXT
#### background & icons ######
${image ~/.conkyrc/pix/system.png -p 5,20 -s 45x45}${image ~/.conkyrc/pix/resources.png -p 260,20 -s 45x45}${image ~/.conkyrc/pix/file-system.png -p 500,20 -s 45x45}${image ~/.conkyrc/pix/wireless.png -p  760,20 -s 45x45}${image ~/.conkyrc/pix/units.png -p 970,20 -s 45x45}
### Units ###
${image ~/.conkyrc/pix/units/batt.png -p 977,90 -s 25x25}${image ~/.conkyrc/pix/units/hdd.png -p 980,120 -s 25x25}${image ~/.conkyrc/pix/units/proc.png -p 980,152 -s 25x25}${image ~/.conkyrc/pix/units/freq.png -p 980,186 -s 25x25}
${GOTO 90}${font Ubuntu:bold:size=10}System${GOTO 350}${font Ubuntu:bold:size=10}Resources${GOTO 600}${font Ubuntu:bold:size=10}File System${GOTO 860}${font Ubuntu:bold:size=10}Network${GOTO 1080}${font Ubuntu:bold:size=10}Units${font}



${font Ubuntu:bold:size=9}Computer${font} :${GOTO 100}${nodename}${GOTO 260}${font Ubuntu:bold:size=9}RAM${font}:   ${mem}   |   ${memmax}${GOTO 500}${font Ubuntu:bold:size=9}Dir. ${GOTO 545}| ${GOTO 565}Total${GOTO 610}|${GOTO 630}Used${GOTO 675}|${GOTO 695}Free${font}${GOTO 760}${font Ubuntu:bold:size=9}${wireless_essid wlp1s0}${font}:${GOTO 860}${wireless_link_qual_perc wlp1s0}%
${GOTO 1020}${font Ubuntu:bold:size=9}Battery${font}:  ${battery_percent} %   -   ${acpiacadapter}
${font Ubuntu:bold:size=9}System${font}:${GOTO 100}${sysname}   ${kernel}${GOTO 300}    ${membar 5,120} - ${memperc} %${GOTO 500}_________________________________________${GOTO 760}${font Ubuntu:bold:size=9}Public IP${font}:${GOTO 860}${execi 1800 ~/.conkyrc/scripts/ip.sh}
${font Ubuntu:bold:size=9}Machine${font}:${GOTO 100}$machine${GOTO 260}${font Ubuntu:bold:size=9}CPU 1${font}:   ${cpubar cpu1 5,120} - ${cpu cpu1} %${GOTO 760}${font Ubuntu:bold:size=9}Local IP${font}:${GOTO 860}${addr wlp1s0}${GOTO 1020}${font Ubuntu:bold:size=9}HDD${font}:  ${execi 4 sensors | grep -A 0 'temp1' | cut -c15-18} °C  
${font Ubuntu:bold:size=9}Uptime${font}:${GOTO 100}${uptime} ${GOTO 260}${font Ubuntu:bold:size=9}CPU 2${font}:   ${cpubar cpu2 5,120} - ${cpu cpu2} %${GOTO 500}${font Ubuntu:bold:size=9}root${font}${GOTO 560}${fs_size /}${GOTO 625}${fs_used /}${GOTO 690}${fs_free /}${GOTO 760}${font Ubuntu:bold:size=9}Receiving${font}:${GOTO 860}${downspeedf wlp1s0} /s 
${GOTO 260}${font Ubuntu:bold:size=9}SWAP${font}:   ${swapbar 5,120} - ${swapperc} % ${GOTO 500}${font Ubuntu:bold:size=9}home${font}${GOTO 560}${fs_size /home/}${GOTO 625}${fs_used /home/}${GOTO 690}${fs_free /home/}${GOTO 760}${font Ubuntu:bold:size=9}Total${font}:${GOTO 860}${totaldown wlp1s0}${GOTO 1020}${font Ubuntu:bold:size=9}Processor${font}:  ${acpitemp} °C
${font Ubuntu:bold:size=9}Date${font}:${GOTO 100}${time %A, %d %b %Y}${GOTO 260}${font Ubuntu:bold:size=9}Load${font}:   $loadavg ${GOTO 760}${font Ubuntu:bold:size=9}Sending${font}:${GOTO 860}${upspeedf wlp1s0} /s${GOTO 500}${font Ubuntu:bold:size=9}Data${font}${GOTO 560}${fs_size /run/media/Data/}${GOTO 625}${fs_used /run/media/Data/}${GOTO 690}${fs_free /run/media/Data/}
${font Ubuntu:bold:size=9}Time${font}:${GOTO 100}${time %H:%M %p}${GOTO 260}${font Ubuntu:bold:size=9}Processes${font}:   $processes ${GOTO 500}${font Ubuntu:bold:size=9}${GOTO 760}${font Ubuntu:bold:size=9}Total${font}:${GOTO 860}${totalup wlp1s0} ${GOTO 1020}${font Ubuntu:bold:size=9}Frequency${font}:  ${freq_g} Ghz
# Various images #
${execi 300 curl -s "http://weather.yahooapis.com/forecastrss?w=1532755&u=c" -o ~/.cache/weather.xml}${goto 100}${font Ubuntu:bold:size=9}${execi 300 grep "yweather:location" ~/.cache/weather.xml | grep -o "city=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}\
${GOTO 260}NAME${GOTO 408}PID${GOTO 466}CPU\
${GOTO 500}${diskiograph 50,260 656667 828282 1024KiB -l -t}\
${GOTO 760}${upspeedgraph wlp1s0 50,100 656667 828282 -t -l}${GOTO 860}${downspeedgraph wlp1s0 50,100 656667 828282 -t -l}
\
# The name of the days #
\
${voffset -50}${goto 40}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1' | tr '[a-z]' '[A-Z]'}${color}\
${goto 120}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2' | tr '[a-z]' '[A-Z]'}${color}\
${goto 200}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3' | tr '[a-z]' '[A-Z]'}${color}${font Ubuntu:bold:size=9}${GOTO 260}${top name 1}${font}${GOTO 400}${top pid 1}${GOTO 460}${top cpu 1}
\
# The temperatures #
\
${voffset 40}${font Droid Sans :size=12}${goto 40}${execi 300 grep "yweather:condition" ~/.cache/weather.xml | grep -o "temp=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}°${font}${color}\
${goto 120}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2'}°/${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2'}°${color}\
${goto 200}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3'}°/${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3'}°\
${font Ubuntu:bold:size=9}${voffset -46}${color}${GOTO 260}${top name 2}${font}${GOTO 400}${top pid 2}${GOTO 460}${top cpu 2}
${font Ubuntu:bold:size=9}${GOTO 260}${top name 3}${font}${GOTO 400}${top pid 3}${GOTO 460}${top cpu 3}
${font Ubuntu:bold:size=9}${GOTO 260}${top name 4}${font}${GOTO 400}${top pid 5}${GOTO 460}${top cpu 4}${GOTO 630}${font Ubuntu:bold:size=9}I/O${GOTO 810}UP${GOTO 890}DOWN
${font Ubuntu:bold:size=9}${GOTO 260}${top name 4}${font}${GOTO 400}${top pid 4}${GOTO 460}${top cpu 4}\
# The icons of the forecast and condition #
${execi 300 cp -f ~/.conky-weather/icons/weather-icons-light3/$(grep "yweather:condition" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*").png ~/.cache/weather.png}${image ~/.cache/weather.png -p 27,245 -s 32x32}\
${execi 300 cp -f ~/.conky-weather/icons/weather-icons-light3/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2').png ~/.cache/weather-2.png}${image ~/.cache/weather-2.png -p 108,245 -s 32x32}\
${execi 300 cp -f ~/.conky-weather/icons/weather-icons-light3/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3').png ~/.cache/weather-3.png}${image ~/.cache/weather-3.png -p 199,245 -s 32x32}

I need to learn how to speak/write English big_smile
latest Firefox on #! handylinux

Offline

#7438 2014-05-05 13:10:56

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

Re: Conky v1.9 Thread

yikes wagmic1 !! Nice to see you there ! Really nice conky system, great work again !
I did "twice" conky real time simulated view of Earth with Europe and US (night,cloud cover...)sourceMay be better with dates and times of major cities ... like one of famous sector11 conky... but it was a flat map rectangular or orthographic... big work to place it again... difficulties for placements with clouds ?
1399295423.png

ConkySatEu:

#A real time simulated view of Europe#
#=========ragamatrix's==========#

background no
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
double_buffer yes
no_buffers yes
text_buffer_size 1024
imlib_cache_size 0

own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,skip_taskbar,skip_pager,below,sticky

border_inner_margin 1
border_outer_margin 0

minimum_size 520 460 #Taille minimum (px) ; largeur / hauteur
maximum_width 520 ##largeur

alignment tr
gap_x 30
gap_y 30

draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_shade_color 181818

use_xft yes
xftfont Monofur:size=12
xftalpha 1.0
uppercase no
override_utf8_locale yes
###############################
#   1h=60m=3600s              #
#   1j=24h=1440m=86400s       #
#365j=8760h=525600m=31536000s #
###############################


default_color ececec
color2 585858
color1 606060
lua_load ~/.conky/script/image.lua

TEXT
${texeci 1200 ~/.conky/script/detour_sat_eu.sh} 
${lua conky_fDrawImage $HOME/SATEU.png 0 0 520 420}

ConkySatUS:

#A real time simulated view of USA

background no
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
double_buffer yes
no_buffers yes
text_buffer_size 1024
imlib_cache_size 0

own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,skip_taskbar,skip_pager,below,sticky

border_inner_margin 1
border_outer_margin 0

minimum_size 520 460 #Taille minimum (px) ; largeur / hauteur
maximum_width 520 ##largeur

alignment tl
gap_x 30
gap_y 30

draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_shade_color 181818

use_xft yes
xftfont Monofur:size=12
xftalpha 1.0
uppercase no
override_utf8_locale yes
###############################
#   1h=60m=3600s              #
#   1j=24h=1440m=86400s       #
#365j=8760h=525600m=31536000s #
###############################


default_color ececec
color2 585858
color1 606060
lua_load ~/.conky/script/image.lua

TEXT
${texeci 1200 ~/.conky/script/detour_sat_us.sh} 
${lua conky_fDrawImage $HOME/SATUS.png 0 0 520 420}

detour_sat_us.sh:

#!/bin/bash
#A real time simulated view of the USA#
#05-05-2014-ragamatrix's-script#
IMDLUS="http://www.ruwenzori.net/earth/Earth_The_Americas_1280x1024.jpg"
MASK="/tmp/mask.png"
IMDET="$HOME/SATUS.jpg"
# script detour_terre.sh
wget -q -O  $IMDET $IMDLUS
# pour le cadrage et le diametre si il ya lieu jouer sur 630,50
convert -size 1280x1024 xc:none -fill blue -draw 'circle 640,512 630,50' -alpha extract $MASK
convert $IMDET  $MASK  -alpha off -compose CopyOpacity -composite -resize 500x400! $HOME/SATUS.png
convert $HOME/SATUS.png -background  DodgerBlue1  \( +clone -shadow 80x10+0+0 \) +swap -background  none   -flatten $HOME/SATUS.png
rm $MASK
#your final image is in.png you have to modify it in conky file

detour_sat_eu.sh:

#!/bin/bash
#A real time simulated view of Europe
#05-05-2014-ragamatrix's-script#
IMDLEU="http://www.ruwenzori.net/earth/Earth_EMEA+Atlantic_1280x1024.jpg"
MASK="/tmp/mask.png"
IMDET="$HOME/SATEU.jpg"
# script detour_terre.sh
wget -q -O  $IMDET $IMDLEU
# pour le cadrage et le diametre si il ya lieu jouer sur 630,50
convert -size 1280x1024 xc:none -fill blue -draw 'circle 640,512 630,50' -alpha extract $MASK
convert $IMDET  $MASK  -alpha off -compose CopyOpacity -composite -resize 500x400! $HOME/SATEU.png
convert $HOME/SATEU.png -background  DodgerBlue1  \( +clone -shadow 80x10+0+0 \) +swap -background  none   -flatten $HOME/SATEU.png
rm $MASK
#your final image is in.png you have to modify it in conky file

image.lua:

require 'cairo'
home = os.getenv ('HOME')

--Fonction d'affichage
function conky_fDrawImage(path,x,y,w,h,arc)

	path = string.gsub(path, "~", home)
	path = string.gsub(path, "$HOME", home)

	local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
	
	local function fDrawImage(path,x,y,w,h,arc)
		x=x+(w/2)
		y=y+(h/2)
		local img =  cairo_image_surface_create_from_png(path)
		local w_img, h_img = cairo_image_surface_get_width (img), cairo_image_surface_get_height (img)

		local cr = cairo_create (cs)
		cairo_translate (cr, x, y)

		if arc then
			cairo_rotate (cr, arc)
		end

		cairo_scale (cr, w/w_img, h/h_img)
		cairo_set_source_surface (cr, img, -w_img/2, -h_img/2)
		cairo_paint (cr)
		cairo_destroy(cr)
		cairo_surface_destroy (img)
	end
	fDrawImage(path,x,y,w,h,arc)
	cairo_surface_destroy(cs)
	return ""
end

Last edited by ragamatrix (2014-05-05 13:40:27)

Offline

#7439 2014-05-05 15:49:53

Marenbraga
Member
Registered: 2013-11-14
Posts: 40

Re: Conky v1.9 Thread

Hello friends,
Does anyone know how to show the volume of audio channels - separate - left and right? How would the bar for them?

Offline

#7440 2014-05-05 17:44:19

chepioq
#! Member
Registered: 2013-01-09
Posts: 79

Re: Conky v1.9 Thread

Marenbraga wrote:

Hello friends,
Does anyone know how to show the volume of audio channels - separate - left and right? How would the bar for them?

May be you can use the amixer command :

[dominique@host-192-168-1-2 ~]$ amixer
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 3285 [5%] [on]
  Front Right: Playback 3285 [5%] [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 65536
  Front Left: Capture 5841 [9%] [on]
  Front Right: Capture 5841 [9%] [on]

I think that volumes are under Playback lines :

[dominique@host-192-168-1-2 ~]$ amixer | grep Playback
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Front Left: Playback 45864 [70%] [on]
  Front Right: Playback 45864 [70%] [on]
[dominique@host-192-168-1-2 ~]$ amixer | grep Playback | grep Left: | awk '{print $5}'
[70%]
[dominique@host-192-168-1-2 ~]$ amixer | grep Playback | grep Right: | awk '{print $5}'
[70%]

After I think you can use sed (or awk or grep) for extract just the valor (here it's 70)

And with conky you can mix with execbar command

Offline

#7441 2014-05-06 06:39:21

Naik
#! Die Hard
From: Leipzig
Registered: 2012-11-16
Posts: 595

Re: Conky v1.9 Thread

@ragamatrix: thanks for sharing this world-conky. finaly i had something to explain my 4yo son why there is day and night... cool

sadly i can`t seem to find a way to shrink the  whole thing to 333x266px (i only have 1024x768px of screen estate).. can you may point me to the values? every attempt of mine led to only a quarter of the world shown  roll

Last edited by Naik (2014-05-06 06:45:48)


*kaum macht man es richtig, funktioniert es sofort*

Offline

#7442 2014-05-06 07:12:13

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

Re: Conky v1.9 Thread

Naik wrote:

@ragamatrix: thanks for sharing this world-conky. finaly i had something to explain my 4yo son why there is day and night... cool

sadly i can`t seem to find a way to shrink the  whole thing to 333x266px (i only have 1024x768px of screen estate).. can you may point me to the values? every attempt of mine led to only a quarter of the world shown  roll

Hi Naik, nice to show how our planet is to the children, I did the same, now I'm trying to explain the time...
I'm not sure to have understood why the planet is not shown correctly... neutral
In the conky to display pictures with lua script:

${lua conky_fDrawImage $HOME/SATUS.png 0 0 520 420}

x y   L   x  l   >these values are positions and size you can shrink it with a good ratio any size you want ...?
^ ^   ^      ^
0 0 520 420

Otherwise if you want to download the smaller picture you have to modify the "mask" and the .jpg web adress  in the convert script:

convert -size 1280x1024 xc:none -fill blue -draw 'circle 640,512 630,50' -alpha extract $MASK

Might be more difficult settings...

Offline

#7443 2014-05-06 08:29:39

Naik
#! Die Hard
From: Leipzig
Registered: 2012-11-16
Posts: 595

Re: Conky v1.9 Thread

^ thanks, i got it working now! i tried to mix up both suggested solutions at first and the output was just horrible.


*kaum macht man es richtig, funktioniert es sofort*

Offline

#7444 2014-05-06 10:34:31

DrakarNoir
#! CrunchBanger
From: just beyond the sign post
Registered: 2011-09-02
Posts: 132
Website

Re: Conky v1.9 Thread

Greetings to ALL!
Been away awhile...seems like much to catch up on.
Here is my latest conky inspired by a wallpaper search. Thanks out to wlourf, mrpeachy, s11, et al for the code help over the past months.
Your thoughts and/or suggestions are welcome!
conky.jpg

The clock:

conky:

# killall conky && conky -c ~/Conky/The_Clock.conky &
#
# Thank you:
# Chronograph LUA - mrpeachy (originally 4 clocks - tweaked by Sector11)
# v9000 LUA weather - mrpeachy
# background - londonali1010, mrpeachy, dk75
# mounted.lua - mrpeachy

###  Begin Window Settings  ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager,sticky
#own_window_colour gray
own_window_class Conky
own_window_title Chronograph

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

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

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

#minimum_size 420 420  ## width, height
#maximum_width 420     ## width

### For use with The-Clock.lua
minimum_size 264 264 ## width, height
maximum_width 264    ## width

gap_x 8 #15        ### left &right
gap_y -3       ### up & down

### alignment values or top_left, bottom_right, etc
# tl, tm, tr
# ml, mm, mr
# bl, bm, br
alignment mm

####################################################  End Window Settings  ###
###  Font Settings  ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
#xftfont CorporateMonoExtraBold:size=9
xftfont monofur:bold:size=14
# X font when Xft is disabled, you can pick one with program xfontsel
#font 5x7
#font 6x10
#font 7x13
#font 8x13
#font 9x15
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*

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

uppercase no
######################################################  End Font Settings  ###
###  Color Settings  #########################################################
draw_shades no
default_shade_color black

draw_outline no # amplifies text if yes
default_outline_color black

default_color DCDCDC #220 220 220	Gainsboro
color0 8FBC8F #143 188 143	DarkSeaGreen
color1 C2CCFF # Not a clue - a blue #778899 #119 136 153	LightSlateGray
color2 FF8C00 #255 140   0	DarkOrange
color3 7FFF00 #127 255   0	Chartreuse
color4 FFA07A #255 160 122	LightSalmon
color5 FFDEAD #255 222 173	NavajoWhite
color6 00BFFF #  0 191 255	DeepSkyBlue
color7 00FFFF #  0 255 255	Cyan
color8 FFFF00 #255 255   0	Yellow
color9 B22222 #178  34  34	FireBrick
#####################################################  End Color Settings  ###
###  Borders Section  ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders yes #no
#default_graph_size 15 40
#####################################################  End Borders Secton  ###
###  Miscellaneous Section  ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background yes

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

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

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

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

# If enabled, values which are in bytes will be printed in human readable
# format (i.e., KiB, MiB, etc). If disabled, bytes is printed instead
format_human_readable yes

# Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off.
short_units yes


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

##############################################  End Miscellaneous Section  ###
###  LUA Settings  ###########################################################
## draw-bg.lua
##
lua_load ~/.conky/lyle/scripts/draw_bg.lua
################### Chronograph ##############################################
lua_load ~/.conky/lyle/scripts/clock.lua
lua_draw_hook_pre main
lua_draw_hook_post clock

##############################  End LUA Settings  ###
update_interval 1

TEXT
${lua conky_draw_bg 115 138 138 35 0x000000 0.5}
${lua conky_draw_bg 83 138 138 30 0x00ff00 0.2}

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)
 15 Dec 2012 - Month name displayed instead of hour number (ie: 1 2 3 4 May 6 7 8 . . . .) (Thanks to mrpeachy for the help) - DrakarNoir
 16 Dec 2012 - Day name displayed in place of the date number (ie: . . .14 15 Sun 17 18 . . .) - DrakarNoir

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.
]]

--set the music display parameters  here
--other parameters can be set in widgets files

--font name to use
font_name="Ubuntu-Title"

--set the colors here
--for foreground
fg_col1=0x97EF93
fg_col2=0xF61330

--for background
bg_col1=0xC9C6C6

--END OF PARAMETERS


--call the widgets 
--or use full path if you don't call the conkyrc from it's own directory

function conky_main()
	
end



require 'cairo'
 -- ### CLOCK POSITION - AND DEFAULTS ##########################################
local init={
center_x=138,
center_y=138,
radius=118,
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=0 --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_clock()
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, "Planewalker", 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 == false 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
  
end
 -- ######################################### END DIAL B ###

 -- ### 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});
febdaynum=tonumber(((os.difftime(t1,t2))/(12*60*60)/2))

 -- 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]

--dates, with day-name displayed instead of digit
mx=138
my=145
radius=85
cairo_select_font_face (cr, "Planewalker", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 13)
cairo_set_source_rgba (cr,1,1,1,1)
this_day=tonumber(os.date("%d"))
for i=1,number_days do
local point=(math.pi/180)*((360/number_days)*(i-1))
local x=mx+radius*(math.sin(point))
local y=my-radius*(math.cos(point))

    --only print even numbers
    if math.mod(i, 2) == 0 and math.mod(this_day, 2)==0 then
    text=string.format("%01d",i) --formats numbers to single digit
    elseif math.mod(i, 2) ~= 0 and math.mod(this_day, 2)~=0 then
    text=string.format("%01d",i) --formats numbers to single digit
    else
    text=""
    end --odd even matching
	if i==this_day then
        cairo_set_source_rgba (cr,1,1,0,1) -- active colour
	local text=os.date("%a")--day name
	cairo_text_extents(cr,text,extents)
   	local w=extents.width
    	local h=extents.height
	cairo_move_to(cr,x-(w/2),y-(h/2)+3)
	cairo_show_text(cr,text)
	cairo_stroke (cr)
	else
	cairo_set_source_rgba (cr,1,1,1,0.5) -- dim inactive numbers
	--local text=string.format("%01d",i)
	cairo_text_extents(cr,text,extents)
   	local w=extents.width
    	local h=extents.height
	cairo_move_to(cr,x-(w/2),y-(h/2))
	cairo_show_text(cr,text)
	cairo_stroke (cr)
	end
   end--for loop
 -- INNER POINTS POSITION, radius smaller than text circle
  local radius=72
  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,1,1,0,0.7) -- active colour
	else
	cairo_set_source_rgba (cr,1,1,1,0.2) -- 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=66
 -- 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=100
 -- set minute hand width
mh_width_A=2
 -- 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

 -- 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,0/255,0/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   ###
 -- 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,0,1,0,0.9) -- 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,0,1,0,0.9) -- 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, "Planewalker", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 22)
cairo_set_source_rgba (cr,1,1,1,0.0) -- HR Clock numbers
 -- TABLE OF TEXT -- in order
if init.hour == 12 then
  text_days={"12","1","2","3","4","5","6","7","8","9","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.0)
    cairo_stroke (cr)
  end
 -- INNER POINTS POSITION, radius smaller than text circle
  local radius=101 -- 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.5)
    cairo_stroke (cr)
  end
end
 -- ############################################################################
 -- POSITION FOR TEXT HOUR NUMBERS
  if init.hour == 12 and init.second == true then
    text_days={"","1","2","3","4","","6","7","8","9","","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,0.2) -- does not work -- settings moved
    cairo_select_font_face (cr, "Planewalker", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    for i=1,60 do
      local radius=100 -- 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.3) -- 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,0,1,1,0.0) -- active colour
        else
          cairo_set_source_rgba (cr,0,1,1,0.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, 10)
    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,0,0,1.0) -- active colour
      else
        cairo_set_source_rgba (cr,1,1,1,0.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
 -- ############################################################################
 -- ### START DIAL C ### Month Names Dial ##################
 --hours, with month displayed instead of hour, 12 hour clock
local center_x=init.center_x --(+85)
local center_y=init.center_y+15
local radius=118
cairo_select_font_face (cr, "Planewalker", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 18)

month_number=tonumber(os.date("%m"))
for i=1,12 do
local point=(math.pi/180)*((360/12)*(i))
local x=center_x+radius*(math.sin(point))
local y=center_y-radius*(math.cos(point))
	if i==month_number then
	local text=os.date("%b")--month name
	cairo_text_extents(cr,text,extents)
	cairo_set_source_rgba (cr,0,1,0,1)
   	local w=extents.width
    	local h=extents.height
	cairo_move_to(cr,x-(w/2),y-(h/2))
	cairo_show_text(cr,text)
	cairo_stroke (cr)
	else--if i does not = month_number
	local text=string.format("%01d",i)
	cairo_set_source_rgba (cr,0,1,0,0.9)
	cairo_text_extents(cr,text,extents)
   	local w=extents.width
    	local h=extents.height
	cairo_move_to(cr,x-(w/2),y-(h/2))
	cairo_show_text(cr,text)
	cairo_stroke (cr)
	end--if

end--for loop
 -- ######################################### END DIAL C ###
cairo_stroke (cr)
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end -- end clock function

The BioHazard indicator:

conky:

# -- 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

own_window_type normal
own_window_hints undecorated,sticky,skip_taskbar,skip_pager,below
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_colour 000000
own_window_title rings & sectors

border_inner_margin 0
border_outer_margin 0

minimum_size 900 900
alignment mm
gap_x 5
gap_y 0

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

temperature_unit fahrenheit

# -- Lua load -- #
lua_load ~/.conky/rings/rings2.lua
lua_draw_hook_pre main_rings

#at least one line (empty or not) after TEXT
TEXT

Lua:

--[[ RINGS with SECTORS widget
	v1.0 by wlourf (08.08.2010)
	this widget draws a ring with differents effects 
	http://u-scripts.blogspot.com/2010/08/rings-sectors-widgets.html
	
To call the script in a conky, use, before TEXT
	lua_load /path/to/the/script/rings.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:
xc,yc		- coordinates of the center of the ring,
			  default = middle of the conky window
radius		- external radius of the ring, in pixels,
			  default = quarter of the width of the conky window
thickness	- thickness of the ring, in pixels, default = 10 pixels
start_angle	- starting angle of the ring, in degrees, value can be negative,
			  default = 0 degree
end_angle	- ending angle of the ring, in degrees,
			  value must be greater than start_angle, default = 360 degrees
sectors		- number of sectors in the ring, default = 10
gap_sectors - gap between two sectors, in pixels, default = 1 pixel
cap			- the way to close a sector, available values are
				"p" for parallel , default value 
				"r" for radial (follow the radius)
inverse_arc	- if set to true, arc will be anticlockwise, default=false
border_size	- size of the border, in pixels, default = 0 pixel i.e. no border
fill_sector	- if set to true, each sector will be completely filled,
			  default=false, this parameter is inoperate if sectors=1
background	- if set to false, background will not be drawn, default=true
foreground	- if set to false, foreground will not be drawn, default=true

Colours tables below are defined into braces :
{position in the gradient (0 to 1), colour in hexadecimal, alpha (0 to 1)}
example for a single colour table : 
{{0,0xFFAA00,1}} position parameter doesn't matter
example for a two-colours table : 
{{0,0xFFAA00,1},{1,0x00AA00,1}} or {{0.5,0xFFAA00,1},{1,0x00AA00,1}}
example for a three-colours table : 
{{0,0xFFAA00,1},{0.5,0xFF0000,1},{1,0x00AA00,1}}

bg_colour1	- colour table for background,
			  default = {{0,0x00ffff,0.1},{0.5,0x00FFFF,0.5},{1,0x00FFFF,0.1}}
fg_colour1	- colour table for foreground,
			  default = {{0,0x00FF00,0.1},{0.5,0x00FF00,1},{1,0x00FF00,0.1}}
bd_colour1	- colour table for border,
			  default = {{0,0xFFFF00,0.5},{0.5,0xFFFF00,1},{1,0xFFFF00,0.5}}			  

Seconds tables for radials gradients :
bg_colour2	- second colour table for background, default = no second colour
fg_colour2	- second colour table for foreground, default = no second colour
bd_colour2	- second colour table for border, default = no second colour

v1.0 (08 Aug. 2010) original release

]]

require 'cairo'

function conky_main_rings()
-- START PARAMETERS HERE
local rings_settings={
	{
	name="fs_used_perc",
	arg="/",
	max=100,
	xc=435,
	yc=225,
	thickness=70,
	radius=230,
	sectors=60,
	gap_sectors=0,
	fill_sectors=true,
	inverse_arc=false,
	start_angle=214,
	end_angle=340,
	fg_colour2={{0.49,0x00FF00,0},{0.5,0x00FF00,1},{0.51,0x00FF00,0}},
	fg_colour1={{0,0x00FF00,0},{0.5,0x00ff00,1},{1,0x00FF00,0}},
	bg_colour2={{0.49,0x000000,0},{0.5,0x000000,1},{0.51,0x000000,0}},
	bg_colour1={{0,0x000000,0},{0.5,0xffffff,1},{1,0x000000,0}},
	draw_me=true
	},
	{
	name="fs_used_perc",
	arg="/home",
	max=100,
	xc=460,
	yc=226,
	thickness=70,
	radius=230,
	sectors=60,
	gap_sectors=0,
	fill_sectors=true,
	inverse_arc=true,
	start_angle=146,
	end_angle=20,
	fg_colour2={{0.49,0x00FF00,0},{0.5,0x00FF00,1},{0.51,0x00FF00,0}},
	fg_colour1={{0,0x00FF00,0},{0.5,0x00ff00,1},{1,0x00FF00,0}},
	bg_colour1={{0.49,0x000000,0},{0.5,0x000000,1},{0.51,0x000000,0}},
	bg_colour2={{0,0x000000,0},{0.5,0xffffff,1},{1,0x000000,0}},
	draw_me=true
	},
	{
	name="fs_used_perc",
	arg="/media/movies",
	max=100,
	xc=235,
	yc=550,
	thickness=70,
	radius=230,
	sectors=60,
	gap_sectors=0,
	fill_sectors=true,
	inverse_arc=true,
	start_angle=30,
	end_angle=-120,
	fg_colour2={{0.49,0x00FF00,0},{0.5,0x00FF00,1},{0.51,0x00FF00,0}},
	fg_colour1={{0,0x00FF00,0},{0.5,0x00ff00,1},{1,0x00FF00,0}},
	bg_colour1={{0.49,0x000000,0},{0.5,0x000000,1},{0.51,0x000000,0}},
	bg_colour2={{0,0x000000,0},{0.5,0xffffff,1},{1,0x000000,0}},
	draw_me=true
	},
	{
	name="fs_used_perc",
	arg="/media/tvshows",
	max=100,
	xc=255,
	yc=578,
	thickness=70,
	radius=230,
	sectors=60,
	gap_sectors=0,
	fill_sectors=true,
	inverse_arc=false,
	start_angle=93,
	end_angle=205,
	fg_colour2={{0.49,0x00FF00,0},{0.5,0x00FF00,1},{0.51,0x00FF00,0}},
	fg_colour1={{0,0x00FF00,0},{0.5,0x00ff00,1},{1,0x00FF00,0}},
	bg_colour2={{0.49,0x000000,0},{0.5,0x000000,1},{0.51,0x000000,0}},
	bg_colour1={{0,0x000000,0},{0.5,0xffffff,1},{1,0x000000,0}},
	draw_me=true
	},
	{
	name="fs_used_perc",
	arg="/media/music",
	max=100,
	xc=645,
	yc=578,
	thickness=70,
	radius=230,
	sectors=60,
	gap_sectors=0,
	fill_sectors=true,
	inverse_arc=true,
	start_angle=267,
	end_angle=140,
	fg_colour2={{0.49,0x00FF00,0},{0.5,0x00FF00,1},{0.51,0x00FF00,0}},
	fg_colour1={{0,0x00FF00,0},{0.5,0x00ff00,1},{1,0x00FF00,0}},
	bg_colour1={{0.49,0x000000,0},{0.5,0x000000,1},{0.51,0x000000,0}},
	bg_colour2={{0,0x000000,0},{0.5,0xffffff,1},{1,0x000000,0}},
	draw_me=true
	},
	{
	name="fs_used_perc",
	arg="/media/pics",
	max=100,
	xc=660,
	yc=555,
	thickness=70,
	radius=230,
	sectors=60,
	gap_sectors=0,
	fill_sectors=true,
	inverse_arc=false,
	start_angle=-28,
	end_angle=98,
	fg_colour2={{0.49,0x00FF00,0},{0.5,0x00FF00,1},{0.51,0x00FF00,0}},
	fg_colour1={{0,0x00FF00,0},{0.5,0x00ff00,1},{1,0x00FF00,0}},
	bg_colour2={{0.49,0x000000,0},{0.5,0x000000,1},{0.51,0x000000,0}},
	bg_colour1={{0,0x000000,0},{0.5,0xffffff,1},{1,0x000000,0}},
	draw_me=true
	},
	{
	name="upspeedf",
	arg="wlan0",
	max=270,
	xc=450,
	yc=450,
	thickness=30,
	radius=210,
	sectors=60,
	gap_sectors=0,
	fill_sectors=true,
	start_angle=-40,
	end_angle=-15,
	bg_colour1={{0,0x000000,0},{0.5,0xffffff,0.7},{1,0x000000,0}},
	fg_colour1={{0,0xFF0000,0},{0.5,0xff0000,1},{1,0xFF0000,0}},
	draw_me=true
	},
	{
	name="wireless_link_qual",
	arg="wlan0",
	max=100,
	xc=450,
	yc=450,
	thickness=30,
	radius=210,
	sectors=60,
	gap_sectors=0,
	fill_sectors=true,
	start_angle=-12,
	end_angle=13,
	bg_colour1={{0,0x000000,0},{0.5,0xffffff,0.7},{1,0x000000,0}},
	fg_colour1={{0,0xFF0000,0},{0.5,0xff0000,1},{1,0xFF0000,0}},
	draw_me=true
	},
	{
	name="downspeedf",
	arg="wlan0",
	max=270,
	xc=450,
	yc=450,
	thickness=30,
	radius=210,
	sectors=60,
	gap_sectors=0,
	fill_sectors=true,
	start_angle=15,
	end_angle=40,
	bg_colour1={{0,0x000000,0},{0.5,0xffffff,0.7},{1,0x000000,0}},
	fg_colour1={{0,0xFF0000,0},{0.5,0xff0000,1},{1,0xFF0000,0}},
	draw_me=true
	},
	{
	name="memperc",
	arg="",
	max=100,
	xc=450,
	yc=450,
	thickness=30,
	radius=210,
	sectors=60,
	gap_sectors=0,
	fill_sectors=true,
	start_angle=80,
	end_angle=105,
	bg_colour1={{0,0x000000,0},{0.5,0xffffff,0.7},{1,0x000000,0}},
	fg_colour1={{0,0xFF0000,0},{0.5,0xff0000,1},{1,0xFF0000,0}},
	draw_me=true
	},
	{
	name="cpu",
	arg="",
	max=100,
	xc=450,
	yc=450,
	thickness=30,
	radius=210,
	sectors=60,
	gap_sectors=0,
	fill_sectors=true,
	start_angle=108,
	end_angle=133,
	bg_colour1={{0,0x000000,0},{0.5,0xffffff,0.7},{1,0x000000,0}},
	fg_colour1={{0,0xFF0000,0},{0.5,0xff0000,1},{1,0xFF0000,0}},
	draw_me=true
	},
	{
	name="battery_percent",
	arg="",
	max=100,
	xc=450,
	yc=450,
	thickness=30,
	radius=210,
	sectors=60,
	gap_sectors=0,
	fill_sectors=true,
	start_angle=136,
	end_angle=160,
	bg_colour1={{0,0x000000,0},{0.5,0xffffff,0.7},{1,0x000000,0}},
	fg_colour1={{0,0xFF0000,0},{0.5,0xff0000,1},{1,0xFF0000,0}},
	draw_me=true
	},
	{
	name="execi 30 hddtemp -nuF",
	arg="/dev/sda",
	max=200,
	xc=450,
	yc=450,
	thickness=30,
	radius=210,
	sectors=1,
	start_angle=200,
	end_angle=225,
	bg_colour1={{0,0x000000,0},{0.5,0xffffff,0.7},{1,0x000000,0}},
	fg_colour1={{0,0xFF0000,0},{0.5,0xff0000,1},{1,0xFF0000,0}},
	draw_me=true
	},
	{
	name="hwmon 0",
	arg="temp 1",
	max=200,
	xc=450,
	yc=450,
	thickness=30,
	radius=210,
	sectors=1,
	start_angle=228,
	end_angle=253,
	bg_colour1={{0,0x000000,0},{0.5,0xffffff,0.7},{1,0x000000,0}},
	fg_colour1={{0,0xFF0000,0},{0.5,0xff0000,1},{1,0xFF0000,0}},
	draw_me=true
	},
	{
	name="hwmon 1",
	arg="temp 1",
	max=200,
	xc=450,
	yc=450,
	thickness=30,
	radius=210,
	sectors=1,
	start_angle=255,
	end_angle=280,
	bg_colour1={{0,0x000000,0},{0.5,0xffffff,0.7},{1,0x000000,0}},
	fg_colour1={{0,0xFF0000,0},{0.5,0xff0000,1},{1,0xFF0000,0}},
	draw_me=true
	},
	--[[{
	name="",
	arg="",
	max=100,
	xc=300,
	yc=300,
	thickness=10,
	radius=140,
	sectors=1,
	start_angle=0,
	end_angle=360,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	},]]
	
}
--END OF PARAMETERS HERE

--main function

	if conky_window==nil then return end

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

	if tonumber(conky_parse('${updates}'))>3 then
		for i in pairs(rings_settings) do
			draw_ring(cr,rings_settings[i])
		end
	end

	cairo_destroy(cr)

end




function draw_ring(cr, t)

	local function rgba_to_r_g_b_a(tcolour)
		local colour,alpha=tcolour[2],tcolour[3]
		return ((colour / 0x10000) % 0x100) / 255., 
			((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
	end
			
			
	local function calc_delta(tcol1,tcol2)
		--calculate deltas P R G B A to table_colour 1

		for x = 1, #tcol1 do
			tcol1[x].dA = 0
			tcol1[x].dP = 0
	 		tcol1[x].dR = 0
			tcol1[x].dG = 0
			tcol1[x].dB = 0
			if tcol2~=nil and #tcol1 == #tcol2 then
				local r1,g1,b1,a1 = rgba_to_r_g_b_a(tcol1[x])
				local r2,g2,b2,a2 = rgba_to_r_g_b_a(tcol2[x])
				tcol1[x].dP = (tcol2[x][1]-tcol1[x][1])/t.sectors
		 		tcol1[x].dR = (r2-r1)/t.sectors
				tcol1[x].dG = (g2-g1)/t.sectors
				tcol1[x].dB = (b2-b1)/t.sectors
				tcol1[x].dA = (a2-a1)/t.sectors		
				
			end
		end
		
		return tcol1
	end

	--check values
	local function setup(t)
		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'")
			print ("for name=" .. t.name)
			print ("with arg=" .. t.arg)
			return
		end
		if t.name==nil then t.name="" end
		if t.arg==nil then t.arg="" end

		if t.xc==nil then t.xc=conky_window.width/2 end
		if t.yc==nil then t.yc=conky_window.height/2 end
		if t.thickness ==nil then t.thickness = 10 end
		if t.radius ==nil then t.radius =conky_window.width/4 end
		if t.start_angle==nil then t.start_angle =0 end
		if t.end_angle==nil then t.end_angle=360 end
		if t.bg_colour1==nil then 
			t.bg_colour1={{0,0x00ffff,0.1},{0.5,0x00FFFF,0.5},{1,0x00FFFF,0.1}}
		end
		if t.fg_colour1==nil then
			t.fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1},{1,0x00FF00,0.1}}
		end
		if t.bd_colour1==nil then
			t.bd_colour1={{0,0xFFFF00,0.5},{0.5,0xFFFF00,1},{1,0xFFFF00,0.5}}
		end
		if t.sectors==nil then t.sectors=10 end
		if t.gap_sectors==nil then t.gap_sectors=1 end 
		if t.fill_sector==nil then t.fill_sector=false end
		if t.sectors==1 then t.fill_sector=false end
		if t.border_size==nil then t.border_size=0 end
		if t.cap==nil then t.cap="p" end
		--some checks
		if t.thickness>t.radius then t.thickness=t.radius*0.1 end
		t.int_radius = t.radius-t.thickness

		--check colors tables 
		for i=1, #t.bg_colour1 do 
			if #t.bg_colour1[i]~=3 then t.bg_colour1[i]={1,0xFFFFFF,0.5} end
		end
		for i=1, #t.fg_colour1 do 
			if #t.fg_colour1[i]~=3 then t.fg_colour1[i]={1,0xFF0000,1} end
		end
		for i=1, #t.bd_colour1 do 
			if #t.bd_colour1[i]~=3 then t.bd_colour1[i]={1,0xFFFF00,1} end
		end
	
		if t.bg_colour2~=nil then
			for i=1, #t.bg_colour2 do 
				if #t.bg_colour2[i]~=3 then t.bg_colour2[i]={1,0xFFFFFF,0.5} end
			end
		end
		if t.fg_colour2~=nil then
			for i=1, #t.fg_colour2 do 
				if #t.fg_colour2[i]~=3 then t.fg_colour2[i]={1,0xFF0000,1} end
			end
		end
		if t.bd_colour2~=nil then
			for i=1, #t.bd_colour2 do 
				if #t.bd_colour2[i]~=3 then t.bd_colour2[i]={1,0xFFFF00,1} end
			end
		end 	
		
		if t.start_angle>=t.end_angle then
		 local tmp_angle=t.end_angle
		 t.end_angle= t.start_angle
		 t.start_angle = tmp_angle
		 -- print ("inversed angles")
			if t.end_angle-t.start_angle>360 and t.start_angle>0 then
				t.end_angle=360+t.start_angle
				print ("reduce angles")
			end
		
			if t.end_angle+t.start_angle>360 and t.start_angle<=0 then
				t.end_angle=360+t.start_angle
				print ("reduce angles")
			end
		
			if t.int_radius<0 then t.int_radius =0 end
			if t.int_radius>t.radius then
				local tmp_radius=t.radius
				t.radius=t.int_radius
				t.int_radius=tmp_radius
				print ("inversed radius")
			end
			if t.int_radius==t.radius then
				t.int_radius=0
				print ("int radius set to 0")
			end 
		end
		
		t.fg_colour1 = calc_delta(t.fg_colour1,t.fg_colour2)
		t.bg_colour1 = calc_delta(t.bg_colour1,t.bg_colour2)
		t.bd_colour1 = calc_delta(t.bd_colour1,t.bd_colour2)
	end
	
	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	
	--initialize table
	setup(t)
	
	--initialize cairo context
	cairo_save(cr)
	cairo_translate(cr,t.xc,t.yc)
	cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND)
	cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND)

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

	--initialize sectors
	--angle of a sector :
	local angleA = ((t.end_angle-t.start_angle)/t.sectors)*math.pi/180
	--value of a sector : 
	local valueA = t.max/t.sectors
	--first angle of a sector : 
	local lastAngle = t.start_angle*math.pi/180


	local function draw_sector(type_arc,angle0,angle,valpc, idx)
	 
		--this function draws a portion of arc
	 	--type of arc, angle0 = strating angle, angle= angle of sector,
	 	--valpc = percentage inside the sector, idx = sctor number #
	 	local tcolor
		 if type_arc=="bg" then 		--background
			 if valpc==1 then return end
		 	tcolor=t.bg_colour1
		 elseif type_arc=="fg" then	--foreground
		 	if valpc==0 then return end
		 	tcolor=t.fg_colour1
		 elseif type_arc=="bd" then	--border
		 	tcolor=t.bd_colour1
		 end 

		--angles equivalents to gap_sector
		local ext_delta=math.atan(t.gap_sectors/(2*t.radius))
		local int_delta=math.atan(t.gap_sectors/(2*t.int_radius))

		--angles of arcs
		local ext_angle=(angle-ext_delta*2)*valpc
		local int_angle=(angle-int_delta*2)*valpc

		--define colours to use for this sector
		if #tcolor==1 then 
			--plain color
			local vR,vG,vB,vA = rgba_to_r_g_b_a(tcolor[1])
			cairo_set_source_rgba(cr,vR+tcolor[1].dR*idx,
									vG+tcolor[1].dG*idx,
									vB+tcolor[1].dB*idx,
									vA+tcolor[1].dA*idx	)
		else
			--radient color
			local pat=cairo_pattern_create_radial(0,0,t.int_radius,0,0,t.radius)
			for i=1, #tcolor do
				local vP,vR,vG,vB,vA = tcolor[i][1], rgba_to_r_g_b_a(tcolor[i])
				cairo_pattern_add_color_stop_rgba (pat, 
									vP+tcolor[i].dP*idx,
									vR+tcolor[i].dR*idx,
									vG+tcolor[i].dG*idx,
									vB+tcolor[i].dB*idx,
									vA+tcolor[i].dA*idx	)
			end
			cairo_set_source (cr, pat)
			cairo_pattern_destroy(pat)
		end

		--start drawing
		 cairo_save(cr)
		--x axis is parrallel to start of sector
		cairo_rotate(cr,angle0-math.pi/2)

		local ri,re = t.int_radius ,t.radius

		--point A 
		local angle_a
	
		if t.cap == "p" then 
			angle_a = int_delta
			if t.inverse_arc and type_arc ~="bg" then
				angle_a = angle-int_angle-int_delta
			end
			if not(t.inverse_arc) and type_arc =="bg" then
				angle_a = int_delta+int_angle
			end
		else --t.cap=="r"
			angle_a = ext_delta
			if t.inverse_arc and type_arc~="bg" then
				angle_a = angle-ext_angle-ext_delta
			end
			if not(t.inverse_arc) and type_arc=="bg" then
				angle_a = ext_delta+ext_angle
			end
		end
		local ax,ay = ri*math.cos(angle_a),ri*math.sin(angle_a)


		--point B
		local angle_b = ext_delta
		if t.cap == "p" then 
			if t.inverse_arc and type_arc ~="bg" then
				angle_b = angle-ext_angle-ext_delta
			end
			if not(t.inverse_arc) and type_arc=="bg" then
				angle_b = ext_delta+ext_angle
			end
		else
			if t.inverse_arc and type_arc ~="bg" then
				angle_b = angle-ext_angle-ext_delta
			end
			if not(t.inverse_arc) and type_arc=="bg" then
				angle_b = ext_delta+ext_angle
			end
		end
		local bx,by = re*math.cos(angle_b),re*math.sin(angle_b)

		-- EXTERNAL ARC B --> C
		local b0,b1
		if t.inverse_arc then
			if type_arc=="bg" then
				b0,b1= ext_delta, angle-ext_delta-ext_angle
			else
				b0,b1= angle-ext_angle-ext_delta, angle-ext_delta
			end
		else
			if type_arc=="bg" then
				b0,b1= ext_delta+ext_angle, angle-ext_delta
			else
				b0,b1= ext_delta, ext_angle+ext_delta
			end
		end
		
		---POINT D
		local angle_c, angle_d
		if t.cap == "p" then 
			angle_d = angle-int_delta
			if t.inverse_arc and type_arc=="bg" then
				angle_d = angle-int_delta-int_angle	
			end
			if not(t.inverse_arc) and type_arc~="bg" then
				angle_d=int_delta+int_angle
			end
		else
			angle_d = angle-ext_delta
			if t.inverse_arc and type_arc=="bg" then
				angle_d =angle-ext_delta-ext_angle
			end
			if not(t.inverse_arc) and type_arc~="bg" then
				angle_d = ext_angle+ext_delta
			end
		end
		local dx,dy = ri*math.cos(angle_d),ri*math.sin(angle_d)
		
		-- INTERNAL ARC D --> A
		local d0,d1
		if t.cap=="p" then	
			if t.inverse_arc then	
				if type_arc=="bg" then
					d0,d1= angle-int_delta-int_angle,int_delta
				else
					d0,d1= angle-int_delta, angle- int_angle-int_delta
				end
			else
				if type_arc=="bg" then
					d0,d1= angle-int_delta, int_delta+int_angle
				else
					d0,d1= int_delta+int_angle, int_delta
				end
			end
		else
			if t.inverse_arc then	
				if type_arc=="bg" then	
					d0,d1= angle-ext_delta-ext_angle,ext_delta
				else
					d0,d1= angle-ext_delta, angle- ext_angle-ext_delta
				end
			else
				if type_arc=="bg" then	
					d0,d1= angle-ext_delta,ext_delta+ext_angle
				else	
					d0,d1= ext_angle+ext_delta, ext_delta
				end
			end			
		end
			
		--draw sector
		cairo_move_to(cr,ax,ay)
		cairo_line_to(cr,bx,by)
		cairo_arc(cr,0,0,re,b0,b1)
		cairo_line_to(cr,dx,dy) 
		cairo_arc_negative(cr,0,0,ri,d0,d1)
		 cairo_close_path (cr);

		--stroke or fill sector
		 if type_arc=="bd" then
		 	cairo_set_line_width(cr,t.border_size)
		 	cairo_stroke(cr)
		 else
			 cairo_fill(cr)
		 end

		 cairo_restore(cr)

	 end
	--draw sectors
	local n0,n1,n2 = 1,t.sectors,1
	if t.inverse_arc then n0,n1,n2 = t.sectors,1,-1 end
	local index = 0
	for i = n0,n1,n2 do 
		index = index +1
		local valueZ=1
		local cstA, cstB = (i-1),i
		if t.inverse_arc then cstA,cstB = (t.sectors-i), (t.sectors-i+1) end
		
		if value>valueA *cstA and value<valueA*cstB then
			if not t.fill_sector then
				valueZ = (value-valueA*cstA)/valueA
			end
		else
			if value<valueA*cstB then valueZ=0 end
		end
		
		local start_angle= lastAngle+(i-1)*angleA
		if t.foreground ~= false then 
			draw_sector("fg",start_angle,angleA,valueZ, index)
		end
		if t.background ~= false then 
			draw_sector("bg",start_angle,angleA,valueZ, i)
		end
		if t.border_size>0 then draw_sector("bd",start_angle,angleA,1, i) end
	end

	cairo_restore(cr)
end


--[[END OF RING-SECTORS WIDGET]]

Also, a request for a little more help...I would like to make these two conkys into one but am having no joy!


"The nine most terrifying words in the English language are, 'I'm from the government and I'm here to help.'.”  ~Ronald Reagan

Offline

#7445 2014-05-06 11:37:06

wagmic1
#! CrunchBanger
Registered: 2013-11-15
Posts: 119

Re: Conky v1.9 Thread

@DrakarNoir very nice work


I need to learn how to speak/write English big_smile
latest Firefox on #! handylinux

Offline

#7446 2014-05-06 13:09:56

HELPME
#! Junkie
From: the holley land
Registered: 2013-11-15
Posts: 256
Website

Re: Conky v1.9 Thread

how do I use the builtin hddtemp?

Offline

#7447 2014-05-06 13:16:11

DrakarNoir
#! CrunchBanger
From: just beyond the sign post
Registered: 2011-09-02
Posts: 132
Website

Re: Conky v1.9 Thread

HELPME wrote:

how do I use the builtin hddtemp?

^This is not a built in function of conky. You must install it from the repos.

sudo apt-get install hddtemp

Further, you may have issues with permissions which can be resolved by running this command and answering each question positively.

sudo dpkg-reconfigure hddtemp

Also, imprtant to note, that you must also have lmsnsors installed and configured for some of the other functions to work.


"The nine most terrifying words in the English language are, 'I'm from the government and I'm here to help.'.”  ~Ronald Reagan

Offline

#7448 2014-05-06 13:18:42

DrakarNoir
#! CrunchBanger
From: just beyond the sign post
Registered: 2011-09-02
Posts: 132
Website

Re: Conky v1.9 Thread

wagmic1 wrote:

@DrakarNoir very nice work

Thank you wagmic1!  big_smile


"The nine most terrifying words in the English language are, 'I'm from the government and I'm here to help.'.”  ~Ronald Reagan

Offline

#7449 2014-05-06 13:22:51

Marenbraga
Member
Registered: 2013-11-14
Posts: 40

Re: Conky v1.9 Thread

chepioq wrote:
Marenbraga wrote:

Hello friends,
Does anyone know how to show the volume of audio channels - separate - left and right? How would the bar for them?

May be you can use the amixer command :

[dominique@host-192-168-1-2 ~]$ amixer
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 3285 [5%] [on]
  Front Right: Playback 3285 [5%] [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 65536
  Front Left: Capture 5841 [9%] [on]
  Front Right: Capture 5841 [9%] [on]

I think that volumes are under Playback lines :

[dominique@host-192-168-1-2 ~]$ amixer | grep Playback
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Front Left: Playback 45864 [70%] [on]
  Front Right: Playback 45864 [70%] [on]
[dominique@host-192-168-1-2 ~]$ amixer | grep Playback | grep Left: | awk '{print $5}'
[70%]
[dominique@host-192-168-1-2 ~]$ amixer | grep Playback | grep Right: | awk '{print $5}'
[70%]

After I think you can use sed (or awk or grep) for extract just the valor (here it's 70)

And with conky you can mix with execbar command

Thanks friend,
Do you know how these values could be used in a ring on .LUA?

Last edited by Marenbraga (2014-05-06 20:02:14)

Offline

Be excellent to each other!

#7450 2014-05-06 13:57:58

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

Re: Conky v1.9 Thread

@ wagmic1 - ragamatrix - DrakarNoir

OH MY!  That's all great stuff!

Good to see you again DrakarNoir, hope you keep coming back.

@ HELPME - as DrakarNoir said ... let me add a little.

While doing:

sudo dpkg-reconfigure hddtemp

.. answer like this: Yes, 0, Yes, OK, OK
Then in a conky: ${hddtemp /dev/sda}, ${hddtemp /dev/sdb}, etc

and for lmsensors - once it's installed read mrpeachy's HowTo.  I recommend the "platform" method, but choose what's best for you.

Sadly - nothing new to post from me.   sad   8.(

And if you have inxi installed you can actually find out what 'sensor' belongs where:

alias sensen='sensors && inxi -s -c5'		# lm & inxi sensors
 06 May 14 | 10:50:21 ~
    $ sensen
acpitz-virtual-0
Adapter: Virtual device
temp1:        +30.0°C  (crit = +110.0°C)

k10temp-pci-00c3
Adapter: PCI adapter
temp1:        +26.5°C  (high = +70.0°C)

f71862fg-isa-0a00
Adapter: ISA adapter
+3.3V:        +3.50 V  
in1:          +1.35 V  
in2:          +1.51 V  
in3:          +0.87 V  
in4:          +0.00 V  
in5:          +0.00 V  
in6:          +0.00 V  
3VSB:         +3.39 V  
Vbat:         +2.96 V  
fan1:        1920 RPM
fan2:           0 RPM  ALARM
fan3:           0 RPM  ALARM
temp1:        +35.0°C  (high = +85.0°C, hyst = +81.0°C)
                       (crit = +255.0°C, hyst = +251.0°C)  sensor = transistor
temp2:        +31.0°C  (high = +85.0°C, hyst = +81.0°C)
                       (crit = +100.0°C, hyst = +96.0°C)  sensor = thermistor
temp3:       +127.0°C  (high = +70.0°C, hyst = +68.0°C)  ALARM (CRIT)
                       (crit = +85.0°C, hyst = +83.0°C)  sensor = transistor

Sensors:   System Temperatures: cpu: 35.0C mobo: 31.0C gpu: 38C 
           Fan Speeds (in rpm): cpu: 1920 fan-2: 0 fan-3: 0 
 
 06 May 14 | 10:50:25 ~
    $ 

Notice that "sensors" does not report my NVIDIA GPU temp but inxi does:

If you have the NVIDIA drivers and nvidia.-settings installed ... then:

${nvidia temp}

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

Offline

Board footer

Powered by FluxBB

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

Debian Logo