Pas de problème. Le voici :
.conkyrc
######################
# - Conky settings - #
######################
update_interval 1
total_run_times 0
net_avg_samples 1
cpu_avg_samples 1
imlib_cache_size 0
double_buffer yes
no_buffers yes
#####################
# - Text settings - #
#####################
use_xft yes
xftfont Ubuntu:size=9
override_utf8_locale yes
text_buffer_size 2048
#############################
# - Window specifications - #
#############################
own_window_class Conky
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#own_window_argb_visual yes
#own_window_argb_value 100
alignment tr
gap_x -2
gap_y 180
minimum_size 350 450
default_bar_size 60 10
# - Graphics settings - #
#########################
draw_shades no
default_color ffffff
default_shade_color 1d1d1d
color0 ffffff
color1 ffffff
color2 ffffff
lua_load ~/.conky/script.lua
lua_draw_hook_pre main
TEXT
${voffset 0}
#---DATE & HEURE----
#---METEO----
${execi 600 ~/.conky/meteo_update.sh}
#---CPU ET RAM----
#---DISQUE DUR----
#---DEBIT INTERNET----
${if_up eth0}
${voffset 255}
${alignr 40}${upspeedgraph eth0 8,100 ffffff ffffff}
${alignr 40}${downspeedgraph eth0 8,100 ffffff ffffff}
${endif}
#---MUSIQUE----
${if_running clementine}
${color}
$endif
#---IMAGES----
${image ~/.conky/base.png -p 10,0 -s 339x86}${image ~/.conky/base.png -p 10,73 -s 339x86}${image ~/.conky/base.png -p 10,146 -s 339x86}${image ~/.conky/base.png -p 10,219 -s 339x86}${image ~/.conky/base.png -p 10,292 -s 339x86}${image ~/.conky/base.png -p 10,365 -s 339x86}${image ~/.conky/calendar.png -p 28,20 -s 45x45}${image ~/.conky/weather.png -p 28,93 -s 45x45}${image ~/.conky/emblem-system.png -p 28,166 -s 45x45}${image ~/.conky/folder.png -p 28,239 -s 45x45}${image ~/.conky/nm-signal-75.png -p 28,312 -s 45x45}${image ~/.conky/emblem-sound.png -p 28,385 -s 45x45}
meteo_update.sh
#!/bin/bash
#
# Ce script stocke les données météos dans plusieurs fichiers pour qu'ils soient affichées ensuite dans conky
date +%a > ~/.conky/meteo.jour
for jour in `seq 2 7` ; do
date --date="+$(($jour-1)) day" +%a >> ~/.conky/meteo.jour
done
w3m -dump "http://api.openweathermap.org/data/2.5/weather?q=Toulouse&mode=xml&units=metric" > ~/.conky/meteo.1
w3m -dump "http://api.openweathermap.org/data/2.5/forecast/daily?q=Toulouse&mode=xml&units=metric&cnt=7" > ~/.conky/meteo.7
grep "weather number" ~/.conky/meteo.1 | cut -d\" -f2 > ~/.conky/meteo.cond
grep "symbol number" ~/.conky/meteo.7 | cut -d\" -f2 | sed -e '1d' >> ~/.conky/meteo.cond
grep "temperature value" ~/.conky/meteo.1 | cut -d\" -f2 | cut -d. -f1 > ~/.conky/meteo.temp
grep "temperature" ~/.conky/meteo.7 | cut -d\" -f2 | cut -d. -f1 | sed -e '1d' >> ~/.conky/meteo.temp
grep "pressure value" ~/.conky/meteo.1 | cut -d\" -f2 | cut -d. -f1 > ~/.conky/meteo.pres
grep "pressure" ~/.conky/meteo.7 | cut -d\" -f4 | cut -d. -f1 | sed -e '1d' >> ~/.conky/meteo.pres
meteo_display.sh
#!/bin/bash
# Ce script permet d'afficher les infos dans conky. Les paramètres sont les suivant
# $1 = jour : renvoie le nom du jour $2
# $1 = pression : renvoie la pression du jour $2
# $1 = temperature : renvoie la temperature du jour $2
# $1 = meteo : renvoie la météo du jour $2
#
#
if [ $1 = "jour" ] ; then
res_jour=`sed -n $(($2))p ~/.conky/meteo.jour`
echo $res_jour
elif [ $1 = "pression" ] ; then
res_pression=`sed -n $(($2))p ~/.conky/meteo.pres`
echo $res_pression
elif [ $1 = "temperature" ] ; then
res_temp=`sed -n $(($2))p ~/.conky/meteo.temp`
echo $res_temp
elif [ $1 = "meteo" ] ; then
condition=`sed -n $(($2))p ~/.conky/meteo.cond`
case $condition in
"200"|"201"|"202"|"230"|"231"|"232"|"906")
meteo="i" ;;
"210"|"211"|"212")
meteo="f" ;;
"221"|"731"|"900")
meteo="W" ;;
"300"|"301"|"302"|"310"|"311"|"312"|"321")
meteo="G" ;;
"500"|"501"|"520")
meteo="g" ;;
"502"|"503"|"504"|"521"|"522")
meteo="h" ;;
"511"|"600"|"601"|"611"|"621")
meteo="k" ;;
"602")
meteo="j" ;;
"701"|"711")
meteo="J" ;;
"721")
meteo="I" ;;
"741")
meteo="F" ;;
"800")
meteo="a" ;;
"801")
meteo="b" ;;
"802")
meteo="c" ;;
"803")
meteo="d" ;;
"804")
meteo="e" ;;
"901"|"902")
meteo="V" ;;
"903")
meteo="x" ;;
"904")
meteo="z" ;;
"905")
meteo="v" ;;
esac
echo $meteo
else
echo "Err"
fi
sensors.sh
#!/bin/bash
if [ $1 = 1 ] ; then
temp=`sensors | grep 'Core 0' | cut -c 18-19`
else
temp=`sensors | grep 'Core 1' | cut -c 18-19`
fi
echo $temp
sript.lua
--this is a lua script for use in conky
require 'cairo'
--------------------------------------------------------------------------------
-- horloge DONNÉES
-- HEURE
clock_h = {
{
name='time', arg='%H', max_value=12,
x=200, y=48,
graph_radius=20,
graph_thickness=2,
graph_unit_angle=30, graph_unit_thickness=30,
graph_bg_colour=0xffffff, graph_bg_alpha=0.2,
graph_fg_colour=0xffffff, graph_fg_alpha=1.0,
txt_radius=20,
txt_weight=1, txt_size=11.0,
txt_fg_colour=0xffffff, txt_fg_alpha=0.8,
graduation_radius=20,
graduation_thickness=3, graduation_mark_thickness=2,
graduation_unit_angle=30,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.3,
},
}
-- MINUTES
clock_m = {
{
name='time', arg='%M', max_value=60,
x=200, y=48,
graph_radius=25,
graph_thickness=2,
graph_unit_angle=6, graph_unit_thickness=6,
graph_bg_colour=0xffffff, graph_bg_alpha=0.2,
graph_fg_colour=0xffffff, graph_fg_alpha=1.0,
txt_radius=35,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0xffffff, txt_fg_alpha=0.6,
graduation_radius=57,
graduation_thickness=0, graduation_mark_thickness=2,
graduation_unit_angle=30,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.3,
},
}
-- SECONDES
clock_s = {
{
name='time', arg='%S', max_value=60,
x=200, y=48,
graph_radius=30,
graph_thickness=2,
graph_unit_angle=6, graph_unit_thickness=2,
graph_bg_colour=0xffffff, graph_bg_alpha=0.0,
graph_fg_colour=0xffffff, graph_fg_alpha=1.0,
txt_radius=40,
txt_weight=0, txt_size=9.0,
txt_fg_colour=0xffffff, txt_fg_alpha=0.6,
graduation_radius=0,
graduation_thickness=0, graduation_mark_thickness=0,
graduation_unit_angle=0,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.0,
},
}
--------------------------------------------------------------------------------
-- jauge DONNÉES
gauge = {
{
name='downspeedf', arg='', max_value=100,
x=40, y=160,
graph_radius=0,
graph_thickness=0,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xffffff, graph_fg_alpha=0.0,
hand_fg_colour=0xEF5A29, hand_fg_alpha=0.8,
txt_radius=34,
txt_weight=1, txt_size=10.0,
txt_fg_colour=0xEF5A29, txt_fg_alpha=0.0,
graduation_radius=0,
graduation_thickness=4, graduation_mark_thickness=2,
graduation_unit_angle=27,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.3,
-- caption='download',
caption_weight=1, caption_size=8.0,
caption_fg_colour=0xffffff, caption_fg_alpha=0.5,
},
{
name='upspeedf', arg='', max_value=100,
x=40, y=160,
graph_radius=0,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xffffff, graph_fg_alpha=0.0,
hand_fg_colour=0xffffff, hand_fg_alpha=0.6,
txt_radius=10,
txt_weight=0, txt_size=9.0,
txt_fg_colour=0xffffff, txt_fg_alpha=0.0,
graduation_radius=0,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.3,
-- caption='upload',
caption_weight=1, caption_size=8.0,
caption_fg_colour=0xffffff, caption_fg_alpha=0.5,
},
}
settings_table = {
{
name='fs_used_perc', arg='/home',
x=120, y=255, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=17,
thickness=3,
start_angle=-180,
end_angle=180
},
{
name='fs_used_perc', arg='/',
x=205, y=255, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=17,
thickness=3,
start_angle=-180,
end_angle=180
},
{
name='fs_used_perc', arg='/media/Documents',
x=290, y=255, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=17,
thickness=3,
start_angle=-180,
end_angle=180
},
{
name='memperc', arg='',
x=290, y=205, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=25,
thickness=5,
start_angle=-90,
end_angle=90
},
{
name='cpu', arg='cpu1',
x=125, y=205, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=25,
thickness=2,
start_angle=-90,
end_angle=90
},
{
name='cpu', arg='cpu2',
x=125, y=205, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=20,
thickness=2,
start_angle=-90,
end_angle=90
},
}
-------------------------------------------------------------------------------
-- position_de_l'angle
-- convertit les degrés, rotation et rad (0 degré est en haut / nord)
--
function angle_to_position(start_angle, current_angle)
local pos = current_angle + start_angle
return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end
-------------------------------------------------------------------------------
-- rgb_to_r_g_b
-- convertit la couleur de hexa en décimal
--
function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
-------------------------------------------------------------------------------
-- draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_start_angle = data['graph_start_angle']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
local graph_end_angle = (max_value * graph_unit_angle) % 360
-- background ring
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- arc of value
local val = value % (max_value + 1)
local start_arc = 0
local stop_arc = 0
local i = 1
while i <= val do
start_arc = (graph_unit_angle * i) - graph_unit_thickness
stop_arc = (graph_unit_angle * i)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = start_arc
-- hand
start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
stop_arc = (graph_unit_angle * val)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
cairo_stroke(display)
-- graduations marks
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = graph_end_angle / graduation_unit_angle
local i = 0
while i < nb_graduation do
cairo_set_line_width(display, graduation_thickness)
start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
-- text
local txt_radius = data['txt_radius']
local txt_weight, txt_size = data['txt_weight'], data['txt_size']
local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
cairo_set_font_size (display, txt_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
cairo_show_text (display, value)
cairo_stroke (display)
-- caption
local caption = data['caption']
local caption_weight, caption_size = data['caption_weight'], data['caption_size']
local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
cairo_set_font_size (display, caption_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
cairo_move_to (display, x + tox + 5, y + toy + 1)
-- bad hack but not enough time !
if graph_start_angle < 105 then
cairo_move_to (display, x + tox - 30, y + toy + 1)
end
cairo_show_text (display, caption)
cairo_stroke (display)
end
-------------------------------------------------------------------------------
-- draw_clock_ring
-- affichage horloge
--
function draw_clock_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
-- fond de l'anneau
cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi)
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- valeur arc
local val = (value % max_value)
local i = 1
while i <= val do
cairo_arc(display, x, y, graph_radius,( ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360) )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2))
cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = (graph_unit_angle * i) - graph_unit_thickness
-- graduations
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = 360 / graduation_unit_angle
local i = 1
while i <= nb_graduation do
cairo_set_line_width(display, graduation_thickness)
cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
end
-------------------------------------------------------------------------------
-- go_clock_rings
-- loads data and displays clock
--
function go_clock_rings(display)
local function load_clock_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_clock_ring(display, data, value)
end
for i in pairs(clock_h) do
load_clock_rings(display, clock_h[i])
end
for i in pairs(clock_m) do
load_clock_rings(display, clock_m[i])
end
for i in pairs(clock_s) do
load_clock_rings(display, clock_s[i])
end
end
-------------------------------------------------------------------------------
-- go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
local function load_gauge_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_gauge_ring(display, data, value)
end
for i in pairs(gauge) do
load_gauge_rings(display, gauge[i])
end
end
-------------------------------------------------------------------------------
-- displays rings
--
--
function draw_ring(cr,t,pt)
local w,h=conky_window.width,conky_window.height
local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']
local angle_0=sa*(2*math.pi/360)-math.pi/2
local angle_f=ea*(2*math.pi/360)-math.pi/2
local t_arc=t*(angle_f-angle_0)
cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
cairo_set_line_width(cr,ring_w)
cairo_stroke(cr)
cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
cairo_stroke(cr)
end
function display_text()
red,green,blue,alpha=1,1,1,1
font_slant=CAIRO_FONT_SLANT_NORMAL
font_normal=CAIRO_FONT_WEIGHT_NORMAL
font_bold=CAIRO_FONT_WEIGHT_BOLD
----------------------------------
--[[###########################################
Heure et Date
##############################################]]
font_ville="Ubuntu"
font_size_ville=11
ville="Toulouse"
x_ville,y_ville=100,27
cairo_select_font_face (cr, font_ville, font_slant, font_normal);
cairo_set_font_size (cr, font_size_ville)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_ville,y_ville)
cairo_show_text (cr,ville)
cairo_stroke (cr)
font_heure="Ubuntu"
font_size_heure=12
heure=conky_parse("${time %H:%M}")
x_heure,y_heure=185,52
cairo_select_font_face (cr, font_heure, font_slant, font_bold);
cairo_set_font_size (cr, font_size_heure)
cairo_move_to (cr,x_heure,y_heure)
cairo_show_text (cr,heure)
cairo_stroke (cr)
font_jour="Ubuntu"
font_size_jour=12
jour=conky_parse("${time %A}") --${time %A}
x_jour,y_jour=280,31
cairo_select_font_face (cr, font_jour, font_slant, font_normal);
cairo_set_font_size (cr, font_size_jour)
cairo_move_to (cr,x_jour,y_jour)
cairo_show_text (cr,jour)
cairo_stroke (cr)
font_mois="Ubuntu"
font_size_mois=12
mois=conky_parse("${time %B}") --${time %B}
x_mois,y_mois=280,42
cairo_select_font_face (cr, font_mois, font_slant, font_normal);
cairo_set_font_size (cr, font_size_mois)
cairo_move_to (cr,x_mois,y_mois)
cairo_show_text (cr,mois)
cairo_stroke (cr)
font_day="Ubuntu"
font_size_day=32
day=conky_parse("${time %d}")
x_day,y_day=245,42
cairo_select_font_face (cr, font_day, font_slant, font_normal);
cairo_set_font_size (cr, font_size_day)
cairo_move_to (cr,x_day,y_day)
cairo_show_text (cr,day)
cairo_stroke (cr)
font_year="Ubuntu"
font_size_year=32
year=conky_parse("${time %Y}")
x_year,y_year=245,72
cairo_select_font_face (cr, font_year, font_slant, font_normal);
cairo_set_font_size (cr, font_size_year)
cairo_move_to (cr,x_year,y_year)
cairo_show_text (cr,year)
cairo_stroke (cr)
--[[###########################################
Météo
##############################################]]
font_meteo="Weather"
font_size_meteo=65
meteo=conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 1}")
x_meteo,y_meteo=105,73
cairo_select_font_face (cr, font_meteo, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo,y_meteo)
cairo_show_text (cr,meteo)
cairo_stroke (cr)
font_temp_jour="Ubuntu"
font_size_temp_jour=11
temp=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 1}")
pressu=conky_parse("${execi 10 ~/.conky/meteo_display.sh pression 1}")
temp_jour=temp.."°C-"..pressu.." hPa"
x_temp_jour,y_temp_jour=92,75
cairo_select_font_face (cr, font_temp_jour, font_slant, font_normal);
cairo_set_font_size (cr, font_size_temp_jour)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_temp_jour,y_temp_jour)
cairo_show_text (cr,temp_jour)
cairo_stroke (cr)
-- prévision metéo jour
font_meteo1="Weather"
font_size_meteo1=50
meteo1=conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 2}")
x_meteo1,y_meteo1=95,140
cairo_select_font_face (cr, font_meteo1, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo1)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo1,y_meteo1)
cairo_show_text (cr,meteo1)
cairo_stroke (cr)
font_meteo2="Weather"
font_size_meteo2=50
meteo2=conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 3}")
x_meteo2,y_meteo2=135,140
cairo_select_font_face (cr, font_meteo2, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo2)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo2,y_meteo2)
cairo_show_text (cr,meteo2)
cairo_stroke (cr)
font_meteo3="Weather"
font_size_meteo3=50
meteo3=conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 4}")
x_meteo3,y_meteo3=175,140
cairo_select_font_face (cr, font_meteo3, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo3)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo3,y_meteo3)
cairo_show_text (cr,meteo3)
cairo_stroke (cr)
font_meteo4="Weather"
font_size_meteo4=50
meteo4=conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 5}")
x_meteo4,y_meteo4=215,135
cairo_select_font_face (cr, font_meteo4, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo4)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo4,y_meteo4)
cairo_show_text (cr,meteo4)
cairo_stroke (cr)
font_meteo5="Weather"
font_size_meteo5=50
meteo5=conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 6}")
x_meteo5,y_meteo5=255,140
cairo_select_font_face (cr, font_meteo5, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo5)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo5,y_meteo5)
cairo_show_text (cr,meteo5)
cairo_stroke (cr)
font_meteo6="Weather"
font_size_meteo6=50
meteo6=conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 7}")
x_meteo6,y_meteo6=295,140
cairo_select_font_face (cr, font_meteo6, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo6)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo6,y_meteo6)
cairo_show_text (cr,meteo6)
cairo_stroke (cr)
-- affichage du jour
font_meteo1="Ubuntu"
font_size_meteo1=11
meteo1=conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 2}")
x_meteo1,y_meteo1=100,100
cairo_select_font_face (cr, font_meteo1, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo1)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo1,y_meteo1)
cairo_show_text (cr,meteo1)
cairo_stroke (cr)
font_meteo2="Ubuntu"
font_size_meteo2=11
meteo2=conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 3}")
x_meteo2,y_meteo2=140,100
cairo_select_font_face (cr, font_meteo2, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo2)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo2,y_meteo2)
cairo_show_text (cr,meteo2)
cairo_stroke (cr)
font_meteo3="Ubuntu"
font_size_meteo3=11
meteo3=conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 4}")
x_meteo3,y_meteo3=180,100
cairo_select_font_face (cr, font_meteo3, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo3)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo3,y_meteo3)
cairo_show_text (cr,meteo3)
cairo_stroke (cr)
font_meteo4="Ubuntu"
font_size_meteo4=11
meteo4=conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 5}")
x_meteo4,y_meteo4=220,100
cairo_select_font_face (cr, font_meteo4, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo4)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo4,y_meteo4)
cairo_show_text (cr,meteo4)
cairo_stroke (cr)
font_meteo5="Ubuntu"
font_size_meteo5=11
meteo5=conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 6}")
x_meteo5,y_meteo5=260,100
cairo_select_font_face (cr, font_meteo5, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo5)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo5,y_meteo5)
cairo_show_text (cr,meteo5)
cairo_stroke (cr)
font_meteo6="Ubuntu"
font_size_meteo6=11
meteo6=conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 7}")
x_meteo6,y_meteo6=300,100
cairo_select_font_face (cr, font_meteo6, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo6)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo6,y_meteo6)
cairo_show_text (cr,meteo6)
cairo_stroke (cr)
-- prévision température jour
font_meteo1="Ubuntu"
font_size_meteo1=12
meteo1=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 2}").."°C"
x_meteo1,y_meteo1=100,147
cairo_select_font_face (cr, font_meteo1, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo1)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo1,y_meteo1)
cairo_show_text (cr,meteo1)
cairo_stroke (cr)
font_meteo2="Ubuntu"
font_size_meteo2=12
meteo2=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 3}").."°C"
x_meteo2,y_meteo2=140,147
cairo_select_font_face (cr, font_meteo2, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo2)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo2,y_meteo2)
cairo_show_text (cr,meteo2)
cairo_stroke (cr)
font_meteo3="Ubuntu"
font_size_meteo3=12
meteo3=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 4}").."°C"
x_meteo3,y_meteo3=180,147
cairo_select_font_face (cr, font_meteo3, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo3)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo3,y_meteo3)
cairo_show_text (cr,meteo3)
cairo_stroke (cr)
font_meteo4="Ubuntu"
font_size_meteo4=12
meteo4=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 5}").."°C"
x_meteo4,y_meteo4=220,147
cairo_select_font_face (cr, font_meteo4, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo4)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo4,y_meteo4)
cairo_show_text (cr,meteo4)
cairo_stroke (cr)
font_meteo5="Ubuntu"
font_size_meteo5=12
meteo5=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 6}").."°C"
x_meteo5,y_meteo5=260,147
cairo_select_font_face (cr, font_meteo5, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo5)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo5,y_meteo5)
cairo_show_text (cr,meteo5)
cairo_stroke (cr)
font_meteo6="Ubuntu"
font_size_meteo6=12
meteo6=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 7}").."°C"
x_meteo6,y_meteo6=300,147
cairo_select_font_face (cr, font_meteo6, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo6)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo6,y_meteo6)
cairo_show_text (cr,meteo6)
cairo_stroke (cr)
--[[###########################################
CPU Temperature et RAM
##############################################]]
font_titre="Ubuntu"
font_size_titre=15
titre="CPU Température RAM"
x_titre,y_titre=105,175
cairo_select_font_face (cr, font_titre, font_slant, font_normal);
cairo_set_font_size (cr, font_size_titre)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_titre,y_titre)
cairo_show_text (cr,titre)
cairo_stroke (cr)
font_cpu="Ubuntu"
font_size_cpu=12
cpu1=conky_parse("${cpu cpu1}")
cpu2=conky_parse("${cpu cpu2}")
cpu=cpu1.."% / "..cpu2.."%"
x_cpu,y_cpu=100,220
cairo_select_font_face (cr, font_cpu, font_slant, font_normal);
cairo_set_font_size (cr, font_size_cpu)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_cpu,y_cpu)
cairo_show_text (cr,cpu)
cairo_stroke (cr)
font_temp="Ubuntu"
font_size_temp=12
T1=conky_parse("${execi 30 ~/.conky/sensors.sh 1}")
T2=conky_parse("${execi 30 ~/.conky/sensors.sh 2}")
temp1="T1 : "..T1.."°C"
temp2="T2 : "..T2.."°C"
x_temp1,y_temp1=180,200
x_temp2,y_temp2=180,215
cairo_select_font_face (cr, font_temp, font_slant, font_normal);
cairo_set_font_size (cr, font_size_temp)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_temp1,y_temp1)
cairo_show_text (cr,temp1)
cairo_move_to (cr,x_temp2,y_temp2)
cairo_show_text (cr,temp2)
cairo_stroke (cr)
font_ram_perc="Ubuntu"
font_size_ram_perc=17
ram=conky_parse("${memperc}")
ram_perc=ram.."%"
x_ram_perc,y_ram_perc=275,205
cairo_select_font_face (cr, font_ram_perc, font_slant, font_normal);
cairo_set_font_size (cr, font_size_ram_perc)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_ram_perc,y_ram_perc)
cairo_show_text (cr,ram_perc)
cairo_stroke (cr)
font_memo="Ubuntu"
font_size_memo=11
mem_prise=conky_parse("${mem}")
mem_libre=conky_parse("${memeasyfree}")
memo=mem_prise.."/"..mem_libre
x_memo,y_memo=250,220
cairo_select_font_face (cr, font_memo, font_slant, font_normal);
cairo_set_font_size (cr, font_size_memo)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_memo,y_memo)
cairo_show_text (cr,memo)
cairo_stroke (cr)
--[[###########################################
Espace disponible
##############################################]]
font_esp_perc="Ubuntu"
font_size_esp_perc=15
espace1=conky_parse("${fs_used_perc /home}")
espace2=conky_parse("${fs_used_perc /}")
espace3=conky_parse("${fs_used_perc /media/Documents}")
esp_perc=espace1.."% "..espace2.."% "..espace3.."%"
x_esp_perc,y_esp_perc=108,260
cairo_select_font_face (cr, font_esp_perc, font_slant, font_normal);
cairo_set_font_size (cr, font_size_esp_perc)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_esp_perc,y_esp_perc)
cairo_show_text (cr,esp_perc)
cairo_stroke (cr)
font_esp_nom="Ubuntu"
font_size_esp_nom=11
esp_nom="home : Racine : Docs :"
x_esp_nom,y_esp_nom=105,285
cairo_select_font_face (cr, font_esp_nom, font_slant, font_normal);
cairo_set_font_size (cr, font_size_esp_nom)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_esp_nom,y_esp_nom)
cairo_show_text (cr,esp_nom)
cairo_stroke (cr)
font_esp_mem="Ubuntu"
font_size_esp_mem=11
esp_mem1=conky_parse("${fs_free /home}")
esp_mem2=conky_parse("${fs_free /}")
esp_mem3=conky_parse("${fs_free /media/Documents}")
esp_mem=esp_mem1.." free "..esp_mem2.." free "..esp_mem3.." free"
x_esp_mem,y_esp_mem=105,295
cairo_select_font_face (cr, font_esp_mem, font_slant, font_normal);
cairo_set_font_size (cr, font_size_esp_mem)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_esp_mem,y_esp_mem)
cairo_show_text (cr,esp_mem)
cairo_stroke (cr)
--[[###########################################
Débit internet
##############################################]]
font_up="Ubuntu"
font_size_up=12
up_eth0=conky_parse("${upspeed eth0}")
down_eth0=conky_parse("${downspeed eth0}")
up="Up : "..up_eth0
down="Down : "..down_eth0
x_up,y_up=100,330
x_down,y_down=100,345
cairo_select_font_face (cr, font_up, font_slant, font_normal);
cairo_set_font_size (cr, font_size_up)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_up,y_up)
cairo_show_text (cr,up)
cairo_move_to (cr,x_down,y_down)
cairo_show_text (cr,down)
cairo_stroke (cr)
font_total="Ubuntu"
font_size_total=12
up_total=conky_parse("${totalup eth0}")
down_total=conky_parse("${totaldown eth0}")
total="Total Up / Down : "..up_total.." / "..down_total
x_total,y_total=100,360
cairo_select_font_face (cr, font_total, font_slant, font_normal);
cairo_set_font_size (cr, font_size_total)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_total,y_total)
cairo_show_text (cr,total)
cairo_stroke (cr)
--[[###########################################
Musique
##############################################]]
font_album="Ubuntu"
font_size_album=11
album=conky_parse("${execi 5 python2 ~/.conky/anowplaying.py -l}")
x_album,y_album=100,400
cairo_select_font_face (cr, font_album, font_slant, font_normal);
cairo_set_font_size (cr, font_size_album)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_album,y_album)
cairo_show_text (cr,album)
cairo_stroke (cr)
font_titre_mus="Ubuntu"
font_size_titre_mus=11
titre_mus=conky_parse("${execi 5 python2 ~/.conky/anowplaying.py -t}")
x_titre_mus,y_titre_mus=100,415
cairo_select_font_face (cr, font_titre_mus, font_slant, font_normal);
cairo_set_font_size (cr, font_size_titre_mus)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_titre_mus,y_titre_mus)
cairo_show_text (cr,titre_mus)
cairo_stroke (cr)
font_temp_mus="Ubuntu"
font_size_temp_mus=11
temp_ecoule=conky_parse("${execi 5 python2 ~/.conky/anowplaying.py -e}")
temp_total=conky_parse("${execi 5 python2 ~/.conky/anowplaying.py -m}")
indic_temp=temp_ecoule.." / "..temp_total
x_temp,y_temp=100,430
cairo_select_font_face (cr, font_temp_mus, font_slant, font_normal);
cairo_set_font_size (cr, font_size_temp_mus)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_temp,y_temp)
cairo_show_text (cr,indic_temp)
cairo_stroke (cr)
end
function draw_graph(display,data,max_value,table_length,blx,bly,red,green,blue,alpha,width,cheight)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_set_line_width (cr,width)
for i=1,table_length do
--calculate bar height
bar_height=(cheight/max_value)*data[i]
--set start position for each bar, and modify with the value of "i"
cairo_move_to (cr,blx+(width/2)+((i-1)*width),bly)
--draw relative line, y becomes equal to bar height and must be negative to draw up
cairo_rel_line_to (cr,0,bar_height*-1)
--draw the line
cairo_stroke (cr)
end
end--of function draw_graph
function conky_main()
if conky_window == nil then
return
end
local function setup_rings(cr,pt)
local str=''
local value=0
str=string.format('${%s %s}',pt['name'],pt['arg'])
str=conky_parse(str)
value=tonumber(str)
if value == nil then value = 0 end
pct=value/pt['max']
draw_ring(cr,pct,pt)
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 display = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates==4 then
up_table={}
down_table={}
end
if updates>5 then
display_text()
go_clock_rings(display)
go_gauge_rings(display)
for i in pairs(settings_table) do
setup_rings(cr,settings_table[i])
end
--début fonction historique upload
blx,bly=100,200
gvalue=conky_parse('${upspeed eth0}')
max_value=7
red,green,blue,alpha=1,1,1,1--fully opaque white
width=2
cheight=150
table_length=10
table_length=20
for i = 1, tonumber(table_length) do
if up_table[i+1]==nil then up_table[i+1]=0 end
up_table[i]=up_table[i+1]
if i==table_length then
up_table[table_length]=tonumber(conky_parse('${upspeed eth0}'))
end
end
draw_graph(display,up_table,max_value,table_length,blx,bly,red,green,blue,alpha,width,cheight)
end
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end
anowplaying
#!/usr/bin/env python2
#-*- coding: ascii -*-
#
# anowplaying.py
#
# Connects to dbus and retrieves
# information about the currently
# playing track in amarok.
#
import dbus, optparse, shutil, commands
import unicodedata
def unaccent(str):
return unicodedata.normalize('NFKD', str).encode('ascii', 'ignore')
if __name__ == '__main__':
'''Check if clementine is running'''
output = commands.getoutput('ps -A')
if 'clementine' not in output:
raise SystemExit
'''Get system bus'''
bus = dbus.SessionBus()
amarok = bus.get_object('org.mpris.clementine', '/Player')
amarokdict = amarok.GetMetadata()
'''Set up the command line parser'''
usage = 'usage: %prog [options]'
parser = optparse.OptionParser(usage=usage)
parser.add_option('-a', '--artist', action='store_true', help='artist name')
parser.add_option('-t', '--title', action='store_true', help='title of the track')
parser.add_option('-l', '--album', action='store_true', help='album name')
parser.add_option('-g', '--genre', action='store_true', help='genre of the current track')
parser.add_option('-y', '--year', action='store_true', help='year of the track')
parser.add_option('-m', '--mtime', action='store_true', help='time of the track')
parser.add_option('-r', '--rtime', action='store_true', help='remaining time for the track')
parser.add_option('-e', '--etime', action='store_true', help='elapsed time for the track')
parser.add_option('-p', '--progress', action='store_true', help='progress of the track')
parser.add_option('-n', '--track', action='store_true', help='track number')
parser.add_option('-b', '--bitrate', action='store_true', help='bitrate of the track')
parser.add_option('-s', '--sample', action='store_true', help='sample rate of the track')
parser.add_option('-c', '--cover', metavar='filename', help='copy cover art to destination file')
'''Get the parser options printed'''
(opts, args) = parser.parse_args()
if opts.artist and amarokdict.has_key('artist') :
print amarokdict['artist']
if opts.title and amarokdict.has_key('title'):
nomTitre = unaccent(amarokdict['title'][0:50])
print nomTitre
if opts.album and amarokdict.has_key('album'):
nomAlbum = unaccent(amarokdict['album'][0:35])
print nomAlbum
if opts.genre and amarokdict.has_key('genre'):
print amarokdict['genre']
if opts.year and amarokdict.has_key('year'):
print amarokdict['year']
if opts.track and amarokdict.has_key('tracknumber'):
print amarokdict['tracknumber']
if opts.bitrate and amarokdict.has_key('audio-bitrate'):
print amarokdict['audio-bitrate']
if opts.sample :
print amarokdict['audio-samplerate']
'''Manage time stuff'''
cpos = mt = mtime = etime = rtime = progress = None
if (opts.etime or opts.rtime or opts.mtime or opts.progress) and amarokdict.has_key('mtime'):
cpos = amarok.PositionGet()/1000
mt = amarokdict['mtime']/1000
mtime = str(mt/60)+":"+str(mt%60) if mt%60>9 else str(mt/60)+":0"+str(mt%60)
etime = str(cpos/60)+":"+str(cpos%60) if cpos%60>9 else str(cpos/60)+":0"+str(cpos%60)
rtime = str((mt-cpos)/60)+":"+str((mt-cpos)%60) if (mt-cpos)%60>9 else str((mt-cpos)/60)+":0"+str((mt-cpos)%60)
progress= float(cpos)/float(mt)*100
if opts.etime and etime is not None:
print etime
if opts.rtime and rtime is not None:
print rtime
if opts.mtime and mtime is not None:
print mtime
if opts.progress and progress is not None:
print progress
if opts.cover :
cover = amarokdict['arturl']
if cover != "" :
try :
shutil.copyfile(cover.replace('file://', ''), opts.cover)
print ""
except Exception, e:
print e
print ""
else :
print ""
J'ai rassemblé les images ici :
http://www.partage-facile.com/WWCWPQSFNI/images_conky.zip.html
D'autre part j'utilise un script pour mettre à jour mon fond d'écran et adapter la couleur du fond conky à l'image.
Il est en cours de changement en ce moment avec tout le transfert lua donc avec plein de trucs commentés... 😃
#!/bin/bash
#
#
#
prefixe=`date +%Y-%m-%d`
if [ -z $1 ] ; then
wget -q http://www.goodfon.su/1920x1200/ -O index.html
sed -e 's/itemprop/\nitemprop/g' index.html | grep ^itemprop | grep "img src" > liste_wlppr
numAleatoire=$[($RANDOM % ($[20 - 1] + 1)) + 1]
image=`sed -n $((numAleatoire))p liste_wlppr | cut -d\" -f4 | sed -e 's/wallpaper/original/g;s/middle/1920x1080/g'`
#echo $image
wget -q -U firefox $image
nomImage=`basename $image`
nomFinal=$prefixe"_"$nomImage
cp $nomImage /media/Documents/personnalisation_pc/Wallpaper/wlppr/$nomFinal
mv $nomImage ~/Images/$nomFinal
rm index.html liste_wlppr
else
if [ -e "$1" ] ; then
verif=`echo $1 | grep \/`
if [ -z $verif ] ; then
echo "tata"
nomImage=$1
nomFinal=$prefixe"_"$nomImage
cp $PWD/$1 /media/Documents/personnalisation_pc/Wallpaper/wlppr/$nomFinal
cp $PWD/$1 ~/Images/$nomFinal
else
echo "toto"
nomImage=`basename $1`
nomFinal=$prefixe"_"$nomImage
cp $1 /media/Documents/personnalisation_pc/Wallpaper/wlppr/$nomFinal
cp $1 ~/Images/$nomFinal
fi
elif [ $1 = "live" ] ; then
wget -q http://wlppr.com/live.1920x1200.jpg
nomImage=live.1920x1200.jpg
nomFinal=$prefixe"_"$nomImage
cp $nomImage /media/Documents/personnalisation_pc/Wallpaper/wlppr/$nomFinal
cp $nomImage ~/Images/$nomFinal
rm $nomImage
else
exit 0
fi
fi
## calcul de la luminance sur le wlppr actuel :
# image_old=`gsettings get org.gnome.desktop.background picture-uri | sed -e "s_'__g;s_file://__g"`
# rgb_old=`convert $image_old -resize 3x3 -filter cubic -fuzz 15% -brightness-contrast 15% -colorspace RGB -format '%[pixel:s]' info:-`
# red_old=`echo $rgb_old | cut -d\( -f2 | cut -d, -f1`
# gre_old=`echo $rgb_old | cut -d\( -f2 | cut -d, -f2`
# blu_old=`echo $rgb_old | cut -d\( -f2 | cut -d, -f3 | cut -d\) -f1`
# lumi_old=$(echo "$red_old * 0.2126 + $gre_old * 0.7152 + $blu_old * 0.0722" | bc)
# lumi_old=${lumi_old%.*}
gsettings set org.gnome.desktop.background picture-uri "file:///home/sebastien/Images/$nomFinal"
gsettings set org.gnome.desktop.screensaver picture-uri "file:///home/sebastien/Images/$nomFinal"
RgbHighlight=`convert ~/Images/$nomFinal -resize 3x3 -filter cubic -fuzz 15% -brightness-contrast 15% -colorspace RGB -format '%[pixel:s]' info:-`
txRedHighlight=`echo $RgbHighlight | cut -d\( -f2 | cut -d, -f1`
txGreenHighlight=`echo $RgbHighlight | cut -d\( -f2 | cut -d, -f2`
txBlueHighlight=`echo $RgbHighlight | cut -d\( -f2 | cut -d, -f3 | cut -d\) -f1`
luminance=$(echo "$txRedHighlight * 0.2126 + $txGreenHighlight * 0.7152 + $txBlueHighlight * 0.0722" | bc -l)
luminance=${luminance%.*}
txRedBack=$((txRedHighlight*20/45))
txGreenBack=$((txGreenHighlight*20/45))
txBlueBack=$((txBlueHighlight*20/45))
if [ $luminance -gt 180 ] ; then
sed -e 's/0xffffff/0x000000/g:s/1,1,1,1/0,0,0,1/g' ~/.conky/script_modele.lua > ~/.conky/script.lua
else
cp ~/.conky/script_modele.lua ~/.conky/script.lua
fi
#if [[ "$luminance" -gt 180 && "$lumi_old" -gt 180 ]] ; then
# echo ""
#elif [[ "$luminance" -lt 180 && "$lumi_old" -lt 180 ]] ; then
# echo ""
#else
# if [[ "$luminance" -gt 180 ]] ; then
# cp ~/.conky/template_conkyrc ~/.conkyrc
# cp ~/.conky/template_conky_orange ~/.conky/conky_orange.lua
# else
# sed -e 's/000000/ffffff/g' ~/.conky/template_conkyrc > ~/.conkyrc
# sed -e 's/0x000000/0xffffff/g' ~/.conky/template_conky_orange > ~/.conky/conky_orange.lua
# fi
#fi
##if [ $luminance -gt 180 ] ; then
## cp ~/.conky/template_conkyrc ~/.conkyrc
## cp ~/.conky/template_conky_orange ~/.conky/conky_orange.lua
##else
## sed -e 's/000000/ffffff/g' ~/.conky/template_conkyrc > ~/.conkyrc
## sed -e 's/0x000000/0xffffff/g' ~/.conky/template_conky_orange > ~/.conky/conky_orange.lua
##fi
convert ~/.conky/base_init.png -fuzz 30% -fill "rgb($txRedHighlight,$txGreenHighlight,$txBlueHighlight)" -opaque 'rgb(255,0,0)' ~/.conky/temp.png
convert ~/.conky/temp.png -fuzz 20% -fill "rgb($txRedBack,$txGreenBack,$txBlueBack)" -opaque 'rgb(0,0,255)' ~/.conky/base.png
rm ~/.conky/temp.png
Si tu as des suggestions d'améliorations n'hésites pas à m'en suggérer. Je suis sûr qu'il y doit y avoir moyen de factoriser certaines choses dans mon script lua... :/