Connexion

Conky -conkyrc -scripts - partie 2

Conkymeteo+lune+baromètre



Attention il faut le pack meteo6jours de Didier-T trouvé ici ainsi que le graphe (même page post n'4 l'accuweather-3.deb) comme se sont des .deb il faut extraire les fichiers ) .

Le conkyrc :
Code TEXT :
 
background yes
use_xft yes
xftfont URW Chancery L:style=Bold:size=10
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 410 820
maximum_width 410
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color ffffff
default_outline_color black
alignment tl
gap_x 20
gap_y 60
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes
imlib_cache_size 0 
 uppercase no
 
 # -- Déclaration template -- #
 template0 ${lua fDrawImage ~/.conky/conky-meteo/meteo/images/\1 \2 \3 \4 \5} # -- images fond -- #
 template1 ${lua Meteo_\1 \2 \3 \4 \5 \6} # -- gestion météo --#
 template2 ${lua Meteo_\1 \2 \3 \4 \5 \6 \7} # -- icônes météo -- \2=répertoire icônes \3=position \4=taille \5=jour (pour les prévisions) #
 template3 ${lua Lune_\1} 
 template4 ${lua_parse Images_\1 \2 \3 60 \4} # -- Appelle image -- \2=position \3=taille \4=jour (pour les prévisions) #
 lua_load ~/.conky/conky-meteo/meteo_lua_2/scripts/meteo2.lua
 
 lua_load ~/.conky/conky-meteo/meteo_lua_2/scripts/baro.lua
lua_draw_hook_pre main
 
lua_load ~/.conky/conky-meteo/meteo_lua_2/scripts/textwriting.lua
lua_draw_hook_post draw_text
 
 lua_startup_hook init ~/.conky/conky-meteo/meteo6jours/meteo.cfg 
 
 
TEXT
 
#### Heure ####
${template1 Maj}
${voffset -25}${font LED_mono :style=Medium:size=30}${goto 30}${time %H}${goto 80}: ${goto 95}${time %M}${font LED_mono :size=20:style=Medium}${color 808080}${goto 150}${time %S}${font}
##### Date et Saints du jour #####
${voffset -40}${goto 220}${color yellow}${font URW Chancery L :size=16:style=Bold}${exec date "+%A %d %B %Y"|sed 's/^.\| [a-z]/\U&/g'}${font}${color}
${voffset -1}${goto 250}Aujourd'hui St :${texeci 1000 wget -O - -q  http://fetedujour.fr/  --user-agent="Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0" | grep h2 | head -1 | cut -d">" -f2 | cut -d"<" -f1 | cut -d":" -f2 } 
##### Heure mise à jour #####
${voffset 1}${goto 130}Dernière mise à jour : ${template1 Heure} h ${template1 Minute}
##### Ville plus température et condition actuelles #####
${voffset 10}${goto 15}${font URW Chancery L :size=12 style:bold}${template1 Ville} : ${font}
${voffset 10}${goto 10}${template1  CondMeteo1} ${voffset 15}${goto 10}${template1  CondMeteo2} ${voffset -55}${goto 240}${font URW Chancery L :size=30:style=Bold}${if_match ${template1 TempAct}<5}${color cornflowerblue}${blink ${template1 TempAct}°}${else}${color ffe595}${template1 TempAct}°${endif} ${font}
##### Affichage infos vent   ######
${voffset 50}${color ffffff}Vent : ${template1 VentDirP}    Vitesse : ${template1 VentForce} km/h   max: ${template1 Jour_VentRafales 1} Km/h     Pluie : ${template1 Jour_NivPrec 1} mm     Visibilité: ${template1  Visibilite 1} km
#### Prévisions six prochaines heures #####
${voffset -2}${goto 10}${template1 huitHeures_Heure 1} h         ${goto 85}${template1 huitHeures_Heure 2} h         ${goto 160}${template1 huitHeures_Heure 3} h         ${goto 235}${template1 huitHeures_Heure 4} h     ${goto 305}${template1 huitHeures_Heure 5} h         ${goto 380}${template1 huitHeures_Heure 6} h    
${voffset -5}${goto 15}${template1 huitHeures_Temp 1}°           ${goto 90}${template1 huitHeures_Temp 2}°           ${goto 165}${template1 huitHeures_Temp 3}°           ${goto 240}${template1 huitHeures_Temp 4}°       ${goto 310}${template1 huitHeures_Temp 5}°           ${goto 385}${template1 huitHeures_Temp 6}°                      
##### Prévisions six prochains jours #####
${voffset 35}${alignc 95}${template1 Jour %a_%d 2}${alignc 40}${template1 Jour %a_%d 3}${alignc -15}${template1 Jour %a_%d 4}${alignc -72}${template1 Jour %a_%d 5}${alignc -127}${template1 Jour %a_%d 6}${alignc -175}${template1 Jour %a_%d 7}
${voffset -5}${alignc 85}${color cornflowerblue}${template1 Nuit_Temp 2}°${color white} | ${color red}${template1 Jour_Temp 2}°  ${alignc 38}${color cornflowerblue}${template1 Nuit_Temp 3}°${color white} | ${color red}${template1 Jour_Temp 3}° ${alignc -20}${color cornflowerblue}${template1 Nuit_Temp 4}°${color white} | ${color red}${template1 Jour_Temp 4}° ${alignc -72}${color cornflowerblue}${template1 Nuit_Temp 5}°${color white} | ${color red}${template1 Jour_Temp 5}°${alignc -128}${color cornflowerblue}${template1 Nuit_Temp 6}°${color white} | ${color red}${template1 Jour_Temp 6}°  ${alignc -173}${color cornflowerblue}${template1 Nuit_Temp 7}°${color white} | ${color red}${template1 Jour_Temp 7}°${font}${color}
#### Lunaison ####
${voffset 50}${goto 190}${font URW Chancery L:style=Bold:size=20}Lune ${font}
${template1 horsligne}
${voffset -20}Ephéméride :          ${goto 110}${template3 ephemerides}
Phase :               ${goto 110}${template3 Phases}
Taux de visibilitée : ${goto 110}${template3 Visibilite } %                            ${goto 180}Age : ${template3 Age}
La Lune se lève à  :  ${goto 110}${template3 HLeverLune}  :  ${template3 MLeverLune}   ${goto 180}Et se couche à  : ${template3 HCoucherLune}  :  ${template3 MCoucherLune}
#### Pression ####
${voffset 10}${goto 160}${font URW Chancery L:style=Bold:size=20}Baromètre${font}
${voffset 150}${goto 185}${template1 Pression 1} mb
#### Affichage base ####
${template0 base.png 0 0 420 330}
${template0 base.png 0 335 420 110}
${template0 base.png 0 450 420 200}
#### Réduction de la hauteur du conky ####
${voffset -2000}
#### Affichage icones condition actuelle et rose des vents ####
${template2 IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 290 80 90 80} ${template2 IconeV ~/.conky/conky-meteo/meteo_lua_2/icones 240 125 40 40}
#### Affichage icones prévisions six prochaines heures ####
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones   1 215 50 40 1}
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones  70 215 50 40 2} 
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 145 215 50 40 3}
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 220 215 50 40 4}
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 295 215 50 40 5}
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 365 215 50 40 6} 
#### Affichage six prochains jours ####
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones   1 285 50 40 2}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones  70 285 50 40 3}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 145 285 50 40 4}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 220 285 50 40 5}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 295 285 50 40 6}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 365 285 50 40 7}
#### Affichage image lune ####
${lua fDrawImage /tmp/lune.png 330 360 60 60}
####Affichage baromètre ####
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_meteo/15.png  60 600 60 40}
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_meteo/18.png  70 550 60 40}
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_meteo/13.png 105 500 60 40}
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_meteo/14.png 158 470 60 40}
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_meteo/6.png  220 470 60 40}
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_meteo/4.png  260 500 60 40}
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_meteo/3.png  280 550 60 40}
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_meteo/1.png  280 600 60 40}
 


le baro.lua
Code TEXT :
 
--==============================================================================
--                                 baro.lua
--
--  author  : SLK-adapted by shamen456
--  version : v2011-06-13
--  license : Distributed under the terms of GNU GPL version 2 or later
--
--==============================================================================
 
require 'cairo'
 
--------------------------------------------------------------------------------
--                                                                    gauge DATA
gauge = {
 
{
    name='cpu',                arg='',                      max_value=1060, sub_value=960,
    x=205,                          y=600,
    graph_radius=60,
    graph_thickness=10,
    graph_start_angle=235,
    graph_unit_angle=2.5,          graph_unit_thickness=2.,
    graph_bg_colour=0xFFFFFF,      graph_bg_alpha=0.4,
    graph_fg_colour=0xB1ADA7,      graph_fg_alpha=0,
    hand_fg_colour=0x000000,       hand_fg_alpha=.0,
    txt_radius=0,
    txt_weight=0,                  txt_size=10.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0,
    graduation_radius=50,
    graduation_thickness=8,        graduation_mark_thickness=2,
    graduation_unit_angle=18,
    graduation_fg_colour=0x4F4B41, graduation_fg_alpha=0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.8,
},
{
    name='lua',                arg='Meteo_Pression',                      max_value=1050, sub_value=950,
    x=205,                          y=600,
    graph_radius=30,
    graph_thickness=70,
    graph_start_angle=255,
    graph_unit_angle=2.1,          graph_unit_thickness=2.,
    graph_bg_colour=0xFFFFFF,      graph_bg_alpha=0.0,
    graph_fg_colour=0xB1ADA7,      graph_fg_alpha=0,
    hand_fg_colour=0xFF0000,       hand_fg_alpha=0.8,
    txt_radius=20,
    txt_weight=0,                  txt_size=10.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0,
    graduation_radius=70,
    graduation_thickness=8,        graduation_mark_thickness=2,
    graduation_unit_angle=18,
    graduation_fg_colour=0x4F4B41, graduation_fg_alpha=1,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.1,
},
{
    name='lua',                arg='Meteo_TempRes',   
    max_value=60,                   sub_value=-30,--valeur de depart du graphe
    x=175,                          y=100,
    graph_radius=20,
    graph_thickness=40,
    graph_start_angle=75,
    graph_unit_angle=2.33,          graph_unit_thickness=1.5,
    graph_bg_colour=0xFFFFFF,      graph_bg_alpha=0,
    graph_fg_colour=0xB1ADA7,      graph_fg_alpha=0,
    hand_fg_colour=0xFF0000,       hand_fg_alpha=0,
    txt_radius=18,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0xC0C0FF,        txt_fg_alpha=0,
    graduation_radius=20,
    graduation_thickness=8,        graduation_mark_thickness=2,
    graduation_unit_angle=11.6,
    graduation_fg_colour=0xffffff, graduation_fg_alpha=0.9,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.3,
},
{
    name='lua',                arg='Meteo_TempAct',                      max_value=60, sub_value=-30,
    x=175,                          y=100,
    graph_radius=20,
    graph_thickness=40,
    graph_start_angle=75,
    graph_unit_angle=2.33,          graph_unit_thickness=1.5,
    graph_bg_colour=0xFFFFFF,      graph_bg_alpha=0.,
    graph_fg_colour=0xB1ADA7,      graph_fg_alpha=0,
    hand_fg_colour=0xff0000,       hand_fg_alpha=1,
    txt_radius=30,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0xED7F77,        txt_fg_alpha=0,
    graduation_radius=22,
    graduation_thickness=14,        graduation_mark_thickness=2,
    graduation_unit_angle=23.3,
    graduation_fg_colour=0xffffff, graduation_fg_alpha=1,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.9,
},
 
}
 
-------------------------------------------------------------------------------
--                                                                 rgb_to_r_g_b
-- converts color in hexa to decimal
--
function rgb_to_r_g_b(colour, alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
 
-------------------------------------------------------------------------------
--                                                            angle_to_position
-- convert degree to rad and rotate (0 degree is top/north)
--
function angle_to_position(start_angle, current_angle)
    local pos = current_angle + start_angle
    return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end
 
-------------------------------------------------------------------------------
--                                                              draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
    local max_value = data['max_value']-data['sub_value']
    local sub_value = data['sub_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_start_angle = data['graph_start_angle']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
    local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
    local graph_end_angle = (max_value * graph_unit_angle) % 360
 
    -- background ring
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)
 
    -- arc of value
    local val = (value-sub_value) % (max_value + 1)
    local start_arc = 0
    local stop_arc = 0
    local i = 1
    while i <= val do
        start_arc = (graph_unit_angle * i) - graph_unit_thickness
        stop_arc = (graph_unit_angle * i)
        cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
        cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = start_arc
 
    -- hand
    start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
    stop_arc = (graph_unit_angle * val)
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
    cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
    cairo_stroke(display)
 
    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = graph_end_angle / graduation_unit_angle
        local i = 0
        while i < nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
            stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
            cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end
 
    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
    local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
    cairo_set_font_size (display, txt_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
    cairo_show_text (display, value)
    cairo_stroke (display)
 
    -- caption
    local caption = data['caption']
    local caption_weight, caption_size = data['caption_weight'], data['caption_size']
    local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
    local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
    cairo_set_font_size (display, caption_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
    cairo_move_to (display, x + tox + 5, y + toy + 1)
    -- bad hack but not enough time !
    if graph_start_angle < 105 then
        cairo_move_to (display, x + tox - 30, y + toy + 1)
    end
    cairo_show_text (display, caption)
    cairo_stroke (display)
end
 
 
-------------------------------------------------------------------------------
--                                                               go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
    local function load_gauge_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_gauge_ring(display, data, value)
    end
 
    for i in pairs(gauge) do
        load_gauge_rings(display, gauge[i])
    end
end
 
-------------------------------------------------------------------------------
--                                                                         MAIN
function conky_main()
    if conky_window == nil then 
        return
    end
 
    local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    local display = cairo_create(cs)
 
    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)
 
    if update_num > 5 then
        go_gauge_rings(display)
    end
 
end
 


le textwriting.lua:
Code TEXT :
 
--[[circlewriting by mrpeachy (2010)]]
require 'cairo'
function addzero100(num)
if tonumber(num) < 10 then
return "00" .. num
elseif tonumber(num) <100 then
return "0" .. num
else
return num
end
end
 
function string:split(delimiter)
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end
 
function circlewriting(cr, text, font, fsize, radi, horiz, verti, tred, tgreen, tblue, talpha, start, finish, var1)
local inum=string.len(text)
range=finish
deg=(finish-start)/(inum-1)
degrads=1*(math.pi/180)
local textcut=string.gsub(text, ".", "%1@@@")
texttable=string.split(textcut, "@@@")
for i = 1,inum do
ival=i
interval=(degrads*(start+(deg*(i-1))))+var1
interval2=degrads*(start+(deg*(i-1)))
txs=0+radi*(math.sin(interval))
tys=0-radi*(math.cos(interval))
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize);
cairo_set_source_rgba (cr, tred, tgreen, tblue, talpha);
cairo_move_to (cr, txs+horiz, tys+verti);
cairo_rotate (cr, interval2)
cairo_show_text (cr, (texttable[i]))
cairo_stroke (cr)
cairo_rotate (cr, -interval2)
end
end
 
function circlewritingdown(cr, text, font, fsize, radi, horiz, verti, tred, tgreen, tblue, talpha, start, finish, var1)
local inum=string.len(text)
deg=(start-finish)/(inum-1)
degrads=1*(math.pi/180)
local textcut=string.gsub(text, ".", "%1@@@")
texttable=string.split(textcut, "@@@")
for i = 1,inum do
ival=i
interval=(degrads*(start-(deg*(i-1))))+var1
interval2=degrads*(start-(deg*(i-1)))
txs=0+radi*(math.sin(interval))
tys=0-radi*(math.cos(interval))
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize);
cairo_set_source_rgba (cr, tred, tgreen, tblue, talpha);
cairo_move_to (cr, txs+horiz, tys+verti);
cairo_rotate (cr, interval2+(180*math.pi/180))
cairo_show_text (cr, (texttable[i]))
cairo_stroke (cr)
cairo_rotate (cr, -interval2-(180*math.pi/180))
end
end
 
function conky_draw_text()
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num > 5 then
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)
 
 
 
--circlewriting variable
cpu=tonumber(conky_parse('${cpu}'))
--text must be in quotes
text=("Tempete - Pluie - Variable - Beau - Tres Sec")
--text=("Stormy - Rain - Change - Fair - Very Dry") 
--font name must be in quotes
font="URW Chancery L"
fontsize=15
radius=80
positionx=205
positiony=600
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450.  Finish has to be greater than start.
start=-115
finish=115
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
 
--circlewritingdown variables
--mem=tonumber(conky_parse('${memperc}'))
--text must be in quotes
text=(" 0 ")
--font name must be in quotes
font="URW Chancery L"
fontsize=12
radius=48
positionx=175
positiony=100
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewritingdown, if the text will cross 0 degrees then you must calculate for 0-finish degrees
--eg if you want to go from 90 to 270, then you will input 90 to -90.  Start has to be greater than finish
start=150
finish=144
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
 
text=("50")
font="URW Chancery L"
fontsize=12
radius=48
positionx=175
positiony=100
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
start=268
finish=262
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
 
text=("40")
font="URW Chancery L"
fontsize=12
radius=48
positionx=175
positiony=100
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
start=245
finish=239
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
 
text=("30")
font="URW Chancery L"
fontsize=12
radius=48
positionx=175
positiony=100
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
start=222
finish=216
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
 
text=("20")
font="URW Chancery L"
fontsize=12
radius=48
positionx=175
positiony=100
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
start=199
finish=193
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
 
text=("10")
font="URW Chancery L"
fontsize=12
radius=48
positionx=175
positiony=100
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
start=176
finish=170
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
 
text=("-10")
font="URW Chancery L"
fontsize=12
radius=48
positionx=175
positiony=100
colorred=1
colorgreen=0
colorblue=0
coloralpha=1
start=134
finish=124
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
 
text=("-20")
font="URW Chancery L"
fontsize=12
radius=48
positionx=175
positiony=100
colorred=1
colorgreen=0
colorblue=0
coloralpha=1
start=112
finish=99
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
 
end
end
 



Conky barographe



Il faut installer "gnuplot" et "bc"
le conkyrc :
Code TEXT :
 
background yes
use_xft yes
xftfont URW Chancery L:style=Bold:size=10
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 410 145
maximum_width 410
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color ffffff
default_outline_color black
alignment tl
gap_x 0
gap_y 720
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes
imlib_cache_size 0 
 uppercase no
  # -- Déclaration template -- #
 template0 ${lua fDrawImage ~/.conky/conky-meteo/meteo/images/\1 \2 \3 \4 \5} # -- images fond -- #
 template1 ${lua Meteo_\1 \2 \3 \4 \5 \6} # -- gestion météo --#
 template2 ${lua Meteo_\1 \2 \3 \4 \5 \6 \7} # -- icônes météo -- \2=répertoire icônes \3=position \4=taille \5=jour (pour les prévisions) #
 template3 ${lua Lune_\1} 
 template4 ${lua_parse Images_\1 \2 \3 60 \4} # -- Appelle image -- \2=position \3=taille \4=jour (pour les prévisions) #
 lua_load ~/.conky/conky-meteo/meteo_lua_2/scripts/meteo2.lua
 lua_startup_hook init ~/.conky/conky-meteo/meteo6jours/meteo.cfg 
 
color1  lightgreen
color2  ff2121
 TEXT
${voffset -30}${goto 100}${font URW Chancery L:style=Bold:size=20}Pression Atmospherique
${if_gw}${execi 1200 bash ~/.conky/barograph/barognuplot.sh }${endif}#
${image ~/.conky/barograph/graph.png -s 285x150 -p 50,10 -n}#
${font URW Chancery L:style=Bold:size=8}}#
 ${voffset -15}${goto 50}${color1} 40 ° ${goto 320}${color2}1040mb
 ${voffset 06} ${goto 50}${color1} 20 ° ${goto 320}${color2}1020mb
 ${voffset 05} ${goto 50}${color1}  0 ° ${goto 320}${color2}1000mb
 ${voffset 09} ${goto 50}${color1}-10 ° ${goto 320}${color2} 980mb
 ${voffset 06} ${goto 50}${color1}-20 ° ${goto 320}${color2} 960mb
 ${template0 base.png 0 0 420 155}
 ${lua fDrawImage ~/.conky/barograph/white.png 70 140 245 12}
 ${voffset -800}
 

le barognuplot.sh :
Code TEXT :
#!/bin/bash
## files
LOG="$HOME/.conky/barograph/ListePression.log"
GRAPH="$HOME/.conky/barograph/graph.png"
## Verifier argument 
##Infos generales
DATE=$(date +"%s")
DATE1WEEK=$(date --date="1 week ago" +"%s")
# liste des dates de releve du fichier log
EPOCH=()
while read 
do
    EPOCH+=( "$REPLY" )
done< <(awk '{print $1}' "$LOG")
# si le fichier existe et contient des valeurs de plus d'une semaine (premiere = plus vieille)
#supprimer premiere valeur
[[ -f $LOG ]] && {
    for i in $(seq 0 $(($(wc -l < $LOG)-1)))
    do
        [[ $DATE1WEEK -gt ${EPOCH[$i]} ]] && sed -i '1d' $LOG || break
    done
}
## Conversion en hectopascal et soustraction de la pression moyenne pour ramener l'axe a zero
PR_HP=`awk '/Pression: / {print int($2)}' ~/.conky/conky-meteo/meteo6jours/reptravail/CC`
TEMP=`awk '/Temp: / {print int($2)}' ~/.conky/conky-meteo/meteo6jours/reptravail/CC`
PR_CALC=$(bc << EOF
scale=0
$PR_HP - 1000
EOF
)
echo "$DATE $PR_CALC $TEMP" >> $LOG
gnuplot <<EOF
set border linewidth 2.5
set terminal png enhanced size 300,170  transparent #font "Ubuntu,10" 400,350
set term png font "URW Chancery L:style=Bold,14"
set output "$GRAPH"
unset key
set grid
set xzeroaxis lt 3 lw 1
set yzeroaxis
set ytics ("" -40, "" -20, "" 20, "" 40)
set mxtics 0
set xdata time
set timefmt "%s"
set xtics 86400
set format x "%d"
set style line 1 lw 2
set style line 2 lw 2
plot ["$DATE1WEEK":"$DATE"] [-40:50] "$LOG" using 1:3 with lines ls 2, "$LOG" using 1:2 with lines ls 1
EOF
exit 0
 


L'heure en mode texte



Une partie à ajouter pour avoir l'heure en mode texte(n'est pas de moi trouvé sur le forum cruchbang et avec quelques une de mes modifications) .
Ne donne pas l'heure exacte mais toute les cinq minutes (mais c'est faisable).La particularité est que dans le talktime_fr.sf on peut remplacer le français par le patois de sa région.
La partie à ajouter(le chemin du .sh sera à modifier en fonction de votre configuration) :
Code TEXT :
${voffset -20}${font URW Chancery L:style=Bold:size=14}${alignc}${execpi 30 /home/romuald/.conky/blanc/talktime_fr.sh}
${alignc}${if_match ${time %u} == 1}lundi${else}\
${if_match ${time %u} == 2}mardi${else}\
${if_match ${time %u} == 3}mercredi${else}\
${if_match ${time %u} == 4}jeudi${else}\
${if_match ${time %u} == 5}vendredi${else}\
${if_match ${time %u} == 6}samedi${else}\
dimanche${endif}${endif}${endif}${endif}${endif}${endif} \
${if_match ${time %e} <= 9}${time %e}${else}${time %d}${endif} \
${if_match ${time %m} == 01}janvier${else}\
${if_match ${time %m} == 02}février${else}\
${if_match ${time %m} == 03}mars${else}\
${if_match ${time %m} == 04}avril${else}\
${if_match ${time %m} == 05}mai${else}\
${if_match ${time %m} == 06}juin${else}\
${if_match ${time %m} == 07}juillet${else}\
${if_match ${time %m} == 08}août${else}\
${if_match ${time %m} == 09}septembre${else}\
${if_match ${time %m} == 10}octobre${else}\
${if_match ${time %m} == 11}novembre${else}\
décembre${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif} \
${time %Y}

le talktime_fr.sh
Code TEXT :
 
#!/bin/sh
# DC's english time 07/07/09
# Tweaked by Sector11
# Converted to French by Sector11 with help from ragamatrix
# find current time
t_hr=$(date +%-H)
#echo $t_hr
t_min=$(date +%-M)
#echo $t_min
#t_hr=9 #tester
#t_min=17 #tester
# is it time to ONE ( the only wierd case)
if [ $t_hr -eq 12 ] && [ $t_min -gt 32 ] ;then
# what minute is it
case $t_min in
33|34|35|36|37)
echo une heure moins vingt-cinq ;;
38|39|40|41|42)
echo une heure moins vingt ;;
43|44|45|46|47)
echo une heure moins le quart ;;
48|49|50|51|52)
echo une heure moins dix ;;
53|54|55|56|57|58|59)
echo une heure moins cinq ;;
58|59)
echo presque une heure
esac
exit
fi
#echo $t_hr
#add one hour for the "to" hour
if [ $t_min -gt 32 ] ; then
t_hr=$(($t_hr + 1)) # override t_hr
fi
#echo $t_hr
# find out what hour it is and change into text
case $t_hr in
0)
t_hr_text=minuit ;;
1)
t_hr_text="une heure" ;;
2)
t_hr_text="deux heure" ;;
3)
t_hr_text="trois heure" ;;
4)
t_hr_text="quatre heure" ;;
5)
t_hr_text="cinq heure" ;;
6)
t_hr_text="six heure" ;;
7)
t_hr_text="sept heure" ;;
8)
t_hr_text="huit heure" ;;
9)
t_hr_text="neuf heure" ;;
10)
t_hr_text="dix heure" ;;
11)
t_hr_text="onze heure" ;;
12)
t_hr_text=midi ;;
13)
t_hr_text="treize heure" ;;
14)
t_hr_text="quatorze heure" ;;
15)
t_hr_text="quinze heure" ;;
16)
t_hr_text="seize heure" ;;
17)
t_hr_text="dix-sept heure" ;;
18)
t_hr_text="dix-huit heure" ;;
19)
t_hr_text="dix-neuf heure" ;;
20)
t_hr_text="vingt heure" ;;
21)
t_hr_text="vingt et une heure" ;;
22)
t_hr_text="vingt-deux heure" ;;
23)
t_hr_text="vingt-trois heure" ;;
esac
# what minute is it
case $t_min in
0|1|2)
echo $t_hr_text ;;
3|4|5|6|7)
echo  $t_hr_text cinq ;;
8|9|10|11|12)
echo $t_hr_text dix ;;
13|14|15|16|17)
echo $t_hr_text un quart ;;
18|19|20|21|22)
echo $t_hr_text vingt ;;
23|24|25|26|27)
echo $t_hr_text vingt-cinq;;
28|29|30|31|32)
echo $t_hr_text et demie ;;
33|34|35|36|37)
echo $t_hr_text moins vingt-cinq ;;
38|39|40|41|42)
echo $t_hr_text moins vingt ;;
43|44|45|46|47)
echo $t_hr_text moins le quart ;;
48|49|50|51|52)
echo $t_hr_text moins dix ;;
53|54|55|56|57)
echo $t_hr_text moins cinq ;;
58|59)
echo ± $t_hr_text ;;
esac
 

et en image:


Amrok cover-album



Pour avoir la pochette avec amarok( pour un fond d'écran clair rajouter le draw bg)

La partie après TEXT
Code TEXT :
${if_running amarok}Amarok: ${voffset 3}${stippled_hr 1}
${execi 10 ~/.conky/amarok/getcover}
${execi 10 ~/.conky/amarok/Amarok artist}
${execi 10 ~/.conky/amarok/Amarok title}
${execi 10 ~/.conky/amarok/Amarok year}
${execi 1 ~/.conky/amarok/Amarok time}
${execibar 1 ~/.conky/amarok/Amarok progress}
${image ~/.conky/cover.png -p 55,185 -s 200x200 -n}
$endif
 

Le getcover ( @ rendre éxécutable)
Code TEXT :
 
#!/bin/bash
# get Amarok cover art  of current track and transform into an album stack
# copypasta from  http://www.imagemagick.org/Usage/thumbnails/#polaroid
# thanks to  eightmillion for completely rewriting the script
# http://ubuntuforums.org/showpost.php?p=8117609&postcount=9846
# edited by fireandfuel                   
# requires: amarok >= 2.0, dbus, libqt4-dbus, perl
# Temp directory must be full path.
tempdir="$HOME/.conky/"
tempfile="${tempdir}nowplaying"
[ -d "$tempdir" ] || mkdir -p "$tempdir"  #test if $tempdir exists, if  not create it.
[ -e "$tempfile" ] || touch "$tempfile"
cover="$(qdbus org.kde.amarok /Player GetMetadata | grep arturl: | cut -c 16- | perl -MURI::Escape -lne 'print uri_unescape($_)')"
if  [[ -z "$cover" ]]; then #test if $cover was set, if not copy nocover.png to cover.png .
    hash=0
     read oldhash < "$tempfile"
    cover="${tempdir}nocover.png"
     if [ "$oldhash" == "$hash" ];then
        :
    else
         cp "${cover}" "${tempdir}cover.png"
        echo 0 >  "$tempfile"
    fi
else
    hash=$(echo "$cover" | md5sum |  cut -d" " -f 1) #Generate hash for current song.
    read  oldhash < "$tempfile"
    if [ "$oldhash" == "$hash" ];then
             :
    else
        convert "${cover}" -resize 200x200  "${tempdir}cover.png"
 
            echo $hash > "$tempfile"
     fi
 
fi
exit


Lanceur pour un programme et son conky



Pour ceux que cela intéresse voici un lanceur pour l'utilisation d'un programme et de son conky .
Pour l'exemple j'ai pris le lecteur Audacious et son conky.
Voici le script @ rendre éxécutable mis dans votre Home :
Code TEXT :
 
#!/bin/bash
PROG_NAME1="conky -c /home/$USER/.conky/audacious/conkyrc"# Nom du programme à  démarrer/arrêter.
PROG_NAME2="/usr/bin/audacious" # Nom du programme à  démarrer/arrêter.
PROCESSPID1=$(pgrep -f /home/$USER/.conky/audacious/conkyrc)# Récupère le PID du processus.
PROCESSPID2=$(pgrep -f "usr/bin/audacious")# Récupére le PID du processus.
if [[ "$PROCESSPID1" != ""  && "$PROCESSPID2" != "" ]]; then# Si les deux processus existe alors on le(s) kill.
        kill $PROCESSPID1 && echo "Stop $PROG_NAME1 (PID: $PROCESSPID1)"
        kill $PROCESSPID2  && echo "Stop $PROG_NAME2 (PID: $PROCESSPID2)"
else# Si aucun processus on démarre le programme.
        kill $PROCESSPID1 
        $PROG_NAME1 & 
        echo "Start $PROG_NAME1"
        kill $PROCESSPID2  
        $PROG_NAME2 & 
        echo "Start $PROG_NAME2"
        if [[ "$PROCESSPID1" == ""  || "$PROCESSPID2" == "" ]]; then# Si un des processus n'existe pas alors on le(s) kill.
                kill $PROCESSPID1 && echo "Stop $PROG_NAME1 (PID: $PROCESSPID1)"
                kill $PROCESSPID2  && echo "Stop $PROG_NAME2 (PID: $PROCESSPID2)"
                echo "Il y a eu un souci au lancement tout a été coupé"
        fi
fi
exit 0

Ensuite on édite son menu pour y rajouter ce script avec une belle icône et on l'ajoute à son tableau de bord ou sa barre des tâches ou son bureau .
Un clic pour ouvrir et un reclic pour refermer le programme et son conky ,comme cela il ni à plus de conky ouvert et non actif.

Conky radiotray



Conky radiotray avec affichage du logo de la station et pour le moment seulement lounderadio avec la pochette du titre joué.
Pour les logos( pas trop grand) ,un petit tour sur le net et les mettre dans le dossier du conky.

le conkyrc :
Code TEXT :
background yes
use_xft yes
xftfont URW Chancery L:style=Bold:size=11
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
#own_window_color 000000
own_window_argb_visual yes
#own_window_argb_value 0
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager,sticky
double_buffer yes
minimum_size 250 250
maximum_width 250
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_outline_color white
alignment top_right
gap_x 0
gap_y 150
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
imlib_cache_size 0
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes
# Taille des pointillés
stippled_borders 5
# Couleurs
default_color FFFFFF #blanc
default_shade_color 333333
default_outline_color black
color1                ffffff
#
color2                e8e8e8
#
color3                6495ee
#
color4                cacaca
#
color5                e7e7e7
#
color6                red
lua_load ~/.conky/draw_bg/draw_bg.lua
TEXT
${voffset -30}${font URW Chancery L:style=Bold:size=20}${alignc}Radiotray ${font}${lua conky_draw_bg 0 60 140 120 120 0x000000 0.99}
${texeci 60 ~/.conky/radiotray/loungeradio.sh}
Radio : ${alignc}${font URW Chancery L:style=Bold:size=14}${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}$font
En ce moment :
${font URW Chancery L:style=Bold:size=10}${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w40}
${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "RTL"}${image ~/.conky/radiotray/rtl.png -p 55,135 -s 120x120 -n}${else}
${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "RTL2"}${image ~/.conky/radiotray/rtl2.jpg -p 55,135 -s 120x120 -n}${else}
${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "HOTMIX80"}${image ~/.conky/radiotray/Hotmixradio-80.jpg -p 55,135 -s 120x120 -n}${else}
${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "MAXI80"}${image ~/.conky/radiotray/maxi80.jpg -p 55,135 -s 120x120 -n}${else}
${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "LOUNGERADIO"}${image ~/.conky/radiotray/loungeradio.jpg -p 55,135 -s 120x120 -n}${endif}
${endif}${endif}${endif}${endif}

le loungeradio.sh modifié pour n'afficher que la pochette .
Code TEXT :
 
#!/bin/bash
    #pulling info from loung-radio.com for conky by nlinedesignz(at)web(dot)de 2013
 
    wget http://www.lounge-radio.com/code/pushed_files/now.html -O ~/.conky/radiotray/loungeradio.html >/dev/null 2>&1 &&
 
    #artist=$(awk '/id="artist"/{getline; print}' ~/.conky/radiotray/loungeradio.html | sed "s/<div>\|<\/div>//g")
     #album=$(awk '/id="album"/{getline; print}' ~/.conky/radiotray/loungeradio.html | sed "s/<div>\|<\/div>//g")
     #track=$(awk '/id="track"/{getline; print}' ~/.conky/radiotray/loungeradio.html | sed "s/<div>\|<\/div>//g")
 
    wget "http://www.lounge-radio.com/code/pushed_files/$(awk '/id="covercontainer"/{print}' ~/.conky/radiotray/loungeradio.html | sed -r 's/.*src="(.*)" width=.*/\1/')" -O ~/.conky/radiotray/loungeradio.jpg >/dev/null 2>&1 &&
 
    #echo '${image ~/loungeradio.jpg -p 42,42 -s 123x123 }';
    #echo 'Artiste:' $artist
    #echo '       Titre:'  $track
    #echo '       Album:'  $album
 
    exit

En image
Loungeradio avec pochette en cours de lecture:

Une radio (hotmix80) avec son logo:

Conky radiotray avec logos et pochette



le conkyrc :
Code TEXT :
background yes
use_xft yes
xftfont URW Chancery L:style=Bold:size=11
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
#own_window_color 000000
own_window_argb_visual yes
#own_window_argb_value 0
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager,sticky
double_buffer yes
minimum_size 250 250
maximum_width 250
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_outline_color white
alignment top_right
gap_x 0
gap_y 600
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
imlib_cache_size 0
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes
# Taille des pointillés
stippled_borders 5
# Couleurs
default_color FFFFFF #blanc
default_shade_color 333333
default_outline_color black
color1                ffffff
lua_load ~/.conky/conky-meteo/meteo_lua_2/scripts/meteo2.lua
TEXT
${voffset -30}${font URW Chancery L:style=Bold:size=20}${alignc}Radiotray ${font}
Radio : ${alignc}${font URW Chancery L:style=Bold:size=12}${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}$font
${alignc}${voffset 50}En ce moment :
${font URW Chancery L:style=Bold:size=10}${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w40 }
${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w40 > ~/.conky/radiotray/artiste_titre.txt}
${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "RTL"}${lua fDrawImage ~/.conky/radiotray/logos/rtl.png 100 50 50 50}${else}
${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "HOTMIX80"}${lua fDrawImage ~/.conky/radiotray/logos/hotmix-80.png 100 50 50 50}${else}
${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "MAXI80"}${lua fDrawImage ~/.conky/radiotray/logos/maxi80.png 100 50 50 50}${else}
${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "RTL2"}${lua fDrawImage ~/.conky/radiotray/logos/rtl2.png 100 50 50 50}${else}
${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "MAGNUM LA RADIO"}${lua fDrawImage ~/.conky/radiotray/logos/magnumradio.png 40 50 150 50}${else}
${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "LOUNGERADIO"}${lua fDrawImage ~/.conky/radiotray/logos/image.png 100 50 50 50}${else}
${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "RFM"}${lua fDrawImage ~/.conky/radiotray/logos/rfm.png 100 50 50 50}${endif}
${endif}${endif}${endif}${endif}${endif}${endif}
${execi 10 ~/.conky/radiotray/pochette.sh}
${lua fDrawImage ~/.conky/radiotray/pochette.png 80 150 100 100}
${voffset -1000}

Pochette.sh :
Code TEXT :
#bin/bash
 
titre=$(head -1 ~/.conky/radiotray/artiste_titre.txt)
lienMiniature=$(wget -U'Googlebot-Image/1.0' -qO - "www.google.fr/search?q=$titre\&tbm=isch" | perl -pe 's!.*?<img .*?src="([^"]*)".*!$1!')
wget -qO miniatureGoogleImage $lienMiniature
convert ~/miniatureGoogleImage ~/.conky/radiotray/pochette.png
 


Image.lua



Un script en lua pour afficher les images ou logos ou autre chose avec en plus la rotation.
@ mettre dans un dossier @ part comme cela la ligne d'appel sera la même pour tout les conky soit.
lua_load ~/.conky/lua/image.lua
Mise avant la partie TEXT des conkys .Cela permet d'avoir toutes les images ( obligatoirement une png) qui restent voyantes quel que soit le type de fond d'écran clair ou foncé.
Puis dans le conky j'appelle l'image ainsi:
${lua fDrawImage ~/.conky/radiotray/image.png 50 100 150 150 0 }
Ceci étant un exemple il faudra donc modifier le chemin de votre image à afficher
${lua fDrawImage= fonction lua
~/.conky/...= chemin de l'image @ afficher
50=position horizontale en partant de gauche
100=position verticale en partant du haut
150=hauteur de l'image
150=largeur de l'image
0=rotation de l'image (on peut ici ne rien mettre sinon 0.1 -1-1.5 ou autre jusqu'à la rotation désirée.
le script "image.lua"
Code TEXT :
 
-- De Didier-T 
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

Mucic On Console MOC



Pour ceux qui utilise Music On Console (moc)
Le script qui lance le conky et mocp avec son interface dans la console( remplacer konsole par console ou autre suivant votre environnement)
Code :
 
#!/bin/bash
PROG_NAME1="conky -c /home/$USER/.conky/moc/conkyrc"# Nom du programme à  démarrer/arrêter.
PROG_NAME2="/usr/bin/konsole -e /usr/bin/mocp" # Nom du programme à  démarrer/arrêter.
PROCESSPID1=$(pgrep -f /home/$USER/.conky/moc/conkyrc)# Récupère le PID du processus.
PROCESSPID2=$(pgrep -f "/usr/bin/mocp")# Récupére le PID du processus.
if [[ "$PROCESSPID1" != ""  && "$PROCESSPID2" != "" ]]; then# Si les deux processus existe alors on le(s) kill.
        kill $PROCESSPID1 && echo "Stop $PROG_NAME1 (PID: $PROCESSPID1)"
        kill $PROCESSPID2  && echo "Stop $PROG_NAME2 (PID: $PROCESSPID2)"
else# Si aucun processus on démarre le programme.
        kill $PROCESSPID1 
        $PROG_NAME1 & 
        echo "Start $PROG_NAME1"
        kill $PROCESSPID2  
        $PROG_NAME2 & 
        echo "Start $PROG_NAME2"
        if [[ "$PROCESSPID1" == ""  || "$PROCESSPID2" == "" ]]; then# Si un des processus n'existe pas alors on le(s) kill.
                kill $PROCESSPID1 && echo "Stop $PROG_NAME1 (PID: $PROCESSPID1)"
                kill $PROCESSPID2  && echo "Stop $PROG_NAME2 (PID: $PROCESSPID2)"
                echo "Il y a eu un souci au lancement tout a été coupé"
        fi
fi
exit 0

le conkyrc:
Code :
 
background yes
use_xft yes
xftfont URW Chancery L:style=Bold:size=10
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 310 500
maximum_width 310
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color ffffff #ffd579
default_outline_color black
default_bar_size 230 6
alignment tl
gap_x 0
gap_y 200
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes
imlib_cache_size 0 
 uppercase no
 
 TEXT
 
${font URW Chancery L:style=Bold:size=20}${alignc}Music On Console $font
Artiste : ${goto 150}${moc_artist}
Album :   ${goto 150}${moc_album}
Titre :   ${goto 150}${moc_song}
${goto 40}${execbar mocp -Q '%cs/%ts*100' | bc -l}
${voffset -20}0:00 ${goto 280}${moc_totaltime}
 ${goto 140}${moc_curtime}


avec la fenêtre réduite:

Conky Accuweather



Conky météo accuweather (l'ancien ne fonctionne plus depuis la refonte complète du site accuweather.com)
le pack est @ prendre ici :
https://forums.bunsenlabs.org/viewtopic.php?id=189
La francisation n'est pas complète mais elle reste facile à faire .Pour cela ouvrir le fichier 1_accuweather descendre dans la partie .
#English to french (ligne 520)
prendre une ligne et faire un copier-coller puis effectuer la traduction (attention respecter les majuscules et les espaces)
exemple:
je prend cette ligne :
Code TEXT :
sed -i -e 's/Clear/Dégagé/' $HOME/1_accuweather/curr_cond-fr

Mon conky affiche " Fog" cela donne
Code TEXT :
sed -i -e 's/Fog/Brouillard/' $HOME/1_accuweather/curr_cond-fr

Ainsi de suite .

le conkyrc
Code TEXT :
 
background yes
use_xft yes
xftfont GE Inspira:size=9
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 450 440
maximum_width 455
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white #dbc38f
default_outline_color black
alignment tl
gap_x 60
gap_y 60
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes
imlib_cache_size 0 
 uppercase no
 
 color7 6495ee
 color9 red
 
    lua_load ~/.conky/lua/image.lua
 
TEXT
${execi 600 bash $HOME/1_accuweather/1_accuweather -f -h}
#### Prelier cadre ####
${voffset -30}${font LED_mono :style=Medium:size=55}${color 434343}${goto 27}${time %H}${goto 138}${time %M}${font LED_mono :size=20:style=Medium}${color 808080}${goto 235}${time %S}$font
#### Date ####
${voffset -30}${color white}${font GE Inspira:size=9}${alignc -108}${time %A, %d %B %Y}$font
### vent ####
${voffset 10}
${goto 310}${font GE Inspira:size=10}Vent : ${execi 90 sed -n '5p' $HOME/1_accuweather/curr_cond-fr} 
${goto 310}Vitesse : ${execi 90 sed -n '6p' $HOME/1_accuweather/curr_cond}
${goto 310}Préssion : ${execi 90 sed -n '8p' $HOME/1_accuweather/curr_cond}
${goto 310}Indice UV : ${execi 90 sed -n '9p' $HOME/1_accuweather/curr_cond} $font
#### Ville ####
${voffset -50}${font GE Inspira:size=14:}Sarreguemines : ${font} ${execi 90 sed -n '4p' $HOME/1_accuweather/curr_cond-fr} 
Temp.: ${execi 90 sed -n '2p' $HOME/1_accuweather/curr_cond} °C   Res.: ${execi 90 sed -n '3p' $HOME/1_accuweather/curr_cond} °C 
Alerte : ${execi 600  sed -n '2p' $HOME/1_accuweather/Alertes}
#### Deuxième cadre ####
##### Affichage temperatures #####
${voffset 1}
${goto 20}${color7}${execi 90 sed -n '9p' $HOME/1_accuweather/first_days}°${color}/${color9}${execi 90 sed -n '8p' $HOME/1_accuweather/first_days}°${color}
${goto 95}${color7}${execi 90 sed -n '14p' $HOME/1_accuweather/first_days}°${color}/${color9}${execi 90 sed -n '13p' $HOME/1_accuweather/first_days}°${color}
${goto 170}${color7}${execi 90 sed -n '19p' $HOME/1_accuweather/first_days}°${color}/${color9}${execi 90 sed -n '18p' $HOME/1_accuweather/first_days}°${color}
${goto 245}${color7}${execi 90 sed -n '24p' $HOME/1_accuweather/first_days}°${color}/${color9}${execi 90 sed -n '23p' $HOME/1_accuweather/first_days}°${color}
${goto 320}${color7}${execi 90 sed -n '4p' $HOME/1_accuweather/last_days}°${color}/${color9}${execi 90 sed -n '3p' $HOME/1_accuweather/last_days}°${color}
${goto 400}${color7}${execi 90 sed -n '9p' $HOME/1_accuweather/last_days}°${color}/${color9}${execi 90 sed -n '8p' $HOME/1_accuweather/last_days}°${color}
#### Affichage date ####
${voffset 40}
${goto 20}${execi 3600 echo `date --date="1 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="1 day" | awk '{print $3}'`}
${goto 95}${execi 3600 echo `date --date="2 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="2 day" | awk '{print $3}'`}
${goto 170}${execi 3600 echo `date --date="3 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="3 day" | awk '{print $3}'`}
${goto 245}${execi 3600 echo `date --date="4 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="4 day" | awk '{print $3}'`}
${goto 320}${execi 3600 echo `date --date="5 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="5 day" | awk '{print $3}'`}
${goto 400}${execi 3600 echo `date --date="6 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="6 day" | awk '{print $3}'`}
#### Troisième cadre ####
${voffset -22}
${color FFFFFF}${goto 10}${voffset 20}${cpu cpu0}%
${goto 55}${exec expr `cat /sys/class/hwmon/hwmon2/temp1_input` / 1000} °
${goto 105}${execi 120 hddtemp -n /dev/sda} °
${goto 155}${hwmon 1 temp 1} °
${goto 200}${memperc}%
${goto 255}${fs_used_perc /}%
${goto 305}${fs_used_perc /home}%
${goto 350}${downspeed wlp2s0}
${goto 400}${upspeed wlp2s0}
${color 6495ee}${goto 10}CPU
${goto 50}Temp
${goto 100}Disque
${goto 150}Carte
${goto 200}Ram
${goto 250}Racine
${goto 300}Home
${goto 350}Entrant
${goto 400}Sortant $color
${goto 250}Signal : ${wireless_link_qual wlp2s0} %${goto 350}${totaldown wlp2s0}${goto 400}${totalup wlp2s0}
${color FFFFFF}${font caviar dreams:size=8}Uptime: ${uptime_short}
${color FFFFFF}${font caviar dreams:size=8}Processes: ${processes}
${color FFFFFF}${font caviar dreams:size=8}Running: ${running_processes}
${voffset -54}
${color 6495ee}${font caviar dreams:size=8}${alignr 20}${nodename}
${color 6495ee}${font caviar dreams:size=8}${alignr 20}Mageia 5 $machine
${color 6495ee}${font caviar dreams:size=8}${alignr 20}Kernel: ${kernel}
#### Affichage des cadres utilisés dans le conky ####
${voffset -935}
#### premier cadre ####
${lua fDrawImage $HOME/1_accuweather/fond/base.png 0 40 450 110}
${lua fDrawImage $HOME/1_accuweather/fond/flip_bg.png 22 3 100 100}
${lua fDrawImage $HOME/1_accuweather/fond/flip_bg.png 132 3 100 100}
#### Second cadre ####
${lua fDrawImage $HOME/1_accuweather/fond/base.png 0 155 450 85}
#### Troisième cadre ####
${lua fDrawImage $HOME/1_accuweather/fond/base.png 0 250 450 85}
#### icônes premier cadre ####
${lua fDrawImage $HOME/1_accuweather/0.png 205 70 132 70}
${lua fDrawImage $HOME/1_accuweather/Wind1.png 370 40 90 90}
#### icônes Second cadre ####
${lua fDrawImage $HOME/1_accuweather/1.png -15 170 90 55}
${lua fDrawImage $HOME/1_accuweather/2.png  60 170 90 55}
${lua fDrawImage $HOME/1_accuweather/3.png 135 170 90 55}
${lua fDrawImage $HOME/1_accuweather/4.png 215 170 90 55}
${lua fDrawImage $HOME/1_accuweather/5.png 290 170 90 55}
${lua fDrawImage $HOME/1_accuweather/6.png 370 170 90 55}
${voffset - 800}
 

le 1_accuweather ( a rendre éxecutable)
Code TEXT :
#!/bin/bash
if (( $# < 1 )); then
    exit
fi
#put your Accuweather address here
#address="http://www.accuweather.com/en/ca/montreal/h3a/weather-forecast/56186"
address="http://www.accuweather.com/en/fr/sarreguemines/135050/weather-forecast/135050"
#address="http://www.accuweather.com/en/gr/kastoria/178682/weather-forecast/178682"
loc_id=$(echo $address|sed 's//weather-forecast.*$//'|sed 's/^.*///')
last_number=$(echo $address|sed 's/^.*///')
###################################################
#NORMAL FORECAST: -f passed as 1rst or 2nd argument
###################################################
if [[ $1 == -f || $2 == -f ]]; then
 
    #function: test_image
    test_image () {
        case $1 in
             1)
               echo a
             ;;
             2|3)
               echo b 
             ;;
             4|5)
               echo c
             ;;
             6)
               echo d
             ;;
             7)
               echo e
             ;;
             8)
               echo f
             ;;
             11)
               echo 0
             ;;
             12)
               echo h
             ;;
             13|14)
               echo g
             ;;
             15)
               echo m
             ;;
             16|17)
               echo k
             ;;
             18)
               echo i
             ;;
             19)
               echo q
             ;;
             20|21|23)
               echo o
             ;;
             22)
               echo r
             ;;
             24|31)
               echo E
             ;;
             25)
               echo v
             ;;
             26)
               echo x
             ;;
             29)
               echo y
             ;;
             30)
               echo 5
             ;;
             32)
               echo 6
             ;;
             33)
               echo A
             ;;
             34|35)
               echo B
             ;;
             36|37)
               echo C
             ;;
             38)
               echo D
             ;;
             39|40)
               echo G
             ;;
             41|42)
               echo K
             ;;
             43|44)
               echo O
             ;;
             *)
               echo -
             ;;   
            esac
    } 
 
 
    kill -STOP $(pidof conky)
    killall wget
 
    curr_addr="$(echo $address|sed 's/weather-forecast.*$//')"current-weather/"$last_number"
    wget -O $HOME/1_accuweather/curr_cond_raw "$curr_addr"
 
    addr1="$(echo $address|sed 's/weather-forecast.*$//')"daily-weather-forecast/"$last_number"
    wget -O $HOME/1_accuweather/first_days_raw "$addr1"
 
    addr2="$addr1"?day=6
    wget -O $HOME/1_accuweather/last_days_raw "$addr2"
 
    rm $HOME/1_accuweather/*.png
 
    #current conditions
    if [[ -s $HOME/1_accuweather/curr_cond_raw ]]; then
        sed -i '/detail-now/,/Astronomy <span class/!d' $HOME/1_accuweather/curr_cond_raw
        egrep -i '"cond"|icon i-|large-temp|small-temp|wind-point|"wind"|Humidity|Pressure|UV Index|Cloud Cover|Ceiling|Dew Point|Visibility|Duration|Sunrise:|Sunset:|Moonrise:|Moonset:' $HOME/1_accuweather/curr_cond_raw > $HOME/1_accuweather/curr_cond
        sed -i -e 's/^.*<strong>//g' -e 's/^.*<span>//g' -e 's/^.*icon i-//g' -e 's/^.*large-temp">//g' -e 's/^.*</em> //g' -e 's/^.*"cond">//g' -e 's/^.*wind-point //g' $HOME/1_accuweather/curr_cond
        sed -i -e 's/">.*$//g' -e 's/°.*$//g' -e 's/</span>.*$//g' -e 's/&#.*$//g' -e 's/ &darr.*$//g' -e 's/ &uarr.*$//g' -e 's/</strong>.*$//g' $HOME/1_accuweather/curr_cond
        sed -i '1s/-.*$//' $HOME/1_accuweather/curr_cond
        image=$(sed -n 1p $HOME/1_accuweather/curr_cond)
        echo $(test_image $image) >> $HOME/1_accuweather/curr_cond
        cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n 1p $HOME/1_accuweather/curr_cond).png $HOME/1_accuweather/0.png
    fi
 
    #First 5 days
    if [[ -s $HOME/1_accuweather/first_days_raw ]]; then
 
        sed -i '/.feed-controls/,/.feed-tabs/!d' $HOME/1_accuweather/first_days_raw
        egrep -i 'href="#"|icon i-|"large-temp"|"small-temp"|temp-label|"cond"' $HOME/1_accuweather/first_days_raw > $HOME/1_accuweather/first_days
        sed -i -e '/icon/s/-. //g' -e 's/^.*icon i-//g' -e 's/^.*large-temp">//g' -e 's/^.*small-temp">///g' -e 's/^.*"cond">//g' -e 's/^.*href="#">//g' -e 's/^.*"temp-label tonight ">//g' -e 's/^.*"temp-label tonight selected">//g' $HOME/1_accuweather/first_days
        sed -i -e 's/°.*$//g' -e 's/</a>.*$//g' -e 's/</span>.*$//g' -e 's/">.*$//g' $HOME/1_accuweather/first_days
        sed -i -e 's/Mon/Monday/' -e 's/Tue/Tuesday/' -e 's/Wed/Wednesday/' -e 's/Thu/Thursday/' -e 's/Fri/Friday/' -e 's/Sat/Saturday/' -e 's/Sun/Sunday/' $HOME/1_accuweather/first_days
        for (( i=2; i<=22; i+=5 ))
          do
              image=$(sed -n "${i}"p $HOME/1_accuweather/first_days)
              echo $(test_image $image) >> $HOME/1_accuweather/first_days
          done
        j=1
        for (( i=2; i<=22; i+=5 ))
          do
              cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/first_days).png $HOME/1_accuweather/$j.png
              ((j++))
          done
    fi
 
    # icone direction vent 
wind_direction=$(sed -n 5p $HOME/1_accuweather/curr_cond)
if [[ $wind_direction == "S" ]]; then
    cp $HOME/1_accuweather/vents/"02.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "South" ]]; then
    cp $HOME/1_accuweatherI/vents/"02.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "SSW" ]]; then
    cp $HOME/1_accuweather/vents/"03.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "SW" ]]; then
    cp $HOME/1_accuweather/vents/"04.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "WSW" ]]; then
    cp $HOME/1_accuweather/vents/"05.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "W" ]]; then
    cp $HOME/1_accuweather/vents/"06.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "West" ]]; then
    cp $HOME/1_accuweather/vents/"06.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "WNW" ]]; then
    cp $HOME/1_accuweather/vents/"07.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "NW" ]]; then
    cp $HOME/1_accuweather/vents/"08.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "NNW" ]]; then
    cp $HOME/1_accuweather/vents/"09.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "N" ]]; then
    cp $HOMME/1_accuweather/vents/"10.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "North" ]]; then
    cp $HOME/1_accuweather/vents/"10.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "NNE" ]]; then
    cp $HOME/1_accuweather/vents/"11.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "NE" ]]; then
    cp $HOME/1_accuweather/vents/"12.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "ENE" ]]; then
    cp $HOME/1_accuweather/vents/"13.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "E" ]]; then
    cp $HOME/1_accuweather/vents/"14.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "East" ]]; then
    cp $HOME/1_accuweather/vents/"14.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "ESE" ]]; then
    cp $HOME/1_accuweather/vents/"15.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "SE" ]]; then
    cp $HOME/1_accuweather/vents/"16.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "SSE" ]]; then
    cp $HOME/1_accuweather/vents/"17.png" $HOME/1_accuweather/Wind1.png
elif [[ $wind_direction == "Variable" ]]; then
    cp $HOME/1_accuweather/vents/"00.png" $HOME/1_accuweather/Wind1.png
fi
    #Next 5 days
    if [[ -s $HOME/1_accuweather/last_days_raw ]]; then
 
        sed -i '/.feed-controls/,/.feed-tabs/!d' $HOME/1_accuweather/last_days_raw
        egrep -i 'href="#"|icon i-|large-temp|small-temp|temp-label|"cond"' $HOME/1_accuweather/last_days_raw > $HOME/1_accuweather/last_days
        sed -i -e '/icon/s/-. //g' -e 's/^.*icon i-//g' -e 's/^.*large-temp">//g' -e 's/^.*small-temp">///g' -e 's/^.*"cond">//g' -e 's/^.*href="#">//g' -e 's/^.*"temp-label tonight ">//g' $HOME/1_accuweather/last_days
        sed -i -e 's/°.*$//g' -e 's/</a>.*$//g' -e 's/</span>.*$//g' -e 's/">.*$//g' $HOME/1_accuweather/last_days
        sed -i -e 's/Mon/Monday/' -e 's/Tue/Tuesday/' -e 's/Wed/Wednesday/' -e 's/Thu/Thursday/' -e 's/Fri/Friday/' -e 's/Sat/Saturday/' -e 's/Sun/Sunday/' $HOME/1_accuweather/last_days
        for (( i=2; i<=22; i+=5 ))
          do
              image=$(sed -n "${i}"p $HOME/1_accuweather/last_days)
              echo $(test_image $image) >> $HOME/1_accuweather/last_days
          done
        j=6
        for (( i=2; i<=22; i+=5 ))
          do
              cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/last_days).png $HOME/1_accuweather/$j.png
              ((j++))
          done
    fi
 
    if [[ $1 != -h && $2 != -h ]]; then
        kill -CONT $(pidof conky)
    fi
fi
###################################################
#HOURLY FORECAST: -h passed as 1rst or 2nd argument
###################################################
if [[ $1 == -h || $2 == -h ]]; then
    #Hourly: First 8h
 
    if [[ $1 != -f && $2 != -f ]]; then
        kill -STOP $(pidof conky)
    fi
 
    killall wget
    rm $HOME/1_accuweather/hourly_*.png
 
    hourly_addr1="$(echo $address|sed 's/weather-forecast.*$//')"hourly-weather-forecast/"$last_number"
    wget -O $HOME/1_accuweather/hourly_raw1 "$hourly_addr1"
 
    if [[ -s $HOME/1_accuweather/hourly_raw1 ]]; then
        sed -i '/detail-tab-buttons.detail-tab-buttons/,/<div class="hourly-table">/!d' $HOME/1_accuweather/hourly_raw1
        egrep -i 'hour=|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|pm</div>|am</div>|icon-weather icon i-|<th>Forecast|<span>.*</span>|<th>Temp|<th>Realfeel|<th>Wind|<th>Rain|<th>Snow|<th>Ice|<th>UV Index|<th>Cloud Cover|<th>Humidity|<th>Dew Point' $HOME/1_accuweather/hourly_raw1 > $HOME/1_accuweather/hourly1
        sed -i -e 's/^[ t]*//g' -e 's/^.*<div>//g' -e 's/^.*<span>//g' -e 's/^.*<th>//g' -e 's/^.*icon i-//g' -e 's/-s">.*$//g' -e 's/</div>.*$//g' -e 's/&#.*$//g' -e 's/</span>.*$//g' -e 's/</th>.*$//g' -e 's/^.*href="//g' -e 's/" class=.*$//g' $HOME/1_accuweather/hourly1
        sed -i -e 's/Monday/Mon/' -e 's/Tuesday/Tue/' -e 's/Wednesday/Wed/' -e 's/Thursday/Thu/' -e 's/Friday/Fri/' -e 's/Saturday/Sat/' -e 's/Sunday/Sun/' -e 's/r//g' $HOME/1_accuweather/hourly1
        j=1
        for (( i=4; i<=18; i+=2 ))
          do
            cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/hourly1).png $HOME/1_accuweather/hourly_$j.png
            ((j++))
          done
    fi
 
    #Hourly: Next 8h
    hourly_addr2=$(sed -n 1p $HOME/1_accuweather/hourly1)
    wget -O $HOME/1_accuweather/hourly_raw2 "$hourly_addr2"
 
    if [[ -s $HOME/1_accuweather/hourly_raw2 ]]; then
        sed -i '/detail-tab-buttons.detail-tab-buttons/,/<div class="hourly-table">/!d' $HOME/1_accuweather/hourly_raw2
        egrep -i 'hour=|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|pm</div>|am</div>|icon-weather icon i-|<th>Forecast|<span>.*</span>|<th>Temp|<th>Realfeel|<th>Wind|<th>Rain|<th>Snow|<th>Ice|<th>UV Index|<th>Cloud Cover|<th>Humidity|<th>Dew Point' $HOME/1_accuweather/hourly_raw2 > $HOME/1_accuweather/hourly2
        sed -i -e 's/^[ t]*//g' -e 's/^.*<div>//g' -e 's/^.*<span>//g' -e 's/^.*<th>//g' -e 's/^.*icon i-//g' -e 's/-s">.*$//g' -e 's/</div>.*$//g' -e 's/&#.*$//g' -e 's/</span>.*$//g' -e 's/</th>.*$//g' -e 's/^.*href="//g' -e 's/" class=.*$//g' $HOME/1_accuweather/hourly2
        sed -i 1d $HOME/1_accuweather/hourly2
        sed -i -e 's/Monday/Mon/' -e 's/Tuesday/Tue/' -e 's/Wednesday/Wed/' -e 's/Thursday/Thu/' -e 's/Friday/Fri/' -e 's/Saturday/Sat/' -e 's/Sunday/Sun/' -e 's/r//g' $HOME/1_accuweather/hourly2
        j=9
        for (( i=4; i<=18; i+=2 ))
          do
            cp $HOME/1_accuweather/Forecast_Images_2016/$(sed -n ${i}p $HOME/1_accuweather/hourly2).png $HOME/1_accuweather/hourly_$j.png
            ((j++))
          done
    fi
 
 
    # Full info, next 16h - altogether16 file
    rm $HOME/1_accuweather/altogether16
 
    #TIME
    echo "${color ffe595}TIME${goto 100}" > $HOME/1_accuweather/altogether16
    sed -i "1s/$/$(sed -n 2p $HOME/1_accuweather/hourly1):$(sed -n 3p $HOME/1_accuweather/hourly1)/" $HOME/1_accuweather/altogether16
    jump_to=160
    for (( i=5; i<=17; i+=2 ))
        do
            time=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
            sed -i "1s/$/${goto $jump_to}$time/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    sed -i "1s/$/${goto 580}$(sed -n 2p $HOME/1_accuweather/hourly2):$(sed -n 3p $HOME/1_accuweather/hourly2)/" $HOME/1_accuweather/altogether16
    jump_to=640
    for (( i=5; i<=17; i+=2 ))
        do
            time=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
            sed -i "1s/$/${goto $jump_to}$time/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    sed -i '1s/$/n/' $HOME/1_accuweather/altogether16
 
    #IMAGES
    jump_to=85
    for (( i=1; i<=16; i+=1 ))
        do
            sed -i "2s/$/${image $HOME/1_accuweather/hourly_$i.png -s 36x36 -p $jump_to,49}/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    sed -i '1s/$/nn/' $HOME/1_accuweather/altogether16
 
    #FORECAST
    echo "FORECAST${color}" >> $HOME/1_accuweather/altogether16
    jump_to=100
    for (( i=20; i<=27; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1|awk '{print $1}'|cut -c1-8)
            sed -i "5s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    for (( i=20; i<=27; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2|awk '{print $1}'|cut -c1-8)
            sed -i "5s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    sed -i '5s/$/n/' $HOME/1_accuweather/altogether16
    jump_to=100
    for (( i=20; i<=27; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1|awk '{print $2}'|cut -c1-8)
            sed -i "6s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    for (( i=20; i<=27; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2|awk '{print $2}'|cut -c1-8)
            sed -i "6s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
 
    #TEMPERATURE
    echo "${color ffe595}${goto 100}${hr 1}" >> $HOME/1_accuweather/altogether16
    echo "Température${color}" >> $HOME/1_accuweather/altogether16
    jump_to=100
    for (( i=29; i<=36; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
            sed -i "8s/$/${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    for (( i=29; i<=36; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
            sed -i "8s/$/${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
 
    #REAL FEEL
    echo "${color ffe595}${goto 100}${hr 1}" >> $HOME/1_accuweather/altogether16
    echo "Ressentie${color}" >> $HOME/1_accuweather/altogether16
    jump_to=100
    for (( i=38; i<=45; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
            sed -i "10s/$/${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done    
    for (( i=38; i<=45; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
            sed -i "10s/$/${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done    
 
    #WIND
    echo "${color ffe595}${goto 100}${hr 1}" >> $HOME/1_accuweather/altogether16
    echo "Vent${color}" >> $HOME/1_accuweather/altogether16
    jump_to=100
    for (( i=47; i<=54; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
            sed -i "12s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    for (( i=47; i<=54; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
            sed -i "12s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
 
    #RAIN
    echo "${color ffe595}${goto 100}${hr 1}" >> $HOME/1_accuweather/altogether16
    echo "Pluie${color}" >> $HOME/1_accuweather/altogether16
    jump_to=100
    for (( i=64; i<=71; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
            sed -i "14s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    for (( i=64; i<=71; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
            sed -i "14s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
 
    #SNOW
    echo "${color ffe595}${goto 100}${hr 1}" >> $HOME/1_accuweather/altogether16
    echo "Neige${color}" >> $HOME/1_accuweather/altogether16
    jump_to=100
    for (( i=73; i<=80; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
            sed -i "16s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    for (( i=73; i<=80; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
            sed -i "16s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
 
    #ICE
    echo "${color ffe595}${goto 100}${hr 1}" >> $HOME/1_accuweather/altogether16
    echo "Geler${color}" >> $HOME/1_accuweather/altogether16
    jump_to=100
    for (( i=82; i<=89; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
            sed -i "18s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    for (( i=82; i<=89; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
            sed -i "18s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
 
    #UV INDEX
    echo "${color ffe595}${goto 100}${hr 1}" >> $HOME/1_accuweather/altogether16
    echo "Index UV${color}" >> $HOME/1_accuweather/altogether16
    jump_to=100    
    for (( i=99; i<=106; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
            sed -i "20s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    for (( i=99; i<=106; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
            sed -i "20s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
 
    #CLOUD COVER
    echo "${color ffe595}${goto 100}${hr 1}" >> $HOME/1_accuweather/altogether16
    echo "Couv.Nuag.${color}" >> $HOME/1_accuweather/altogether16
    jump_to=100    
    for (( i=108; i<=115; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
            sed -i "22s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    for (( i=108; i<=115; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
            sed -i "22s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
 
    #HUMIDITY
    echo "${color ffe595}${goto 100}${hr 1}" >> $HOME/1_accuweather/altogether16
    echo "Humidité${color}" >> $HOME/1_accuweather/altogether16
    jump_to=100    
    for (( i=117; i<=124; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
            sed -i "24s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    for (( i=117; i<=124; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
            sed -i "24s/$/${goto $jump_to}$messg/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
 
    #DEW POINT
    echo "${color ffe595}${goto 100}${hr 1}" >> $HOME/1_accuweather/altogether16
    echo "Point de ros.${color}" >> $HOME/1_accuweather/altogether16
    jump_to=100    
    for (( i=126; i<=133; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly1)
            sed -i "26s/$/${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
    for (( i=126; i<=133; i+=1 ))
        do
            messg=$(sed -n ${i}p $HOME/1_accuweather/hourly2)
            sed -i "26s/$/${goto $jump_to}$messg°/" $HOME/1_accuweather/altogether16
            ((jump_to+=60))
        done
 
 
 
 
        ## English to French
cp $HOME/1_accuweather/curr_cond $HOME/1_accuweather/curr_cond-fr
if [[ -s $HOME/1_accuweather/curr_cond-fr ]]; then
        sed -i -e 's/Clear/Dégagé/' $HOME/1_accuweather/curr_cond-fr
        sed -i -e 's/Cloudy/Nuageux/' $HOME/1_accuweather/curr_cond-fr
        sed -i -e 's/Mostly cloudy/Peu nuageux/' $HOME/1_accuweather/curr_cond-fr
        sed -i -e 's/Partly sunny/Ensoleillé/' $HOME/1_accuweather/curr_cond-fr
        sed -i -e 's/Sunny/Ensoleillé/' $HOME/1_accuweather/curr_cond-fr
fi
#### Alerts ####
wget -O $HOME/1_accuweather/Alertes http://www.accuweather.com/fr/fr/sarreguemines/135050/weather-forecast/135050
sed -i 's/r//' $HOME/1_accuweather/Alertes
message1=$(sed -n '/<span>Perspectives</span>/ { n;p; }' $HOME/1_accuweather/Alertes)
message2=$(sed -n '/^[ t]*<em>.*</em>$/p' $HOME/1_accuweather/Alertes)
echo $message1 > $HOME/1_accuweather/Alertes
echo $message2 >> $HOME/1_accuweather/Alertes
sed -i -e 's/<p>//' -e 's/</p>.*$//' -e 's/<em>//' -e 's/</em>//' $HOME/1_accuweather/Alertes
char_1rst_line=$(sed -n 1p $HOME/1_accuweather/Alertes|wc -c)
if (( $char_1rst_line <= 1 )); then
  sed -i '1s/^$/RAS/' $HOME/1_accuweather/Alertes
fi
char_2nd_line=$(sed -n 2p $HOME/1_accuweather/Alertes|wc -c)
if (( $char_2nd_line <= 1 )); then
  sed -i '2s/^$/RAS/' $HOME/1_accuweather/Alertes
fi
        sed -i -e 's/NW/NO/g' -e 's/WNW/ONO/g' -e 's/NNW/NNO/g' -e 's/W/O/g' -e 's/SSW/SSO/g' -e 's/SW/SO/g' -e 's/WSW/OSO/g' -e 's/W/O/g' /$HOME/1_accuweather/curr_cond-fr
 
 
    kill -CONT $(pidof conky)
fi    
 




Écrit par: loutch, Le: 30-01-2015

Cette page a été vue 16164 fois