Logiciels » Autres logiciels Les conkys de Loutch
loutch
Membre non connecté

Reprise du message précédent
.gif)
Conky lune prendre le pack ici: http://bit.ly/4_2-6-15 du site "bunsenlabs" à décompresser dans votre home.
J'y ais intégré du lua (pour ceux qui on un fond d'écran clair) les images passent mieux et traduit en françois .
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 410 250
maximum_width 410
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 tr
gap_x 00
gap_y 620
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
lua_load ~/.conky/lua/image.lua
TEXT
${texeci 500 bash $HOME/4_Moon/moon_MoonGiant}
${voffset 90}${alignc 10}${execpi 600 sed -n '7p' $HOME/4_Moon/raw | awk '{print $1}'}
${alignc 10}${execpi 600 sed -n '7p' $HOME/4_Moon/raw | awk '{print $2}'}
${alignc 10}${execpi 600 sed -n '1p' $HOME/4_Moon/raw}
${voffset -60}${goto 25}${execi 3600 echo `date --date="-2 day" | awk '{print $3" "$2}'`}
${goto 92}${execi 3600 echo `date --date="-1 day" | awk '{print $3" "$2}'`}
${goto 277}${execi 3600 echo `date --date="+1 day" | awk '{print $3" "$2}'`}
${goto 350}${execi 3600 echo `date --date="+2 day" | awk '{print $3" "$2}'`}
${voffset -5}${goto 25}${execpi 600 sed -n '19p' $HOME/4_Moon/raw | awk '{print $1}'}
${goto 92}${execpi 600 sed -n '27p' $HOME/4_Moon/raw | awk '{print $1}'}
${goto 277}${execpi 600 sed -n '35p' $HOME/4_Moon/raw | awk '{print $1}'}
${goto 350}${execpi 600 sed -n '43p' $HOME/4_Moon/raw | awk '{print $1}'}
${voffset -5}${goto 20}${execpi 600 sed -n '19p' $HOME/4_Moon/raw | awk '{print $2}'}
${goto 87}${execpi 600 sed -n '27p' $HOME/4_Moon/raw | awk '{print $2}'}
${goto 272}${execpi 600 sed -n '35p' $HOME/4_Moon/raw | awk '{print $2}'}
${goto 347}${execpi 600 sed -n '43p' $HOME/4_Moon/raw | awk '{print $2}'}
${voffset -5}${goto 30}${execpi 600 sed -n '13p' $HOME/4_Moon/raw}
${goto 100}${execpi 600 sed -n '21p' $HOME/4_Moon/raw}
${goto 280}${execpi 600 sed -n '29p' $HOME/4_Moon/raw}
${goto 355}${execpi 600 sed -n '37p' $HOME/4_Moon/raw}
${alignc}Details
Visibilitée: ${execpi 600 sed -n '1p' $HOME/4_Moon/raw} % ${goto 250}Age lune: ${execpi 600 sed -n '5p' $HOME/4_Moon/raw} jours
Angle soleil: ${execpi 600 sed -n '2p' $HOME/4_Moon/raw} ° ${goto 250}Angle lune: ${execpi 600 sed -n '6p' $HOME/4_Moon/raw} °
Distance soleil: ${execpi 600 sed -n '3p' $HOME/4_Moon/raw} kms ${goto 250}Distance lune: ${execpi 600 sed -n '4p' $HOME/4_Moon/raw} kms
${lua fDrawImage ~/4_Moon/-2.png 10 65 60 60}
${lua fDrawImage ~/4_Moon/-1.png 80 65 60 60}
${lua fDrawImage ~/4_Moon/0.png 157 35 90 90}
${lua fDrawImage ~/4_Moon/1.png 265 65 60 60}
${lua fDrawImage ~/4_Moon/2.png 340 65 60 60}
${voffset -500}
le moon_MoonGiant (rendu éxécutable ) aussi en françois:
Code :
#!/bin/bash
#function: moonrise_set
moonrise_set () {
case "$1" in
"FirstQuarter")
echo "Noon/Midnight"
cp $HOME/4_Moon/riseicons/rise_FirstQuarter.jpg $HOME/4_Moon/rise.jpg
;;
"FullMoon")
echo "6PM/6AM"
cp $HOME/4_Moon/riseicons/rise_FullMoon.jpg $HOME/4_Moon/rise.jpg
;;
"LastQuarter")
echo "Midnight/Noon"
p $HOME/4_Moon/riseicons/rise_LastQuarter.jpg $HOME/4_Moon/rise.jpg
;;
"NewMoon")
echo "6AM/6PM"
cp $HOME/4_Moon/riseicons/rise_NewMoon.jpg $HOME/4_Moon/rise.jpg
;;
"WaningCrescent")
echo "3AM/3PM"
cp $HOME/4_Moon/riseicons/rise_WaningCrescent.jpg $HOME/4_Moon/rise.jpg
;;
"WaningGibbous")
echo "9PM/9AM"
cp $HOME/4_Moon/riseicons/rise_WaningGibbous.jpg $HOME/4_Moon/rise.jpg
;;
"WaxingCrescent")
echo "9AM/9PM"
cp $HOME/4_Moon/riseicons/rise_WaxingCrescent.jpg $HOME/4_Moon/rise.jpg
;;
"WaxingGibbous")
echo "3PM/3AM"
cp $HOME/4_Moon/riseicons/rise_WaxingGibbous.jpg $HOME/4_Moon/rise.jpg
;;
*)
echo "Unavailable"
esac
}
kill -STOP $(pidof conky)
killall wget
#put your hemisphere here: north or south
hemisphere=north
wget -O $HOME/4_Moon/raw "http://www.moongiant.com/phase/today"
rm $HOME/4_Moon/*.png $HOME/4_Moon/*.jpg
sed -i -e '/^ *$/d' -e 's/^ *//g' $HOME/4_Moon/raw
sed -i '/var jArray=|"todayMoonContainer"|"moonNotToday"/!d' $HOME/4_Moon/raw
sed -i -e '/var jArray/s/","/n/g' -e 's/<span>|<b>|<\/span>|<\/b>|\n//g' /$HOME/4_Moon/raw
sed -i 's/"].*["/n/g' /$HOME/4_Moon/raw
sed -i '/var jArray/d' /$HOME/4_Moon/raw
sed -i -e 's/"]};//g' -e 's/^.*today_phase///g' -e 's/.jpg.*$//g' /$HOME/4_Moon/raw
sed -i -e 's/^small///g' -e 's/.png.*$//g' /$HOME/4_Moon/raw
sed -i 's/Illumination: |Sun Angle: |Sun Distance: |Moon Distance: |Moon Age: |Moon Angle: //g' /$HOME/4_Moon/raw
phase=$(sed -n 7p $HOME/4_Moon/raw|sed 's/ //')
mrise_mset=$(moonrise_set $phase)
sed -i 7a$(moonrise_set $phase) /$HOME/4_Moon/raw
#Day before Yesterday
img_in=$(sed -n 44p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/-2.png
#Yesterday
img_in=$(sed -n 45p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/-1.png
#Today
img_in=$(sed -n 46p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/0.png
#Tomorrow
img_in=$(sed -n 47p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/1.png
#Day after Tomorrow
img_in=$(sed -n 48p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/2.png
sed -i -e 's/New Moon/Nouvelle Lune/g' -e 's/Waxing Crescent/Lune Montante/g' -e 's/First Quarter/Premier Quartier/g' -e 's/Waxing Gibbous/Gibeuse Croissante/g' -e 's/Full Moon/Pleine Lune/g' -e 's/Waning Gibbous/Gibeuse Décroissante/g' -e 's/Last Quarter/Dernier Quartier/g' -e 's/Waning Crescent/Lune Déscendante/g' /$HOME/4_Moon/raw
kill -CONT $(pidof conky)

.gif)
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
loutch
Membre non connecté

.gif)
Conky accuweather pour les 16 prochaines heures .Les informations sont à prendre sur la page english j'ai traduit en Français ce que j'ai pu
Pour les traductions qui manquent il suffit de mettre à la suite dans le fichier 1c dans la partie traduction. Ce conky aura besoin d'etre mis à jour lors des changement d'heure (été-hivers) vu qu tztime ne prend pas tout les formats ,a moins que l'un d'entre vous puisse faire un script ou autre pour avoir les heures au format 24h.
le pack du site bunsenlabs est à prendre ici et à extraire dans le home .
http://bit.ly/1c_12-2-14
mon conkyrc modifier :
Code :
background yes
use_xft yes
xftfont URW Chancery L:style=Bold:size=10
xftalpha 1
update_interval 6.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 1050 300
maximum_width 1050
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color ffffff
color0 A9A9A9 #DarkGray
color1 778899 #LightSlateGray
color2 F5F5DC #Beige
color3 87CEFA #LightSkyBlue
color4 48D1CC #MediumTurquoise
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 B0E0E6 #PowderBlue
color8 FFD700 #Gold
color9 ff0000 #LightSalmon
default_outline_color black
alignment tl
gap_x 260
gap_y 120
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
text_buffer_size 4096
lua_load ~/.conky/lua/image.lua
# stuff after 'TEXT' will be formatted on screen
TEXT
${texeci 600 bash $HOME/1c_accuweather_images_hourly/1c}
Heures${goto 95} ${tztime Europe/Paris %H} h${goto 160} ${tztime GMT-2 %H} h${goto 220} ${tztime GMT-3 %H} h${goto 280} ${tztime GMT-4 %H} h${goto 340} ${tztime GMT-5 %H} h${goto 400} ${tztime GMT-6 %H} h${goto 460} ${tztime GMT-7 %H} h${goto 520} ${tztime GMT-8 %H} h${goto 580} ${tztime GMT-9 %H}${goto 640} ${tztime GMT-10 %H}${goto 700} ${tztime GMT-11 %H} h${goto 760} ${tztime GMT-12 %H} h${goto 820} ${tztime GMT-13 %H} h${goto 880} ${tztime GMT-14 %H} h${goto 940} ${tztime GMT-15 %H} h${goto 1000} ${tztime GMT-16 %H} h
Prévisions${color}
${goto 100}${execpi 600 sed -n '21p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 160}${execpi 600 sed -n '25p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 220}${execpi 600 sed -n '29p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 280}${execpi 600 sed -n '33p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 340}${execpi 600 sed -n '37p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 400}${execpi 600 sed -n '41p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 460}${execpi 600 sed -n '45p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 520}${execpi 600 sed -n '49p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 580}${execpi 600 sed -n '21p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}${goto 640}${execpi 600 sed -n '25p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}${goto 700}${execpi 600 sed -n '29p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}${goto 760}${execpi 600 sed -n '33p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}${goto 820}${execpi 600 sed -n '37p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}${goto 880}${execpi 600 sed -n '41p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}${goto 940}${execpi 600 sed -n '45p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}${goto 1000}${execpi 600 sed -n '49p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}
${goto 100}${execpi 600 sed -n '22p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 160}${execpi 600 sed -n '26p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 220}${execpi 600 sed -n '30p' $HOME/1c_accuweather_images_hourly/hourly_raw1}${goto 280}${execpi 600 sed -n '34p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 340}${execpi 600 sed -n '38p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 400}${execpi 600 sed -n '42p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 460}${execpi 600 sed -n '46p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 520}${execpi 600 sed -n '50p' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr}${goto 580}${execpi 600 sed -n '22p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}${goto 640}${execpi 600 sed -n '26p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}${goto 700}${execpi 600 sed -n '30p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}${goto 760}${execpi 600 sed -n '34p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}${goto 820}${execpi 600 sed -n '38p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}${goto 880}${execpi 600 sed -n '42p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}${goto 940}${execpi 600 sed -n '46p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}${goto 1000}${execpi 600 sed -n '50p' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr}
${execpi 600 sed -n '1,21p' $HOME/1c_accuweather_images_hourly/altogether}
#### icones ####
${lua fDrawImage $HOME/1c_accuweather_images_hourly/20.png 80 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/23.png 140 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/26.png 200 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/29.png 260 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/32.png 320 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/35.png 380 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/38.png 440 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/41.png 500 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/120.png 560 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/123.png 620 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/126.png 680 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/129.png 740 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/132.png 800 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/135.png 860 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/138.png 920 60 60 40}
${lua fDrawImage $HOME/1c_accuweather_images_hourly/141.png 980 60 60 40}
le fichier 1c
Code :
#!/bin/bash
#put your Accuweather address here
#address="http://www.accuweather.com/en/gr/kastoria/178682/weather-forecast/178682"
address="http://www.accuweather.com/en/fr/sarreguemines/57200/weather-forecast/135050"
loc_id=$(echo $address|sed 's//weather-forecast.*$//'|sed 's/^.*///')
last_number=$(echo $address|sed 's/^.*///')
curr_addr="$(echo $address|sed 's/weather-forecast.*$//')"current-weather/"$last_number"
addr1="$(echo $address|sed 's/weather-forecast.*$//')"hourly-weather-forecast/"$last_number"
kill -STOP $(pidof conky)
killall wget
rm $HOME/1c_accuweather_images_hourly/*.png
wget --save-cookies $HOME/1c_accuweather_images_hourly/cookie -O $HOME/1c_accuweather_images_hourly/curr_cond_raw $curr_addr
wget --load-cookies $HOME/1c_accuweather_images_hourly/cookie -O $HOME/1c_accuweather_images_hourly/hourly_raw1 $addr1
#First 8hrs - hourly_raw1 file
if [[ -s $HOME/1c_accuweather_images_hourly/hourly_raw1 ]]; then
sed -i -e '/"arrow-small-right">Next 8 hours/,/"chart chart-top"/!d' -e 's/°/°/g' $HOME/1c_accuweather_images_hourly/hourly_raw1
sed -i '/td style="border-right/d' $HOME/1c_accuweather_images_hourly/hourly_raw1
sed -i -e 's/^.*<th>//g' -e 's/^.*<td class="//g' -e 's/^.*<div class="//g' $HOME/1c_accuweather_images_hourly/hourly_raw1
sed -i -e 's/ icon.*$//g' $HOME/1c_accuweather_images_hourly/hourly_raw1
sed -i -e 's/^">|first-col">|last-col">//g' -e 's/</td>.*$//g' $HOME/1c_accuweather_images_hourly/hourly_raw1
sed -i -e '60,67s/^.*>//g' -e 's/^.*row">|</th>//g' -e 's/®|°//g' $HOME/1c_accuweather_images_hourly/hourly_raw1
sed -i -e 's/^.*row">|</th>//g' -e 's/®|°//g' $HOME/1c_accuweather_images_hourly/hourly_raw1
sed -i -e 's/^.*</span></div>//g' $HOME/1c_accuweather_images_hourly/hourly_raw1
sed -i -e 's/">/n/g' -e '/<tr|</tr>/d' -e 's/" class="arrow-small-right.*$//g' -e 's/^.*<span>//g' -e 's/</span><br />/:/g' $HOME/1c_accuweather_images_hourly/hourly_raw1
sed -i -e 's/</div>.*$//g' -e 's/^.*icon i-//g' -e '/<th class="first/d' -e 's/^.*<th class="//g' $HOME/1c_accuweather_images_hourly/hourly_raw1
sed -i -e 's/^.*<a href="//g' -e 's/" class=".*$//g' $HOME/1c_accuweather_images_hourly/hourly_raw1
sed -i -e '/<|;/d' -e 's/r//g' -e '/^ *$/d' -e 's/^ *//g' $HOME/1c_accuweather_images_hourly/hourly_raw1
sed -i -e 's/day.*$/day/g' -e 's/night.*$/night/g' -e 's/-h.*$//g' $HOME/1c_accuweather_images_hourly/hourly_raw1
for (( i=20; i<=41; i+=3 ))
do
cp $HOME/1c_accuweather_images_hourly/Forecast_Images/$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw1).png $HOME/1c_accuweather_images_hourly/$i.png
done
for (( i=21; i<=50; i+=3 ))
do
no=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw1|wc -c)
if (( no<=7 )); then
sed -i $i"s/$/n/" $HOME/1c_accuweather_images_hourly/hourly_raw1
i=$((i+1))
elif (( no>7 )); then
sed -i $i"s/^(.{7})/1n/" $HOME/1c_accuweather_images_hourly/hourly_raw1
i=$((i+1))
fi
done
fi
addr2=$(sed -n 1p $HOME/1c_accuweather_images_hourly/hourly_raw1)
wget --load-cookies $HOME/1c_accuweather_images_hourly/cookie -O $HOME/1c_accuweather_images_hourly/hourly_raw2 $addr2
#Next 8hrs - hourly_raw2 file
if [[ -s $HOME/1c_accuweather_images_hourly/hourly_raw2 ]]; then
sed -i -e '/"arrow-small-right">Next 8 hours/,/"chart chart-top"/!d' -e 's/°/°/g' $HOME/1c_accuweather_images_hourly/hourly_raw2
sed -i '/td style="border-right/d' $HOME/1c_accuweather_images_hourly/hourly_raw2
sed -i -e 's/^.*<th>//g' -e 's/^.*<td class="//g' -e 's/^.*<div class="//g' $HOME/1c_accuweather_images_hourly/hourly_raw2
sed -i -e 's/ icon.*$//g' $HOME/1c_accuweather_images_hourly/hourly_raw2
sed -i -e 's/^">|first-col">|last-col">//g' -e 's/</td>.*$//g' $HOME/1c_accuweather_images_hourly/hourly_raw2
sed -i -e '60,67s/^.*>//g' -e 's/^.*row">|</th>//g' -e 's/®|°//g' $HOME/1c_accuweather_images_hourly/hourly_raw2
sed -i -e 's/^.*row">|</th>//g' -e 's/®|°//g' $HOME/1c_accuweather_images_hourly/hourly_raw2
sed -i -e 's/^.*</span></div>//g' $HOME/1c_accuweather_images_hourly/hourly_raw2
sed -i -e 's/">/n/g' -e '/<tr|</tr>/d' -e 's/" class="arrow-small-right.*$//g' -e 's/^.*<span>//g' -e 's/</span><br />/:/g' $HOME/1c_accuweather_images_hourly/hourly_raw2
sed -i -e 's/</div>.*$//g' -e 's/^.*icon i-//g' -e '/<th class="first/d' -e 's/^.*<th class="//g' $HOME/1c_accuweather_images_hourly/hourly_raw2
sed -i -e 's/^.*<a href="//g' -e 's/" class=".*$//g' $HOME/1c_accuweather_images_hourly/hourly_raw2
sed -i -e '/<|;/d' -e 's/r//g' -e '/^ *$/d' -e 's/^ *//g' $HOME/1c_accuweather_images_hourly/hourly_raw2
sed -i -e 's/day.*$/day/g' -e 's/night.*$/night/g' -e 's/-h.*$//g' $HOME/1c_accuweather_images_hourly/hourly_raw2
for (( i=20; i<=41; i+=3 ))
do
cp $HOME/1c_accuweather_images_hourly/Forecast_Images/$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw2).png $HOME/1c_accuweather_images_hourly/$(( $i+100 )).png
done
for (( i=21; i<=50; i+=3 ))
do
no=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw2|wc -c)
if (( no<=7 )); then
sed -i $i"s/$/n/" $HOME/1c_accuweather_images_hourly/hourly_raw2
i=$((i+1))
elif (( no>7 )); then
sed -i $i"s/^(.{7})/1n/" $HOME/1c_accuweather_images_hourly/hourly_raw2
i=$((i+1))
fi
done
fi
# Full info - altogether file
rm $HOME/1c_accuweather_images_hourly/altogether
#TEMP
echo "${color ffffff}${goto 10}${hr 1}" > $HOME/1c_accuweather_images_hourly/altogether
echo "TEMP.(°C)${color}" >> $HOME/1c_accuweather_images_hourly/altogether
jump_to=100
for (( i=52; i<=59; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw1)
sed -i "2s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
for (( i=52; i<=59; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw2)
sed -i "2s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
#REALFEEL
echo "${color ffffff}${goto 100}${hr 1}" >> $HOME/1c_accuweather_images_hourly/altogether
echo "Réel.(°C)${color}" >> $HOME/1c_accuweather_images_hourly/altogether
jump_to=100
for (( i=61; i<=68; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw1)
sed -i "4s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
for (( i=61; i<=68; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw2)
sed -i "4s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
#HUMIDITY
echo "${color ffffff}${goto 100}${hr 1}" >> $HOME/1c_accuweather_images_hourly/altogether
echo "HUMIDITEE${color}" >> $HOME/1c_accuweather_images_hourly/altogether
jump_to=100
for (( i=70; i<=77; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw1)
sed -i "6s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
for (( i=70; i<=77; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw2)
sed -i "6s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
#RAIN
echo "${color ffffff}${goto 100}${hr 1}" >> $HOME/1c_accuweather_images_hourly/altogether
echo "PLUIE${color}" >> $HOME/1c_accuweather_images_hourly/altogether
jump_to=100
for (( i=79; i<=86; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw1)
sed -i "8s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
for (( i=79; i<=86; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw2)
sed -i "8s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
#SNOW
echo "${color ffffff}${goto 100}${hr 1}" >> $HOME/1c_accuweather_images_hourly/altogether
echo "NEIGE${color}" >> $HOME/1c_accuweather_images_hourly/altogether
jump_to=100
for (( i=88; i<=95; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw1)
sed -i "10s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
for (( i=88; i<=95; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw2)
sed -i "10s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
#ICE
echo "${color ffffff}${goto 100}${hr 1}" >> $HOME/1c_accuweather_images_hourly/altogether
echo "GIVRE${color}" >> $HOME/1c_accuweather_images_hourly/altogether
jump_to=100
for (( i=97; i<=104; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw1)
sed -i "12s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
for (( i=97; i<=104; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw2)
sed -i "12s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
#WIND
echo "${color ffffff}${goto 100}${hr 1}" >> $HOME/1c_accuweather_images_hourly/altogether
echo "VENT(km/h)${color}" >> $HOME/1c_accuweather_images_hourly/altogether
jump_to=100
for (( i=106; i<=113; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw1)
sed -i "14s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
for (( i=106; i<=113; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw2)
sed -i "14s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
#UV INDEX
echo "${color ffffff}${goto 100}${hr 1}" >> $HOME/1c_accuweather_images_hourly/altogether
echo "INDEX UV${color}" >> $HOME/1c_accuweather_images_hourly/altogether
jump_to=100
for (( i=115; i<=122; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw1)
sed -i "16s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
for (( i=115; i<=122; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw2)
sed -i "16s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
#CLOUD COVER
echo "${color ffffff}${goto 100}${hr 1}" >> $HOME/1c_accuweather_images_hourly/altogether
echo "COUV. NUAGE${color}" >> $HOME/1c_accuweather_images_hourly/altogether
jump_to=100
for (( i=124; i<=131; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw1)
sed -i "18s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
for (( i=124; i<=131; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw2)
sed -i "18s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
#DEW POINT
echo "${color ffffff}${goto 100}${hr 1}" >> $HOME/1c_accuweather_images_hourly/altogether
echo "ROSEE (°C)${color}" >> $HOME/1c_accuweather_images_hourly/altogether
jump_to=100
for (( i=133; i<=140; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw1)
sed -i "20s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
for (( i=133; i<=140; i+=1 ))
do
temp=$(sed -n ${i}p $HOME/1c_accuweather_images_hourly/hourly_raw2)
sed -i "20s/$/${goto $jump_to}$temp/" $HOME/1c_accuweather_images_hourly/altogether
jump_to=$(( jump_to+=60 ))
done
## English to French
cp $HOME/1c_accuweather_images_hourly/hourly_raw1 $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
if [[ -s $HOME/1c_accuweather_images_hourly/hourly_raw1-fr ]]; then
sed -i -e 's/Clouds and sun/Nuages et soleil/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/A couple of showers/Averses éparses/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/cloudy/Nuageux/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/Mostly Cloudy/Ciel plutôt nuageux/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/Rain and drizzle/Pluie et bruine/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/Cloudy with a couple/Nuages épars/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/Cloudy with a bit of/Nuageux,Faible pluie/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/Showers/Averses/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/breezy/Venteux/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/Times of clouds and/Nuages épars avec soleil/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/Rain shover/Averses de pluie/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/Rain/Pluie/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/Light rain/Pluie/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/Cloudy/Nuageux/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/Mostly cloudy/Peu nuageux/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
sed -i -e 's/Mostly/Peu/' $HOME/1c_accuweather_images_hourly/hourly_raw1-fr
fi
## English to French
cp $HOME/1c_accuweather_images_hourly/hourly_raw2 $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
if [[ -s $HOME/1c_accuweather_images_hourly/hourly_raw2-fr ]]; then
sed -i -e 's/Clouds and sun/Nuages et soleil/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
sed -i -e 's/A couple of showers/Averses éparses/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
sed -i -e 's/cloudy/Nuageux/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
sed -i -e 's/Mostly Cloudy/Ciel plutôt nuageux/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
sed -i -e 's/Rain and drizzle/Pluie et bruine/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
sed -i -e 's/Cloudy with a couple/Nuages épars/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
sed -i -e 's/Cloudy with a bit of/Nuageux,Faible pluie/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
sed -i -e 's/Showers/Averses/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
sed -i -e 's/breezy/Venteux/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
sed -i -e 's/Times of clouds and/Nuages épars avec soleil/' $HOME/1c_accuweather_images_hourly/hourly_raw21-fr
sed -i -e 's/Rain shover/Averses de pluie/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
sed -i -e 's/Rain/Pluie/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
sed -i -e 's/Light rain/Pluie/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
sed -i -e 's/Cloudy/Nuageux/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
sed -i -e 's/Mostly cloudy/Peu nuageux/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
sed -i -e 's/Mostly/Peu/' $HOME/1c_accuweather_images_hourly/hourly_raw2-fr
fi
kill -CONT $(pidof conky)
ce que ça donne:

.gif)
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
loutch
Membre non connecté

.gif)
Conky olgmen que j'ai doublé (c'est du russe)
conky de gauche
Code TEXT :
background yes use_xft yes xftfont URW Chancery L:style=Bold:size=10 xftalpha 1 imlib_cache_size 0 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 250 250 maximum_width 250 text_buffer_size 2048 draw_shades no draw_outline no draw_borders no draw_graph_borders no default_color ffffff #ffd579 default_outline_color white alignment top_left gap_x 00 gap_y 00 no_buffers yes uppercase no cpu_avg_samples 2 override_utf8_locale yes lua_load ~/.conky/olgmen/olgmen7_1.lua lua_draw_hook_pre widgets TEXT ${voffset 90}${goto 100}${execi 6 expr `cat /sys/class/hwmon/hwmon2/temp1_input` / 1000}°C${goto 160}${execi 6 expr `cat /sys/class/hwmon/hwmon2/temp2_input` / 1000}°C ${voffset 20}${goto 60}ram: $memperc%${goto 170}hdd: ${fs_used_perc /}% ${voffset 10}${goto 100}${execi 6 expr `cat /sys/class/hwmon/hwmon2/temp3_input` / 1000}°C${goto 160}${execi 6 expr `cat /sys/class/hwmon/hwmon2/temp1_input` / 1000}°C ${voffset 80}
son olgmen_7.1.lua
Code TEXT :
--[[ При сборке скрипта использованы данные из следующих скриптов Conky Widgets by londonali1010 (2009) - часы и кольца Shadowed clock by wlourf (10 jan. 2010) - стрелки часов с тенью BARGRAPH WIDGET v1.3 by wlourf (03 march 2010) Собрал все это Борис Кринкель <olgmen> krinkel@rambler.ru Для этого серипта требуется CONKY версии 1.7.2 Для вызова этого скрипта в Conky вставьте следующие строки до TEXT (при условии, что скрипт сохранен в ~/scripts/conky_widgets.lua): lua_load ~/scripts/olgmen7_1.lua lua_draw_hook_pre widgets ]] require 'cairo' --[[ AIR CLOCK WIDGET ]] --[[ Виджет выводит изображение часов. Часть настроек находится в виджете ]] function clock(cr, x, y, s, bgc, bga, fgc, fga) -- функция перекодировки цвета function rgb_to_r_g_b(colour,alpha) return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha end -- назначаем толщину выводимых линий local s_th = 2 -- рисуем циферблат local radius = s/2 local m_x,m_y = x + s/2, y + s/2 -- вывод часовых делений local i = 0 local winkel = math.rad(30) for i=0,11,1 do cairo_set_line_width(cr,s_th*1.5) cairo_move_to(cr, m_x-math.sin(winkel*i)*(radius), m_y-math.cos(winkel*i)*(radius)) cairo_line_to(cr, m_x-math.sin(winkel*i)*(radius*0.8), m_y-math.cos(winkel*i)*(radius*0.8)) cairo_fill_preserve(cr) cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga)) cairo_stroke(cr) end -- вывод минутных делений local i = 0 local winkel = math.rad(6) for i=0,59,1 do cairo_set_line_width(cr,1) cairo_move_to(cr, m_x-math.sin(winkel*i)*radius, m_y-math.cos(winkel*i)*radius) cairo_line_to(cr, m_x-math.sin(winkel*i)*(radius*0.9), m_y-math.cos(winkel*i)*(radius*0.9)) cairo_stroke(cr) end -- часовые стрелки с тенью, взято из Shadowed clock by wlourf (10 jan. 2010) function draw_hand(a_trame,arc,arc0,arc1,lg,r,border,rgb) xx = xc + clock_r*math.sin(arc)*lg yy = yc - clock_r*math.cos(arc)*lg x0 = xc + r*math.sin(arc0) y0 = yc - r*math.cos(arc0) x1 = xc + r*math.sin(arc1) y1 = yc - r*math.cos(arc1) if border ~= nil then cairo_set_line_width(cr,1) cairo_set_source_rgba(cr,border[1],border[2],border[3],0.5) cairo_move_to (cr, x0, y0) cairo_curve_to (cr, x0, y0, xx, yy, x1, y1) cairo_arc(cr,xc,yc,r,arc1-math.pi/2,arc0-math.pi/2) cairo_stroke(cr) end -- рисуем тень cairo_move_to (cr, x0, y0) cairo_curve_to (cr, x0, y0, xx+shadow_xoffset, yy+shadow_yoffset, x1, y1) cairo_arc(cr,xc,yc,r,arc1-math.pi/2,arc0-math.pi/2) pat = cairo_pattern_create_radial (xc, yc, 0, xc, yc, clock_r) cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 0, shadow_opacity) cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 0) cairo_set_source (cr, pat) cairo_fill (cr) -- рисуем стрелки cairo_move_to (cr, x0, y0) cairo_curve_to (cr, x0, y0, xx, yy, x1, y1) cairo_arc(cr,xc,yc,r,arc1-math.pi/2,arc0-math.pi/2) pat = cairo_pattern_create_radial (xc, yc, clock_r/10, xc, yc, clock_r*lg) cairo_pattern_add_color_stop_rgba (pat,0, rgb[1], rgb[2], rgb[3], 1) cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 1) cairo_set_source (cr, pat) cairo_fill (cr) cairo_pattern_destroy (pat) end -- Здесь вводятся основные данные -- радиус часов в пикселях, задаем половину диаметра часов clock_r=s/2 -- координаты центра часов xc = x+s/2 yc = y+s/2 -- координаты источника света относительно центра часов, 0 - источник света над центром -- может быть положительным, источник света выше центра, или отрицательным shadow_xoffset=70 shadow_yoffset=70 -- прозрачность тени, значения от 0 до 1 shadow_opacity=0 -- Выводить секундную стрелку, Да - true, Нет - false. -- При выводе секундной стрелки update_interval в .conkyrc должен быть менее 1 сек. show_seconds=true -- Выводить ось стрелок в центре часов, Да - true, Нет - false. show_dot = true -- размеры стрелок, первая цифра ширина, вторая - длина rh,lgh=3,0 -- 3,1.2 aiguille heure rm,lgm=2,0 -- 2,1.75 aiguille minutes rs,lgs=1.5,2.3 -- секундная стрелка -- забираем данные из ОС local hours=os.date("%I") local mins=os.date("%M") local secs=os.date("%S") -- расчет угла движения стрелок gamma = math.pi/2-math.atan(rs/(clock_r*lgs)) secs_arc=(2*math.pi/60)*secs secs_arc0=secs_arc-gamma secs_arc1=secs_arc+gamma gamma = math.pi/2-math.atan(rm/(clock_r*lgm)) mins_arc=(2*math.pi/60)*mins + secs_arc/60 mins_arc0=mins_arc-gamma mins_arc1=mins_arc+gamma gamma = math.pi/2-math.atan(rh/(clock_r*lgh)) hours_arc=(2*math.pi/12)*hours+mins_arc/12 hours_arc0=hours_arc-gamma hours_arc1=hours_arc+gamma -- вывод стрелок draw_hand(alpha_trame,hours_arc,hours_arc0,hours_arc1,lgh,rh,{0,0,0},{1,1,1}) draw_hand(alpha_trame,mins_arc,mins_arc0,mins_arc1,lgm,rm,{0,0,0},{.9,.9,.9}) if show_seconds then draw_hand(alpha_trame,secs_arc,secs_arc0,secs_arc1,lgs,rs,{0,0,0},{.8,.8,.8}) end -- рисуем ось стрелок if show_dot then lg_shadow_center=3 radius=math.min(rh,rm,rs)*0.75 if radius<1 then radius=1 end ang = math.atan(shadow_yoffset/shadow_xoffset) -- тень от оси gamma = -math.atan(1/lg_shadow_center) ang0=ang-gamma ang1=ang+gamma end end --[[ END AIR CLOCK WIDGET ]] -- --------------------------------------------------------------------------- --[[ BARGRAPH WIDGET v1.3 by wlourf (03 march 2010) This widget draw a simple bar like (old) equalizers on hi-fi systems. http://u-scripts.blogspot.com/ The arguments are : - "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'... or you can set it to "" if you want to display a numeric value with arg=numeric_value - "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''. - "max" is the maximum value of the bar. If the Conky variable outputs a percentage, use 100. - "nb_blocks" is the umber of block to draw - "cap" id the cap of a block, possibles values are CAIRO_LINE_CAP_ROUND , CAIRO_LINE_CAP_SQUARE or CAIRO_LINE_CAP_BUTT see http://www.cairographics.org/samples/set_line_cap/ - "xb" and "yb" are the coordinates of the bottom left point of the bar, or the center of the circle if radius>0 - "w" and "h" are the width and the height of a block (without caps), w has no effect for "circle" bar - "space" is the space betwwen two blocks, can be null or negative - "bgc" and "bga" are background colors and alpha when the block is not LIGHT OFF - "fgc" and "fga" are foreground colors and alpha when the block is not LIGHT ON - "alc" and "ala" are foreground colors and alpha when the block is not LIGHT ON and ALARM ON - "alarm" is the value where blocks LIGHT ON are in a different color (values from 0 to 100) - "led_effect" true or false : to show a block with a led effect - "led_alpha" alpha of the center of the led (values from 0 to 1) - "smooth" true or false : colors in the bar has a smooth effect - "mid_color",mid_alpha" : colors of the center of the bar (mid_color can to be set to nil) - "rotation" : angle of rotation of the bar (values are 0 to 360 degrees). 0 = vertical bar, 90 = horizontal bar - "radius" : draw the bar on a circle (it's no more a circle, radius = 0 to keep bars) - "angle_bar" : if radius>0 angle_bar is the angle of the bar v1.0 (10 Feb. 2010) original release v1.1 (13 Feb. 2010) numeric values can be passed instead conky stats with parameters name="", arg = numeric_value v1.2 (28 Feb. 2010) just renamed the widget to bargraph v1.3 (03 March 2010) added parameters radius & angle_bar to draw the bar in a circular way ]] function equalizer(cr, name, arg, max, nb_blocks, cap, xb, yb, w, h, space, bgc, bga, fgc, fga,alc,ala,alarm,led_effect,led_alpha,smooth,mid_color,mid_alpha,rotation, radius, angle_bar) local function rgb_to_r_g_b(colour, alpha) return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha end local function setup_equalizer() local value = 0 if name ~="" then local str = conky_parse(string.format('${%s %s}', name, arg)) value = tonumber(str) else value = arg end if value==nil then value =0 end --if value <= 25 then max = 50 --elseif value <= 50 then max = 100 end local pct = 100*value/max local pcb = 100/nb_blocks cairo_set_line_width (cr, h) cairo_set_line_cap (cr, cap) local angle_rot= rotation*math.pi/180 local alpha_bar = (angle_bar*math.pi/180)/2 for pt = 1,nb_blocks do local light_on=false --set colors local col,alpha = bgc,bga if pct>=(100/nb_blocks/2) then --start after an half bloc if pct>=(pcb*(pt-1)) then light_on=true col,alpha = fgc,fga if pct>=alarm and (pcb*pt)>alarm then col,alpha = alc,ala end end end --vertical points local x1=xb local y1=yb-pt*(h+space) local radius0 = yb-y1 local x2=xb+radius0*math.sin(angle_rot) local y2=yb-radius0*math.cos(angle_rot) --line on angle_rot local a1=(y2-yb)/(x2-xb) local b1=y2-a1*x2 --line perpendicular to angle_rot local a2=-1/a1 local b2=y2-a2*x2 --dots on perpendicular local xx0,xx1,yy0,yy1=0,0,0,0 if rotation == 90 or rotation == 270 then xx0,xx1=x2,x2 yy0=yb yy1=yb+w else xx0,xx1=x2,x2+w*math.cos(angle_rot) yy0=xx0*a2+b2 yy1=xx1*a2+b2 end local xc,yc --perpendicular segment if alpha_bar == 0 then cairo_move_to (cr, xx0 ,yy0) cairo_line_to (cr, xx1 ,yy1) xc,yc=(xx0+xx1)/2,(yy0+yy1)/2 else cairo_arc( cr, xb, yb, radius+(h+space)*(pt)-h/2, ( -alpha_bar -math.pi/2+angle_rot) , ( alpha_bar -math.pi/2+angle_rot) ) xc=xb+ (radius+(h+space)*(pt))*math.sin(angle_rot) yc=yb- (radius+(h+space)*(pt))*math.cos(angle_rot) end --colors if light_on and led_effect then local pat = cairo_pattern_create_radial (xc, yc, 0, xc,yc,w/1.5) cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col,led_alpha)) cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col,alpha)) cairo_set_source (cr, pat) cairo_pattern_destroy(pat) else cairo_set_source_rgba(cr, rgb_to_r_g_b(col,alpha)) end if light_on and smooth then local radius = (nb_blocks+1)*(h+space) if pt==1 then xc0,yc0=xc,yc --remember the center of first block end cairo_move_to(cr,xc0,yc0) local pat = cairo_pattern_create_radial (xc0, yc0, 0, xc0,yc0,radius) cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(fgc,fga)) cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(alc,ala)) if mid_color ~=nil then cairo_pattern_add_color_stop_rgba (pat, 0.5,rgb_to_r_g_b(mid_color,mid_alpha)) end cairo_set_source (cr, pat) cairo_pattern_destroy(pat) end cairo_stroke (cr); end end --prevent segmentatioon error local updates=tonumber(conky_parse('${updates}')) if updates> 3 then setup_equalizer() end end -- ------------------------------------------------------------------------------------ --[[ TEXT WIDGET ]] function addzero100(num) if tonumber(num) == nil then return end --tonumber(num) == 0 end if tonumber(num) < 10 then return "0" .. num elseif tonumber(num) <100 then return "" .. 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_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_rotate (cr, -interval2-(180*math.pi/180)) end end function conky_draw_text() local updates=conky_parse('${updates}') update_num=tonumber(updates) --circlewriting variable cpu=tonumber(conky_parse('${cpu cpu1}')) if cpu == nil then cpu = 0 end --text must be in quotes text=("CPU 1 " .. (addzero100(cpu)) .. "%") --font name must be in quotes font="URW Chancery L" fontsize=14 radius=70 positionx=140 positiony=160 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=290 finish=340 letterposition=0 circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition) --circlewritingdown variables cpu=tonumber(conky_parse('${cpu cpu2}')) if cpu == nil then cpu = 0 end --text must be in quotes text=("CPU 2 " .. (addzero100(cpu)) .. "%") --font name must be in quotes font="URW Chancery L" fontsize=14 radius=70 positionx=140 positiony=160 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=10 finish=60 letterposition=0 circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition) --circlewritingdown variable down=tonumber(conky_parse('${cpu cpu3}')) --text must be in quotes text=("CPU 3 " .. (addzero100(cpu)) .. "%") --font name must be in quotes font="URW Chancery L" fontsize=14 radius=77 positionx=140 positiony=160 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=240 finish=190 letterposition=0.06 circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition) --circlewriting variables up=tonumber(conky_parse('${upspeedf wlp2s0}')) --text must be in quotes text=("CPU 4 " .. (addzero100(cpu)) .. "%") --font name must be in quotes font="URW Chancery L" fontsize=14 radius=77 positionx=140 positiony=160 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=170 finish=120 letterposition=0 circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition) -- end end --[[ END TEXT WIDGET ]] -- ------------------------------------------------------------------------------------- function conky_widgets() 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) -- ------------------------------------------------------------------------------------- --function equalizer(name, arg, max, nb_blocks, cap, xb, yb, w, h, space, bgc, bga, fgc, fga, alc, ala, alarm, led_effect, led_alpha, smooth, mid_color, mid_alpha, rotation, radius, angle_bar) cr = cairo_create(cs) if var == nil then var = 0 end var = var + 1 angle = var equalizer(cr, 'cpu', 'cpu2', 100, 50, CAIRO_LINE_CAP_SQUARE, 140, 160, 100, 1, 1, 0x00cc66, 0, 0x6495ee, 1, 0xffffff, 1, 80, true, 1, true, 0x6495ee, 1.0, 40, 10, 75) equalizer(cr, 'cpu', 'cpu1', 100, 50, CAIRO_LINE_CAP_SQUARE, 140, 160, 100, 1, 1, 0x00cc66, 0, 0x6495ee, 1, 0xffffff, 1, 80, true, 1, true, 0x6495ee, 1.0, 320, 10, 75) equalizer(cr, 'memperc', '', 100, 50, CAIRO_LINE_CAP_BUTT, 140, 160, 100, 1, 1, 0x00cc66, 0, 0x6495ee, 1, 0xffffff, 1, 80, true, 1, true, 0x6495ee, 1.0, 270, 10, 20) equalizer(cr, 'fs_used_perc', '/', 100, 50, CAIRO_LINE_CAP_SQUARE, 140, 160, 100, 1, 1, 0x00cc66, 0, 0x6495ee, 1, 0xffffff, 1, 80, true, 1, true, 0x6495ee, 1.0, 90, 10, 20) equalizer(cr, 'cpu', 'cpu3', 100, 50, CAIRO_LINE_CAP_SQUARE, 140, 160, 100, 1, 1, 0x00cc66, 0, 0x6495ee, 1, 0xffffff, 1, 80, true, 1, true, 0x6495ee, 1.0, 220, 10, 75) equalizer(cr, 'cpu', 'cpu4', 100, 50, CAIRO_LINE_CAP_SQUARE, 140, 160, 100, 1, 1, 0x00cc66, 0, 0x6495ee, 1, 0xffffff, 1, 80, true, 1, true, 0x6495ee, 1.0, 140, 10, 75) cairo_destroy(cr) --[[ Вывод часов ]] cr = cairo_create(cs) clock(cr, 30, 50, 220, 0xffffff, 1, 0xFFFfff, 1) cairo_destroy(cr) --[[ Вывод текста по кругу, настройке в скрипте ]] cr = cairo_create(cs) conky_draw_text() cairo_destroy(cr) end
conky de droite
Code TEXT :
background yes use_xft yes xftfont URW Chancery L:style=Bold:size=10 xftalpha 1 imlib_cache_size 0 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 250 270 maximum_width 250 text_buffer_size 2048 draw_shades no draw_outline no draw_borders no draw_graph_borders no default_color ffffff #ffd579 default_outline_color white alignment top_right gap_x 00 gap_y 00 no_buffers yes uppercase no cpu_avg_samples 2 override_utf8_locale yes lua_load ~/.conky/olgmen/olgmen7_1a.lua lua_draw_hook_pre widgets TEXT ${voffset 60}${goto 95}Racine ${goto 150}Home ${voffset 14}${goto 52}Ecr. : ${diskio_write sda6} ${goto 146}Ecr. : ${diskio_write sda8} ${voffset -1}${goto 52}Lec. : ${diskio_read sda6} ${goto 146}Ecr. : ${diskio_read sda8} ${voffset 01}${goto 60}swap: $swapperc%${goto 170}home: ${fs_used_perc /home}%
son olgmen_7.1a.lua (penser à modifier la partie wifi pour votre configuration)
Code TEXT :
--[[ При сборке скрипта использованы данные из следующих скриптов Conky Widgets by londonali1010 (2009) - часы и кольца Shadowed clock by wlourf (10 jan. 2010) - стрелки часов с тенью BARGRAPH WIDGET v1.3 by wlourf (03 march 2010) Собрал все это Борис Кринкель <olgmen> krinkel@rambler.ru Для этого серипта требуется CONKY версии 1.7.2 Для вызова этого скрипта в Conky вставьте следующие строки до TEXT (при условии, что скрипт сохранен в ~/scripts/conky_widgets.lua): lua_load ~/scripts/olgmen7_1.lua lua_draw_hook_pre widgets ]] require 'cairo' --[[ AIR CLOCK WIDGET ]] --[[ Виджет выводит изображение часов. Часть настроек находится в виджете ]] function clock(cr, x, y, s, bgc, bga, fgc, fga) -- функция перекодировки цвета function rgb_to_r_g_b(colour,alpha) return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha end -- назначаем толщину выводимых линий local s_th = 2 -- рисуем циферблат local radius = s/2 local m_x,m_y = x + s/2, y + s/2 -- вывод часовых делений local i = 0 local winkel = math.rad(30) for i=0,11,1 do cairo_set_line_width(cr,s_th*1.5) cairo_move_to(cr, m_x-math.sin(winkel*i)*(radius), m_y-math.cos(winkel*i)*(radius)) cairo_line_to(cr, m_x-math.sin(winkel*i)*(radius*0.8), m_y-math.cos(winkel*i)*(radius*0.8)) cairo_fill_preserve(cr) cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga)) cairo_stroke(cr) end -- вывод минутных делений local i = 0 local winkel = math.rad(6) for i=0,59,1 do cairo_set_line_width(cr,1) cairo_move_to(cr, m_x-math.sin(winkel*i)*radius, m_y-math.cos(winkel*i)*radius) cairo_line_to(cr, m_x-math.sin(winkel*i)*(radius*0.9), m_y-math.cos(winkel*i)*(radius*0.9)) cairo_stroke(cr) end -- часовые стрелки с тенью, взято из Shadowed clock by wlourf (10 jan. 2010) function draw_hand(a_trame,arc,arc0,arc1,lg,r,border,rgb) xx = xc + clock_r*math.sin(arc)*lg yy = yc - clock_r*math.cos(arc)*lg x0 = xc + r*math.sin(arc0) y0 = yc - r*math.cos(arc0) x1 = xc + r*math.sin(arc1) y1 = yc - r*math.cos(arc1) if border ~= nil then cairo_set_line_width(cr,1) cairo_set_source_rgba(cr,border[1],border[2],border[3],0.5) cairo_move_to (cr, x0, y0) cairo_curve_to (cr, x0, y0, xx, yy, x1, y1) cairo_arc(cr,xc,yc,r,arc1-math.pi/2,arc0-math.pi/2) cairo_stroke(cr) end -- рисуем тень cairo_move_to (cr, x0, y0) cairo_curve_to (cr, x0, y0, xx+shadow_xoffset, yy+shadow_yoffset, x1, y1) cairo_arc(cr,xc,yc,r,arc1-math.pi/2,arc0-math.pi/2) pat = cairo_pattern_create_radial (xc, yc, 0, xc, yc, clock_r) cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 0, shadow_opacity) cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 0) cairo_set_source (cr, pat) cairo_fill (cr) -- рисуем стрелки cairo_move_to (cr, x0, y0) cairo_curve_to (cr, x0, y0, xx, yy, x1, y1) cairo_arc(cr,xc,yc,r,arc1-math.pi/2,arc0-math.pi/2) pat = cairo_pattern_create_radial (xc, yc, clock_r/10, xc, yc, clock_r*lg) cairo_pattern_add_color_stop_rgba (pat,0, rgb[1], rgb[2], rgb[3], 1) cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 1) cairo_set_source (cr, pat) cairo_fill (cr) cairo_pattern_destroy (pat) end -- Здесь вводятся основные данные -- радиус часов в пикселях, задаем половину диаметра часов clock_r=s/2 -- координаты центра часов xc = x+s/2 yc = y+s/2 -- координаты источника света относительно центра часов, 0 - источник света над центром -- может быть положительным, источник света выше центра, или отрицательным shadow_xoffset=70 shadow_yoffset=70 -- прозрачность тени, значения от 0 до 1 shadow_opacity=0 -- Выводить секундную стрелку, Да - true, Нет - false. -- При выводе секундной стрелки update_interval в .conkyrc должен быть менее 1 сек. show_seconds=false -- Выводить ось стрелок в центре часов, Да - true, Нет - false. show_dot = true -- размеры стрелок, первая цифра ширина, вторая - длина rh,lgh=3,1.2 -- 1.2 rm,lgm=2,1.75 -- 1.75 rs,lgs=1,1.9 -- секундная стрелка -- забираем данные из ОС local hours=os.date("%I") local mins=os.date("%M") local secs=os.date("%S") -- расчет угла движения стрелок gamma = math.pi/2-math.atan(rs/(clock_r*lgs)) secs_arc=(2*math.pi/60)*secs secs_arc0=secs_arc-gamma secs_arc1=secs_arc+gamma gamma = math.pi/2-math.atan(rm/(clock_r*lgm)) mins_arc=(2*math.pi/60)*mins + secs_arc/60 mins_arc0=mins_arc-gamma mins_arc1=mins_arc+gamma gamma = math.pi/2-math.atan(rh/(clock_r*lgh)) hours_arc=(2*math.pi/12)*hours+mins_arc/12 hours_arc0=hours_arc-gamma hours_arc1=hours_arc+gamma -- вывод стрелок draw_hand(alpha_trame,hours_arc,hours_arc0,hours_arc1,lgh,rh,{0,0,0},{1,1,1}) draw_hand(alpha_trame,mins_arc,mins_arc0,mins_arc1,lgm,rm,{0,0,0},{.9,.9,.9}) if show_seconds then draw_hand(alpha_trame,secs_arc,secs_arc0,secs_arc1,lgs,rs,{0,0,0},{.8,.8,.8}) end -- рисуем ось стрелок if show_dot then lg_shadow_center=3 radius=math.min(rh,rm,rs)*0.75 if radius<1 then radius=1 end ang = math.atan(shadow_yoffset/shadow_xoffset) -- тень от оси gamma = -math.atan(1/lg_shadow_center) ang0=ang-gamma ang1=ang+gamma end end --[[ END AIR CLOCK WIDGET ]] -- --------------------------------------------------------------------------- --[[ BARGRAPH WIDGET v1.3 by wlourf (03 march 2010) This widget draw a simple bar like (old) equalizers on hi-fi systems. http://u-scripts.blogspot.com/ The arguments are : - "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'... or you can set it to "" if you want to display a numeric value with arg=numeric_value - "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''. - "max" is the maximum value of the bar. If the Conky variable outputs a percentage, use 100. - "nb_blocks" is the umber of block to draw - "cap" id the cap of a block, possibles values are CAIRO_LINE_CAP_ROUND , CAIRO_LINE_CAP_SQUARE or CAIRO_LINE_CAP_BUTT see http://www.cairographics.org/samples/set_line_cap/ - "xb" and "yb" are the coordinates of the bottom left point of the bar, or the center of the circle if radius>0 - "w" and "h" are the width and the height of a block (without caps), w has no effect for "circle" bar - "space" is the space betwwen two blocks, can be null or negative - "bgc" and "bga" are background colors and alpha when the block is not LIGHT OFF - "fgc" and "fga" are foreground colors and alpha when the block is not LIGHT ON - "alc" and "ala" are foreground colors and alpha when the block is not LIGHT ON and ALARM ON - "alarm" is the value where blocks LIGHT ON are in a different color (values from 0 to 100) - "led_effect" true or false : to show a block with a led effect - "led_alpha" alpha of the center of the led (values from 0 to 1) - "smooth" true or false : colors in the bar has a smooth effect - "mid_color",mid_alpha" : colors of the center of the bar (mid_color can to be set to nil) - "rotation" : angle of rotation of the bar (values are 0 to 360 degrees). 0 = vertical bar, 90 = horizontal bar - "radius" : draw the bar on a circle (it's no more a circle, radius = 0 to keep bars) - "angle_bar" : if radius>0 angle_bar is the angle of the bar v1.0 (10 Feb. 2010) original release v1.1 (13 Feb. 2010) numeric values can be passed instead conky stats with parameters name="", arg = numeric_value v1.2 (28 Feb. 2010) just renamed the widget to bargraph v1.3 (03 March 2010) added parameters radius & angle_bar to draw the bar in a circular way ]] function equalizer(cr, name, arg, max, nb_blocks, cap, xb, yb, w, h, space, bgc, bga, fgc, fga,alc,ala,alarm,led_effect,led_alpha,smooth,mid_color,mid_alpha,rotation, radius, angle_bar) local function rgb_to_r_g_b(colour, alpha) return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha end local function setup_equalizer() local value = 0 if name ~="" then local str = conky_parse(string.format('${%s %s}', name, arg)) value = tonumber(str) else value = arg end if value==nil then value =0 end --if value <= 25 then max = 50 --elseif value <= 50 then max = 100 end local pct = 100*value/max local pcb = 100/nb_blocks cairo_set_line_width (cr, h) cairo_set_line_cap (cr, cap) local angle_rot= rotation*math.pi/180 local alpha_bar = (angle_bar*math.pi/180)/2 for pt = 1,nb_blocks do local light_on=false --set colors local col,alpha = bgc,bga if pct>=(100/nb_blocks/2) then --start after an half bloc if pct>=(pcb*(pt-1)) then light_on=true col,alpha = fgc,fga if pct>=alarm and (pcb*pt)>alarm then col,alpha = alc,ala end end end --vertical points local x1=xb local y1=yb-pt*(h+space) local radius0 = yb-y1 local x2=xb+radius0*math.sin(angle_rot) local y2=yb-radius0*math.cos(angle_rot) --line on angle_rot local a1=(y2-yb)/(x2-xb) local b1=y2-a1*x2 --line perpendicular to angle_rot local a2=-1/a1 local b2=y2-a2*x2 --dots on perpendicular local xx0,xx1,yy0,yy1=0,0,0,0 if rotation == 90 or rotation == 270 then xx0,xx1=x2,x2 yy0=yb yy1=yb+w else xx0,xx1=x2,x2+w*math.cos(angle_rot) yy0=xx0*a2+b2 yy1=xx1*a2+b2 end local xc,yc --perpendicular segment if alpha_bar == 0 then cairo_move_to (cr, xx0 ,yy0) cairo_line_to (cr, xx1 ,yy1) xc,yc=(xx0+xx1)/2,(yy0+yy1)/2 else cairo_arc( cr, xb, yb, radius+(h+space)*(pt)-h/2, ( -alpha_bar -math.pi/2+angle_rot) , ( alpha_bar -math.pi/2+angle_rot) ) xc=xb+ (radius+(h+space)*(pt))*math.sin(angle_rot) yc=yb- (radius+(h+space)*(pt))*math.cos(angle_rot) end --colors if light_on and led_effect then local pat = cairo_pattern_create_radial (xc, yc, 0, xc,yc,w/1.5) cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col,led_alpha)) cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col,alpha)) cairo_set_source (cr, pat) cairo_pattern_destroy(pat) else cairo_set_source_rgba(cr, rgb_to_r_g_b(col,alpha)) end if light_on and smooth then local radius = (nb_blocks+1)*(h+space) if pt==1 then xc0,yc0=xc,yc --remember the center of first block end cairo_move_to(cr,xc0,yc0) local pat = cairo_pattern_create_radial (xc0, yc0, 0, xc0,yc0,radius) cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(fgc,fga)) cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(alc,ala)) if mid_color ~=nil then cairo_pattern_add_color_stop_rgba (pat, 0.5,rgb_to_r_g_b(mid_color,mid_alpha)) end cairo_set_source (cr, pat) cairo_pattern_destroy(pat) end cairo_stroke (cr); end end --prevent segmentatioon error local updates=tonumber(conky_parse('${updates}')) if updates> 3 then setup_equalizer() end end -- ------------------------------------------------------------------------------------ --[[ TEXT WIDGET ]] function addzero100(num) if tonumber(num) == nil then return end --tonumber(num) == 0 end 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_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_rotate (cr, -interval2-(180*math.pi/180)) end end function conky_draw_text() local updates=conky_parse('${updates}') update_num=tonumber(updates) --circlewriting variable --circlewritingdown variables --circlewritingdown variable down=tonumber(conky_parse('${downspeedf wlp2s0}')) --text must be in quotes text=("Entrant. " .. down .. "") --font name must be in quotes font="URW Chancery L" fontsize=14 radius=77 positionx=140 positiony=160 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=255 finish=190 letterposition=0.06 circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition) --circlewriting variables up=tonumber(conky_parse('${upspeedf wlp2s0}')) --text must be in quotes text=("Sortant. " .. up .. "") --font name must be in quotes font="URW Chancery L" fontsize=14 radius=77 positionx=140 positiony=160 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=170 finish=110 letterposition=0 circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition) -- end end --[[ END TEXT WIDGET ]] -- ------------------------------------------------------------------------------------- function conky_widgets() 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) -- ------------------------------------------------------------------------------------- --function equalizer(name, arg, max, nb_blocks, cap, xb, yb, w, h, space, bgc, bga, fgc, fga, alc, ala, alarm, led_effect, led_alpha, smooth, mid_color, mid_alpha, rotation, radius, angle_bar) cr = cairo_create(cs) if var == nil then var = 0 end var = var + 1 angle = var equalizer(cr, 'swapperc', '', 100, 50, CAIRO_LINE_CAP_BUTT, 140, 160, 100, 1, 1, 0x00cc66, 0, 0x6495ee, 1, 0xffffff, 1, 80, true, 1, true, 0x6495ee, 1.0, 270, 10, 20) equalizer(cr, 'fs_used_perc', '/home', 100, 50, CAIRO_LINE_CAP_SQUARE, 140, 160, 100, 1, 1, 0x00cc66, 0, 0x6495ee, 1, 0xffffff, 1, 80, true, 1, true, 0x6495ee, 1.0, 90, 10, 20) equalizer(cr, 'downspeedf', 'wlp2s0', 380, 50, CAIRO_LINE_CAP_SQUARE, 140, 160, 100, 1, 1, 0x00cc66, 0, 0x6495ee, 1, 0xffffff, 1, 80, true, 1, true, 0x6495ee, 1.0, 220, 10, 75) equalizer(cr, 'upspeedf', 'wlp2s0', 100, 50, CAIRO_LINE_CAP_SQUARE, 140, 160, 100, 1, 1, 0x00cc66, 0, 0x6495ee, 1, 0xffffff, 1, 80, true, 1, true, 0x6495ee, 1.0, 140, 10, 75) cairo_destroy(cr) --[[ Вывод часов ]] cr = cairo_create(cs) clock(cr, 30, 50, 220, 0xffffff, 1, 0xFFFfff, 1) cairo_destroy(cr) --[[ Вывод текста по кругу, настройке в скрипте ]] cr = cairo_create(cs) conky_draw_text() cairo_destroy(cr) end

.gif)
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
loutch
Membre non connecté

.gif)
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
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/$/\n\n/' $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

.gif)
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
loutch
Membre non connecté

.gif)
Dernière mise à jour pour le conky accuweather avec 3 thèmes différents.
Ne pas oublier de changer l'adresse dans le script 1_accuweather ainsi que d'installer les polices .
le pack est ici
https://drive.google.com/file/d/0Bygxc3zi7pV-c0xHTlpnbF92cFU/view?usp=sharing
et cela donne ceci:

.gif)
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
Bonjour loutch,
Quand je lance conkyrcweather, je n'ai pas l'affichage des cadres du conky et un message d'erreur défile en boucle :
Où faut-il mettre les images pour qu'elles soient prises en compte ? Par contre le reste de l'affichage est bon, après installation des polices météo et vent.
Pascal
Quand je lance conkyrcweather, je n'ai pas l'affichage des cadres du conky et un message d'erreur défile en boucle :
Code TEXT :
Conky: llua_do_call: function conky_fDrawImage execution failed: attempt to call a nil value
Où faut-il mettre les images pour qu'elles soient prises en compte ? Par contre le reste de l'affichage est bon, après installation des polices météo et vent.
Pascal
loutch
Membre non connecté

Merci, ça fonctionne maintenant. J'en ai profité pour modifier le conky, en ne gardant que la partie météo et en faisant en sorte que l'aspect corresponde à ceux que j'utilise déjà. Voici ce que ça donne sous Mageia 6 (je précise que j'ai dû désinstaller la version 1.10 fournie par Mageia 6 et réinstaller la 1.9 de Mageia 5, car la première casse la configuration des anciens conky, malgré les tentatives de mise à jour des fichiers de configuration) :

Pascal

Pascal
loutch
Membre non connecté

.gif)
conky-clic aucacious
le conkyrc :
Code TEXT :
# -- Conky settings -- # background no update_interval 0.5 cpu_avg_samples 2 net_avg_samples 2 override_utf8_locale yes double_buffer yes no_buffers yes text_buffer_size 1024 imlib_cache_size 15000 max_specials 10000 max_user_text 15000 diskio_avg_samples 2 format_human_readable yes border_inner_margin 0 border_outer_margin 0 # -- Window specifications -- # own_window yes own_window_type normal own_window_transparent no own_window_argb_visual yes own_window_argb_value 0 own_window_hints undecorate,skip_taskbar,skip_pager,below own_window_title media minimum_size 412 106 maximum_width 412 alignment top_right gap_x 00 gap_y 775 # -- Graphics settings -- # draw_shades no draw_outline no draw_borders no draw_graph_borders no border_width 0 default_bar_size 216 2 # -- Text settings -- # use_xft yes xftfont GE Inspira:size=8 color1 92deee color2 668c95 color3 d0fefb color4 2f3d40 color5 ff6c4a lua_load ~/.conky/audacious/scripts/button_script.lua lua_draw_hook_pre get_mouse {"media","/tmp/xdo"} lua_startup_hook start_xdo /tmp/xdo #lua_shutdown_hook stop_xdo lua_load ~/.conky/audacious/scripts/lua_functions.lua lua_load ~/.conky/lua/image.lua template1 ${lua rc_button {btype=3,bname="button1",blx_off=115,bly_off=76,bw_off=12,bh_off=12}} template2 ${lua rc_button {btype=3,bname="button2",blx_off=115,bly_off=46,bw_off=12,bh_off=12}} template3 ${lua rc_button {btype=3,bname="button3",blx_off=100,bly_off=55,bw_off=12,bh_off=12}} template4 ${lua rc_button {btype=3,bname="button4",blx_off=115,bly_off=55,bw_off=12,bh_off=12}} template5 ${lua rc_button {btype=3,bname="button5",blx_off=130,bly_off=55,bw_off=12,bh_off=12}} TEXT ${execi 5 ~/.conky/audacious/scripts/cover.sh} ${lua fDrawImage ~/.conky/audacious/audacious.png 24 14 68 70}${lua fDrawImage ~/.conky/audacious/case.png 0 0 410 108}${voffset -20} ${goto 160}${execi 3 audtool current-song-tuple-data artist} ${goto 160}${execi 3 audtool current-song-tuple-data title} ${goto 160}${execi 3 audtool current-song-tuple-data album} ${goto 160}${execi 1 audtool current-song-output-length} ${goto 358}${execi 1 audtool current-song-length} ${goto 160}${color ff6c4a}${execbar expr 100 * $(audtool --current-song-output-length-seconds) / $(audtool --current-song-length-seconds)}$color ${goto 160}${color 777777}${execbar echo 0} ${if_match ${template1}==0} ${else}${lua fDrawImage ~/.conky/audacious/images/Orange.png 360 5 35 35}${exec audacious --pause} ${endif} ${if_match ${template2}==0} ${else}${lua fDrawImage ~/.conky/audacious/images/Orange.png 360 5 35 35}${exec audacious --stop} ${endif} ${if_match ${template3}==0} ${else}${lua fDrawImage ~/.conky/audacious/images/Orange.png 360 5 35 35}${exec audacious --rew} ${endif} ${if_match ${template4}==0} ${else}${lua fDrawImage ~/.conky/audacious/images/Orange.png 360 5 35 35}${exec audacious --play} ${endif} ${if_match ${template5}==0} ${else}${lua fDrawImage ~/.conky/audacious/images/Orange.png 360 5 35 35}${exec audacious --fwd} ${endif} ${lua fDrawImage ~/.conky/audacious/pause.png 115 59 13 13} ${lua fDrawImage ~/.conky/audacious/stop.png 115 31 13 13} ${lua fDrawImage ~/.conky/audacious/rew.png 100 45 13 13} ${lua fDrawImage ~/.conky/audacious/play.png 115 45 13 13} ${lua fDrawImage ~/.conky/audacious/fwd.png 130 45 13 13} ${voffset -250}

le pack ici pour les png.
https://drive.google.com/open?id=0Bygxc3zi7pV-U3lGaUZ1U05DRUU
vidéo ici:
https://drive.google.com/open?id=0Bygxc3zi7pV-VXJWQ1hVYUJYa0U
.gif)
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
jlfh0816
Membre non connecté

Bonjour Loutch,
Je suis admiratif de voir ton conky cliquable audacious. Un sacré beau travail et en plus très esthétique.
J'essaie également de mon côté de faire un conky interactif (un gif animé cliquable) mais autant ça fonctionnait très bien sous Xubuntu 14.04 / Conky 1.9, autant maintenant avec Xubuntu 16.04 / conky 1.10 c'est la cata, les scripts lua (gif.lua et Click.lua de mrpeachy et de Didier-T) ne fonctionnent plus.
Bon, j'essaie de contourner les difficultés en n'utilisant plus de scripts lua mais ce n'est pas gagné.
Pour la partie affichage d'un gif animé, ça peut aller, j'ai pour cela remis au goût du jour un ancien post de Pieter Blinkellshell (utilisant gifsicle) et le modeste conky que j'ai bidouillé fait bien son travail : le gif animé s'affiche correctement.
Par contre, pour la partie clic, je coince .. Le mouse-click de xdotool ne fonctionne plus.
Je peux certes faire fonctionner mouse-enter mais ce n'est pas vraiment un clic, c'est un simple survol du conky. Mais comme pour l'instant, c'est la seule façon que j'ai trouvée de rendre le conky interactif, c'est mieux que rien.
Et dire que sous Xubuntu 14.04 / Conky 1.9, mouse-click fonctionnait très bien, c'est vraiment rageant ... J'espère qu'il ne va pas falloir attendre la sortie de la version 2 de Conky ... ça risque d'être long !
Donc, ma question est la suivante : aurais-tu la gentillesse de me dire si tu as réussi à faire fonctionner ton conky audacious cliquable avec la version 1.10 de Conky ? Ou est-ce sans espoir ?
Merci beaucoup d'avance de ta réponse !
Je suis admiratif de voir ton conky cliquable audacious. Un sacré beau travail et en plus très esthétique.
J'essaie également de mon côté de faire un conky interactif (un gif animé cliquable) mais autant ça fonctionnait très bien sous Xubuntu 14.04 / Conky 1.9, autant maintenant avec Xubuntu 16.04 / conky 1.10 c'est la cata, les scripts lua (gif.lua et Click.lua de mrpeachy et de Didier-T) ne fonctionnent plus.
Bon, j'essaie de contourner les difficultés en n'utilisant plus de scripts lua mais ce n'est pas gagné.
Pour la partie affichage d'un gif animé, ça peut aller, j'ai pour cela remis au goût du jour un ancien post de Pieter Blinkellshell (utilisant gifsicle) et le modeste conky que j'ai bidouillé fait bien son travail : le gif animé s'affiche correctement.
Par contre, pour la partie clic, je coince .. Le mouse-click de xdotool ne fonctionne plus.
Je peux certes faire fonctionner mouse-enter mais ce n'est pas vraiment un clic, c'est un simple survol du conky. Mais comme pour l'instant, c'est la seule façon que j'ai trouvée de rendre le conky interactif, c'est mieux que rien.
Et dire que sous Xubuntu 14.04 / Conky 1.9, mouse-click fonctionnait très bien, c'est vraiment rageant ... J'espère qu'il ne va pas falloir attendre la sortie de la version 2 de Conky ... ça risque d'être long !

Donc, ma question est la suivante : aurais-tu la gentillesse de me dire si tu as réussi à faire fonctionner ton conky audacious cliquable avec la version 1.10 de Conky ? Ou est-ce sans espoir ?
Merci beaucoup d'avance de ta réponse !

Xubuntu 14.04.5 LTS (64 bits) et Xubuntu 16.04.1 LTS (64 bits)
loutch
Membre non connecté

.gif)
Code TEXT :
Donc, ma question est la suivante : aurais-tu la gentillesse de me dire si tu as réussi à faire fonctionner ton conky audacious cliquable avec la version 1.10 de Conky ? Ou est-ce sans espoir ?
Désolé mais je ne peux te répondre car je n'ais que la version 1.9 de conky .Mais demande à "funix " si son conky est bien cliquable .Il est sur le chaudron en XFCE et avec conky en version 1.10
Image

le post est ici
https://www.mageialinux-online.org/forum/topic-23075+passage-a-xfce.php
.gif)
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
jlfh0816
Membre non connecté

loutch
Membre non connecté

.gif)
Conky Harmattan @ la sauce Loutch
le conkyrc:
Code TEXT :
# Use Xft? use_xft yes xftfont GE Inspira:size=10 xftalpha 0.8 text_buffer_size 2048 uppercase no # Update interval in seconds update_interval 1 # This is the number of times Conky will update before quitting. # Set to zero to run forever. total_run_times 0 # Create own window instead of using desktop (required in nautilus) own_window yes own_window_transparent yes own_window_type normal own_window_hints undecorated,below,skip_taskbar,skip_pager #own_window_argb_visual yes #own_window_argb_value 255 # Use double buffering (reduces flicker, may not work for everyone) double_buffer yes minimum_size 282 # Draw shades? draw_shades no default_shade_color 292421 # Draw outlines? draw_outline no # Draw borders around text draw_borders no # Stippled borders? stippled_borders 0 # border margins #border_inner_margin 30 #border_outer_margin 0 draw_graph_borders no # border width border_width 0 # Text alignment, other possible values are commented #alignment top_left alignment top_right #alignment bottom_left #alignment bottom_right # Gap between borders of screen and text # same thing as passing -x at command line gap_x 40 gap_y 140 # Open Sans Light fonts # Droid Sans imlib_cache_size 0 color1 323232 color2 323232 color3 000000 color4 6b6b6b color5 6db9d5 color6 000000 color7 000000 TEXT ${image ~/.conky/conkyeos/icons/background.png -p 0,0 -s 287x600}${image ~/.conky/conkyeos/icons/box.png -p 10,208 -s 267x64}${execi 600 bash $HOME/1_accuweather/1_accuweather -f2016 -h2016} ${voffset -20}${color1}${alignc}[${time %A,}${time %H:%M:%S}]${image ~/.conky/conkyeos/icons/fav-color.png -p 1,20 -s 285x185} ${alignc 60}${font Relaway:size=30}${time %d %B %Y}$font ${image ~/1_accuweather/forecast_2016/forecast_0.png -p 20,52 -s 80x80} ${voffset 12}${color1}${font GE Inspira:size=42}${alignr 10}${execi 90 sed -n '2p' $HOME/1_accuweather/curr_cond}°${font} ${color1}${alignc}${execi 90 sed -n '4p' $HOME/1_accuweather/curr_cond} ${image ~/.conky/conkyeos/icons/wind.png -p 10,136 -s 16x16}${alignc}${color1}${execi 90 sed -n '5p' $HOME/1_accuweather/curr_cond} à ${execi 90 sed -n '6p' $HOME/1_accuweather/curr_cond}${color5} ${image ~/.conky/conkyeos/icons/humidity.png -p 10,146 -s 16x16}${color1}${alignc}${execi 90 sed -n '7p' $HOME/1_accuweather/curr_cond} ${image ~/.conky/conkyeos/icons/pressure.png -p 10,160 -s 16x16}${color1}${alignc}${execi 90 sed -n '8p' $HOME/1_accuweather/curr_cond} ${image ~/.conky/conkyeos/icons/sunrise.png -p 10,174 -s 16x16}${color1}${goto 80}De ${execi 90 sed -n '14p' $HOME/1_accuweather/curr_cond} à ${execi 90 sed -n '15p' $HOME/1_accuweather/curr_cond} durée ${execi 90 sed -n '16p' $HOME/1_accuweather/curr_cond} ${image ~/.conky/conkyeos/icons/sunset.png -p 10,188 -s 16x16}${color1} ${goto 80}De ${execi 90 sed -n '18p' $HOME/1_accuweather/curr_cond} à ${execi 90 sed -n '19p' $HOME/1_accuweather/curr_cond} durée ${execi 90 sed -n '20p' $HOME/1_accuweather/curr_cond}${voffset 4} ${color1}${voffset 4}${goto 20}${execi 90 sed -n '8p' $HOME/1_accuweather/first_days}° ${goto 120}${execi 90 sed -n '13p' $HOME/1_accuweather/first_days}° ${goto 220}${execi 90 sed -n '18p' $HOME/1_accuweather/first_days}° ${image ~/1_accuweather/forecast_2016/forecast_2.png -p 20,228 -s 35x35} ${image ~/1_accuweather/forecast_2016/forecast_3.png -p 120,228 -s 35x35} ${image ~/1_accuweather/forecast_2016/forecast_4.png -p 220,228 -s 35x35} ${voffset -4}${color4}${goto 60}${execi 90 sed -n '9p' $HOME/1_accuweather/first_days}° ${goto 160}${execi 90 sed -n '14p' $HOME/1_accuweather/first_days}°${goto 260}${execi 90 sed -n '19p' $HOME/1_accuweather/first_days}° ${goto 30}${color1}${execi 3600 echo `date --date="1 day" | awk '{print $1}' | cut -c1-3`}${goto 130}${execi 3600 echo `date --date="2 day" | awk '{print $1}' | cut -c1-3`} ${goto 230}${execi 3600 echo `date --date="3 day" | awk '{print $1}' | cut -c1-3`} ${image ~/.conky/conkyeos/icons/bg-3.png -p 1,286 -s 285x2} ${if_existing /proc/net/route wlp2s0}${image ~/.conky/conkyeos/icons/online.png -p 120,295 -s 43x18}${else}${image ~/.conky/conkyeos/icons/offline.png -p 120,295 -s 43x18}${endif} ${voffset -12}${font Droid Sans:pixelsize=9}${goto 14}${color1}Signal: ${wireless_link_qual_perc wlp2s0} % ${goto 14}${color1}Sortant:${color3} ${upspeed wlp2s0}${color1}${alignr}${goto 190}${color1}Entrant: ${color3}${downspeed wlp2s0}${color1} ${goto 14}${upspeedgraph wlp2s0 50,120 6db9d5 6db9d5}${alignr}${goto 160}${downspeedgraph wlp2s0 50,120 6db9d5 6db9d5} ${goto 14}${color1}Envoyé:${color1} ${color2}${totalup wlp2s0}${color1}${alignr}${goto 190}${color1}Reçu:${color1} ${color2}${totaldown wlp2s0}${color}1 ${image ~/.conky/conkyeos/icons/bg-3.png -p 1,392 -s 285x2} ${goto 14}${color5}${font Droid Sans:pixelsize=9}CPU 1: ${color1}${alignc}${freq_g 0} ${color1}Ghz ${color2}${alignr}${goto 254}${cpu cpu0}${color1}% ${goto 14}${color5}${font Droid Sans:pixelsize=9}CPU 2: ${color1}${alignc}${freq_g 1} ${color1}Ghz ${color2}${alignr}${goto 254}${cpu cpu1}${color1}% ${goto 14}${color5}${font Droid Sans:pixelsize=9}CPU 3: ${color1}${alignc}${freq_g 2} ${color1}Ghz ${color2}${alignr}${goto 254}${cpu cpu2}${color1}% ${goto 14}${color5}${font Droid Sans:pixelsize=9}CPU 4: ${color1}${alignc}${freq_g 3} ${color1}Ghz ${color2}${alignr}${goto 254}${cpu cpu3}${color1}% ${goto 14}${color5}Températures : ${color1} CPU ${exec expr `cat /sys/class/hwmon/hwmon2/temp1_input` / 1000}°C Carte: ${hwmon 0 temp 1} °C Disque${execi 120 hddtemp -n /dev/sda} °C ${goto 14}${alignr}${goto 14}${loadgraph 50,266 6db9d5 6db9d5 -l} ${goto 14}${color5}${font Droid Sans:pixelsize=9}RAM: ${color1}${alignc 10}${mem} ${goto 14}${color5}${font Droid Sans:pixelsize=9}TOTAL: ${color1}${alignc 10}${memmax} ${image ~/.conky/conkyeos/icons/bg-3.png -p 1,532 -s 285x2} ${goto 14}${color1}${font Droid Sans:pixelsize=9}${color5}${top_mem name 1}${color1}${alignc -10}${top_mem mem_res 1}${color2}${alignr}${goto 234}${top_mem mem 1}${color1} % ${goto 14}${color1}${font Droid Sans:pixelsize=9}${color5}${top_mem name 2}${color1}${alignc -10}${top_mem mem_res 2}${color2}${alignr}${goto 234}${top_mem mem 2}${color1} % ${goto 14}${color1}${font Droid Sans:pixelsize=9}${color5}${top_mem name 3}${color1}${alignc -10}${top_mem mem_res 3}${color2}${alignr}${goto 234}${top_mem mem 3}${color1} % ${goto 14}${color1}${font Droid Sans:pixelsize=9}${color5}${top_mem name 4}${color1}${alignc -10}${top_mem mem_res 4}${color2}${alignr}${goto 234}${top_mem mem 4}${color1} % ${goto 14}${color1}${font Droid Sans:pixelsize=9}${color5}${top_mem name 5}${color1}${alignc -10}${top_mem mem_res 5}${color2}${alignr}${goto 234}${top_mem mem 5}${color1} %
ce qui donne ceci:

.gif)
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
loutch
Membre non connecté

.gif)
position du soleil et de la lune
conkyrc
Code TEXT :
background no use_xft yes xftfont URW Chancery L:style=Bold:size=10 xftalpha 1 update_interval 1 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 380 310 maximum_width 380 text_buffer_size 2048 draw_shades no draw_outline no draw_borders no border_width 1 draw_graph_borders no default_outline_color cacaca alignment top_right gap_x 5 gap_y 100 no_buffers yes uppercase no cpu_avg_samples 2 override_utf8_locale yes # color1 ffff00 lua_load ~/.conky/v11/conky/soleil.lua lua_draw_hook_pre draw_fig default_color 8b8b8b lua_load ~/.conky/lua/image.lua TEXT ${lua fDrawImage /home/loutch/.conky/v11/conky/terre.png 170 170 60 64 0}
soleil.lua
Code TEXT :
--sun position lua script by mrpeachy 2010 version 2 includes moon position --############################################################ --############################################################ --input latitude --for northern hemisphere enter positive --for southern hemisphere enter negative latitude=-49.1 longitude=7.06 --input hemisphere --for northern enter 1 --for southern enter 2 hemisphere=2 --daylight saving? 1=yes, 0=no dst=0 --position - this is the point where the N-S line crosses the horizon line --the .5 helps make lines look sharper across=200.5 down=200.5 --############################################################ --############################################################ require 'cairo' function cos(x) a=math.cos(math.rad(x)) return a end function sin(x) a=math.sin(math.rad(x)) return a end function tan(x) a=math.tan(math.rad(x)) return a end function addzero10(num) if tonumber(num) < 10 then return "0" .. num else return num end end function round(val, decimal) if (decimal) then return math.floor( (val * 10^decimal) + 0.5) / (10^decimal) else return math.floor(val+0.5) 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 datan2(y, x) if x == 0 and y == 0 then return 0 else a = math.atan(math.rad(y / x)) end if (x < 0) then a = a + 180 else if y < 0 and x > 0 then a = a + 360 end end return math.rad(a) end function ipart(x) if (x> 0) then a = math.floor(x) else a = math.ceil(x); end return a end function range(x) b = x / 360; a = 360 * (b - ipart(b)); if a < 0 then a = a + 360 end return a end function ranget(x) b = x / 24; a = 24 * (b - ipart(b)); if a < 0 then a = a + 24 end return a end function rangei(x) b = x / 1440; a = 1440 * (b - ipart(b)); if a < 0 then a = a + 1440 end return a end --################################################################################################################################################ --########### MAIN FUNCTION ######################################################################################################## --################################################################################################################################################ --################################################################################################################################################ function conky_draw_fig() if conky_window == nil then return end local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height) cr = cairo_create(cs) local updates=tonumber(conky_parse('${updates}')) --########### START FUNCTION ######################################################################################################## if updates > 5 then --########### SET HEMISPHERE ######################################################################################################## if hemisphere==1 then start=0 else start=180 end --################ sets daylignt saving #####################################3 if dst==1 then ds=-1 else ds=0 end --################################################################################################################################################ --################################################################################################################################################ --########### calculate julian time ######################################################################################################## --################################################################################################################################################ --################################################################################################################################################ M=os.date("%m") --month K=os.date("%G") --4 digit year I=(os.date("%d"))--day of month H=ranget((os.date("%H"))+ds) --hours Min=os.date("%M") Mi=(os.date("%M"))/60 --minutes expressed as hours --current Julian time----------------------------------------------------------------- JD=round((367*K)-((7*(K+((M+9)/12)))/4)+((275*M)/9)+I+1721013.5,0)+0.5+((H+Mi)/24) -------------------------------------------------------------------------------------- days=(JD)-2451545.0 --correct T=days/36525 --correct --Julian time at preceeding midnight JD0=round((367*K)-((7*(K+((M+9)/12)))/4)+((275*M)/9)+I+1721013.5,0)+0.5 D0=JD0-2451545.0 --########### calculate sidereal time ######################################################################################################## --current sidereal time CST=6.697374558+(0.06570982441908*D0)+(1.00273790935*(H+Mi)) ----------------------------------------------------------------- GMST = 6.697374558 + (0.06570982441908*D0) + (1.00273790935*(H+Mi)) + (0.000026*(T^2)) ADJ=longitude/15 GMST24=ranget(GMST) GMST24S=string.split(GMST24, "%p") GMST24H=GMST24S[1] GMST24M=string.len(GMST24S[2]) GMST24M=GMST24S[2]/(10^(GMST24M))*60 GMST24M=string.split(GMST24M,"%p") GMST24M=GMST24M[1] sgtime=(GMST24H*60)+GMST24M ------------------------------------------------------------- day=os.date("%j") B=(360/365)*(day-81) eot=(9.87*math.sin(2*B))-(7.53*math.cos(B))-(1.5*math.sin(B)) LSTM=15*10 TC=(4*(LSTM-longitude))+eot LT=((H)*60)+Min LST=LT+(TC/60) --------------------------------------- LST24=ranget(LST/60) LST24S=string.split(LST24, "%p") LST24H=LST24S[1] LST24M=string.len(LST24S[2]) LST24M=(LST24S[2]/(10^(LST24M)))*60 LST24M=string.split(LST24M,"%p") LST24M=LST24M[1] --below is current solar time stime=(LST24H*60)+LST24M --################################################################################################################################################ --############# END TIME CALCS ########################################################################################################### --################################################################################################################################################ --################################################################################################################################################ --############# SUN CACULATIONS AND DISPLAY ########################################################################################################### --################################################################################################################################################ --################################################################################################################################################ --################################################################################################################################################ -- Sun formulas -- -- L1 - Mean longitude -- M1 - Mean anomaly -- C1 - Equation of centre -- V1 - True anomaly -- Ec1 - Eccentricity -- R1 - Sun distance -- Th1 - Theta (true longitude) -- Om1 - Long Asc Node (Omega) -- Lam1- Lambda (apparent longitude) -- Obl - Obliquity of ecliptic -- Ra1 - Right Ascension -- Dec1- Declination t=T L1 = range(280.466 + 36000.8 * t) M1 = range(357.529+35999*t - 0.0001536* t*t + t*t*t/24490000) sinm1=math.sin(math.rad(M1)) C1 = (1.915 - 0.004817* t - 0.000014* t * t)* sinm1; C1 = C1 + (0.01999 - 0.000101 * t)* sinm1; C1 = C1 + 0.00029 * sinm1; V1 = M1 + C1; cosv1=math.cos(math.rad(V1)) Ec1 = 0.01671 - 0.00004204 * t - 0.0000001236 * t*t; R1 = 0.99972 / (1 + Ec1 * cosv1);--correct Th1 = L1 + C1 Om1 = range(125.04 - 1934.1 * t) om1sin=math.sin(math.rad(Om1)) Lam1 = Th1 - 0.00569 - 0.00478 * math.deg(om1sin); Obl = (84381.448 - 46.815 * t)/3600; --correct th1sin=math.sin(math.rad(Th1)) th1cos=math.cos(math.rad(Th1)) th1tan=math.tan(math.rad(Th1)) oblsin=math.sin(math.rad(Obl)) oblcos=math.cos(math.rad(Obl)) obltan=math.tan(math.rad(Obl)) zsin=math.sin(math.rad(0)) zcos=math.cos(math.rad(0)) ztan=math.tan(math.rad(0)) Ra1 = datan2((th1sin * oblcos - ztan* zsin),th1cos)--close ish Dec1 = math.asin(zsin* oblcos + zcos*oblsin*th1sin)--very close --SUN CALCULATIONS--------------------------------------------------------------- ------------------------------------------------------- delta=math.deg(Dec1) ------------------------------------------------------ sdec=delta --calculate hangle in relation to altitude in relation to time althrtab={} shartab={} total=1440 for i=1,total do sha=180+(i*(360/total)) cossha=math.cos(math.rad(sha)) cossundec=math.cos(math.rad(sdec)) coslat=math.cos(math.rad(latitude)) cosmath=cossha*cossundec*coslat sinsundec=math.sin(math.rad(sdec)) sinlat=math.sin(math.rad(latitude)) sinmath=sinsundec*sinlat sinelevation=cosmath+sinmath elevation=math.deg(math.asin(sinelevation)) curaltlong=elevation curalt=round(curaltlong,2) althrtab[i]=curalt shartab[i]=sha-360 end --############################################# --calculate sunrise and sunset for i=1,(total-1) do if althrtab[i]<0 and althrtab[i+1]>0 then rise=i end if althrtab[i]>0 and althrtab[i+1]<0 then set=i end end rise=rise/60 rises=string.split(rise,"%p") sriseh=rises[1] riseml=string.len(rises[2]) risem=(rises[2]/(10^riseml))*60 risems=string.split(risem,"%p") srisem=risems[1] set=set/60 sets=string.split(set,"%p") sseth=sets[1] setml=string.len(sets[2]) setm=(sets[2]/(10^setml))*60 setms=string.split(setm,"%p") ssetm=setms[1] --############################################# --calculate azimuth for all above points if hemisphere==1 then azitab={} for i=1,total do azmath1=(math.cos(math.rad(shartab[i]))*cossundec*sinlat)-(sinsundec*coslat) azmath2=math.cos(math.rad(althrtab[i])) cosaz=azmath1/azmath2 azi1=math.deg(math.acos(cosaz)) aziplot=azi1 if shartab[i]<0 then azitab[i]=(aziplot-180)*-1 else azitab[i]=aziplot+180 end end end--if hemishpere if hemisphere==2 then azitab={} for i=1,total do azmath1=(math.cos(math.rad(shartab[i]))*cossundec*sinlat)-(sinsundec*coslat) azmath2=math.cos(math.rad(althrtab[i])) cosaz=azmath1/azmath2 azi1=math.deg(math.acos(cosaz)) aziplot=azi1 if shartab[i]<0 then azitab[i]=(aziplot-360)*-1 else azitab[i]=aziplot--+180 end end end--if hemishpere ------------------------------------------------------------------------------ --diplay sun plot for i = 1,total do circrad=0.25 circx=across-180+azitab[i] circy=down-althrtab[i] cairo_arc(cr,circx,circy,circrad,0,2*math.pi) cairo_close_path(cr) cairo_set_source_rgba(cr,0.4,0.4,0.4,1) cairo_fill (cr) end --plot current sun position circrad=7 circx=across-180+azitab[stime] circy=down-althrtab[stime] cairo_arc(cr,circx,circy,circrad,0,2*math.pi) cairo_close_path(cr) cairo_set_source_rgba(cr,1,1,0,1) cairo_fill (cr) ------------------------------- --curerent sun alt and azi sunalt=althrtab[stime] sunazi=azitab[stime] -------------------------------------------- --############################################################################ --draw vertical N-S line cairo_set_line_width (cr, 1) cairo_set_source_rgba(cr,0.5,0.5,0.5,1) cairo_move_to (cr, across, down+100) cairo_line_to (cr, across, down-100) cairo_stroke (cr) --draw horizon cairo_move_to (cr, across-180, down) cairo_line_to (cr, across+180, down) cairo_stroke (cr) if hemisphere==1 then cairo_move_to (cr, across-4, down-102) cairo_show_text (cr, "S") cairo_move_to (cr, across-4, down+109) cairo_show_text (cr, "N") else cairo_move_to (cr, across-4, down-102) cairo_show_text (cr, "N") cairo_move_to (cr, across-4, down+109) cairo_show_text (cr, "S") cairo_stroke (cr) end --################################################################################################################################################ --################################################################################################################################################ --################################################################################################################################################ --################################################################################################################################################ --################################################################################################################################################ --############# MOON CACULATIONS AND DISPLAY ########################################################################################################### --################################################################################################################################################ --################################################################################################################################################ --################################################################################################################################################ --calculate moon data---------------------------------------------------------------- --moon stuff F = range(93.2721 + 483202 * t - 0.003403 * t* t - t * t * t/3526000); L2 = range(218.316 + 481268 * t); Om2 = range(125.045 - 1934.14 * t + 0.002071 * t * t + t * t * t/450000); M2 = range(134.963 + 477199 * t + 0.008997 * t * t + t * t * t/69700); cosm2=math.cos(math.rad(M2)) D = range(297.85 + 445267 * t - 0.00163 * t * t + t * t * t/545900); D2 = 2*D; cosd2m2=math.cos(math.rad(D2-M2)) cosd2=math.cos(math.rad(D2)) R2 = 1 + (-20954 * cosm2 - 3699 * cosd2m2 - 2956 * cosd2 / 385000); R3 = (R2 / R1) / 379.168831168831; sinf=math.sin(math.rad(F)) sinm2f=math.sin(math.rad(M2-F)) sind2f=math.sin(math.rad(D2-F)) Bm = 5.128 * sinf + 0.2806 * sinm2f; Bm = Bm + 0.2777 * sinm2f + 0.1732 * sind2f; sinm2=math.sin(math.rad(M2)) sind2m2=math.sin(math.rad(D2-M2)) sind2=math.sin(math.rad(D2)) Lm = 6.289 * sinm2 + 1.274 * sind2m2 + 0.6583 * sind2; sin2m2=math.sin(math.rad(2*M2)) sin2f=math.sin(math.rad(2*F)) Lm = Lm + 0.2136 * sin2m2 - 0.1851 * sinm1 - 0.1143 * sin2f; sind22m2=math.sin(math.rad(D2-(2*M2))) Lm = Lm +0.0588 * sind22m2 sind2m1m2=math.sin(math.rad(D2-M1-M2)) sind2m22=math.sin(math.rad(D2+M2)) Lm = Lm + 0.0572* sind2m1m2 + 0.0533* sind2m22; Lm = Lm + L2; tanbm=math.tan(math.rad(Bm)) sinbm=math.sin(math.rad(Bm)) cosbm=math.cos(math.rad(Bm)) sinlm=math.sin(math.rad(Lm)) coslm=math.cos(math.rad(Lm)) Ra2 = math.atan((sinlm * oblcos - tanbm* oblsin)); Dec2 = math.asin(sinbm* oblcos + cosbm*oblsin*sinlm); sinlam1lm=math.sin(math.rad(Lam1-Lm)) HLm = range(Lam1 + 180 + (180/math.pi) * R3 * cosbm * sinlam1lm); HBm = R3 * Bm; -------------------------------------------------------------------- --obliquity of ecliptic: eps = 23.0 + 26.0/60.0 + 21.448/3600.0 - (46.8150*T+ 0.00059*T*T- 0.001813*T*T*T)/3600; X = cos(Bm)*cos(Lm) Y = cos(eps)*cos(Bm)*sin(Lm) - sin(eps)*sin(Bm) Z = sin(eps)*cos(Bm)*sin(Lm) - cos(eps)*sin(Bm) R = math.sqrt(1.0-Z*Z); delta = (180/math.pi)*math.atan(Z/R); -- in degrees-- declination RA = (24/math.pi)*math.atan(Y/(X+R)); -- in hours ------------------------------------------------------- delta=math.deg(Dec2) ------------------------------------------------------ sdec=delta althrtab={} shartab={} total=1440 cossundec=math.cos(math.rad(sdec)) coslat=math.cos(math.rad(latitude)) sinlat=math.sin(math.rad(latitude)) sinsundec=math.sin(math.rad(sdec)) sinmath=sinsundec*sinlat for i=0,total do sha=180+(i*(360/total)) cossha=math.cos(math.rad(sha)) cosmath=cossha*cossundec*coslat sinelevation=cosmath+sinmath elevation=math.deg(math.asin(sinelevation)) curaltlong=elevation curalt=round(curaltlong,2) althrtab[i]=curalt shartab[i]=sha-360 end --############################################# --calculate moonrise and moonset for i=1,(total-1) do if althrtab[i]<0 and althrtab[i+1]>0 then rise=i end if althrtab[i]>0 and althrtab[i+1]<0 then set=i end end rise=rise/60 rises=string.split(rise,"%p") mriseh=rises[1] riseml=string.len(rises[2]) risem=(rises[2]/(10^riseml))*60 risems=string.split(risem,"%p") mrisem=risems[1] set=set/60 sets=string.split(set,"%p") mseth=sets[1] setml=string.len(sets[2]) setm=(sets[2]/(10^setml))*60 setms=string.split(setm,"%p") msetm=setms[1] --############################################# --calculate azimuth for all above points if hemisphere==1 then azitab={} for i=1,total do azmath1=(math.cos(math.rad(shartab[i]))*cossundec*sinlat)-(sinsundec*coslat) azmath2=math.cos(math.rad(althrtab[i])) cosaz=azmath1/azmath2 azi1=math.deg(math.acos(cosaz)) aziplot=azi1 if shartab[i]<0 then azitab[i]=(aziplot-180)*-1 else azitab[i]=aziplot+180 end end end--if hemishpere if hemisphere==2 then azitab={} for i=1,total do azmath1=(math.cos(math.rad(shartab[i]))*cossundec*sinlat)-(sinsundec*coslat) azmath2=math.cos(math.rad(althrtab[i])) cosaz=azmath1/azmath2 azi1=math.deg(math.acos(cosaz)) aziplot=azi1 if shartab[i]<0 then azitab[i]=(aziplot-360)*-1 else azitab[i]=aziplot end end end--if hemishpere ------------------------------------------------------------------------------ --diplay moon plot for i = 1,total do circrad=0.25 circx=across-180+azitab[i] circy=down-althrtab[i] cairo_arc(cr,circx,circy,circrad,0,2*math.pi) cairo_close_path(cr) cairo_set_source_rgba(cr,0.7,0.7,0.7,1) cairo_fill (cr) end --plot current moon position madj=tostring(rangei(sgtime+360)) mtime=madj circrad=5 circx=across-180+(azitab[tonumber(mtime)]) circy=down-(althrtab[tonumber(mtime)]) cairo_arc(cr,circx,circy,circrad,0,2*math.pi) cairo_close_path(cr) cairo_set_source_rgba(cr,1,1,1,1) cairo_fill (cr) ------------------------------- --curerent moon alt and azi moonalt=althrtab[tonumber(mtime)] moonazi=azitab[tonumber(mtime)] --------------------------------------------- --################################################################################################################################################ --################################################################################################################################################ --############# TEXT DISPLAYS ########################################################################################################### --################################################################################################################################################ --################################################################################################################################################ --################################################################################################################################################ --draws text label font="Mono" fontsize=10 cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_set_font_size (cr, fontsize); cairo_set_source_rgba (cr, 0.1, 0.1, 0.1, 0.5); --top left - sun moon alt and azi tlx=20 tly=20 adj=10 cairo_move_to (cr, tlx, tly) cairo_show_text (cr, "Positions") gap=10 add=fontsize+((fontsize/100)*adj)+gap cairo_move_to (cr, tlx, tly+add) cairo_show_text (cr, "Soleil") add=fontsize+((fontsize/100)*adj)+add cairo_move_to (cr, tlx, tly+add) cairo_show_text (cr, "Azimut " .. round(sunazi,2) .. "°") add=fontsize+((fontsize/100)*adj)+add cairo_move_to (cr, tlx, tly+add) cairo_show_text (cr, "Altitude " .. sunalt .. "°") gap=10 add=fontsize+((fontsize/100)*adj)+add+gap cairo_move_to (cr, tlx, tly+add) cairo_show_text (cr, "Lune") add=fontsize+((fontsize/100)*adj)+add cairo_move_to (cr, tlx, tly+add) cairo_show_text (cr, "Azimut " .. round(moonazi,2) .. "°") add=fontsize+((fontsize/100)*adj)+add cairo_move_to (cr, tlx, tly+add) cairo_show_text (cr, "Altitude " .. moonalt .. "°") tlx=180 tly=20 adj=10 cairo_move_to (cr, tlx, tly) cairo_show_text (cr, "Heure") gap=10 add=fontsize+((fontsize/100)*adj)+gap cairo_move_to (cr, tlx, tly+add) cairo_show_text (cr, "Heure Locale: " .. H .. ":" .. Min) add=fontsize+((fontsize/100)*adj)+add cairo_move_to (cr, tlx, tly+add) cairo_show_text (cr, "Heure Sidérale: " .. GMST24H .. ":" .. GMST24M ) add=fontsize+((fontsize/100)*adj)+add cairo_move_to (cr, tlx, tly+add) cairo_show_text (cr, "Heure Solaire : " .. LST24H .. ":" .. LST24M) cairo_stroke (cr) --####################################################################### --########################################################################################### --########################################################################################### --########################################################################################### --########################################################################################### end-- end if updates = end--end main function

.gif)
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
loutch
Membre non connecté

.gif)
Un autre conky cliquable pour audacious tirer d'un skin covergloobus sur deviantart
le conkyrc
Code :
# -- Conky settings -- #
background no
update_interval 0.5
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
double_buffer yes
no_buffers yes
text_buffer_size 1024
imlib_cache_size 15000
max_specials 10000
max_user_text 15000
diskio_avg_samples 2
format_human_readable yes
border_inner_margin 0
border_outer_margin 0
# -- Window specifications -- #
own_window yes
own_window_type normal
own_window_transparent no
own_window_argb_visual yes
own_window_argb_value 0
own_window_hints undecorate,skip_taskbar,skip_pager,below
own_window_title media
minimum_size 412 176
maximum_width 412
alignment top_right
gap_x 40
gap_y 820
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders yes
draw_graph_borders no
border_width 0
default_bar_size 210 4
default_color 000000
# -- Text settings -- #
use_xft yes
xftfont GE Inspira:size=8
color1 92deee
color2 668c95
color3 d0fefb
color4 2f3d40
color5 ff6c4a
lua_load ~/.conky/audacious/scripts/button_script.lua
lua_draw_hook_pre get_mouse {"media","/tmp/xdo"}
lua_startup_hook start_xdo /tmp/xdo
#lua_shutdown_hook stop_xdo
lua_load ~/.conky/audacious/scripts/lua_functions.lua
lua_load ~/.conky/lua/image.lua
template1 ${lua rc_button {btype=3,bname="button1",blx_off=278,bly_off=75,bw_off=22,bh_off=12}}
template2 ${lua rc_button {btype=3,bname="button2",blx_off=216,bly_off=75,bw_off=22,bh_off=12}}
template3 ${lua rc_button {btype=3,bname="button3",blx_off=185,bly_off=75,bw_off=22,bh_off=12}}
template4 ${lua rc_button {btype=3,bname="button4",blx_off=247,bly_off=75,bw_off=22,bh_off=12}}
template5 ${lua rc_button {btype=3,bname="button5",blx_off=309,bly_off=75,bw_off=22,bh_off=12}}
TEXT
${execi 3 ~/.conky/audacious/scripts/cover.sh}
${lua fDrawImage ~/.conky/audacious/casee.png 0 0 410 138}${lua fDrawImage ~/.conky/audacious/audacious.png 40 32 70 70}${lua fDrawImage ~/.conky/audacious/album.png 28 20 93 92}${voffset -30}${font GE Inspira :size=14}
${alignc -50}${execi 3 audtool current-song-tuple-data artist}${font}
${alignc -50}${execi 3 audtool current-song-tuple-data title}
${alignc -50}${execi 3 audtool current-song-tuple-data album}
${goto 160}${execi 1 audtool current-song-output-length} ${goto 348}${execi 1 audtool current-song-length}
${voffset 10}${goto 160}${color 000000}${execbar expr 100 \* $(audtool --current-song-output-length-seconds) \/ $(audtool --current-song-length-seconds)}$color\
${goto 160}${color ffffff}${execbar echo 0}
${if_match ${template1}==0}
${else}${lua fDrawImage ~/.conky/audacious/images/Orange.png 360 5 35 35}${exec audacious --pause}
${endif}
${if_match ${template2}==0}
${else}${lua fDrawImage ~/.conky/audacious/images/Orange.png 360 5 35 35}${exec audacious --stop}
${endif}
${if_match ${template3}==0}
${else}${lua fDrawImage ~/.conky/audacious/images/Orange.png 360 5 35 35}${exec audacious --rew}
${endif}
${if_match ${template4}==0}
${else}${lua fDrawImage ~/.conky/audacious/images/Orange.png 360 5 35 35}${exec audacious --play}
${endif}
${if_match ${template5}==0}
${else}${lua fDrawImage ~/.conky/audacious/images/Orange.png 360 5 35 35}${exec audacious --fwd}
${endif}
${lua fDrawImage ~/.conky/audacious/ppause.png 278 65 30 15}
${lua fDrawImage ~/.conky/audacious/pstop.png 216 65 30 15}
${lua fDrawImage ~/.conky/audacious/pprev.png 185 65 30 15}
${lua fDrawImage ~/.conky/audacious/pplay.png 247 65 30 15}
${lua fDrawImage ~/.conky/audacious/pnext.png 309 65 30 15}
${voffset -350}

.gif)
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
loutch
Membre non connecté

.gif)
conky olgmen
le conkyrc
Code :
background no
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 100 640
maximum_width 100
text_buffer_size 1024
draw_shades no
draw_outline no
draw_borders no
border_width 1
draw_graph_borders no
default_color ffffff
default_outline_color cacaca
alignment top_left
gap_x 0
gap_y 100
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
#
color1 ffff00
#
color2 6495ee
#
color3 ffffff
#
color4 ffffff
#
color5 6495ee
#
color6 red
#cornflowerblue
# — Lua Load — #
lua_load ~/.conky/olgmen/scripts/data_comp.lua
lua_draw_hook_pre conky_widgets
TEXT
le lua principal
Code :
--[[data_comp.lua par olgmen le 25/12/2011
Francisation par loutch
fonction affiche des données sur le fonctionnement du processeur, de la mémoire, de l'Internet
pour exécuter cette fonction, il est nécessaire dans conkyrc, au-dessus du mot TEXT ajouter les lignes suivantes
# - Lua Load - #
lua_load ~ / scripts / data_comp.lua
lua_draw_hook_pre conky_widgets
Toutes les données sont calculées pour une utilisation dans la fenêtre conky avec la taille de 1260x675 (dans tout mon écran)
]]
require "cairo"
-- définir la section d'accueil, pour la capacité de travailler à partir de n'importe quel ordinateur
usrhome = os.getenv("HOME")
-- les scripts nécessaires sont dans le dossier des scripts
--dofile (usrhome .."/scripts/backgraund.lua") -- arrière-plan de sortie de script, cadres
dofile (usrhome .."/.conky/olgmen/scripts/text1.lua") -- script sorties textes
dofile (usrhome .."/.conky/olgmen/scripts/scale1.lua") -- sorties de script échelles
text_color = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}}
-- fonction qui démarre tout affiché dans la fenêtre conky. Toutes les données sont calculées pour une utilisation dans la fenêtre conky avec la taille de 1260x675 (dans tout mon écran)
function conky_widgets()
text_settings = {
{
text ="Processeurs" ,
x = 20,
y = 10,
font_size = 12,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="CPU1" .. " " .. "°C",
x = 15,
y = 25,
font_size = 9,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="CPU2" .. " " .. "°C",
x = 15,
y = 100,
font_size = 9,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="Mémoire" ,
x = 30,
y = 175,
font_size = 12,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="Ram" .." ".."Swap" ,
x = 15,
y = 190,
font_size = 9,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="Disques" ,
x = 36,
y = 275,
font_size = 12,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="/" .." ".."/Home" ,
x = 25,
y = 290,
font_size = 9,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="Températures" ,
x = 16,
y = 375,
font_size = 12,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="Sda" .." ".."Carte" ,
x = 15,
y = 390,
font_size = 9,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="Internet" ,
x = 36,
y = 475,
font_size = 12,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = "Entrant" .. " " .. "Sortant",
x = 15,
y = 490,
font_size = 9,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = conky_parse("${totaldown wlp2s0}"),
x = 10,
y = 565,
font_size = 8,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = conky_parse("${totalup wlp2s0}"),
x = 70,
y = 565,
font_size = 8,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="Processus" .. " " .. "Mém" .. " " .. "Cpu",
x = 10,
y = 585,
font_size = 9,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = conky_parse("${top name 1}"),
x = 5,
y = 600,
font_size = 7,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = conky_parse("${top mem 1)}%"),
x = 65,
y = 600,
font_size = 7,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x550000, 1},{0.5, 0xff0000, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top cpu 1}%"),
x = 95,
y = 600,
font_size = 7,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x550000, 1},{0.5, 0xff0000, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top name 2}"),
x = 5,
y = 610,
font_size = 7,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color , --{{0, 0x550000, 1},{0.5, 0xcf5500, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top mem 2)}%"),
x = 65,
y = 610,
font_size = 7,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x550000, 1},{0.5, 0xcf5500, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top cpu 2}%"),
x = 95,
y = 610,
font_size = 7,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color , --{{0, 0x550000, 1},{0.5, 0xcf5500, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top name 3}"),
x = 5,
y = 620,
font_size = 7,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color , --{{0, 0x550000, 1},{0.5, 0xcfa500, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top mem 3)}%"),
x = 65,
y = 620,
font_size = 7,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x550000, 1},{0.5, 0xcfa500, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top cpu 3}%"),
x = 95,
y = 620,
font_size = 7,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x550000, 1},{0.5, 0xcfa500, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top name 4}"),
x = 5,
y = 630,
font_size = 7,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color ,--{{0, 0x555500, 1},{0.5, 0xcfcf00, 1},{1, 0x555500, 1}},
orientation="nn",
},
{
text = conky_parse("${top mem 4)}%"),
x = 65,
y = 630,
font_size = 7,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x555500, 1},{0.5, 0xcfcf00, 1},{1, 0x555500, 1}},
orientation="nn",
},
{
text = conky_parse("${top cpu 4}%"),
x = 95,
y = 630,
font_size = 7,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x555500, 1},{0.5, 0xcfcf00, 1},{1, 0x555500, 1}},
orientation="nn",
},
{
text = conky_parse("${top name 5}"),
x = 5,
y = 640,
font_size = 7,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = conky_parse("${top mem 5)}%"),
x = 65,
y = 640,
font_size = 7,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = conky_parse("${top cpu 5}%"),
x = 95,
y = 640,
font_size = 7,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color,
orientation="nn",
},
}
-- dériver des échelles
scale_settings = {
{
name = "cpu",
arg = "cpu0",
x = 10,
y = 30,
width = 35,
height = 60,
scale = 16,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 9,
},
{
name = "exec",
arg = "expr `cat /sys/class/hwmon/hwmon2/temp1_input` / 1000",
x = 70,
y = 30,
width = 35,
height =60,
scale = 16,
colour_scale = {{0, 0xff0000, 1},{0.5, 0xffffff, 1},{1, 0x0000ff, 1}},
font_size = 9,
},
{
name = "cpu",
arg = "cpu1",
x = 10,
y = 105,
width = 35,
height = 60,
scale = 16,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 9,
},
{
name = "exec",
arg = "expr `cat /sys/class/hwmon/hwmon2/temp2_input` / 1000",
x = 70,
y = 105,
width = 35,
height = 60,
scale = 16,
colour_scale = {{0, 0xff0000, 1},{0.5, 0xffffff, 1},{1, 0x0000ff, 1}},
font_size = 9,
},
{
name = "memperc",
arg = "",
x = 10,
y = 200,
width = 35,
height = 60,
scale = 16,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 9,
},
{
name = "swapperc",
arg = "",
x = 70,
y = 200,
width = 35,
height = 60,
scale = 16,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 9,
},
{
name = "fs_used_perc",
arg = "/",
x = 10,
y = 300,
width = 35,
height = 60,
scale = 16,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 9,
},
{
name = "fs_used_perc",
arg = "/home",
x = 70,
y = 300,
width = 35,
height = 60,
scale = 16,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 9,
},
{
name = "execi",
arg = "120 hddtemp -n /dev/sda",
x = 10,
y = 400,
width = 35,
height = 60,
scale = 16,
colour_scale = {{0, 0xff0000, 1},{0.5, 0xffffff, 1},{1, 0x0000ff, 1}},
font_size = 9,
},
{
name = "hwmon",
arg = "1 temp 1",
x = 70,
y = 400,
width = 35,
height = 60,
scale = 16,
colour_scale = {{0, 0xff0000, 1},{0.5, 0xffffff, 1},{1, 0x0000ff, 1}},
font_size = 9,
},
{
name = "",
arg = math.ceil(conky_parse("${downspeedf wlp2s0}")),
x = 10,
y = 500,
width = 35,
height = 60,
scale = 16,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 9,
},
{
name = "",
arg = math.ceil(conky_parse("${upspeedf wlp2s0}")),
x = 70,
y = 500,
width = 35,
height = 60,
scale = 16,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 9,
},
}
-- --------------------------------------------------------------------
--[[ Ici, l'entrée de toutes les données se termine ]]
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)
--[[ ÉCHELLES ]]
for i,v in pairs(scale_settings) do
cr = cairo_create (cs)
dialgraph(v)
cairo_destroy(cr)
end
-- sortie de texte
for i,v in pairs(text_settings) do
cr = cairo_create (cs)
display_text(v)
cairo_destroy(cr)
end
end -- fonction de fermeture
text.lua
Code :
--[[TEXT WIDGET v1.42 par Wlourf le 07 février 2011
Ce widget peut dessiner des textes dans la table "text_settings" avec quelques paramètres
http://u-scripts.blogspot.com/2010/06/text-widget.html
Pour appeler le script dans un conky, utilisez, avant TEXT
lua_load /path/to/the/script/graph.lua
lua_draw_hook_pre main_graph
et ajoutez une ligne (vide ou non) après TEXT
Les paramètres (tous les optionnels) sont:
texte - texte à afficher, défaut = "Conky est bon pour vous"
il peut être utilisé avec des variables conky, c'est-à-dire text = "mon cpu1 est $ {cpu cpu1}%")
- les coordonnées ci-dessous sont relatives au coin supérieur gauche de la fenêtre conique
x - x coordonnée de la première lettre (en bas à gauche), par défaut = centre de la fenêtre conky
y - y coordonnée de la première lettre (en bas à gauche), par défaut = centre de la fenêtre conky
h_align - alignement horizontal du texte par rapport au point (x, y), défaut = "l"
les valeurs disponibles sont "l": gauche, "c": centre, "r": droite
v_align - alignement vertical du texte par rapport au point (x, y), défaut = "b"
valeurs disponibles "t": haut, "m": milieu, "b": bas
font_name - nom de la police à utiliser, default = Free Sans
font_size - taille de la police à utiliser, par défaut = 14
italique - affiche le texte en italique (vrai / faux), défaut = faux
oblique - affiche le texte en oblique (vrai / faux), défaut = faux (je ne vois pas la différence avec italique!)
bold - affiche le texte en gras (vrai / faux), défaut = faux
angle - rotation du texte en degrés, par défaut = 0 (horizontal)
couleur - table de couleurs pour le texte, par défaut = blanc uni {{1,0xFFFFFF, 1}}
cette table contient une ou plusieurs tables au format {P, C, A}
P = position du dégradé (0 = début du texte, 1 = fin du texte)
C = couleur hexadécimale
A = alpha (opacité) de la couleur (0 = invisible, 1 = opacité 100%)
Exemples :
pour une couleur unie {{1,0x00FF00,0.5}}
pour un dégradé avec deux couleurs {{0,0x00FF00,0.5}, {1,0x000033,1}}
ou {{0.5,0x00FF00,1}, {1,0x000033,1}} - avec celui-ci, le dégradé commencera au milieu du texte
pour un dégradé avec trois couleurs {{0,0x00FF00,0.5}, {0.5,0x000033,1}, {1,0x440033,1}}
etc ...
orientation - en cas de gradient, "orientation" définit le point de départ du dégradé, défaut = "ww"
il y a 8 points de départ disponibles: "nw", "nn", "ne", "ee", "se", "ss", "sw", "ww"
(n pour le nord, w pour l'ouest ...)
thèses 8 points sont les 4 coins + les 4 milieux du contour du texte
donc un gradient "nn" passera de "nn" à "ss" (de haut en bas, parallélisé au texte)
un gradient "nw" passera de "nw" à "se" (coin supérieur gauche à coin inférieur droit)
radial - définit un gradient radial (si présent en même temps que "orientation", "orientation" n'aura aucun effet)
ce paramètre est une table avec 6 nombres: {xa, ya, ra, xb, yb, rb}
ils définissent deux cercles pour le dégradé:
xa, ya, xb et yb sont relatifs aux valeurs x et y ci-dessus
reflection_alpha - ajoute un effet de réflexion (valeurs de 0 à 1) défaut = 0 = pas de réflexion
autres valeurs = début de l'opacité
reflection_scale - échelle de la réflexion (par défaut = 1 = hauteur du texte)
reflection_length - longueur de la réflexion, définir où l'opacité sera mise à zéro
calues de 0 à 1, défaut = 1
skew_x, skew_y - incline le texte autour de l'axe x ou y
draw_me - si défini sur false, le texte n'est pas dessiné (par défaut = true ou 1)
il peut être utilisé avec une chaîne conky, si la chaîne renvoie 1, le texte est dessiné:
exemple: "$ {if_empty $ {sans fil wlan0}} $ {else} 1 $ endif",
v1.0 07/06/2010, Version originale
v1.1 10/06/2010 Ajouter un paramètre "orientation"
v1.2 15/06/2010 Ajout des paramètres "h_align", "v_align" et "radial"
v1.3 25/06/2010 Ajouter "reflection_alpha", "reflection_length", "reflection_scale",
"skew_x" et "skew_y"
v1.4 07/01/2011 Ajout du paramètre draw_me et correction des fuites de mémoire grâce à "Creamy Goodness"
le texte est analysé à l'intérieur de la fonction, pas dans le tableau de paramètres
v1.41 26/01/2011 Correction d'un bug pour h_align = "c"
v1.42 09/02/2011 Corriger bug pour l'orientation = "ee"
- Ce programme est un logiciel libre; vous pouvez le redistribuer et / ou modifier
- sous les termes de la Licence Publique Générale GNU telle que publiée par
- la Free Software Foundation version 3 (GPLv3)
-
- Ce programme est distribué dans l'espoir qu'il sera utile,
- mais SANS AUCUNE GARANTIE; sans même la garantie implicite de
- QUALITÉ MARCHANDE ou ADAPTATION À UN USAGE PARTICULIER. Voir le
- Licence publique générale GNU pour plus de détails.
-
- Vous devriez avoir reçu une copie de la Licence Publique Générale GNU
- avec ce programme; sinon, écrivez au logiciel libre
- Foundation, Inc., 51 rue Franklin, cinquième étage, Boston,
- MA 02110-1301, États-Unis.
Suggérer une modification
]]
require 'cairo'
function conky_draw_text()
local text_settings={
--BEGIN OF PARAMETERS
{--display a text at coordinates 20,20
text="unformatted text",
x=20,
y=20,
},
--[[
{--display a text at coordinates 20,40, with selected font and size, true and bold
text="bold and italic text",
x=20,
y=40,
font_name="Verdana",
font_size=18,
italic=true,
bold=true,
draw_me="${if_empty ${wireless_essid wlan0}}${else}1$endif",
},
{--display a text at coordinates 20,70, in green with opacity 0.8 and "oblique"
text="green text",
x=20,
y=70,
font_name="Verdana",
font_size=18,
oblique=true,
--colour table contains one or more tables with 3 elements, here:
--1 = starting point for gradient (0= beginning of the text, 1= end of the text)
--0x00FF00 = colour in hexadecimal
--0.8 = opacity (0=invisible, 1=opacity 100%)
colour={{1,0x00FF00,0.8}}
},
{--display a text at coordinates 20,100, with a red green blue gradient
text="text with gradient (ww)", --(default orientation=ww)
x=20,
y=100,
font_name="Clarendon",
font_size=25,
colour={{0,0xFF0000,0.9},{0.5,0x00FF00,1},{1,0xFFFF00,0.9}},
},
{--display a text at coordinates 20,130, with a red green yellow gradient
text="text with gradient (nn)",
x=20,
y=130,
font_name="Clarendon",
font_size=25,
orientation="nn",
colour={{0,0xFF0000,1},{0.5,0x00FF00,1},{1,0xFFFF00,1}},
},
{--display a text at coordinates 40,290, with a yellow blue yellow gradient
--with a 30° angle
text="text at 30 degrees",
x=400,
y=190,
colour={{0,0xFFFF00,1},{0.5,0x0000FF,1},{1,0xFFFF00,1}},
angle=-30,
font_name="Clarendon",
font_size=32
},
{--text with 5 colours gradient
text="vertical text",
x=50,
y=450,
colour={{0 ,0xFF0000,1},
{0.25 ,0xFFFF00,1},
{0.50 ,0x00FF00,1},
{0.75 ,0x00FFFF,1},
{1 ,0x0000FF,1}
},
angle=-90,
font_name="Clarendon",
font_size=40,
orientation="nw"
},
{--vertical text with 3 colours gradient
text="\"bumped\" effect",
x=250,
y=270,
colour={{0 ,0xDDDDDD,0.15},
{0.50 ,0xFFFFFF,1},
{1 ,0xDDDDDD,0.15}
},
font_name="Clarendon",
font_size=35,
orientation="nn"
},
--radial gradient
{
text="radial gradient",
x=400,
y=350,
font_name="Clarendon",
font_size="48",
colour={
{0.8,0xF0FFF0,1},
{1.00,0xF0F0FF,0.1},
},
h_align="c",
radial={0,300,0,0,300,370}
},
{
text="another radial gradient",
x=400,
y=400,
font_name="Clarendon",
font_size="48",
colour={
{0.98, 0xFFFF00,1},
{0.99, 0xFF0000,1},
{1.00, 0xFF00FF,1},
},
h_align="c",
v_align="m",
radial={0,-1000,0,0,-1000,1020}
},
{--display a text with some conly variables
--use two dots to concatenate texts
text="text with some conky, cpu= ${cpu} %",
x=20,
y=660,
colour={{0,0xFFFF00,1},{0.5,0xFF0000,1},{1,0xFFFF00,1}},
font_name="Purisa",
bold=true,
font_size=38
},
--text with shadow:
]]
{
text=conky_parse("${uptime}"),
x=50,
y=100,
font_name="Clarendon",
font_size=24,
colour={{0,0xFFFF00,1},{0.5,0xFF0000,1},{1,0xFFFF00,1}},
orientation="ww",
},
{
text='text with shadow #1',
x=298,
y=498,
font_name="Clarendon",
font_size=50,
colour={{0,0xFFFF00,1}},
orientation="ww",
},
--blur effect
{
text='blur effect',
x=300,
y=550,
font_name="Clarendon",
font_size=50,
colour={{0.00,0x00FF00,0.35},
},
},
{
text='blur effect',
x=299,
y=549,
font_name="Clarendon",
font_size=50,
colour={{0.00,0x00FF00,0.35},
},
},
{
text='blur effect',
x=301,
y=551,
font_name="Clarendon",
font_size=50,
colour={{0.00,0x00FF00,0.35},
},
},
--focus effect
{
text='focus effect #1',
x=300,
y=600,
font_name="Clarendon",
font_size=50,
colour={{0.00,0x00FFFF,0},
{0.50,0x00FFFF,1},
{1.00,0x00FFFF,0},
},
orientation="ww",
},
{
text='focus effect #1',
x=300,
y=599,
font_name="Clarendon",
font_size=50,
colour={{0.00,0x00FFFF,0.5},
{0.50,0x00FFFF,0},
{1.00,0x00FFFF,0.5},
},
orientation="ww",
},
{
text='focus effect #1',
x=300,
y=601,
font_name="Clarendon",
font_size=50,
colour={{0.00,0x00FFFF,0.5},
{0.50,0x00FFFF,0},
{1.00,0x00FFFF,0.5},
},
orientation="ww",
},
--focus effect 2
{
text='focus effect #2',
x=300,
y=720,
font_name="Clarendon",
font_size=50,
colour={{0.00,0x00FFFF,1},
{1,0x00FFFF,0},
},
},
{
text='focus effect #2',
x=299,
y=719,
font_name="Clarendon",
font_size=50,
colour={{0.00,0x00FFFF,0},
{1,0x00FFFF,0.25},
},
},
{
text='focus effect #2',
x=301,
y=721,
font_name="Clarendon",
font_size=50,
colour={{0.00,0x00FFFF,0},
{1,0x00FFFF,0.25},
},
},
--text with reflection
{
text="${time %H:%M:%S}",
y=730,
x=50,
font_name="Ubuntu-title",
font_size=50,
colour={{0,0xFF0000,1},{1,0xCCCCCC,1}},
orientation="nn",
reflection_alpha=0.8,
reflection_length=0.9
},
--skew x
{
text="skew x",
font_size=24,
colour={{0,0x00FF00,1},{1,0x00FFFF,1}},
x=30,
y=500,
skew_x=-10
},
--skew y
{
text="skew y",
font_size=24,
colour={{0,0x00FF00,1},{1,0x00FFFF,1}},
x=150,
y=500,
skew_y=10
},
--skew x + skew y
{
text="skew x-y",
font_size=24,
colour={{0,0x00FF00,1},{1,0x00FFFF,1}},
x=30,
y=550,
skew_y=10,
skew_x=10
},
--skew x + skew y
{
text="skew x-y",
font_size=24,
colour={{0,0x00FF00,1},{1,0x00FFFF,1}},
x=150,
y=550,
skew_y=10,
skew_x=10,
reflection_alpha=0.8,
reflection_scale=2,
reflection_length=1.5
},
}
--------------END OF PARAMETERS----------------
if conky_window == nil then return end
if tonumber(conky_parse("$updates"))<3 then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
for i,v in pairs(text_settings) do
cr = cairo_create (cs)
display_text(v)
cairo_destroy(cr)
cr = nil
end
cairo_surface_destroy(cs)
end
function rgb_to_r_g_b2(tcolour)
local colour,alpha=tcolour[2],tcolour[3]
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function display_text(t)
if t.draw_me==true then t.draw_me = nil end
if t.draw_me~=nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end
local function set_pattern(te)
--this function set the pattern
if #t.colour==1 then
cairo_set_source_rgba(cr,rgb_to_r_g_b2(t.colour[1]))
else
local pat
if t.radial==nil then
local pts=linear_orientation(t,te)
pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
else
pat = cairo_pattern_create_radial (t.radial[1],t.radial[2],t.radial[3],t.radial[4],t.radial[5],t.radial[6])
end
for i=1, #t.colour do
cairo_pattern_add_color_stop_rgba (pat, t.colour[i][1], rgb_to_r_g_b2(t.colour[i]))
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
end
end
--set default values if needed
if t.text==nil then t.text="Conky is good for you !" end
if t.x==nil then t.x = conky_window.width/2 end
if t.y==nil then t.y = conky_window.height/2 end
if t.colour==nil then t.colour={{1,0xFFFFFF,1}} end
if t.font_name==nil then t.font_name="Free Sans" end
if t.font_size==nil then t.font_size=14 end
if t.angle==nil then t.angle=0 end
if t.italic==nil then t.italic=false end
if t.oblique==nil then t.oblique=false end
if t.bold==nil then t.bold=false end
if t.radial ~= nil then
if #t.radial~=6 then
print ("error in radial table")
t.radial=nil
end
end
if t.orientation==nil then t.orientation="ww" end
if t.h_align==nil then t.h_align="l" end
if t.v_align==nil then t.v_align="b" end
if t.reflection_alpha == nil then t.reflection_alpha=0 end
if t.reflection_length == nil then t.reflection_length=1 end
if t.reflection_scale == nil then t.reflection_scale=1 end
if t.skew_x==nil then t.skew_x=0 end
if t.skew_y==nil then t.skew_y=0 end
cairo_translate(cr,t.x,t.y)
cairo_rotate(cr,t.angle*math.pi/180)
cairo_save(cr)
local slant = CAIRO_FONT_SLANT_NORMAL
local weight = CAIRO_FONT_WEIGHT_NORMAL
if t.italic then slant = CAIRO_FONT_SLANT_ITALIC end
if t.oblique then slant = CAIRO_FONT_SLANT_OBLIQUE end
if t.bold then weight = CAIRO_FONT_WEIGHT_BOLD end
cairo_select_font_face(cr, t.font_name, slant,weight)
for i=1, #t.colour do
if #t.colour[i]~=3 then
print ("error in color table")
t.colour[i]={1,0xFFFFFF,1}
end
end
local matrix0 = cairo_matrix_t:create()
tolua.takeownership(matrix0)
local skew_x,skew_y=t.skew_x/t.font_size,t.skew_y/t.font_size
cairo_matrix_init (matrix0, 1,skew_y,skew_x,1,0,0)
cairo_transform(cr,matrix0)
cairo_set_font_size(cr,t.font_size)
local te=cairo_text_extents_t:create()
tolua.takeownership(te)
t.text=conky_parse(t.text)
cairo_text_extents (cr,t.text,te)
set_pattern(te)
local mx,my=0,0
if t.h_align=="c" then
mx=-te.width/2-te.x_bearing
elseif t.h_align=="r" then
mx=-te.width
end
if t.v_align=="m" then
my=-te.height/2-te.y_bearing
elseif t.v_align=="t" then
my=-te.y_bearing
end
cairo_move_to(cr,mx,my)
cairo_show_text(cr,t.text)
if t.reflection_alpha ~= 0 then
local matrix1 = cairo_matrix_t:create()
tolua.takeownership(matrix1)
cairo_set_font_size(cr,t.font_size)
cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(te.height+te.y_bearing+my)*(1+t.reflection_scale))
cairo_set_font_size(cr,t.font_size)
te=nil
local te=cairo_text_extents_t:create()
tolua.takeownership(te)
cairo_text_extents (cr,t.text,te)
cairo_transform(cr,matrix1)
set_pattern(te)
cairo_move_to(cr,mx,my)
cairo_show_text(cr,t.text)
local pat2 = cairo_pattern_create_linear (0,
(te.y_bearing+te.height+my),
0,
te.y_bearing+my)
cairo_pattern_add_color_stop_rgba (pat2, 0,1,0,0,1-t.reflection_alpha)
cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1)
--line is not drawn but with a size of zero, the mask won't be nice
cairo_set_line_width(cr,1)
local dy=te.x_bearing
if dy<0 then dy=dy*(-1) end
cairo_rectangle(cr,mx+te.x_bearing,te.y_bearing+te.height+my,te.width+dy,-te.height*1.05)
cairo_clip_preserve(cr)
cairo_set_operator(cr,CAIRO_OPERATOR_CLEAR)
--cairo_stroke(cr)
cairo_mask(cr,pat2)
cairo_pattern_destroy(pat2)
cairo_set_operator(cr,CAIRO_OPERATOR_OVER)
te=nil
end
end
function linear_orientation(t,te)
local w,h=te.width,te.height
local xb,yb=te.x_bearing,te.y_bearing
if t.h_align=="c" then
xb=xb-w/2
elseif t.h_align=="r" then
xb=xb-w
end
if t.v_align=="m" then
yb=-h/2
elseif t.v_align=="t" then
yb=0
end
local p=0
if t.orientation=="nn" then
p={xb+w/2,yb,xb+w/2,yb+h}
elseif t.orientation=="ne" then
p={xb+w,yb,xb,yb+h}
elseif t.orientation=="ww" then
p={xb,h/2,xb+w,h/2}
elseif vorientation=="se" then
p={xb+w,yb+h,xb,yb}
elseif t.orientation=="ss" then
p={xb+w/2,yb+h,xb+w/2,yb}
elseif t.orientation=="ee" then
p={xb+w,h/2,xb,h/2}
elseif t.orientation=="sw" then
p={xb,yb+h,xb+w,yb}
elseif t.orientation=="nw" then
p={xb,yb,xb+w,yb+h}
end
return p
end
scale.lua
Code :
--[[cadrans mrpeachy mai 2011
créé par olgmen 11/12/2011
pour le travail il faut ajouter conkyrc au-dessus du mot TEXT
lua_load / chemin d'accès au fichier / scale.lua - modifier pour n'importe quoi et où vous avez enregistré le fichier
lua_draw_hook_pre draw_fig - doit être inchangé
x - coordonnées du coin supérieur gauche de l'échelle horizontalement
y - les coordonnées du coin supérieur droit de l'échelle verticalement
largeur - largeur de l'échelle
hauteur - hauteur de l'échelle
échelle - le nombre total de divisions affichées
couleur - la couleur des divisions et des chiffres affichés
color_middle - couleur des lignes centrales
alpha - saturation des couleurs
nom_fonte - nom de la police
font_size - Taille de la police
dernière mise à jour 02.01.2012
]]
require 'cairo'
function conky_draw_fig()
scale_settings = {
{
name = "",
arg = math.ceil(conky_parse("${time %S}")),
x = 100,
y = 50.5,
width = 60,
height = 200,
scale = 40, --combien de divisions peuvent être vus dans le cadran
font = "Ubuntu",
font_size = 12, --number font and font size
colour_scale = {{0, 0xff0000, 1},{0.5, 0xffffff, 1},{1, 0x0000ff, 1}},
},
}
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)
for i,v in pairs(scale_settings) do
cr = cairo_create (cs)
dialgraph(v)
cairo_destroy(cr)
end
end
-- ---------------------------------------------------------------------
-- функция перекодировки цвета
--[[
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
]]
-- ---------------------------------------------------------------------
function dialgraph (t)
-- local function rgb_to_r_g_b2(tcolour)
-- colour, alpha = tcolour[2], tcolour[3]
-- return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
-- end
local function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
-- vérifier les données et ajouter les données par défaut
if t.x == nil then t.x = conky_window.width/2 end
if t.y == nil then t.y = conky_window.height/2 end
if t.width == nil then t.width = 50 end
if t.height == nil then t.height = 100 end
if t.scale == nil then t.scale = 20 end
if t.alpha == nil then t.alpha = 1 end
if t.colour_middle == nil then t.colour_middle = 0xff5500 end
if t.font_name == nil then t.font_name = "Ubuntu" end
if t.font_size == nil then t.font_size = 14 end
if t.orientation == nil then t.orientation = "nn" end
if t.colour_scale == nil then
t.colour_scale = {{0, 0x333333, 0.75},{0.5, 0xffffff, 1},{1, 0x333333, 0.75}}
end
if t.draw_me == true then t.draw_me = nil end
if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end
local value = 0
if t.name ~= "" then
value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
else
value = tonumber(t.arg)
end
if value == nil then value = 0 end
--valuegraph
local adj = (value % 5)
local lines = tonumber(t.scale)
local gap = t.height/lines
cairo_set_line_width (cr, 1)
-- cairo_set_source_rgba(cr, rgb_to_r_g_b(t.colour, t.alpha))
cairo_select_font_face (cr, t.font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
cairo_set_font_size (cr, t.font_size)
if #t.colour_scale == 1 then
cairo_set_source_rgba(cr,rgb_to_r_g_b2(t.colour_scale[1]))
else
local pat
local pts=linear_orientation_bg(t)
pat = cairo_pattern_create_linear (pts[1], pts[2], pts[3], pts[4])
for i=1, #t.colour_scale do
cairo_pattern_add_color_stop_rgba (pat, t.colour_scale[i][1], rgb_to_r_g_b2(t.colour_scale[i]))
end
cairo_set_source (cr, pat)
end
--calculate line and number positions
for i = 2,lines do
n = i
for i = 1, lines, 5 do
--print (i)
if n == (lines/2)+(5-adj)+i or n == (lines/2)+(5-adj)+(-i-3) then
len = -2*(t.width/5)
else
len = -1*(t.width/5)
end
if n == (lines/2)+(5-adj)+i then
num = value - adj + (i + 4)
elseif n == (lines/2)+(5-adj)+(-i-3) then
num = value - adj-(i-1)
else
num = ""
end
--print lines
cairo_move_to (cr, t.x+(t.width/2), t.y+t.height-(gap*(n-1)))
cairo_rel_line_to (cr, len, 0)
-- cairo_stroke (cr)
--print numbers
cairo_move_to (cr, t.x+(t.width/2)+2, t.y+t.height-(gap*(n-1))+(t.font_size/3))
cairo_show_text (cr, num)
cairo_stroke (cr)
end--for
end--for
--middle lines
cairo_set_source_rgba(cr, rgb_to_r_g_b(t.colour_middle, t.alpha))
cairo_move_to (cr, t.x + t.width, t.y + (t.height/2)+2)
cairo_rel_line_to (cr, -t.width, 0)
cairo_stroke (cr)
cairo_move_to (cr, t.x + t.width, t.y + (t.height/2)-2)
cairo_rel_line_to (cr, -t.width, 0)
cairo_stroke (cr)
cairo_pattern_destroy (pat)
--[[ local function linear_orientation_bg(t)
if t.orientation == "nn" then
p = {t.x + t.width/2, t.y, t.x + t.width/2, t.y + t.height}
elseif t.orientation == "ne" then
p = {t.x + t.width, t.y, t.x, t.y + t.height}
elseif t.orientation == "ee" then
p = {t.x + t.width, t.y + t.height/2, t.x, t.y + t.height/2}
elseif t.orientation == "se" then
p = {t.x +t.width, t.y + t.height, t.x, t.y}
elseif t.orientation == "ss" then
p = {t.x + t.width/2, t.y + t.height, t.x + t.width/2, t.y}
elseif t.orientation == "sw" then
p = {t.x, t.y + t.height, t.x + t.width, t.y}
elseif t.orientation == "ww" then
p = {t.x, t.y + t.height/2, t.x + t.width, t.y + t.height/2}
else
p = {t.x, t.y, t.x + t.width, t.y + t.height}
end
return p
end
]]
end
function rgb_to_r_g_b2(tcolour)
colour, alpha = tcolour[2], tcolour[3]
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function linear_orientation_bg(t)
if t.orientation == "nn" then
p = {t.x + t.width/2, t.y, t.x + t.width/2, t.y + t.height}
elseif t.orientation == "ne" then
p = {t.x + t.width, t.y, t.x, t.y + t.height}
elseif t.orientation == "ee" then
p = {t.x + t.width, t.y + t.height/2, t.x, t.y + t.height/2}
elseif t.orientation == "se" then
p = {t.x +t.width, t.y + t.height, t.x, t.y}
elseif t.orientation == "ss" then
p = {t.x + t.width/2, t.y + t.height, t.x + t.width/2, t.y}
elseif t.orientation == "sw" then
p = {t.x, t.y + t.height, t.x + t.width, t.y}
elseif t.orientation == "ww" then
p = {t.x, t.y + t.height/2, t.x + t.width, t.y + t.height/2}
else
p = {t.x, t.y, t.x + t.width, t.y + t.height}
end
return p
end

.gif)
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie