En cours Conky 2023

Bureaux,conky et autres personnalisations esthétiques.
Répondre
Avatar du membre
loutch
Messages : 517
Enregistré le : lun. 13 juil. 2015 17:32
Localisation : Sarreguemines

Conky 2023

Message par loutch »

Bonjour

Comme cela fait longtemps .

Aux modos si je peux faire le sujet.


Conkyopen-meteo prise sur le site " prevision-meteo.ch" le site est en Français .

Vous pouvez vous faire un dossier icônes avec celles du site . Chez moi ce sont celles de Vclouds .

le conkyrc :

Code : Tout sélectionner

conky.config = {
    background = true,
    use_xft = true,
    font = 'Liberation Sans:size=7',
    xftalpha = 1,
    update_interval = 1.0,
    total_run_times = 0,
    own_window = true,
    own_window_transparent = false,
        own_window_argb_visual = true,
        own_window_argb_value = 00,
    own_window_type = 'normal',
    own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
    double_buffer = true,
    minimum_width = 270, minimum_height = 550,
        maximum_width = 270,
    text_buffer_size = 2048,
    draw_shades = false,
    draw_outline = false,
    draw_borders = false,
    draw_graph_borders = false,
    default_color = 'white',
    default_outline_color = 'white',
    alignment = 'top_left',
    gap_x = 52,
    gap_y = 240,
    no_buffers = true,
    uppercase = false,
    cpu_avg_samples = 2,
    override_utf8_locale = true,
        imlib_cache_flush_interval = 60,
    imlib_cache_size = 10000,
-- Taille des pointillés
    stippled_borders = 5,
-- Couleurs 
    default_color = '#ffffff',
    default_shade_color = '#333333',
    default_outline_color = 'black',
 
lua_load = '~/conky-openmeteo/Suisse/configs/loader.lua',
 lua_draw_hook_pre = 'loader_lua',
color1 = 'F5B800',
color2 = '00f5ff',
color3 = '828200',
color4 = '323200',
color5 = 'fdb72e',
color7 = '6495ee',
color9 = 'red',
};
conky.text = [[${execi 1800 bash $HOME/conky-openmeteo/Suisse/suisse.sh}
##### premier cadre #####
### ${voffset -10}${font LED_mono :style=Medium:size=52}${color 434343}${goto 36}${time %H}${goto 136}${time %M}${font LED_mono :size=20:style=Medium}${color 292929}${goto 230}${time %S}$font
#### Date ####
${voffset 72}${alignc -100}${color yellow}${font URW Chancery L :italic:size=20}${time %A %d %B %Y}${voffset -14}                                                                                                    
${font URW Chancery L :italic:size=14}${color ffe595}Sarreguemines$color${voffset -10}
${font URW Chancery L :italic:size=30}${goto 20}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.tmp'} ° ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.tmp' > $HOME/conky-openmeteo/Suisse/barographe/temp}${voffset -60}
${font URW Chancery L :italic:size=10}${goto 220}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.wnd_dir'} 
                                      ${goto 210}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.wnd_spd'} km/h
                                      ${goto 210}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.wnd_gust'} km/h ${voffset -36}                                                                                     
 ${goto 30}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.pressure' | cut -d'.' -f1} mb ${execi 3600 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.pressure' | cut -d'.' -f1 > $HOME/conky-openmeteo/Suisse/barographe/pression}
 ${goto 30}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.humidity'} % ${voffset -4}
 ${goto 30}${font Liberation Sans :size=10}↑${font URW Chancery L :italic:size=10} ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.city_info.sunrise'}\
${goto 210}${font Liberation Sans :size=10}↓${font URW Chancery L :italic:size=10} ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.city_info.sunset'}${voffset -20}
${alignc}${font URW Chancery L :italic:size=14}${color ffe595}${execi 3600 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.condition'} 
#### aujourdh'hui + demain ########
${voffset 26} 
 ${goto 60}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.tmin'}°${color}/${color9}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.tmax'}°\
${goto 200}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_1.tmin'}°${color}/${color9}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_1.tmax'}°$color
${font URW Chancery L :italic:size=10}${voffset -26}
 ${goto 40}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.condition'}\
${goto 180}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_1.condition'}
${font URW Chancery L :italic:size=14}${voffset -30}
${goto 40}Aujourd'hui\
${goto 190}Demain
 #### 3 jours suivant ########
${font URW Chancery L :italic:size=12}${voffset 20}
${goto 030}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_2.tmin'}°${color}/${color9}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_2.tmax'}°\
${goto 125}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_3.tmin'}°${color}/${color9}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_3.tmax'}°\
${goto 220}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_4.tmin'}°${color}/${color9}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_4.tmax'}°$color
${voffset -25}
${goto 020}${scroll 12 ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_2.condition'}}\
${goto 115}${scroll 12 ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_3.condition'}}\
${goto 210}${scroll 10 ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_4.condition'}}
${voffset -25}
${goto 030}${execi 360 echo `date --date="2 day" | awk '{print $1}' | cut -c1-3`}.${execi 360 echo `date --date="2 day" | awk '{print $2}'`}\
${goto 125}${execi 360 echo `date --date="3 day" | awk '{print $1}' | cut -c1-3`}.${execi 360 echo `date --date="3 day" | awk '{print $2}'`}\
${goto 220}${execi 360 echo `date --date="4 day" | awk '{print $1}' | cut -c1-3`}.${execi 360 echo `date --date="4 day" | awk '{print $2}'`}
 #### matin +midi+soir ########
${font URW Chancery L :italic:size=10}${voffset 22}
${goto 030}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.hourly_data."6H00".TMP2m' | awk '{printf("%d\n",$1)}'}°\
${goto 125}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.hourly_data."12H00".TMP2m' | awk '{printf("%d\n",$1)}'}°\
${goto 220}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.hourly_data."18H00".TMP2m' | awk '{printf("%d\n",$1)}'}°$color
${voffset -25}
${goto 020}${scroll 12 ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.hourly_data."7H00".CONDITION'}}\
${goto 115}${scroll 12 ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.hourly_data."12H00".CONDITION'}}\
${goto 210}${scroll 12 ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.hourly_data."18H00".CONDITION'}}
${voffset -25}
${goto 025}Ce matin\
${goto 120}Ce midi\
${goto 215}Ce soir
${voffset -6}${alignc}${font URW Chancery L :italic:size=14} ${color ffe595}Dernière mise @ jour  ${execpi 600 sed -n '1p' $HOME/conky-openmeteo/Suisse/actualisation | cut -c1-5}
#### Affichage  utilisés dans le conky ####
#### premier cadre ####
${lua conky_draw_bg 20 0 98 270 450 0x000000 0.2}
${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/suite-bgv.png 000 090 273 460}
#${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/base5.png    000 040 270 200}
#${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/flip_bg.png  030 003 100 100}
#${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/flip_bg.png  130 003 100 100}
#${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/base5.png    000 260 270 076}
#${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/base5.png    000 360 270 076}
#${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/base5.png    000 460 270 076}
${lua fDrawImage $HOME/conky-openmeteo/Suisse/now.png   050 096 175 120}\
#${lua fDrawImage $HOME/conky-openmeteo/Suisse/Wind1.png 220 110  45  45}
${lua fDrawImage $HOME/conky-openmeteo/Suisse/d0.png    000 205 135  90}\
${lua fDrawImage $HOME/conky-openmeteo/Suisse/d1.png    134 205 135  90}\
${lua fDrawImage $HOME/conky-openmeteo/Suisse/d2.png    000 340 070  45}\
${lua fDrawImage $HOME/conky-openmeteo/Suisse/d3.png    095 340 070  45}\
${lua fDrawImage $HOME/conky-openmeteo/Suisse/d4.png    190 340 070  45}\
${lua fDrawImage $HOME/conky-openmeteo/Suisse/h7.png    000 440 070  45}\
${lua fDrawImage $HOME/conky-openmeteo/Suisse/h12.png   095 440 070  45}\
${lua fDrawImage $HOME/conky-openmeteo/Suisse/h18.png   190 440 070  45}\
${voffset -4000}
]];
le loader.lua "chemin @ modifier"

Code : Tout sélectionner

require 'cairo'
function conky_loader_lua()
usrhome = os.getenv("HOME")
    
    dofile (usrhome .."/.conky/lua/draw_bg.lua")
    dofile (usrhome .."/.conky/lua/image.lua")
    
end
le suisse.sh

Code : Tout sélectionner

#!/usr/bin/bash
###rm $HOME/conky-openmeteo/Suisse/*.png
rm $HOME/.conky/barometr/temp
sleep 2
wget -O $HOME/conky-openmeteo/json/suisse.json "https://prevision-meteo.ch/services/json/sarreguemines"
jq --raw-output . $HOME/conky-openmeteo/json/suisse.json > $HOME/conky-openmeteo/rawdata/rawsuisse
#### temp+40 pour conky barometr ####
num1=$(sed -n 1p $HOME/conky-openmeteo/Suisse/barographe/temp)
num2=40
ans=$(bc -l <<<"$num1+$num2")
echo $ans >> $HOME/.conky/barometr/temp
#### mise à jour unklar ####
date +%T > $HOME/conky-openmeteo/Suisse/actualisation
#### rose des vents  ####
wind_direction=$(jq --raw-output '.current_condition.wnd_dir' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $wind_direction == "S" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"02.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "South" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"02.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "SSO" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"03.png" $HOME/conky-openmeteo/Suisse/wind1.png
elif [[ $wind_direction == "SO" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"04.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "OSO" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"05.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "O" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"06.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "West" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"06.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "ONO" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"07.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "NO" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"08.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "NNO" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"09.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "N" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"10.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "North" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"10.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "NNE" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"11.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "NE" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"12.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "ENE" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"13.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "E" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"14.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "East" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"14.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "ESE" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"15.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "SE" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"16.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "SSE" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"17.png" $HOME/conky-openmeteo/Suisse/Wind1.png
elif [[ $wind_direction == "Variable" ]]; then
    cp $HOME/conky-openmeteo/Suisse/vent/"00.png" $HOME/conky-openmeteo/Suisse/Wind1.png
fi
##### maintenant condition icône ######
icon=$(jq --raw-output '.current_condition.condition' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/now.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/now.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/now.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/now.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/now.png
elif [[ $icon == "Nuit nuageuse" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-nuageuse.png" $HOME/conky-openmeteo/Suisse/now.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/now.png
elif [[ $icon == "Nuit claire" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-claire.png" $HOME/conky-openmeteo/Suisse/now.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/now.png
elif [[ $icon == "Nuit légèrement voilée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-legerement-voilee.png" $HOME/conky-openmeteo/Suisse/now.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/now.png
elif [[ $icon == "Pluie modérée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-moderee.png" $HOME/conky-openmeteo/Suisse/now.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/now.png
elif [[ $icon == "Faibles passages nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faibles-passages-nuageux.png" $HOME/conky-openmeteo/Suisse/now.png
elif [[ $icon == "Nuit avec averses" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-avec-averses.png" $HOME/conky-openmeteo/Suisse/now.png
fi
##### aujourd'hui icône fcst_day_0 ######
icon=$(jq --raw-output '.fcst_day_0.condition' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/d0.png
elif [[ $icon == "Eclaircies" ]]; then
     cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/d0.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp  $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/d0.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/d0.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/d0.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/d0.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/d0.png
    elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/d0.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/d0.png
fi
##### demain icône fcst_day_1 ######
icon=$(jq --raw-output '.fcst_day_1.condition' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/d1.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/d1.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp  $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/d1.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/d1.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/d1.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/d1.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/d1.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/d1.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/d1.png
fi
##### jour+2 icône ######
icon=$(jq --raw-output '.fcst_day_2.condition' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/d2.png
elif [[ $icon == "Eclaircies" ]]; then
    cp  $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/d2.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/d2.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/d2.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/d2.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averse-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/d2.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/d2.png
    elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/d2.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/d2.png
fi
##### jour+3 icône ######
icon=$(jq --raw-output '.fcst_day_3.condition' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/d3.png
elif [[ $icon == "Eclaircies" ]]; then
    cp  $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/d3.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/d3.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/d3.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/d3.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/d3.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/d3.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/d3.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/d3.png
fi
##### jour+4 icône ######
icon=$(jq --raw-output '.fcst_day_4.condition' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/d4.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/d4.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/d4.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/d4.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/d4.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/d4.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/d4.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/d4.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/d4.png
fi
La suite du suisse.sh (le faux ruhm me dit que je dois le couper)

Code : Tout sélectionner

##### 00h00 condition icône ######
icon=$(jq --raw-output '.fcst_day_0.hourly_data."0H00".CONDITION' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/h0.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/h0.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/h0.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/h0.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/h0.png
elif [[ $icon == "Nuit nuageuse" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-nuageuse.png" $HOME/conky-openmeteo/Suisse/h0.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/h0.png
elif [[ $icon == "Nuit claire" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-claire.png" $HOME/conky-openmeteo/Suisse/h0.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/h0.png
elif [[ $icon == "Nuit légèrement voilée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-legerement-voilee.png" $HOME/conky-openmeteo/Suisse/h0.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/h0.png
elif [[ $icon == "Pluie modérée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-moderee.png" $HOME/conky-openmeteo/Suisse/h0.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/h0.png
elif [[ $icon == "Faibles passages nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faibles-passages-nuageux.png" $HOME/conky-openmeteo/Suisse/h0.png
fi
##### 02h00 condition icône ######
icon=$(jq --raw-output '.fcst_day_0.hourly_data."2H00".CONDITION' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/h2.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/h2.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/h2.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/h2.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/h2.png
elif [[ $icon == "Nuit nuageuse" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-nuageuse.png" $HOME/conky-openmeteo/Suisse/h2.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/h2.png
elif [[ $icon == "Nuit claire" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-claire.png" $HOME/conky-openmeteo/Suisse/h2.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/h2.png
elif [[ $icon == "Nuit légèrement voilée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-legerement-voilee.png" $HOME/conky-openmeteo/Suisse/h2.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/h2.png
elif [[ $icon == "Pluie modérée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-moderee.png" $HOME/conky-openmeteo/Suisse/h2.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/h2.png
elif [[ $icon == "Faibles passages nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faibles-passages-nuageux.png" $HOME/conky-openmeteo/Suisse/h2.png
fi
##### 04h00 condition icône ######
icon=$(jq --raw-output '.fcst_day_0.hourly_data."4H00".CONDITION' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/h4.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/h4.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/h4.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/h4.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/h4.png
elif [[ $icon == "Nuit nuageuse" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-nuageuse.png" $HOME/conky-openmeteo/Suisse/h4.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/h4.png
elif [[ $icon == "Nuit claire" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-claire.png" $HOME/conky-openmeteo/Suisse/h4.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/h4.png
elif [[ $icon == "Nuit légèrement voilée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-legerement-voilee.png" $HOME/conky-openmeteo/Suisse/h4.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/h4.png
elif [[ $icon == "Pluie modérée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-moderee.png" $HOME/conky-openmeteo/Suisse/h4.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/h4.png
elif [[ $icon == "Faibles passages nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faibles-passages-nuageux.png" $HOME/conky-openmeteo/Suisse/h4.png
fi
##### 06h00 condition icône ######
icon=$(jq --raw-output '.fcst_day_0.hourly_data."6H00".CONDITION' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/h6.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/h6.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/h6.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/h6.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/h6.png
elif [[ $icon == "Nuit nuageuse" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-nuageuse.png" $HOME/conky-openmeteo/Suisse/h6.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/h6.png
elif [[ $icon == "Nuit claire" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-claire.png" $HOME/conky-openmeteo/Suisse/h6.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/h6.png
elif [[ $icon == "Nuit légèrement voilée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-legerement-voilee.png" $HOME/conky-openmeteo/Suisse/h6.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/h6.png
elif [[ $icon == "Pluie modérée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-moderee.png" $HOME/conky-openmeteo/Suisse/h6.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/h6.png
elif [[ $icon == "Faibles passages nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faibles-passages-nuageux.png" $HOME/conky-openmeteo/Suisse/h6.png
fi
##### 08h00 condition icône ######
icon=$(jq --raw-output '.fcst_day_0.hourly_data."8H00".CONDITION' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/h8.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/h8.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/h8.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/h8.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/h8.png
elif [[ $icon == "Nuit nuageuse" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-nuageuse.png" $HOME/conky-openmeteo/Suisse/h8.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/h8.png
elif [[ $icon == "Nuit claire" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-claire.png" $HOME/conky-openmeteo/Suisse/h8.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/h8.png
elif [[ $icon == "Nuit légèrement voilée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-legerement-voilee.png" $HOME/conky-openmeteo/Suisse/h8.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/h8.png
elif [[ $icon == "Pluie modérée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-moderee.png" $HOME/conky-openmeteo/Suisse/h8.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/h8.png
elif [[ $icon == "Faibles passages nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faibles-passages-nuageux.png" $HOME/conky-openmeteo/Suisse/h8.png
fi
##### 10h00 condition icône ######
icon=$(jq --raw-output '.fcst_day_0.hourly_data."10H00".CONDITION' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/h10.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/h10.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/h10.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/h10.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/h10.png
elif [[ $icon == "Nuit nuageuse" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-nuageuse.png" $HOME/conky-openmeteo/Suisse/h10.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/h10.png
elif [[ $icon == "Nuit claire" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-claire.png" $HOME/conky-openmeteo/Suisse/h10.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/h10.png
elif [[ $icon == "Nuit légèrement voilée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-legerement-voilee.png" $HOME/conky-openmeteo/Suisse/h10.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/h10.png
elif [[ $icon == "Pluie modérée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-moderee.png" $HOME/conky-openmeteo/Suisse/h10.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/h10.png
elif [[ $icon == "Faibles passages nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faibles-passages-nuageux.png" $HOME/conky-openmeteo/Suisse/h10.png
fi
##### 12h00 condition icône ######
icon=$(jq --raw-output '.fcst_day_0.hourly_data."12H00".CONDITION' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/h12.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/h12.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/h12.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/h12.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/h12.png
elif [[ $icon == "Nuit nuageuse" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-nuageuse.png" $HOME/conky-openmeteo/Suisse/h12.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/h12.png
elif [[ $icon == "Nuit claire" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-claire.png" $HOME/conky-openmeteo/Suisse/h12.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/h12.png
elif [[ $icon == "Nuit légèrement voilée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-legerement-voilee.png" $HOME/conky-openmeteo/Suisse/h12.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/h12.png
elif [[ $icon == "Pluie modérée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-moderee.png" $HOME/conky-openmeteo/Suisse/h12.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/h12.png
elif [[ $icon == "Faibles passages nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faibles-passages-nuageux.png" $HOME/conky-openmeteo/Suisse/h12.png
fi
##### 14h00 condition icône ######
icon=$(jq --raw-output '.fcst_day_0.hourly_data."14H00".CONDITION' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/h14.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/h14.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/h14.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/h14.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/h14.png
elif [[ $icon == "Nuit nuageuse" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-nuageuse.png" $HOME/conky-openmeteo/Suisse/h14.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/h14.png
elif [[ $icon == "Nuit claire" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-claire.png" $HOME/conky-openmeteo/Suisse/h14.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/h14.png
elif [[ $icon == "Nuit légèrement voilée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-legerement-voilee.png" $HOME/conky-openmeteo/Suisse/h14.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/h14.png
elif [[ $icon == "Pluie modérée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-moderee.png" $HOME/conky-openmeteo/Suisse/h14.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/h14.png
elif [[ $icon == "Faibles passages nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faibles-passages-nuageux.png" $HOME/conky-openmeteo/Suisse/h14.png
fi
##### 16h00 condition icône ######
icon=$(jq --raw-output '.fcst_day_0.hourly_data."16H00".CONDITION' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/h16.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/h16.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/h16.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/h16.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/h16.png
elif [[ $icon == "Nuit nuageuse" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-nuageuse.png" $HOME/conky-openmeteo/Suisse/h16.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/h16.png
elif [[ $icon == "Nuit claire" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-claire.png" $HOME/conky-openmeteo/Suisse/h16.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/h16.png
elif [[ $icon == "Nuit légèrement voilée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-legerement-voilee.png" $HOME/conky-openmeteo/Suisse/h16.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/h16.png
elif [[ $icon == "Pluie modérée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-moderee.png" $HOME/conky-openmeteo/Suisse/h16.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/h16.png
elif [[ $icon == "Faibles passages nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faibles-passages-nuageux.png" $HOME/conky-openmeteo/Suisse/h16.png
fi
##### 18h00 condition icône ######
icon=$(jq --raw-output '.fcst_day_0.hourly_data."18H00".CONDITION' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/h18.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/h18.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/h18.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/h18.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/h18.png
elif [[ $icon == "Nuit nuageuse" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-nuageuse.png" $HOME/conky-openmeteo/Suisse/h18.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/h18.png
elif [[ $icon == "Nuit claire" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-claire.png" $HOME/conky-openmeteo/Suisse/h18.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/h18.png
elif [[ $icon == "Nuit légèrement voilée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-legerement-voilee.png" $HOME/conky-openmeteo/Suisse/h18.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/h18.png
elif [[ $icon == "Pluie modérée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-moderee.png" $HOME/conky-openmeteo/Suisse/h18.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/h18.png
elif [[ $icon == "Faibles passages nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faibles-passages-nuageux.png" $HOME/conky-openmeteo/Suisse/h18.png
fi
##### 20h00 condition icône ######
icon=$(jq --raw-output '.fcst_day_0.hourly_data."20H00".CONDITION' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/h20.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/h20.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/h20.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/h20.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/h20.png
elif [[ $icon == "Nuit nuageuse" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-nuageuse.png" $HOME/conky-openmeteo/Suisse/h20.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/h20.png
elif [[ $icon == "Nuit claire" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-claire.png" $HOME/conky-openmeteo/Suisse/h20.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/h20.png
elif [[ $icon == "Nuit légèrement voilée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-legerement-voilee.png" $HOME/conky-openmeteo/Suisse/h20.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/h20.png
elif [[ $icon == "Pluie modérée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-moderee.png" $HOME/conky-openmeteo/Suisse/h20.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/h20.png
elif [[ $icon == "Faibles passages nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faibles-passages-nuageux.png" $HOME/conky-openmeteo/Suisse/h20.png
fi
##### 22h00 condition icône ######
icon=$(jq --raw-output '.fcst_day_0.hourly_data."22H00".CONDITION' $HOME/conky-openmeteo/rawdata/rawsuisse)
if [[ $icon == "Ensoleillé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ensoleille.png" $HOME/conky-openmeteo/Suisse/h22.png
elif [[ $icon == "Ciel voilé" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"ciel-voile.png" $HOME/conky-openmeteo/Suisse/h22.png
elif [[ $icon == "Eclaircies" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"eclaircies.png" $HOME/conky-openmeteo/Suisse/h22.png
elif [[ $icon == "Faiblement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faiblement-nuageux.png" $HOME/conky-openmeteo/Suisse/h22.png
elif [[ $icon == "Fortement nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"fortement-nuageux.png" $HOME/conky-openmeteo/Suisse/h22.png
elif [[ $icon == "Nuit nuageuse" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-nuageuse.png" $HOME/conky-openmeteo/Suisse/h22.png
elif [[ $icon == "Pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-faible.png" $HOME/conky-openmeteo/Suisse/h22.png
elif [[ $icon == "Nuit claire" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-claire.png" $HOME/conky-openmeteo/Suisse/h22.png
elif [[ $icon == "Averses de neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-neige-faible.png" $HOME/conky-openmeteo/Suisse/h22.png
elif [[ $icon == "Nuit légèrement voilée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"nuit-legerement-voilee.png" $HOME/conky-openmeteo/Suisse/h22.png
elif [[ $icon == "Neige faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"neige-faible.png" $HOME/conky-openmeteo/Suisse/h22.png
elif [[ $icon == "Pluie modérée" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"pluie-moderee.png" $HOME/conky-openmeteo/Suisse/h22.png
elif [[ $icon == "Averses de pluie faible" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"averses-de-pluie-faible.png" $HOME/conky-openmeteo/Suisse/h22.png
elif [[ $icon == "Faibles passages nuageux" ]]; then
    cp $HOME/conky-openmeteo/Suisse/icones/"faibles-passages-nuageux.png" $HOME/conky-openmeteo/Suisse/h22.png
fi
Image

@+
Modifié en dernier par loutch le mar. 25 avr. 2023 16:14, modifié 1 fois.
HP Pavilion g 7 1357 sf avec ssd Tessa cinnamon Mageia 7rc mate
Asus ROG avec xubuntu 18.04 et xubuntu 19.04

Image

Avatar du membre
loutch
Messages : 517
Enregistré le : lun. 13 juil. 2015 17:32
Localisation : Sarreguemines

Re: Conky 2023

Message par loutch »

Bonjour

Un baromètre qui utilise les prévisions du conky précédent.

conkyrc

Code : Tout sélectionner

conky.config = {
    background = true,
    use_xft = true,
    font = 'Bebas Neue Bold:size=12',
    xftalpha = 1,
    update_interval = 1.0,
    total_run_times = 0,
    own_window = true,
    own_window_transparent = true,
--own_window_color 000000
own_window_argb_visual = true,
--own_window_argb_value = 250,
    own_window_type = 'normal',
    own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
    double_buffer = true,
    minimum_width = 290, minimum_height = 290,
        maximum_width = 290,
    text_buffer_size = 2048,
    draw_shades = false,
    draw_outline = false,
    draw_borders = false,
    draw_graph_borders = false,
    default_color = 'white',
    default_outline_color = 'white',
    alignment = 'top_left',
    gap_x = 40,
    gap_y = 790,
    no_buffers = true,
    uppercase = false,
    cpu_avg_samples = 2,
    override_utf8_locale = true,
imlib_cache_flush_interval = 60,
    imlib_cache_size = 10000,
-- Taille des pointillés
    stippled_borders = 5,
-- Couleurs
    default_color = '#ffffff',--ffd579
    default_shade_color = '#333333',
    default_outline_color = 'black',
lua_load = '~/.conky/barometr/loader.lua',
 lua_draw_hook_pre = 'loader_lua',
 
};
conky.text = [[
${lua conky_draw_bg 126 20 18 260 260 0x000000 0.2}
${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/suite-bgv.png 15 10 270 270}
${execi 1800 bash $HOME/conky-openmeteo/Suisse/suisse.sh}
${execi 3600 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.wnd_dir' > $HOME/.conky/barometr/dir} 
${execi 3600 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.wnd_spd' > $HOME/.conky/barometr/vit}  
${execi 3600 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.pressure' | awk '{printf("%d\n",$1)}' > $HOME/.conky/barometr/pre} 
${execi 3600 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.humidity' > $HOME/.conky/barometr/hum} 
${voffset -200}
]];
le loader.lua

Code : Tout sélectionner

require 'cairo'
function conky_loader_lua()
usrhome = os.getenv("HOME")
    dofile (usrhome .."/.conky/barometr/barometr.lua")
    dofile (usrhome .."/.conky/lua/image.lua")    
        dofile (usrhome .."/.conky/lua/draw_bg.lua")
        conky_main_weather()
                
end
barometr.lua

Code : Tout sélectionner

--[[ barometr_v.0.1.lua by olgmen 07.12.2010
script displays the weather forecast with http://weather.noaa.gov
Use scripts:
BARGRAPH WIDGET v2.0 by wlourf (12.07.2010)
circlewriting by mrpeachy (2010)
Скрипт выводит прогноз погоды с http://weather.noaa.gov
Использованы скрипты:
BARGRAPH WIDGET v2.0 by wlourf (12.07.2010)
circlewriting by mrpeachy (2010)
]]
require 'cairo'
-- [[ здесь вводятся все параметры ]] --
function conky_main_weather()
weather_settings = {            -- ВЫВОД ГРАФИКИ
{                    -- фон
sectors = 1,
gap_sectors = -1,
radius = 150,
thickness = 150,
bg_colour1 = {{0, 0x000000, 0.0}},    -- fond du grand cercle
},
{                    -- обод
sectors = 1,
gap_sectors = -1,
radius = 0,
thickness = 3,
bg_colour1 = {{0, 0xFFFFFF, 0.7}},
bg_colour2 = {{0, 0x1B1A25, 1},{0.5, 0x7D7D78, 0.9},{1, 0x5D5D78, 0}}, -- grand cercle
},
{                    -- фон шкалы барометра
radius = 111,
thickness = 7,
sectors = 1,
fill_sectors = true,
start_angle = -120,
end_angle = 120,
bg_colour1 = {{0, 0xffffff, 0.75}},    -- белый
},
{                    -- деления шкалы барометра
radius = 110,
thickness = 5,
sectors = 80,
gap_sectors = 1,
fill_sectors = true,
start_angle = -120,
end_angle = 120,
bg_colour1 = {{0, 0x000000, 1}},    -- черный
},
{                    -- деления шкалы термометра
radius = 110,
sectors = 9,
gap_sectors = 21,
start_angle = 125,
end_angle = 235,
bg_colour1 = {{0, 0xffffff, 0.5}},    -- белый
},
{                    -- термометр
name = "temperature",
arg = conky_parse('${exec sed -n 1p $HOME/.conky/barometr/temp}'),
max = 80,
radius = 110,
thickness = 9,
sectors = 1,
start_angle = 130,
end_angle = 230,
inverse_arc = true,
cap = "r",
bg_colour1 = {{0.0, 0x999999, 0.0},{0.5, 0x999999, 1.0},{1.0, 0x999999, 0.0}},
fg_colour1 = {{0.0, 0xff0000, 0.0},{0.5, 0xff0000, 1.0},{1.0, 0xff0000, 0.0}},
fg_colour2 = {{0.0, 0x6495ee, 0.0},{0.5, 0x6495ee, 1.0},{1.0, 0x6495ee, 0.0}},
bd_colour1 = {{0.0, 0x00FF00, 1.0},{0.5, 0x00FF0, 1.0},{1.0, 0x00FF00, 1.0}},
},
                
}
text_settings = {            -- ВЫВОД ТЕКСТОВ
{                    -- температура
text = "TEMPERATURE " .. conky_parse('${exec sed -n 1p $HOME/conky-openmeteo/Suisse/barographe/temp}') .. "'C",
font_name = "MonogramsToolbox",        -- навание шрифта
font_size = 8,                -- размер шрифта
bold = true,
inside    = true,                -- размещение текста против часовой стрелки
start_angle = 233,
end_angle = 135,
radius = 95,
},
{                    -- шкала термометра
text = " -40-30-20-10 0 10 20 30 40",
font_name = "URW Chancery L",
font_size = 14,
bold = true,
inside = true,
start_angle = 240,
end_angle = 131,
radius = 125,
},
{                    -- погода
text = "Tempete   Pluie   Variable   Beau   Tres sec",
font_name = "URW Chancery L",
font_size = 18,
bold = true,
start_angle = 245,
end_angle = 472,
radius = 118,        
},
    
{                    -- давление в мм ртутного столба
text = "PRESSION " .. conky_parse('${exec sed -n 1p $HOME/.conky/barometr/pre}') .. "mb",
font_name = "MonogramsToolbox",
font_size = 8,
bold = true,
start_angle = 300,
end_angle = 417,
radius = 90,
},
{                    -- направление и скорость ветра
text = "VIT. " .. conky_parse('${exec sed -n 1p $HOME/.conky/barometr/vit}') .. "km/h",
font_name = "MonogramsToolbox",
font_size = 8,
bold = true,
start_angle = 75,
end_angle = 120,
radius = 90,
},
{                    -- влажность    
text = "HUMIDITE " .. conky_parse('${exec sed -n 1p $HOME/.conky/barometr/hum}') .. "%",
font_name = "MonogramsToolbox",
font_size = 8,
bold = true,
inside = true,
start_angle = 228,
end_angle = 140,
radius = 78,
},
{                    -- облачность
text = "DIR. " .. conky_parse('${exec sed -n 1p $HOME/.conky/barometr/dir}'),
font_name = "MonogramsToolbox",
font_size = 8,
bold = true,
start_angle = 240,
end_angle = 275,
radius = 90,
},
}
image_settings = {            -- вывод центрального изображения
{
name = os.getenv ('HOME')..'/.conky/barometr/images/wind_rose.png',    -- путь к картинке
},
            
}
needle_settings = {            -- вывод стрелок
{
name = "vent",                -- направление ветра
arg = conky_parse('${exec sed -n 1p $HOME/.conky/barometr/dir}'),
max = 360,
length_of_arrows = 1.75,            -- длина стрелки
width_of_arrows = 6,            -- ширина стрелки
},
{                    -- давление 
name = "pression",
arg = conky_parse('${exec sed -n 1p $HOME/.conky/barometr/pre}'),
max = 80,
start_angle = 242,
end_angle = 480,
length_of_arrows = 2.75,
width_of_arrows = 3,
},
}        
----------- END --------------
    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)
    if tonumber(conky_parse('${updates}')) > 1 then
        for i in pairs(weather_settings) do
            draw_weather_graph(weather_settings[i])
        end
        for i in pairs(text_settings) do
            draw_circle_text(text_settings[i])
        end
        for i in pairs(image_settings) do
            draw_image(image_settings[i])
        end
        for i in pairs(needle_settings) do
            draw_needle_graph(needle_settings[i])
        end
    end
    cairo_destroy(cr)
    cairo_surface_destroy(cs)
end
-- -------------------------------------------------
-- функция вывода графики
function draw_weather_graph(t)
-- --------------------------------
-- функция перекодировки цвета
    local function rgba_to_r_g_b_a(tcolour)
        colour,alpha=tcolour[2],tcolour[3]
        return ((colour / 0x10000) % 0x100) / 255., 
            ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
    end
-- ----------------------------------
    local function calc_delta(tcol1,tcol2)
        --calculate deltas P R G B A to table_colour 1
        for x = 1, #tcol1 do
            tcol1[x].dA    = 0
            tcol1[x].dP = 0
             tcol1[x].dR = 0
            tcol1[x].dG = 0
            tcol1[x].dB = 0
            if tcol2~=nil and #tcol1 == #tcol2 then
                local r1,g1,b1,a1 = rgba_to_r_g_b_a(tcol1[x])
                local r2,g2,b2,a2 = rgba_to_r_g_b_a(tcol2[x])
                tcol1[x].dP = (tcol2[x][1]-tcol1[x][1])/t.sectors
                 tcol1[x].dR = (r2-r1)/t.sectors
                tcol1[x].dG = (g2-g1)/t.sectors
                tcol1[x].dB = (b2-b1)/t.sectors
                tcol1[x].dA = (a2-a1)/t.sectors        
                
            end
        end
        
        return tcol1
    end
-- --------------------------------------------
    local function draw_scale (x, y, radius, max)
        local i = 0
        local winkel = math.rad(3)
cairo_set_source_rgba(cr,1,1,1,1)
        for i = 0, max/2 - 1, 1 do
        cairo_set_line_width(cr,1)
        cairo_move_to(cr, x -radius- math.sin(winkel*i)*radius, y-radius - math.cos(winkel*i)*radius)
        cairo_line_to(cr, x-radius - math.sin(winkel*i)*(radius*0.9), y-radius-math.cos(winkel*i)*(radius*0.9))
        cairo_stroke(cr)
        end
    end
-- -------------------------------------------
    --check values
    local function setup(t)
-- сохраняем данные и настройки
    cairo_save(cr)
-- установки по умолчанию
        if t.name        == nil then t.name= "" end
        if t.arg        == nil then t.arg = "" end
        if t.max        == nil then t.max = 100 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.height        == nil then t.height = conky_window.width end
        if t.width        == nil then t.width = conky_window.width end
        if t.radius        == nil then t.radius = (conky_window.width/2)*0.9 end
        if t.start_angle    == nil then t.start_angle=0 end
        if t.end_angle        == nil then t.end_angle = 360 end
        if t.thickness        == nil then t.thickness = 10 end
        if t.sectors        == nil then t.sectors = 10 end
        if t.gap_sectors    == nil then t.gap_sectors = 1 end
        if t.fill_sector    == nil then t.fill_sector = false end
        if t.sectors        == 1   then t.fill_sector = false end
        if t.border_size    == nil then t.border_size = 0 end
        if t.cap        == nil then t.cap = "p" end
-- цвет фона
        if t.bg_colour1 == nil then
            t.bg_colour1 = {{0, 0x00ffff, 0.1},{0.5, 0x00FFFF, 0.5},{1, 0x00FFFF, 0.1}}
        end
-- цвет параметра
        if t.fg_colour1 == nil then
            t.fg_colour1 = {{0, 0x00FF00, 0.1},{0.5, 0x00FF00, 1},{1, 0x00FF00, 0.1}}
        end
-- цвет окантовки
        if t.bd_colour1 == nil then
            t.bd_colour1 = {{0, 0xFFFF00, 0.5},{0.5, 0xFFFF00, 1},{1, 0xFFFF00, 0.5}}
        end
-- проверяем соотношение ширины кольца и радиуса
        if t.thickness > t.radius then t.thickness = t.radius*0.1 end
        t.int_radius = t.radius - t.thickness
-- проверяем данные углов
        if t.start_angle >= t.end_angle then
             local tmp_angle = t.end_angle
             t.end_angle = t.start_angle
             t.start_angle = tmp_angle
         -- print ("inversed angles")
            if t.end_angle-t.start_angle > 360 and t.start_angle > 0 then
                t.end_angle = 360 + t.start_angle
                print ("reduce angles")
            end
        
            if t.end_angle + t.start_angle > 360 and t.start_angle <= 0 then
                t.end_angle = 360 + t.start_angle
                print ("reduce angles")
            end
            if t.int_radius < 0 then t.int_radius = 0 end
            if t.int_radius > t.radius then
                local tmp_radius = t.radius
                t.radius = t.int_radius
                t.int_radius = tmp_radius
                print ("inversed radius")
            end
            if t.int_radius == t.radius then
                t.int_radius = 0
                print ("int radius set to 0")
            end
        end
-- проверка таблиц цвета
        for i = 1, #t.bg_colour1 do
            if #t.bg_colour1[i] ~= 3 then t.bg_colour1[i] = {1, 0xFFFFFF, 0.5} end
        end
        for i = 1, #t.fg_colour1 do
            if #t.fg_colour1[i] ~= 3 then t.fg_colour1[i] = {1, 0xFF0000, 1} end
        end
        for i = 1, #t.bd_colour1 do
            if #t.bd_colour1[i] ~= 3 then t.bd_colour1[i] = {1, 0xFFFF00, 1} end
        end
    
        if t.bg_colour2 ~= nil then
            for i = 1, #t.bg_colour2 do
                if #t.bg_colour2[i] ~= 3 then t.bg_colour2[i] = {1, 0xFFFFFF, 0.5} end
            end
        end
        if t.fg_colour2 ~= nil then
            for i = 1, #t.fg_colour2 do
                if #t.fg_colour2[i] ~= 3 then t.fg_colour2[i] = {1, 0xFF0000, 1} end
            end
        end
        if t.bd_colour2 ~= nil then
            for i = 1, #t.bd_colour2 do
                if #t.bd_colour2[i] ~= 3 then t.bd_colour2[i] = {1, 0xFFFF00, 1} end
            end
        end
        t.fg_colour1 = calc_delta(t.fg_colour1,t.fg_colour2)
        t.bg_colour1 = calc_delta(t.bg_colour1,t.bg_colour2)
        t.bd_colour1 = calc_delta(t.bd_colour1,t.bd_colour2)
    end
    
    setup(t)
    
    --initialize cairo context
    cairo_save(cr)
    cairo_translate(cr, t.x, t.y)
    cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND)
    cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND)
    --get value
    local value = 0
-- --------------------------------------------- обработка вывода температуры
    if t.name == "temperature" then t.name = "" end
-- -------------------------------------------------------------------------
    if t.name ~= "" then
        value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
    else
        value = tonumber(t.arg)
    end
    if value==nil then value =0 end
    --initialize sectors
    --angle of a sector :
    angleA = ((t.end_angle-t.start_angle)/t.sectors)*math.pi/180
    --value of a sector : 
    valueA = t.max/t.sectors
    --first angle of a sector : 
    lastAngle = t.start_angle*math.pi/180
    local function draw_sector(type_arc,angle0,angle,valpc, idx)
     
        --this function draws a portion of arc
         --type of arc, angle0 = strating angle, angle= angle of sector,
         --valpc = percentage inside the sector, idx = sctor number #
         if type_arc=="bg" then         --background
             if valpc==1 then return end
             tcolor=t.bg_colour1
         elseif type_arc=="fg" then    --foreground
             if valpc==0 then return end
             tcolor=t.fg_colour1
         elseif type_arc=="bd" then    --border
             tcolor=t.bd_colour1
         end 
        --angles equivalents to gap_sector
        local ext_delta=math.atan(t.gap_sectors/(2*t.radius))
        local int_delta=math.atan(t.gap_sectors/(2*t.int_radius))
        --angles of arcs
        local ext_angle=(angle-ext_delta*2)*valpc
        local int_angle=(angle-int_delta*2)*valpc
        --define colours to use for this sector
        if #tcolor==1 then 
            --plain color
            local vR,vG,vB,vA = rgba_to_r_g_b_a(tcolor[1])
            cairo_set_source_rgba(cr,vR+tcolor[1].dR*idx,
                                    vG+tcolor[1].dG*idx,
                                    vB+tcolor[1].dB*idx,
                                    vA+tcolor[1].dA*idx    )
        else
            --radient color
            local pat=cairo_pattern_create_radial(0,0,t.int_radius,0,0,t.radius)
            for i=1, #tcolor do
                local vP,vR,vG,vB,vA = tcolor[i][1], rgba_to_r_g_b_a(tcolor[i])
                cairo_pattern_add_color_stop_rgba (pat, 
                                    vP+tcolor[i].dP*idx,
                                    vR+tcolor[i].dR*idx,
                                    vG+tcolor[i].dG*idx,
                                    vB+tcolor[i].dB*idx,
                                    vA+tcolor[i].dA*idx    )
            end
            cairo_set_source (cr, pat)
            cairo_pattern_destroy(pat)
        end
        --start drawing
         cairo_save(cr)
        --x axis is parrallel to start of sector
        cairo_rotate(cr,angle0-math.pi/2)
        local ri,re = t.int_radius ,t.radius
        --point A 
        local angle_a
    
        if t.cap == "p" then 
            angle_a = int_delta
            if t.inverse_arc and type_arc ~="bg" then
                angle_a = angle-int_angle-int_delta
            end
            if not(t.inverse_arc) and type_arc =="bg" then
                angle_a = int_delta+int_angle
            end
        else --t.cap=="r"
            angle_a = ext_delta
            if t.inverse_arc and type_arc~="bg" then
                angle_a = angle-ext_angle-ext_delta
            end
            if not(t.inverse_arc) and type_arc=="bg" then
                angle_a = ext_delta+ext_angle
            end
        end
        local ax,ay = ri*math.cos(angle_a),ri*math.sin(angle_a)
        --point B
        local angle_b = ext_delta
        if t.cap == "p" then 
            if t.inverse_arc and type_arc ~="bg" then
                angle_b = angle-ext_angle-ext_delta
            end
            if not(t.inverse_arc) and type_arc=="bg" then
                angle_b = ext_delta+ext_angle
            end
        else
            if t.inverse_arc and type_arc ~="bg" then
                angle_b = angle-ext_angle-ext_delta
            end
            if not(t.inverse_arc) and type_arc=="bg" then
                angle_b = ext_delta+ext_angle
            end
        end
        local bx,by = re*math.cos(angle_b),re*math.sin(angle_b)
        -- EXTERNAL ARC B --> C
        if t.inverse_arc then
            if type_arc=="bg" then
                b0,b1= ext_delta, angle-ext_delta-ext_angle
            else
                b0,b1= angle-ext_angle-ext_delta, angle-ext_delta
            end
        else
            if type_arc=="bg" then
                b0,b1= ext_delta+ext_angle, angle-ext_delta
            else
                b0,b1= ext_delta, ext_angle+ext_delta
            end
        end
        
        ---POINT D
        local angle_c 
        if t.cap == "p" then 
            angle_d = angle-int_delta
            if t.inverse_arc and type_arc=="bg" then
                angle_d = angle-int_delta-int_angle    
            end
            if not(t.inverse_arc) and type_arc~="bg" then
                angle_d=int_delta+int_angle
            end
        else
            angle_d = angle-ext_delta
            if t.inverse_arc and type_arc=="bg" then
                angle_d =angle-ext_delta-ext_angle
            end
            if not(t.inverse_arc) and type_arc~="bg" then
                angle_d = ext_angle+ext_delta
            end
        end
        local dx,dy = ri*math.cos(angle_d),ri*math.sin(angle_d)
        
        -- INTERNAL ARC D --> A
        if t.cap=="p" then    
            if t.inverse_arc then    
                if type_arc=="bg" then
                    d0,d1= angle-int_delta-int_angle,int_delta
                else
                    d0,d1= angle-int_delta, angle- int_angle-int_delta
                end
            else
                if type_arc=="bg" then
                    d0,d1= angle-int_delta, int_delta+int_angle
                else
                    d0,d1= int_delta+int_angle, int_delta
                end
            end
        else
            if t.inverse_arc then    
                if type_arc=="bg" then    
                    d0,d1= angle-ext_delta-ext_angle,ext_delta
                else
                    d0,d1= angle-ext_delta, angle- ext_angle-ext_delta
                end
            else
                if type_arc=="bg" then    
                    d0,d1= angle-ext_delta,ext_delta+ext_angle
                else    
                    d0,d1= ext_angle+ext_delta, ext_delta
                end
            end            
        end
            
        --draw sector
        cairo_move_to(cr,ax,ay)
        cairo_line_to(cr,bx,by)
        cairo_arc(cr,0,0,re,b0,b1)
        cairo_line_to(cr,dx,dy) 
        cairo_arc_negative(cr,0,0,ri,d0,d1)
         cairo_close_path (cr);
        --stroke or fill sector
         if type_arc=="bd" then
             cairo_set_line_width(cr,t.border_size)
             cairo_stroke(cr)
         else
             cairo_fill(cr)
         end
         cairo_restore(cr)
     end
    --draw sectors
    local n0,n1,n2 = 1,t.sectors,1
    if t.inverse_arc then n0,n1,n2 = t.sectors,1,-1 end
    local index = 0
    for i = n0,n1,n2 do 
        index = index +1
        local valueZ=1
        local cstA, cstB = (i-1),i
        if t.inverse_arc then cstA,cstB = (t.sectors-i), (t.sectors-i+1) end
        
        if value>valueA *cstA and value<valueA*cstB then
            if not t.fill_sector then
                valueZ = (value-valueA*cstA)/valueA
            end
        else
            if value<valueA*cstB then valueZ=0 end
        end
        
        local start_angle= lastAngle+(i-1)*angleA
        if t.foreground ~= false then 
            draw_sector("fg",start_angle,angleA,valueZ, index)
        end
        if t.background ~= false then 
            draw_sector("bg",start_angle,angleA,valueZ, i)
        end
        if t.border_size>0 then draw_sector("bd",start_angle,angleA,1, i) end
    end
    cairo_restore(cr)
end
--[[END OF RING-SECTORS WIDGET]]
-- -----------------------------------------------------------------------
-- [[ TEXT ]] --
-- функция добавления незначащих нулей
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 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 calc_delta(tcol1,tcol2)
        --calculate deltas P R G B A to table_colour 1
        for x = 1, #tcol1 do
            tcol1[x].dA    = 0
            tcol1[x].dP = 0
             tcol1[x].dR = 0
            tcol1[x].dG = 0
            tcol1[x].dB = 0
            if tcol2~=nil and #tcol1 == #tcol2 then
                local r1,g1,b1,a1 = rgba_to_r_g_b_a(tcol1[x])
                local r2,g2,b2,a2 = rgba_to_r_g_b_a(tcol2[x])
                tcol1[x].dP = (tcol2[x][1]-tcol1[x][1])/t.sectors
                 tcol1[x].dR = (r2-r1)/t.sectors
                tcol1[x].dG = (g2-g1)/t.sectors
                tcol1[x].dB = (b2-b1)/t.sectors
                tcol1[x].dA = (a2-a1)/t.sectors        
                
            end
        end
    return tcol1
end
-- --------------------------------------------
function draw_circle_text(t)
-- проверка вводимых параметров и установка параметров по умолчанию
    if t.text    == nil then t.text = "Conky c'est pour pour le moral !" 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.radius    == nil then t.radius = (conky_window.width/2)*0.9 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.start_angle    == nil then t.start_angle = 120 end
    if t.end_angle        == nil then t.end_angle = 240 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.inside        == nil then inside = nil end
    if t.align        == nil then t.align = 0 end
    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)
    local inum = string.len(t.text)
    if t.inside ~= nil then
        deg = (t.start_angle - t.end_angle)/(inum - 1)
    else
        range = t.end_angle
        deg = (t.end_angle - t.start_angle)/(inum-1)
    end
    degrads = 1*(math.pi/180)
    local textcut = string.gsub(t.text, ".", "%1@@@")
    texttable = string.split(textcut, "@@@")
    for i = 1, inum do
        ival = i
        if t.inside ~= nil then
            interval = (degrads*(t.start_angle - (deg*(i - 1)))) + t.align
            interval2 = degrads*(t.start_angle - (deg*(i - 1)))
        else
            interval = (degrads*(t.start_angle + (deg*(i - 1)))) + t.align
            interval2 = degrads*(t.start_angle + (deg*(i - 1)))
        end
        txs = 0 + t.radius*(math.sin(interval))
        tys = 0 - t.radius*(math.cos(interval))
        cairo_set_font_size (cr, t.font_size)
        cairo_set_source_rgba(cr, 1, 1, 1, 1)
        cairo_move_to (cr, txs + t.x, tys + t.y)
        if t.inside ~= nil then
            cairo_rotate (cr, interval2 + (180*math.pi/180))
        else
            cairo_rotate (cr, interval2)
        end
        cairo_show_text (cr, (texttable[i]))
        if t.inside ~= nil then 
            cairo_rotate (cr, -interval2 - (180*math.pi/180))
        else
            cairo_rotate (cr, -interval2)
        end
    end
end
-- ---------------------------------
function draw_image(t)
-- --------------------------------
-- установки по умолчанию
        if t.name        == nil then t.name= "" 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.height        == nil then t.height = conky_window.width end
        if t.width        == nil then t.width = conky_window.width end
-- создаём имидж изображения
    image_bg = cairo_image_surface_create_from_png (t.name)
-- забираем данные о ширине и высоте изображения из образа
    w1 = cairo_image_surface_get_width (image_bg)
    h1 = cairo_image_surface_get_height (image_bg)
-- выводим изображение
    cairo_set_source_surface (cr, image_bg, t.x - w1/2, t.y - h1/2)
    cairo_paint (cr)
    cairo_surface_destroy (image_bg)
end
-- --------------------------------------------------
function draw_needle_graph (t)
-- установки по умолчанию
    if t.name        == nil then t.name= "time" end
    if t.arg        == nil then t.arg = "%S" end
    if t.max        == nil then t.max = 60 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.radius        == nil then t.radius = 100 end
    if t.start_angle    == nil then t.start_angle = 0 end
    if t.end_angle        == nil then t.end_angle = 360 end
    if t.width_of_arrows    == nil then t.width_of_arrows = 2 end
    if t.length_of_arrows    == nil then t.length_of_arrows = 2.2 end
    if t.name == "vent" then
        if t.arg    == "S"        then t.arg = 180.0 end
        if t.arg    == "NNE"    then t.arg = 202.5 end
        if t.arg    == "SO"        then t.arg = 225.0 end
        if t.arg    == "ENE"    then t.arg = 247.5 end
        if t.arg    == "O"        then t.arg = 270.0 end
        if t.arg    == "ESE"    then t.arg = 292.5 end
        if t.arg    == "NO"        then t.arg = 315.0 end
        if t.arg    == "SSE"    then t.arg = 337.5 end
        if t.arg    == "N"        then t.arg = 360.0 end
        if t.arg    == "SSO"    then t.arg = 22.5 end
        if t.arg    == "NE"        then t.arg = 45.0 end
        if t.arg    == "OSO"    then t.arg = 67.5 end
        if t.arg    == "E"        then t.arg = 90.0 end
        if t.arg    == "ONO"    then t.arg = 112.5 end
        if t.arg    == "SE"        then t.arg = 135.0 end
        if t.arg    == "NNO"    then t.arg = 157.5 end
    end
    value = tonumber(conky_parse(t.arg))
    if value == nil then value = 0 end
-- начальный угол
    local sa = t.start_angle * (math.pi / 180)
-- конечный угол
    local ea = t.end_angle * (math.pi / 180)
-- расчет угла движения стрелки
    gamma = math.pi/2-math.atan(t.width_of_arrows/(t.radius*t.length_of_arrows))
    arc = ((ea - sa)/t.max)* value + sa
    arc0=arc-gamma
    arc1=arc+gamma
    xx = t.x + t.radius*math.sin(arc)*t.length_of_arrows
    yy = t.y - t.radius*math.cos(arc)*t.length_of_arrows
    x0 = t.x + t.width_of_arrows*math.sin(arc0)
    y0 = t.y - t.width_of_arrows*math.cos(arc0)
    x1 = t.x + t.width_of_arrows*math.sin(arc1)
    y1 = t.y - t.width_of_arrows*math.cos(arc1)
    cairo_set_line_width(cr,1)
    cairo_set_source_rgba(cr, 0, 0, 0, 0.5)
-- рисуем стрелку
-- dessiner une flèche
    cairo_move_to (cr, x0, y0)
    cairo_curve_to (cr, x0, y0, xx, yy, x1, y1)
    cairo_arc(cr, t.x, t.y, t.width_of_arrows, arc1, arc0)
    pat = cairo_pattern_create_radial (t.x, t.y, t.radius/10, t.x, t.y, t.radius*t.length_of_arrows)
    if t.name == "vent" then
-- для ветра устанавливаем цвет синий переходящий в красный (не очень заметно)
--régler la couleur du vent de bleu à rouge (pas très visible)
        cairo_pattern_add_color_stop_rgba (pat, 0.6, 0.4, 0.6, 0.9, 0.8)   --bleu
        cairo_pattern_add_color_stop_rgba (pat, 0.6, 1, 1, 0.8, 1) --rouge
    else
-- для давления красный
-- pour la pression rouge
        cairo_pattern_add_color_stop_rgba (pat, 0, 0.8, 0, 0, 0.8)
        cairo_pattern_add_color_stop_rgba (pat, 1, 1, 0, 0, 1)  -- rouge
    end
    cairo_set_source (cr, pat)
    cairo_fill (cr)
    cairo_pattern_destroy (pat)
end
--[[  Немного поясню, из чего состоит строка
 cairo_pattern_add_color_stop_rgba (pat, 1, 1, 0, 0, 0.5)
цифры означают: 1- слой, 1-красный, 0-зеленый, 0-синий, 0.5-насыщенность
слой имеет значения от 0 до 1]]--
--[[[ Je vais expliquer un peu en quoi consiste la chaîne de caractères
 cairo_pattern_add_color_stop_rgba (pat, 1, 1, 0, 0, 0.5)
les nombres signifient : 1-couche, 1-rouge, 0-vert, 0-bleu, 0,5-saturation
la couche a des valeurs de 0 à 1]]--.
Image

@+
HP Pavilion g 7 1357 sf avec ssd Tessa cinnamon Mageia 7rc mate
Asus ROG avec xubuntu 18.04 et xubuntu 19.04

Image

Avatar du membre
loutch
Messages : 517
Enregistré le : lun. 13 juil. 2015 17:32
Localisation : Sarreguemines

Re: Conky 2023

Message par loutch »

Re

Jamais deux sans trois.

Une horloge

conkyrc

Code : Tout sélectionner



conky.config = {
    background = true,
    use_xft = true,
    font = 'gerinald:size=7',
    xftalpha = 1,
    update_interval = 1.0,
    total_run_times = 0,
    net_avg_samples = 2,
    own_window = true,
    own_window_transparent = true,
--own_window_color 000000
own_window_argb_visual = true,
--own_window_argb_value = 250,
    own_window_type = 'normal',
    own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
    double_buffer = true,
    minimum_width = 320, minimum_height = 320,
    maximum_width = 320,
    text_buffer_size = 2048,
    draw_shades = false,
    draw_outline = false,
    draw_borders = false,
    draw_graph_borders = false,
    default_color = 'white',
    default_outline_color = 'white',
    alignment = 'top_right',
    gap_x = 120,
    gap_y = 70,
    no_buffers = true,
    uppercase = false,
    cpu_avg_samples = 2,
    override_utf8_locale = true,
    imlib_cache_flush_interval = 60,
    imlib_cache_size = 10000,
    stippled_borders = 5,
-- Couleurs
    default_color         = '#ffffff',      --ffd579
    default_shade_color   = '#333333',
    default_outline_color = 'black',

 lua_load = '~/.conky/cronograph/scripts/loader.lua',
 lua_draw_hook_pre = 'loader_lua',

};

conky.text = [[
${voffset 66}${alignc 14}${time %d}
${voffset 01}${alignc 20}${time %a}  ${offset 8}${time %b}
${voffset 50}${goto 96}${cpu cpu0} % ${goto 188}${cpu cpu1} %
${voffset 50}${alignc 6}${uptime}   
${execpi 1 cat ~/.conky/cronograph/scripts/blinkingLED}
${lua fDrawImage $HOME/.conky/cronograph/images/c2.png 0 0 300 300}

]];

loader.lua

Code : Tout sélectionner


require 'cairo'

function conky_loader_lua()
usrhome = os.getenv("HOME")
	dofile (usrhome .."/.conky/cronograph/scripts/clock_rings.lua")
	dofile (usrhome .."/.conky/cronograph/scripts/multi_rings.lua")
	dofile (usrhome .."/.conky/lua/image.lua")

	conky_main()
        conky_clock_rings()
end

clock_rings.lua

Code : Tout sélectionner

--[[
Clock Rings by londonali1010 (2009)

This script draws percentage meters as rings, and also draws clock hands if you want! It is fully customisable; all options are described in the script. This script is based off a combination of my clock.lua script and my rings.lua script.

IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement near the end of the script uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num > 5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num > 3; conversely if you update Conky every 0.5s, you should use update_num > 10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.

To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
	lua_load ~/scripts/clock_rings-v1.1.1.lua
	lua_draw_hook_pre clock_rings

Changelog:
+ v1.1.1 -- Fixed minor bug that caused the script to crash if conky_parse() returns a nil value (20.10.2009)
+ v1.1 -- Added colour option for clock hands (07.10.2009)
+ v1.0 -- Original release (30.09.2009)
]]

settings_table = {
	{
		-- Edit this table to customise your rings.
		-- You can create more rings simply by adding more elements to settings_table.
		-- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
		name='time',
		-- "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 ''.
		arg='%I.%M',
		-- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
		max=12,
		-- "bg_colour" is the colour of the base ring.
		bg_colour=0xFFFFFF,
		-- "bg_alpha" is the alpha value of the base ring.
		bg_alpha=0.2,
		-- "fg_colour" is the colour of the indicator part of the ring.
		fg_colour=0xFFFFFF,
		-- "fg_alpha" is the alpha value of the indicator part of the ring.
		fg_alpha=0.8,
		-- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
		x=150, y=150,
		-- "radius" is the radius of the ring.
		radius=124,
		-- "thickness" is the thickness of the ring, centred around the radius.
		thickness=3,
		-- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
		start_angle=0,
		-- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger than start_angle.
		end_angle=360
	},
	{
		name='time',
		arg='%M.%S',
		max=60,
		bg_colour=0xFFFFFF,
		bg_alpha=0.2,
		fg_colour=0xFFFFFF,
		fg_alpha=0.8,
		x=150, y=150,
		radius=120,
		thickness=2,
		start_angle=0,
		end_angle=360
	},
	{
		name='time',
		arg='%S',
		max=60,
		bg_colour=0xFFFFFF,
		bg_alpha=0.2,
		fg_colour=0xFFFFFF,
		fg_alpha=0.8,
		x=150, y=150,
		radius=116,
		thickness=2,
		start_angle=0,
		end_angle=360
	},
	{
		name='',
		arg='',
		max=100,
		bg_colour=0x000000,
		bg_alpha=0.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=150,
		radius=66,
		thickness=130,
		start_angle=0,
		end_angle=360
	},
	{
		name='',
		arg='',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=150,
		radius=1,
		thickness=10,
		start_angle=0,
		end_angle=360
	},
	{
		name='',
		arg='',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=85, y=150,
		radius=30,
		thickness=1,
		start_angle=0,
		end_angle=360
	},
	{
		name='',
		arg='',
		max=100,
		bg_colour=0x000000,
		bg_alpha=0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=85, y=150,
		radius=15,
		thickness=27,
		start_angle=0,
		end_angle=360
	},
	{
		name='',
		arg='',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=85, y=150,
		radius=1,
		thickness=2,
		start_angle=0,
		end_angle=360
	},
	{
		name='',
		arg='',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=215, y=150,
		radius=30,
		thickness=1,
		start_angle=0,
		end_angle=360
	},
	{
		name='',
		arg='',
		max=100,
		bg_colour=0x000000,
		bg_alpha=0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=215, y=150,
		radius=15,
		thickness=27,
		start_angle=0,
		end_angle=360
	},
	{
		name='',
		arg='',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=215, y=150,
		radius=1,
		thickness=2,
		start_angle=0,
		end_angle=360
	},
	{
		name='',
		arg='',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=75,
		radius=25,
		thickness=1,
		start_angle=0,
		end_angle=360
	},
	{
		name='',
		arg='',
		max=100,
		bg_colour=0x000000,
		bg_alpha=0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=75,
		radius=13,
		thickness=22,
		start_angle=0,
		end_angle=360
	},
	{
		name='',
		arg='',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=75,
		radius=1,
		thickness=2,
		start_angle=0,
		end_angle=360
	},
	}

-- Use these settings to define the origin and extent of your clock.

clock_r=100

-- "clock_x" and "clock_y" are the coordinates of the centre of the clock, in pixels, from the top left of the Conky window.

clock_x=150
clock_y=150

-- Colour & alpha of the clock hands

clock_colour=0xFFFFFF
clock_alpha=1

-- Do you want to show the seconds hand?

show_seconds=true

require 'cairo'

function rgb_to_r_g_b(colour,alpha)
	return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function draw_ring(cr,t,pt)
	local w,h=conky_window.width,conky_window.height

	local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
	local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']

	local angle_0=sa*(2*math.pi/360)-math.pi/2
	local angle_f=ea*(2*math.pi/360)-math.pi/2
	local t_arc=t*(angle_f-angle_0)

	-- Draw background ring

	cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
	cairo_set_line_width(cr,ring_w)
	cairo_stroke(cr)

	-- Draw indicator ring

	cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
	cairo_stroke(cr)
end

function draw_clock_hands(cr,xc,yc)
	local secs,mins,hours,secs_arc,mins_arc,hours_arc
	local xh,yh,xm,ym,xs,ys

	secs=os.date("%S")
	mins=os.date("%M")
	hours=os.date("%I")

	secs_arc=(2*math.pi/60)*secs
	mins_arc=(2*math.pi/60)*mins+secs_arc/60
	hours_arc=(2*math.pi/12)*hours+mins_arc/12

	-- Draw hour hand

	xh=xc+0.7*clock_r*math.sin(hours_arc)
	yh=yc-0.7*clock_r*math.cos(hours_arc)
	cairo_move_to(cr,xc,yc)
	cairo_line_to(cr,xh,yh)

	cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
	cairo_set_line_width(cr,5)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(clock_colour,clock_alpha))
	cairo_stroke(cr)

	-- Draw minute hand

	xm=xc+clock_r*math.sin(mins_arc)
	ym=yc-clock_r*math.cos(mins_arc)
	cairo_move_to(cr,xc,yc)
	cairo_line_to(cr,xm,ym)

	cairo_set_line_width(cr,3)
	cairo_stroke(cr)

	-- Draw seconds hand

	if show_seconds then
		xs=xc+clock_r*math.sin(secs_arc)
		ys=yc-clock_r*math.cos(secs_arc)
		cairo_move_to(cr,xc,yc)
		cairo_line_to(cr,xs,ys)

		cairo_set_line_width(cr,1)
		cairo_stroke(cr)
	end
end

function conky_clock_rings()
	local function setup_rings(cr,pt)
		local str=''
		local value=0

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

		value=tonumber(str)
		if value == nil then value = 0 end
		pct=value/pt['max']

		draw_ring(cr,pct,pt)
	end

	-- Check that Conky has been running for at least 5s

	if conky_window==nil then return end
	local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)

	local cr=cairo_create(cs)	

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

	if update_num>5 then
		for i in pairs(settings_table) do
			setup_rings(cr,settings_table[i])
		end
	end

	draw_clock_hands(cr,clock_x,clock_y)
end

multi_rings.lua

Code : Tout sélectionner

--==============================================================================
--                            multi_rings.lua
--
--  author  : SLK
--  version : v2011011601
--  license : Distributed under the terms of GNU GPL version 2 or later
--
--==============================================================================

require 'cairo'

--------------------------------------------------------------------------------
--                                                                    clock DATA
-- HOURS
clock_h = {
    {
    name='time',                   arg='%H',                    max_value=12,
    x=150,                           y=150,
    graph_radius=140,
    graph_thickness=0,
    graph_unit_angle=30,           graph_unit_thickness=5,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.0,
    txt_radius=100,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.0,
    graduation_radius=125,
    graduation_thickness=10,        graduation_mark_thickness=2,
    graduation_unit_angle=30,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
    },
}
-- MINUTES
clock_m = {
    {
    name='time',                   arg='%M',                    max_value=60,
    x=150,                           y=150,
    graph_radius=100,
    graph_thickness=3,
    graph_unit_angle=6,            graph_unit_thickness=3,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.0,
    txt_radius=100,
    txt_weight=0,                  txt_size=9.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.0,
    graduation_radius=57,
    graduation_thickness=0,        graduation_mark_thickness=2,
    graduation_unit_angle=30,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
    },
}
-- SECONDS
clock_s = {
    {
    name='time',                   arg='%S',                    max_value=60,
    x=150,                           y=150,
    graph_radius=50,
    graph_thickness=32,
    graph_unit_angle=6,            graph_unit_thickness=3,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.0,
    txt_radius=100,
    txt_weight=0,                  txt_size=12.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.0,
    graduation_radius=0,
    graduation_thickness=0,        graduation_mark_thickness=0,
    graduation_unit_angle=0,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
    },
}

--------------------------------------------------------------------------------
--                                                                    gauge DATA
gauge = {
{
    name='cpu',                    arg='cpu0',                  max_value=100,
    x=105,                       y=150,
    graph_radius=10,
    graph_thickness=15,
    graph_start_angle=0,
    graph_unit_angle=3.5,          graph_unit_thickness=3.0,
    graph_bg_colour=0xFFFFFF,      graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.0,
    hand_fg_colour=0xFFFFFF,       hand_fg_alpha=1.0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.0,
    graduation_radius=27,
    graduation_thickness=4,        graduation_mark_thickness=4,
    graduation_unit_angle=30,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.0,
},
{
    name='cpu',                arg='cpu1',                      max_value=100,
    x=195,                        y=150,
    graph_radius=10,
    graph_thickness=15,
    graph_start_angle=0,
    graph_unit_angle=3.5,          graph_unit_thickness=3.0,
    graph_bg_colour=0xFFFFFF,      graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.0,
    hand_fg_colour=0xFFFFFF,       hand_fg_alpha=1.0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.0,
    graduation_radius=27,
    graduation_thickness=4,        graduation_mark_thickness=4,
    graduation_unit_angle=30,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.0,
},
{
    name='fs_used_perc',                arg='/',                      max_value=100,
    x=150,                        y=75,
    graph_radius=10,
    graph_thickness=23,
    graph_start_angle=0,
    graph_unit_angle=3.5,          graph_unit_thickness=3.0,
    graph_bg_colour=0xFFFFFF,      graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.0,
    hand_fg_colour=0xFFFFFF,       hand_fg_alpha=0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.0,
    graduation_radius=22,
    graduation_thickness=4,        graduation_mark_thickness=4,
    graduation_unit_angle=30,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.0,
},
}

-------------------------------------------------------------------------------
--                                                                 rgb_to_r_g_b
-- converts color in hexa to decimal
--
function rgb_to_r_g_b(colour, alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

-------------------------------------------------------------------------------
--                                                            angle_to_position
-- convert degree to rad and rotate (0 degree is top/north)
--
function angle_to_position(start_angle, current_angle)
    local pos = current_angle + start_angle
    return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end

-------------------------------------------------------------------------------
--                                                              draw_clock_ring
-- displays clock
--
function draw_clock_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']

    -- background ring
    cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi)
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)

    -- arc of value
    local val = (value % max_value)
    local i = 1
    while i <= val do
        cairo_arc(display, x, y, graph_radius,(  ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360)  )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2))
        cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = (graph_unit_angle * i) - graph_unit_thickness

    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = 360 / graduation_unit_angle
        local i = 1
        while i <= nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end

    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * (math.cos((angle * 2 * math.pi / 360)-(math.pi/2)))
    local movey = txt_radius * (math.sin((angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight);
    cairo_set_font_size (display, txt_size);
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha));
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3);
    cairo_show_text (display, value);
    cairo_stroke (display);
end

-------------------------------------------------------------------------------
--                                                              draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_start_angle = data['graph_start_angle']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
    local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
    local graph_end_angle = (max_value * graph_unit_angle) % 360

    -- background ring
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)

    -- arc of value
    local val = value % (max_value + 1)
    local start_arc = 0
    local stop_arc = 0
    local i = 1
    while i <= val do
        start_arc = (graph_unit_angle * i) - graph_unit_thickness
        stop_arc = (graph_unit_angle * i)
        cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
        cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = start_arc

    -- hand
    start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
    stop_arc = (graph_unit_angle * val)
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
    cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
    cairo_stroke(display)

    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = graph_end_angle / graduation_unit_angle
        local i = 0
        while i < nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
            stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
            cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end

    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
    local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
    cairo_set_font_size (display, txt_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
    cairo_show_text (display, value)
    cairo_stroke (display)

    -- caption
    local caption = data['caption']
    local caption_weight, caption_size = data['caption_weight'], data['caption_size']
    local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
    local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
    cairo_set_font_size (display, caption_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
    cairo_move_to (display, x + tox + 5, y + toy + 1)
    -- bad hack but not enough time !
    if graph_start_angle < 105 then
        cairo_move_to (display, x + tox - 30, y + toy + 1)
    end
    cairo_show_text (display, caption)
    cairo_stroke (display)
end

-------------------------------------------------------------------------------
--                                                               go_clock_rings
-- loads data and displays clock
--
function go_clock_rings(display)
    local function load_clock_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_clock_ring(display, data, value)
    end
    
    for i in pairs(clock_h) do
        load_clock_rings(display, clock_h[i])
    end
    for i in pairs(clock_m) do
        load_clock_rings(display, clock_m[i])
    end
    for i in pairs(clock_s) do
        load_clock_rings(display, clock_s[i])
    end
end

-------------------------------------------------------------------------------
--                                                               go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
    local function load_gauge_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_gauge_ring(display, data, value)
    end
    
    for i in pairs(gauge) do
        load_gauge_rings(display, gauge[i])
    end
end

-------------------------------------------------------------------------------
--                                                                         MAIN
function conky_main()
    if conky_window == nil then 
        return
    end

    local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    local display = cairo_create(cs)
    
    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)
    
    if update_num > 5 then
        go_clock_rings(display)
        go_gauge_rings(display)
    end

end


l'image de la montre est prise ici , il faut la modifier avec gimp ou autre pour l'avoir transparente (color to alpha)

https://www.automotivpress.fr/wp-conten ... 4x1024.jpg

Image

@+
HP Pavilion g 7 1357 sf avec ssd Tessa cinnamon Mageia 7rc mate
Asus ROG avec xubuntu 18.04 et xubuntu 19.04

Image

Avatar du membre
loutch
Messages : 517
Enregistré le : lun. 13 juil. 2015 17:32
Localisation : Sarreguemines

Re: Conky 2023

Message par loutch »

Re

L'ensemble donne ceci .

Image

@+
HP Pavilion g 7 1357 sf avec ssd Tessa cinnamon Mageia 7rc mate
Asus ROG avec xubuntu 18.04 et xubuntu 19.04

Image

Avatar du membre
loutch
Messages : 517
Enregistré le : lun. 13 juil. 2015 17:32
Localisation : Sarreguemines

Re: Conky 2023

Message par loutch »

Bonjour

conkyrc

Code : Tout sélectionner

conky.config = {
	background = true,
	use_xft = true,
	font = 'Liberation Sans:size=7',
	xftalpha = 1,
	update_interval = 1.0,
	total_run_times = 0,
	own_window = true,
	own_window_transparent = false,
-- own_window_color = 000000,
        own_window_argb_visual = true,
        own_window_argb_value = 00,
	own_window_type = 'normal',
	own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
	double_buffer = true,
	minimum_width = 270, minimum_height = 550,
        maximum_width = 270,
	text_buffer_size = 2048,
	draw_shades = false,
	draw_outline = false,
	draw_borders = false,
	draw_graph_borders = false,
	default_color = 'white',
	default_outline_color = 'white',
	alignment = 'top_right',
	gap_x = 36,
	gap_y = 330,
	no_buffers = true,
	uppercase = false,
	cpu_avg_samples = 2,
	override_utf8_locale = true,
        imlib_cache_flush_interval = 60,
	imlib_cache_size = 10000,


-- Taille des pointillés
	stippled_borders = 5,

-- Couleurs 
	default_color = '#ffffff',
	default_shade_color = '#333333',
	default_outline_color = 'black',

 lua_load = '~/.conky/olgmen/scripts/loader.lua',
 lua_draw_hook_pre = 'loader_lua',

color1 = 'F5B800',
color2 = '00f5ff',
color3 = '828200',
color4 = '323200',
color5 = 'fdb72e',
color7 = '6495ee',
color9 = 'red',
};

conky.text = [[
${lua conky_draw_bg 20 0 6 270 452 0x000000 0.2}
${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/suite-bgv.png 0 0 273 460}
]];
loader

Code : Tout sélectionner

require 'cairo'

function conky_loader_lua()
usrhome = os.getenv("HOME")
	dofile (usrhome .."/.conky/olgmen/scripts/datah.lua")
	dofile (usrhome .."/.conky/olgmen/scripts/draw_bg.lua")
	dofile (usrhome .."/.conky/lua/image.lua")

	conky_widgets()
	

end
datah

Code : Tout sélectionner

--[[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/text.lua")            -- script sorties textes
dofile (usrhome .."/.conky/olgmen/scripts/scale.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 ="CPU 0" .. "                                                                                               " .. "°C",
    x = 20,
    y = 15,
    font_size = 9,
    bold = false,
    h_align = "l",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    },   
  
    {
    text ="Freq",      
    x = 130,
    y = 15,
    font_size = 9,
    bold = false,
    h_align = "l",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    }, 
    
    {
    text ="Ram" .."            ".."Swap" ,
    x = 25,
    y = 115,
    font_size = 9,
    bold = false,
    h_align = "l",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    },
    
    {
    text ="/" .."                  ".."/Home" ,
    x = 190,
    y = 115,
    font_size = 9,
    bold = false,
    h_align = "l",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    },
     
    {
    text ="Nvidia" .."                                                                                         ".."Intel" ,
    x = 25,
    y = 245,
    font_size = 9,
    bold = false,
    h_align = "l",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    },    
    
   {
    text ="Vitesse",
    x = 120,
    y = 245,
    font_size = 9,
    bold = false,
    h_align = "l",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    },    

    {
    text = "Entrant" .. "           " .. "Sortant",
    x = 104,
    y = 355,
    font_size = 9,
    bold = false,
    h_align = "l",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    },
    
    {
    text = conky_parse("${top name 1}"),
    x = 60,
    y = 35,
    font_size = 10,
    bold = false,
    h_align = "l",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    },
    
    {
    text = conky_parse("${top cpu 1}%"),
    x = 190,
    y = 35,
    font_size = 10,
    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 mem 1)}%"),
    x = 135,
    y = 135,
    font_size = 10,
    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 = 60,
    y = 45,
    font_size = 10,
    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 = 135,
    y = 145,
    font_size = 10,
    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 = 190,
    y = 45,
    font_size = 10,
    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 = 60,
    y = 55,
    font_size = 10,
    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 = 135,
    y = 155,
    font_size = 10,
    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 = 190,
    y = 55,
    font_size = 10,
    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 = 60,
    y = 65,
    font_size = 10,
    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 = 135,
    y = 165,
    font_size = 10,
    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 = 190,
    y = 65,
    font_size = 10,
    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 = 60,
    y = 75,
    font_size = 10,
    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 5)}%"),
    x = 135,
    y = 175,
    font_size = 10,
    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 5}%"),
    x = 190,
    y = 75,
    font_size = 10,
    bold = false,
    h_align = "c",
    v_align = "m",
    colour = text_color ,--{{0, 0x555500, 1},{0.5, 0xcfcf00, 1},{1, 0x555500, 1}},
    orientation="nn",
    },

    {
    text = "Total",
    x = 25,
    y = 380,
    font_size = 10,
    bold = false,
    h_align = "c",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    },

    {
    text = conky_parse("${totaldown wlo1}"),
    x = 15,
    y = 400,
    font_size = 10,
    bold = false,
    h_align = "l",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    },

    {
    text = conky_parse("${downspeedf wlo1}"),
    x = 25,
    y = 420,
    font_size = 10,
    bold = false,
    h_align = "c",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    },

{
    text = "Total",
    x = 225,
    y = 380,
    font_size = 10,
    bold = false,
    h_align = "c",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    },

    {
    text = conky_parse("${totalup wlo1}"),
    x = 215,
    y = 400,
    font_size = 10,
    bold = false,
    h_align = "l",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    },

    {
    text = conky_parse("${upspeedf wlo1}"),
    x = 225,
    y = 420,
    font_size = 10,
    bold = false,
    h_align = "c",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    },

    {
    text = conky_parse("${wireless_essid wlo1}"),
    x = 110,
    y = 450,
    font_size = 10,
    bold = false,
    h_align = "c",
    v_align = "m",
    colour = text_color,
    orientation="nn",
    },

   {
    text = conky_parse("${wireless_link_qual_perc wlo1}%"),
    x = 170,
    y = 450,
    font_size = 10,
    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 = 20,
    width = 42,
    height = 80,
    scale = 20,
    colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
    font_size = 11,
    },
{
    name = "freq",
    arg = "cpu",
    x = 120,
    y = 20,
    width = 38,
    height = 80,
    scale = 20,
    colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
    font_size = 9,
    side = "left",
    },
   
{
    name = "exec",
    arg = "expr `cat /sys/class/hwmon/hwmon4/temp1_input` / 1000",
    x = 220,
    y = 20,
    width = 42,
    height = 80,
    scale = 20,
    colour_scale = {{0, 0xff0000, 1},{0.5, 0xffffff, 1},{1, 0x0000ff, 1}},
    font_size = 11,
    },
    
    
    {
    name = "memperc",
    arg = "",
    x = 10,
    y = 120,
    width = 42,
    height = 80,
    scale = 20,
    colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
    font_size = 11,
    },
    
    {
    name = "swapperc",
    arg = "",
    x = 60,
    y = 120,
    width = 42,
    height = 80,
    scale = 20,
    colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
    font_size = 11,
    },
    
    {
    name = "fs_used_perc",
    arg = "/",
    x = 170,
    y = 120,
    width = 42,
    height = 80,
    scale = 20,
    colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
    font_size = 11,
    },
    
    {
    name = "fs_used_perc",
    arg = "/home",
    x = 220,
    y = 120,
    width = 42,
    height = 80,
    scale = 20,
    colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
    font_size = 11,
    },
    
    {
    name = "exec",
    arg = "nvidia-settings -t -q [gpu:0]/GPUCoreTemp", -- nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader
    x = 10,
    y = 250,
    width = 42,
    height = 80,
    scale = 20,
    colour_scale = {{0, 0xff0000, 1},{0.5, 0xffffff, 1},{1, 0x0000ff, 1}},
    font_size = 11,
    },
    
    {
    name = "exec",
    arg = "sensors | grep -i fan |awk '{print $2}'",
    x = 120,
    y = 250,
    width = 38,
    height = 80,
    scale = 20,
    colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
    font_size = 9,
    },

{
    name = "hwmon",
    arg = "1 temp 1",
    x = 220,
    y = 250,
    width = 42,
    height = 80,
    scale = 20,
    colour_scale = {{0, 0xff0000, 1},{0.5, 0xffffff, 1},{1, 0x0000ff, 1}},
    font_size = 11,
    },

    {
    name = "",
    arg = math.ceil(conky_parse("${downspeedf wlo1}")),
    x = 100,
    y = 360,
    width = 42,
    height = 80,
    scale = 20,
        colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},    
    font_size = 9,
    },
    {
    name = "",
    arg = math.ceil(conky_parse("${upspeedf wlo1}")),
    x = 150,
    y = 360,
    width = 42,
    height = 80,
    scale = 20,
    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
Image

@+
Modifié en dernier par loutch le lun. 8 mai 2023 10:02, modifié 1 fois.
HP Pavilion g 7 1357 sf avec ssd Tessa cinnamon Mageia 7rc mate
Asus ROG avec xubuntu 18.04 et xubuntu 19.04

Image

Avatar du membre
loutch
Messages : 517
Enregistré le : lun. 13 juil. 2015 17:32
Localisation : Sarreguemines

Re: Conky 2023

Message par loutch »

Bonjour

cronographe

J'y ai pas mis les aiguilles vu que j'ai l'heure sur un autre conky.

conkyrc

Code : Tout sélectionner

--[[ pkill -xf "conky -c ~/Conky/The_Clock.conky" &
     Chronograph LUA - mrpeachy (originally 4 clocks - tweaked by Sector11)
     LUA-Syntax 1.10,  04-2023 @unklar
     https://thepeachyblog.blogspot.com/p/index-or-home-page.html    
]]
conky.config = {
    own_window = true,
--own_window_colour ff0000
    own_window_class = 'Conky',
    own_window_transparent = true,
    own_window_argb_visual = true,
    own_window_type = 'normal', 
    own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',--
    minimum_width = 280, minimum_height = 280,
    maximum_width = 280,
    alignment = 'top_right',-- tl, tm, tr, bl, bm, br, ml, mr
    gap_x = 40,
    gap_y = 790,
    background = false,
    draw_borders = false,
    stippled_borders = 1,
    border_width = 1,
    draw_graph_borders = false,
    draw_shades = false,
    draw_outline = false,
    use_spacer = 'right',
    default_color = 'ffffff',
    default_shade_color = '000000',
    default_outline_color = 'ffffff',
    color0 = 'FFFF00',
    color1 = 'white',
    color2 = 'yellow',
    color3 = 'red',
    use_xft = true,
    font = 'Ubuntu:size=9',
    xftalpha = 1,
    
    uppercase = false,
    override_utf8_locale = true,
    update_interval = 1,
    total_run_times = 0,
    double_buffer = true,
    no_buffers = true,
    cpu_avg_samples = 2,
    net_avg_samples = 2,
    imlib_cache_size = 0,
    short_units = true,
    pad_percents = 2,
    text_buffer_size = 2048,
    imlib_cache_size = 00,
    lua_load = '~/.conky/cronographe/loader.lua',
    lua_draw_hook_pre = 'loader_lua',
};
conky.text = [[
${lua fDrawImage $HOME/.conky/cronographe/suite-bgv.png 15 15 270 270}
${lua fDrawImage $HOME/.conky/cronographe/c2.png -6 -5 314 314}
]];
loader

Code : Tout sélectionner

require 'cairo'
function conky_loader_lua()
usrhome = os.getenv("HOME")
        
    dofile (usrhome .."/.conky/cronographe/scripts/crono.lua")              
        dofile (usrhome .."/.conky/lua/image.lua")
        conky_main()
                
end

crono.lua

Code : Tout sélectionner

--chronograph mrpeachy 12/13/12 - i blame sector11 for starting the whole chronograph thing!
require 'cairo'
extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
function conky_main()
if conky_window == nil then return end
local updates=tonumber(conky_parse("${updates}"))
if 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)
cr = cairo_create(cs)
--#########################################################################################################
--defaults
default_font_name="White Rabbit"
default_font_size=16
default_font_face="n"
default_hex_color=0xffffff
default_alpha=1
default_red=1
default_green=1
default_blue=1
default_horizontal_justify="l"    --"l"=left, "r"=right, "c"=center
default_vertical_justify="n"     --"n"=normal, "nb"=normal-ybearing, "m"=middle, "mb"=middle-ybearing, "t"=top
default_rotation="0"
--font({f="name",fs=size,ff="face"}) face="n" or "b" or "i" or "bi"
--hexcolor({c=hexcolor,a=alpha})
--rgbcolor({r=,g=,b=,a=})
--text({x=x,y=y,t="text",hj=horizontal_justify,vj=vertical_justify,r=rotation})
--set center coordinates
centx,centy=150,150
--########################################################################################
--background circle
hexcolor({c=0x000000,a=0.3})
cairo_arc(cr,centx,centy,120,0,2*math.pi)
cairo_fill(cr)
--background circle
hexcolor({c=0x000000,a=0.0})
cairo_arc(cr,centx,centy,108,0,2*math.pi)
cairo_fill(cr)
--setup font and color
font({})
hexcolor({c=0xffffff})
--draw numbers and dots around main circle
for i=1,12 do
    if i==12 or i==4 or i==8 then
    x,y=pt(centx,centy,84,((360/12)*i))    
    text({y=y,x=x,t=i,hj="c",vj="m"})
    end
    if i==2 or i==6 or i==10 then
    hexcolor({c=0xffffff})
    x,y=pt(centx,centy,98,((360/12)*i))
    cairo_arc(cr,x,y,6,0,2*math.pi)
    cairo_fill(cr)
    else
    hexcolor({c=0xffffff})
    x,y=pt(centx,centy,98,((360/12)*i))
    cairo_arc(cr,x,y,4,0,2*math.pi)
    cairo_fill(cr)
    end
end--for
--draw inbetween marks
cairo_set_line_width(cr,1)
for i=1,60 do
    if string.find(i/5,"%.")~=nil then
    x,y=pt(centx,centy,108,((360/60)*i))
    cairo_move_to(cr,x,y)
    x,y=pt(centx,centy,98,((360/60)*i))
    cairo_line_to(cr,x,y)
    cairo_stroke(cr)
    end
end--for
--outer circle
cairo_arc(cr,centx,centy,108,0,2*math.pi)
cairo_stroke(cr)
--########################################################################################
--hours of day at 2 position
dcx,dcy=pt(centx,centy,98,60)
font({fs=8})
--numbers
for i=0,24,3 do
x,y=pt(dcx,dcy,68,180+((120/24)*i))
text({y=y,x=x,t=string.format("%02d",i),hj="c",vj="m"})
end--for
--marks
for i=0,24 do
    if string.find(i/3,"%.")~=nil and i~=0 then
    x,y=pt(dcx,dcy,60,180+((120/24)*i))
    cairo_move_to(cr,x,y)
    x,y=pt(dcx,dcy,56,180+((120/24)*i))
    cairo_line_to(cr,x,y)
    cairo_stroke(cr)
    else
    x,y=pt(dcx,dcy,58,180+((120/24)*i))
    cairo_arc(cr,x,y,1.5,0,2*math.pi)
    cairo_fill(cr)
    end
end
--day name
font({fs=14})
dtx,dty=pt(dcx,dcy,30,180+60)
text({x=dtx,y=dty,t=string.upper(os.date("%a")),hj="c",vj="m"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xffffff})
hour=tonumber(os.date("%H"))
dpx,dpy=pt(dcx,dcy,54,180+(120*(hour/24)))
cairo_move_to(cr,dcx,dcy)
cairo_line_to(cr,dpx,dpy)
cairo_stroke(cr)
--########################################################################################
--days of month at 6 position
font({fs=8})
hexcolor({c=0xffffff})
cairo_set_line_width(cr,1)
mcx,mcy=pt(centx,centy,98,180)
--date calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time({year=year,month=03,day=01,hour=00,min=0,sec=0});
local t2 = os.time({year=year,month=02,day=01,hour=00,min=0,sec=0});
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={31,feb,31,30,31,30,31,31,30,31,30,31} 
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
--marks
for i=1,mdays do
    if string.find((i-1)/3,"%.")~=nil then
    x,y=pt(mcx,mcy,60,300+((120/mdays)*i))
    cairo_move_to(cr,x,y)
    x,y=pt(mcx,mcy,56,300+((120/mdays)*i))
    cairo_line_to(cr,x,y)
    cairo_stroke(cr)
    else
    x,y=pt(mcx,mcy,60,300+((120/mdays)*i))
    cairo_move_to(cr,x,y)
    x,y=pt(mcx,mcy,54,300+((120/mdays)*i))
    cairo_line_to(cr,x,y)
    cairo_stroke(cr)
    end
end--for
--numbers
for i=1,mdays,3 do
x,y=pt(mcx,mcy,68,300+((120/mdays)*i))
text({y=y,x=x,t=string.format("%02d",i),hj="c",vj="m"})
end--for
--month name
font({fs=16})
text({x=mcx,y=mcy-30,t=string.upper(os.date("%b")),hj="c",vj="m"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xffffff})
day=tonumber(os.date("%e"))
mpx,mpy=pt(mcx,mcy,52,300+(120*(day/mdays)))
cairo_move_to(cr,mcx,mcy)
cairo_line_to(cr,mpx,mpy)
cairo_stroke(cr)
--########################################################################################
--months of year at 10 position
font({fs=8})
hexcolor({c=0xffffff})
cairo_set_line_width(cr,1)
ycx,ycy=pt(centx,centy,98,5*60)
--date calculations
td=0
for i=1,12 do
td=td+monthdays[i]
end
angle={}
ang=0
for i=1,12 do
ang=((monthdays[i]/td)*120)+ang
angle[i]=ang
end
months={"J","F","M","A","M","J","J","A","S","O","N","D"}
--arc line
cairo_arc(cr,ycx,ycy,60,adeg(60),adeg(60+ang))
cairo_stroke(cr)
--arc marks
for i=0,12 do
    x,y=pt(ycx,ycy,60,60+((angle[i] or 0)))
    cairo_move_to(cr,x,y)
    x,y=pt(ycx,ycy,56,60+((angle[i] or 0)))
    cairo_line_to(cr,x,y)
    cairo_stroke(cr)
end
--month letters
for i=1,12 do
x,y=pt(ycx,ycy,68,60+((120/12)*i)-(120/24))
text({y=y,x=x,t=months[i],hj="c",vj="m"})
end--for
--year text
font({fs=16})
ytx,yty=pt(ycx,ycy,30,60+60)
text({x=ytx,y=yty,t=string.upper(os.date("%y")),hj="c",vj="m"})
font({fs=12})
text({x=ytx-4,y=yty-10,t="20",hj="c",vj="n"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xffffff})
today=tonumber(os.date("%j"))-1
ypx,ypy=pt(ycx,ycy,55,60+(120*(today/td)))
cairo_move_to(cr,ycx,ycy)
cairo_line_to(cr,ypx,ypy)
cairo_stroke(cr)
--center circle
hexcolor({c=0xffffff,a=0})  -- couleur cercle centre aiguille a=0.8 pour voir
cairo_arc(cr,centx,centy,5,0,2*math.pi)
cairo_stroke(cr)
--hand calculations #######################################################
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- DRAW HOUR HAND
-- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*12))
--call hand drawing function
--hexcolor({c=0xccaa7a,a=0.8})
hexcolor({c=0xff0000,a=0}) -- aiguilles a=0.8 pour les voir
cairo_set_line_width(cr,2)
hands(
centx,--string or coodinate for clock center x
centy,--string or coodinate for clock center y
hsec_degs,--string or value for hand degrees
70,--string or value for hand length (radius)
3,--set hand center width in pixels
3,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.9--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)
--[[hands(
centx,--string or coodinate for clock center x
centy,--string or coodinate for clock center y
hsec_degs+180,--string or value for hand degrees
30,--string or value for hand length (radius)
6,--set hand center width in pixels
18,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
.8--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)--]]
--MINUTES HAND
--hexcolor({c=0xdac09b,a=0.8})
hands(
150,--string or coodinate for clock center x
150,--string or coodinate for clock center y
360*((m_to_s+seconds)/(60*60)),--string or value for hand degrees
99,--string or value for hand length (radius)
3,--set hand center width in pixels
3,--set hand mid width in degrees
2,--set hand end width in pixels, 0=a point
0.9--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)
--[[hands(
200,--string or coodinate for clock center x
200,--string or coodinate for clock center y
180+(360*((m_to_s+seconds)/(60*60))),--string or value for hand degrees
30,--string or value for hand length (radius)
4,--set hand center width in pixels
18,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.8--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)--]]
--#########################################################################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end--end main function
--this function draws hands
function hands(clock_centerx,clock_centery,degrees,length,hand_center_width,hand_mid_width,hand_end_width,distance_to_mid)
--draw_middle
--calc start point
xs,ys=pt(clock_centerx,clock_centery,hand_center_width,degrees-90)
cairo_move_to(cr,xs,ys)
x1,y1=pt(clock_centerx,clock_centery,length*distance_to_mid,degrees-(hand_mid_width/2))
cairo_line_to (cr,x1,y1)
x2,y2=pt(clock_centerx,clock_centery,length,degrees)
cairo_arc(cr,x2,y2,hand_end_width,(degrees+180)*(math.pi/180),(degrees)*(math.pi/180))
--cairo_line_to (cr,x2,y2)
x3,y3=pt(clock_centerx,clock_centery,length*distance_to_mid,degrees+(hand_mid_width/2))
cairo_line_to (cr,x3,y3)
--calc end point
xe,ye=pt(clock_centerx,clock_centery,hand_center_width,degrees+90)
cairo_line_to (cr,xe,ye)
cairo_arc(cr,clock_centerx,clock_centery,hand_center_width,(degrees)*(math.pi/180),(degrees+180)*(math.pi/180))
cairo_fill(cr)
end
function adeg(deg)
return(math.pi/180)*(deg-90)
end
function pt(px,py,prad,pdeg)
local ppo=(math.pi/180)*pdeg
local px1=px+prad*(math.sin(ppo))
local py1=py-prad*(math.cos(ppo))
return px1,py1
end
function font(fontt)
local name=fontt.f    or default_font_name    or "mono"
local size=fontt.fs    or default_font_size    or 12
local face=fontt.ff    or default_font_face    or "n"
if face=="n" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="b" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD)
elseif face=="i" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="bi" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_BOLD)
end
cairo_set_font_size(cr,size)
end
function hexcolor(hexcolort)
local col=hexcolort.c    or default_hex_color    or 0xffffff
local a=hexcolort.a    or default_alpha    or 1
local r,g,b=((col/0x10000) % 0x100)/255,((col/0x100) % 0x100)/255,(col % 0x100)/255
cairo_set_source_rgba(cr,r,g,b,a)
end
function rgbcolor(rgbcolort)
local r=rgbcolort.r        or default_red            or 1
local g=rgbcolort.g        or default_green        or 1
local b=rgbcolort.b        or default_blue            or 1
local a=rgbcolort.a        or default_alpha        or 1
cairo_set_source_rgba(cr,r,g,b,a)
end
function text(textt)
local x=textt.x         or 100
local y=textt.y         or 100
local t=textt.t         or "set txt"
local hj=textt.hj         or default_horizontal_justify        or "l"
local vj=textt.vj         or default_vertical_justify        or "n"
local r=textt.r            or default_rotation            or 0
cairo_text_extents(cr,t,extents)
local wx=extents.x_advance
local wd=extents.width
local hy=extents.height
local bx=extents.x_bearing
local by=extents.y_bearing+hy
--hl-- l=left, c=center, r=right
if hj=="l" then
xa=x-bx
rad=0
elseif hj=="c" then
xa=x-((wx-bx)/2)-bx
rad=(wx-bx)/2
elseif hj=="r" then
xa=x-wx
rad=wx-bx
else
print ('hj not set correctly for text: '..t..' - "l", "c" or "r"')
xa=0
rad=0
end
--vj-- n=normal, nb=normal-ybearing, m=middle, mb=middle-ybearing, t=top
if vj=="n" then
ya=y
rad2=0
ry=by
elseif vj=="nb" then
ya=y-by
rad2=-by
ry=by
elseif vj=="m" then
ya=y+((hy-by)/2)
rad2=((hy-by)/2)
ry=((hy-by)/2)-by
elseif vj=="mb" then
ya=y+(hy/2)-by
rad2=(hy/2)-by
ry=((hy-by)/2)-by
elseif vj=="t" then
ya=y+hy-by
rad2=hy-by
ry=0+by
else
print ('vj not set correctly for text: '..t..' - "n", "nb", "m", "mb" or "t"')
ya=0
rad2=0
ry=0
end
--rotation
if r~=0 then
local x2,y2=pt(x,y,rad2,r-180)
local x1,y1=pt(x2,y2,rad,r-90)
cairo_save (cr)
cairo_translate (cr,x1,y1)
cairo_rotate(cr,(math.pi/180)*r)
cairo_show_text (cr,t)
cairo_stroke (cr)
cairo_restore (cr)
else
cairo_move_to (cr,xa,ya)
cairo_show_text (cr,t)
cairo_stroke (cr)
end--if ro
--set non local variables to nil
xa=nil;ya=nil;rad=nil;rad2=nil;ry=nil
end--function text ################################################################### 
Image

@+
HP Pavilion g 7 1357 sf avec ssd Tessa cinnamon Mageia 7rc mate
Asus ROG avec xubuntu 18.04 et xubuntu 19.04

Image

Répondre