You are not logged in.

#1901 2023-05-10 07:07:23

loutch
Member
Registered: 2015-12-12
Posts: 848

Re: Show us your conky

Hello

Es war nur zu sehen, eine Menge Leute sprechen über bing.com Bilder, so dass ich dachte, warum nicht versuchen, etwas, das auch auf Linux funktioniert, vor allem zu kitzeln die windosians ein wenig zu machen

Heute Morgen habe ich einfach den weg zum bild  (~/bingimages/) geändert, und ich habe keine Fehler mehr in der Konsole )
Linux-Magie vielleicht, aber es funktioniert 

conky -c ~/.conky/bing/conkyrc
conky: desktop window (e00044) is subwindow of root window (19d)
conky: window type - normal
conky: drawing to created window (0x5000002)
conky: drawing to double buffer
conky: forked to background, pid is 15725

---------------------------------------------
It was just to see, a lot of people talk about bing.com images so I thought why not try to make something that also works on linux,
especially to titillate the windosians a bit

This morning I just changed the path of the image recovery folder (~/bingimages/) and I have no more errors in the console
Linux magic perhaps, but it works 

@+

Last edited by loutch (2023-05-10 07:41:18)


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

#1902 2023-05-10 15:37:02

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,641

Re: Show us your conky

Félicitations !
Congratulations!

@loutch,
peux-tu mettre ton script à ma disposition, s'il te plaît ?
Merci !

${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/suite-bgv.png 15 10 270 270}
${execi 1800 bash $HOME/conky-openmeteo/Suisse/suisse.sh}

-------------
@loutch,
can you please provide me with your script?
Thanks!

Last edited by unklar (2023-05-10 15:38:41)

Offline

#1903 2023-05-10 15:51:47

loutch
Member
Registered: 2015-12-12
Posts: 848

Re: Show us your conky

Hello

No problemo

suisse.sh

#!/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/barometre/reptravail/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

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

--créer par  Didier-T

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

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

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

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

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

		if arc then
			cairo_rotate (cr, arc)
		end

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

barometre.lua

--[[ 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/barometre/reptravail/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/barometre/reptravail/pre}') .. "mb",
font_name = "MonogramsToolbox",
font_size = 8,
bold = true,
start_angle = 290,
end_angle = 407,
radius = 90,
},

{					-- направление и скорость ветра
text = "VIT. " .. conky_parse('${exec sed -n 1p $HOME/.conky/barometre/reptravail/vit}') .. "km/h",
font_name = "MonogramsToolbox",
font_size = 8,
bold = true,
start_angle = 65,
end_angle = 110,
radius = 90,
},

{					-- влажность	
text = "HUMIDITE " .. conky_parse('${exec sed -n 1p $HOME/.conky/barometre/reptravail/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/barometre/reptravail/dir}'),
font_name = "MonogramsToolbox",
font_size = 8,
bold = true,
start_angle = 240,
end_angle = 270,
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/barometre/reptravail/dir}'),
max = 360,
length_of_arrows = 1.75,			-- длина стрелки
width_of_arrows = 6,			-- ширина стрелки
},

{					-- давление 
name = "pression",
arg = conky_parse('${exec sed -n 1p $HOME/.conky/barometre/reptravail/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	== "OSO"	then t.arg = 247.5 end
		if t.arg	== "O"		then t.arg = 270.0 end
		if t.arg	== "ONO"	then t.arg = 292.5 end
		if t.arg	== "NO"		then t.arg = 315.0 end
		if t.arg	== "NNO"	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	== "ENE"	then t.arg = 67.5 end
		if t.arg	== "E"		then t.arg = 90.0 end
		if t.arg	== "ESE"	then t.arg = 112.5 end
		if t.arg	== "SE"		then t.arg = 135.0 end
		if t.arg	== "SSE"	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]]--.

@+

Last edited by loutch (2023-05-10 15:57:08)


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

#1904 2023-05-10 17:28:36

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,641

Re: Show us your conky

Merci, loutch.

J'avais juste besoin de suisse.sh et je viens de voir que le service n'est disponible que pour la Suisse, la France et la Belgique.

--------
Thanks, loutch.

I just needed suisse.sh and just saw that the service is only available for Switzerland, France and Belgium.

Offline

#1905 2023-05-11 11:40:39

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,641

Re: Show us your conky

J'ai passé la matinée à changer le baromètre (et ton script) pour le service open-meteo.

Ces deux derniers s'exécutent d'abord sans erreur dans le terminal.

Vf7f0Sjt.png  PdQ6FcBt.png

Peut-être que j'obtiendrai aussi la sortie des valeurs..

-----------------
I spent the morning changing the barometr (and your script) to the open-meteo service.

These two run without errors in the terminal for now:

I may also get the output of the values yet..   27KAlfN.png

Offline

#1906 2023-05-11 14:44:53

loutch
Member
Registered: 2015-12-12
Posts: 848

Re: Show us your conky

Hello

dieses für accuweather

--[[ 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/reptravail/temp1}'),
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 2p $HOME/Accuweather_conky_script/temp/curr_cond}') .. "'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/reptravail/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/reptravail/vit}') .. "",
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/reptravail/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/reptravail/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/reptravail/dir}'),
max = 360,
length_of_arrows = 1.75,			-- длина стрелки
width_of_arrows = 6,			-- ширина стрелки
},

{					-- давление 
name = "pression",
arg = conky_parse('${exec sed -n 1p $HOME/.conky/barometr/reptravail/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	== "OSO"	then t.arg = 247.5 end
		if t.arg	== "O"		then t.arg = 270.0 end
		if t.arg	== "ONO"	then t.arg = 292.5 end
		if t.arg	== "NO"		then t.arg = 315.0 end
		if t.arg	== "NNO"	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	== "ENE"	then t.arg = 67.5 end
		if t.arg	== "E"		then t.arg = 90.0 end
		if t.arg	== "ESE"	then t.arg = 112.5 end
		if t.arg	== "SE"		then t.arg = 135.0 end
		if t.arg	== "SSE"	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]]--.

& das im conky

${execi 900 sed -n '8p' $HOME/Accuweather_conky_script/temp/curr_cond |awk '{print $2}' > $HOME/.conky/barometr/reptravail/pre}
${execi 900 sed -n '5p' $HOME/Accuweather_conky_script/temp/curr_cond > $HOME/.conky/barometr/reptravail/dir} 
${execi 900 sed -n '6p' $HOME/Accuweather_conky_script/temp/curr_cond > $HOME/.conky/barometr/reptravail/vit}  
${execi 900 sed -n '7p' $HOME/Accuweather_conky_script/temp/curr_cond > $HOME/.conky/barometr/reptravail/hum} 

----------------------

this for accuweather
& this in conky

@+

Last edited by loutch (2023-05-11 14:46:18)


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

#1907 2023-05-12 07:14:33

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,641

Re: Show us your conky

Oui, oui
Je n'y avais pas pensé jusqu'à présent. J'ai certes modifié certaines configurations sur accuweather, mais pas le baromètre.

Donc, j'ai presque fini, encore quelques petites choses.

Merci @loutch, conkystador !  gdFOjMR.png

yPMgGdnt.png  nQZ5odvt.png


------------------------
Yes,Yes
I had not thought of that before. I have changed some configurations on accuweather, but not the barometr.

So, I'm almost done, still little things.

Thanks @loutch, you conkystador!

Offline

#1908 2023-05-12 08:18:53

loutch
Member
Registered: 2015-12-12
Posts: 848

Re: Show us your conky

Hello

tut mir leid imgur funktioniert nicht.

@+


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

#1909 2023-05-12 13:27:31

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,641

Re: Show us your conky

loutch wrote:

Hello

tut mir leid imgur funktioniert nicht.

@+

Je ne sais pas de quoi tu parles.
--------------------------------------------

Merci encore pour ta patience/aide.

oi8iZqBt.png


il me semble que la flèche de direction du vent est à l'envers (dirait Teo)   wink
et, je vois qu'il y a toujours quelque chose à améliorer  xjTgQyk.png
------------------------------------------
I don't know what you mean.


Thanks again for your patience/help.
it seems to me that the wind direction arrow is upside down (Teo would say)   wink  and, i see that there is always something to improve.

Offline

#1910 2023-05-14 06:34:31

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,550
Website

Re: Show us your conky

Image display/browser discussion split off here: https://forums.bunsenlabs.org/viewtopic.php?id=8535
Hope that's OK?


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#1911 2023-05-14 07:25:20

loutch
Member
Registered: 2015-12-12
Posts: 848

Re: Show us your conky

Hello

@ Johnraff

Yes it's better so , here is conky post not imgur's problem.

Tanks .

@+


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

#1912 2023-05-14 13:52:22

loutch
Member
Registered: 2015-12-12
Posts: 848

Re: Show us your conky

Hello

@ Unklar

gute Arbeit, jetzt hast du die Wahl

---------------------------------------

good job, now you have a choice

@+


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

#1913 2023-05-14 16:22:54

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,641

Re: Show us your conky

loutch wrote:

Hello

@ Unklar

gute Arbeit, jetzt hast du die Wahl

---------------------------------------

good job, now you have a choice

@+

C'est déjà fait !  dsfgo1o.png

____________________
Already done!

https://forums.bunsenlabs.org/viewtopic … 86#p127686

Last edited by unklar (2023-05-14 16:23:42)

Offline

#1914 2023-05-14 17:13:42

loutch
Member
Registered: 2015-12-12
Posts: 848

Re: Show us your conky

Re

unklar wrote:
loutch wrote:

Hello

@ Unklar

gute Arbeit, jetzt hast du die Wahl

---------------------------------------

good job, now you have a choice

@+

C'est déjà fait !  https://i.imgur.com/dsfgo1o.png

____________________
Already done!

https://forums.bunsenlabs.org/viewtopic … 86#p127686

Ich habe gerade gesehen, dass mit vivaldi imgur.com wieder funktioniert

-------------------------------------------------------------
I just saw that with vivaldi imgur.com works again

@+

Last edited by loutch (2023-05-14 17:14:22)


Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX

Offline

#1915 2023-07-16 07:17:20

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,641

Re: Show us your conky

entertainment for the summer slump, 

an old conky from 2011/12 that I played with in Mageia2.

restored for conkyV1.9 and converted for conkyV1.10

                      j8hdNpDt.png                          pshs1mdt.png

the configurations here is in a resolution of 1680x1050. That means the user has to install both config's (conkyrc and lua-script
adapt to his circumstances. However, it's not difficult to move the font and lua circles around until that fits. I help
also like. wink

1.9 - copy the conkyrc to ~/.conky/conky8/ and the lua script to ~/lua/
1.10 - here comes the lua script after ~/.conky/conky8/scripts/

Have fun

conkyrc9

#==============================================================================
#                                  conkyrc_8a
#
#  author  : CAYMUS
#  version : v20120420-09
#  license : Distributed under the terms of GNU GPL version 2 or later
#
#==============================================================================

background yes
update_interval 1

cpu_avg_samples 2
net_avg_samples 2
temperature_unit celsius

double_buffer yes
no_buffers yes
text_buffer_size 2048

gap_x 10
gap_y 50
minimum_size 260 700
#maximum_width 190
own_window yes
own_window_type normal  #override
own_window_transparent yes
own_window_hints undecorate,skip_taskbar,skip_pager,below  #sticky,
border_inner_margin 0
border_outer_margin 0
alignment tr

draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

override_utf8_locale yes
use_xft yes
font 6x10:size=8  # alle!
xftalpha 0.5
uppercase no

default_color c0c0c0  #778899  #666666
color1 888888
color2 AAAAAA
color3 DDDDDD
color4 CC3333

lua_load ~/lua/conky_81.lua
lua_draw_hook_pre main_rings
#lua_draw_hook_pre main_box
#lua_draw_hook_post main_rings

TEXT
${font 6x10:size=13:bold}${color #F09000}Farewell ${font 6x10:size=8:bold}${color3}${kernel}

${voffset 3}
${goto 40}${font 6x10:size=12:bold}${color3}CPU
${goto 25}${font 6x10:size=8:normal}${color}core 1:${goto 70}${cpu cpu1}%
${goto 25}${font 6x10:size=8:normal}${color}core 2:${goto 70}${cpu cpu2}%
${goto 25}${font 6x10:size=8:normal}${color}${threads} process 

${voffset -100}
${goto 178}${font 6x10:size=12:bold}${color3}MEM
${goto 165}${font 6x10:size=8:normal}${color}RAM ${goto 200}$mem
${goto 165}${font 6x10:size=8:normal}${color}SWAP ${goto 200}$swap

${voffset 50}
${goto 175}${font 6x10:size=12:bold}${color3}DISKS
${goto 160}${font 6x10:size=8:normal}${color}/Data${goto 200}${fs_used /media/DATEN}
${goto 160}${font 6x10:size=8:normal}${color}/${goto 200}${fs_used /}

${voffset -120}
${goto 5}${color3}TOP CPU
${goto 5}${font 6x10:size=7:normal}${color2}${top name 1}${goto 70}${top pid 1}${goto 100}${top cpu 1}%
${goto 5}${font 6x10:size=7:normal}${color}${top name 2}${goto 70}${top pid 2}${goto 100}${top cpu 2}%
${goto 5}${font 6x10:size=7:normal}${color}${top name 3}${goto 70}${top pid 3}${goto 100}${top cpu 3}%

${goto 5}${color3}TOP MEM
${goto 5}${font 6x10:size=7:normal}${color2}${top_mem name 1}${goto 70}${top_mem pid 1}${goto 100}${top_mem mem 1}%
${goto 5}${font 6x10:size=7:normal}${color}${top_mem name 2}${goto 70}${top_mem pid 2}${goto 100}${top_mem mem 2}%
${goto 5}${font 6x10:size=7:normal}${color}${top_mem name 3}${goto 70}${top_mem pid 3}${goto 100}${top_mem mem 3}%

${voffset 0}
${goto 5}${font 6x10:size=12:bold}${color3}NET
${goto 5}${color1}${font 6x10:size=7:bold}eth0 ${addr eth0}
${goto 5}${color}${font 6x10:size=7:normal}Down: ${downspeed eth0}
${goto 5}${color}${font 6x10:size=7:normal}Up: ${upspeed eth0}
${goto 5}Total Down: ${totaldown eth0}
${goto 5}Total Up: ${totalup eth0}

${goto 5}${color1}${font 6x10:size=7:bold}wifi ${addr wlan0}
${goto 5}${color}${font 6x10:size=7:normal}Down: ${downspeed wlan0}
${goto 5}Up: ${upspeed wlan0}
${goto 5}Total Down: ${totaldown wlan0}
${goto 5}Total Up: ${totalup wlan0}
${goto 5}AP: ${wireless_essid wlan0} ${goto 125}Speed: ${wireless_bitrate wlan0}
${goto 5}Mode: ${wireless_mode wlan0} ${goto 125}Quality: ${wireless_link_qual_perc wlan0}%

${goto 5}${font 6x10:size=7:bold}${color}open ports:   ${tcp_portmon 1 65535 count}
${goto 5}${font 6x10:size=7:bold}${color}${offset 10}URL${goto 220}PORT
${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rhost 0} ${goto 220} ${tcp_portmon 1 65535 rport 0}
${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rhost 1} ${goto 220} ${tcp_portmon 1 65535 rport 1}
${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rhost 2} ${goto 220} ${tcp_portmon 1 65535 rport 2}
${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rhost 3} ${goto 220} ${tcp_portmon 1 65535 rport 3}
${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rhost 4} ${goto 220} ${tcp_portmon 1 65535 rport 4}
${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rhost 5} ${goto 220} ${tcp_portmon 1 65535 rport 5}
${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rhost 6} ${goto 220} ${tcp_portmon 1 65535 rport 6}
${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rhost 7} ${goto 220} ${tcp_portmon 1 65535 rport 7}
${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rhost 8} ${goto 220} ${tcp_portmon 1 65535 rport 8}
${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rhost 9} ${goto 220} ${tcp_portmon 1 65535 rport 9}


#${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rip  0}${alignr 1}${tcp_portmon 1 65535 rport  0}
#${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rip  1}${alignr 1}${tcp_portmon 1 65535 rport  1}
#${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rip  2}${alignr 1}${tcp_portmon 1 65535 rport  2}
#${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rip  3}${alignr 1}${tcp_portmon 1 65535 rport  3}
#${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rip  4}${alignr 1}${tcp_portmon 1 65535 rport  4}
#${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rip  5}${alignr 1}${tcp_portmon 1 65535 rport  5}
#${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rip  6}${alignr 1}${tcp_portmon 1 65535 rport  6}
#${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rip  7}${alignr 1}${tcp_portmon 1 65535 rport  7}
#${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rip  8}${alignr 1}${tcp_portmon 1 65535 rport  8}
#${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rip  9}${alignr 1}${tcp_portmon 1 65535 rport  9}

conky_81.lua

--[[ RINGS with SECTORS widget
	v1.1 by wlourf (07 Jan. 2011)
	edited by Caymus
	this widget draws a ring with differents effects 
	http://u-scripts.blogspot.com/2010/08/rings-sectors-widgets.html
	
To call the script in a conky, use, before TEXT
	lua_load /path/to/the/script/rings.lua
	lua_draw_hook_pre main_rings
and add one line (blank or not) after TEXT


Parameters are :
3 parameters are mandatory
name		- the name of the conky variable to display,
			  for example for {$cpu cpu0}, just write name="cpu"
arg			- the argument of the above variable,
			  for example for {$cpu cpu0}, just write arg="cpu0"
		  	  arg can be a numerical value if name=""
max			- the maximum value the above variable can reach,
			  for example for {$cpu cpu0}, just write max=100
	
Optional parameters:
xc,yc		- coordinates of the center of the ring,
			  default = middle of the conky window
radius		- external radius of the ring, in pixels,
			  default = quarter of the width of the conky window
thickness	- thickness of the ring, in pixels, default = 10 pixels
start_angle	- starting angle of the ring, in degrees, value can be negative,
			  default = 0 degree
end_angle	- ending angle of the ring, in degrees,
			  value must be greater than start_angle, default = 360 degrees
sectors		- number of sectors in the ring, default = 10
gap_sectors - gap between two sectors, in pixels, default = 1 pixel
cap			- the way to close a sector, available values are
				"p" for parallel , default value 
				"r" for radial (follow the radius)
inverse_arc	- if set to true, arc will be anticlockwise, default=false
border_size	- size of the border, in pixels, default = 0 pixel i.e. no border
fill_sector	- if set to true, each sector will be completely filled,
			  default=false, this parameter is inoperate if sectors=1
background	- if set to false, background will not be drawn, default=true
foreground	- if set to false, foreground will not be drawn, default=true

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

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

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

draw_me     - if set to false, text is not drawn (default = true or 1)
              it can be used with a conky string, if the string returns 1, the text is drawn :
              example : "${if_empty ${wireless_essid wlan0}}${else}1$endif",

v1.0 (08 Aug. 2010) original release
v1.1 (07 Jan. 2011) Add draw_me parameter and correct memory leaks, thanks to "Creamy Goodness"
                    text is parsed inside the function, not in the array of settings

--      This program is free software; you can redistribute it and/or modify
--      it under the terms of the GNU General Public License as published by
--      the Free Software Foundation version 3 (GPLv3)
--     
--      This program is distributed in the hope that it will be useful,
--      but WITHOUT ANY WARRANTY; without even the implied warranty of
--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--      GNU General Public License for more details.
--     
--      You should have received a copy of the GNU General Public License
--      along with this program; if not, write to the Free Software
--      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
--      MA 02110-1301, USA.		

]]


require 'cairo'

function conky_main_rings()
-- START PARAMETERS HERE
local rings_settings={

	{
	name="cpu",
	arg="cpu1",
	max=100,
	xc=60,
	yc=100,
	thickness=10,
	radius=60,
	start_angle=5,
	end_angle=175,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="cpu",
	arg="cpu2",
	max=100,
	xc=60,
	yc=100,
	thickness=10,
	radius=60,
	start_angle=185,
	end_angle=355,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="memperc",
	arg="",
	max=100,
	xc=200,
	yc=100,
	thickness=10,
	radius=60,
	start_angle=5,
	end_angle=175,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="swapperc",
	arg="",
	max=100,
	xc=200,
	yc=100,
	thickness=10,
	radius=60,
	start_angle=185,
	end_angle=355,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="fs_used_perc",
	arg="/media/DATEN",
	max=100,
	xc=200,
	yc=240,
	thickness=10,
	radius=60,
	start_angle=5,
	end_angle=175,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="fs_free_perc",
	arg="/",
	max=100,
	xc=200,
	yc=240,
	thickness=10,
	radius=60,
	start_angle=185,
	end_angle=355,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="downspeedf",
	arg="eth0",
	max=100,
	xc=220,
	yc=395,
	thickness=5,
	radius=30,
	start_angle=5,
	end_angle=175,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="upspeedf",
	arg="eth0",
	max=100,
	xc=220,
	yc=395,
	thickness=5,
	radius=30,
	start_angle=185,
	end_angle=355,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="downspeedf",
	arg="wlan0",
	max=100,
	xc=220,
	yc=470,
	thickness=5,
	radius=30,
	start_angle=5,
	end_angle=175,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="upspeedf",
	arg="wlan0",
	max=100,
	xc=220,
	yc=470,
	thickness=5,
	radius=30,
	start_angle=185,
	end_angle=355,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

}
--END OF PARAMETERS HERE

--main function

	if conky_window==nil then return end

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

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

	cairo_destroy(cr)

end




function draw_ring(cr, t)

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

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

	--check values
	local function setup(t)
		if t.name==nil and t.arg==nil then 
			print ("No input values ... use parameters 'name'" +
				" with 'arg' or only parameter 'arg' ") 
			return
		end

		if t.max==nil then
			print ("No maximum value defined, use 'max'")
			print ("for name=" .. t.name)
			print ("with arg=" .. t.arg)
			return
		end
		if t.name==nil then t.name="" end
		if t.arg==nil then t.arg="" end

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

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

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

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


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

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

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

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

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

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

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


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

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

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

		 cairo_restore(cr)

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

	cairo_restore(cr)
end


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

require 'cairo'
    
function conky_main_box()

    if conky_window==nil then return end

	---------------------- PARAMETERS BEGIN HERE
    local boxes_settings={
    --FIRST COLUMN
        --default colour and corner

    }


    ---------------------------- PARAMETERS END HERE
    
    local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    local cr=cairo_create(cs)
    
    if tonumber(conky_parse("$updates"))<5 then return end
    for i in pairs(boxes_settings) do
        draw_box (cr,boxes_settings[i])
    end
    cairo_destroy(cr)
    cairo_surface_destroy(cs)    
end

    
function draw_box(cr,t)

	if t.draw_me == true then t.draw_me = nil end
	if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end	

    local table_corners={"circle","curve","line"}

    local t_operators={
        clear   = CAIRO_OPERATOR_CLEAR,
        source  = CAIRO_OPERATOR_SOURCE,
        over    = CAIRO_OPERATOR_OVER,
        ["in"]      = CAIRO_OPERATOR_IN,
        out     = CAIRO_OPERATOR_OUT,
        atop    = CAIRO_OPERATOR_ATOP,
        dest    = CAIRO_OPERATOR_DEST,
        dest_over   = CAIRO_OPERATOR_DEST_OVER,
        dest_in = CAIRO_OPERATOR_DEST_IN,
        dest_out = CAIRO_OPERATOR_DEST_OUT,
        dest_atop = CAIRO_OPERATOR_DEST_ATOP,
        xor = CAIRO_OPERATOR_XOR,
        add = CAIRO_OPERATOR_ADD,
        saturate =  CAIRO_OPERATOR_SATURATE,
    }
        
    function rgba_to_r_g_b_a(tc)
        --tc={position,colour,alpha}
        local colour = tc[2]
        local alpha = tc[3]
        return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
    end

    function table.copy(t)
      local t2 = {}
      for k,v in pairs(t) do
       t2[k] = {v[1],v[2]}
      end
      return t2
    end

    function draw_corner(num,t)
        local shape=t[1]
        local radius=t[2]
        local x,y = t[3],t[4]
        if shape=="line" then
            if num == 1 then cairo_line_to(cr,radius,0) 
                elseif num == 2 then cairo_line_to(cr,x,radius) 
                elseif num == 3 then cairo_line_to(cr,x-radius,y)
                elseif num == 4 then cairo_line_to(cr,0,y-radius)
            end
        end
        if shape=="circle" then
		    local PI = math.pi
           if num == 1 then cairo_arc(cr,radius,radius,radius,-PI,-PI/2)
                elseif num == 2 then cairo_arc(cr,x-radius,y+radius,radius,-PI/2,0)
                elseif num == 3 then cairo_arc(cr,x-radius,y-radius,radius,0,PI/2) 
                elseif num == 4 then cairo_arc(cr,radius,y-radius,radius,PI/2,-PI)
            end
        end
        if shape=="curve" then
            if num == 1 then cairo_curve_to(cr,0,radius ,0,0 ,radius,0) 
                elseif num == 2 then cairo_curve_to(cr,x-radius,0, x,y, x,radius)
                elseif num == 3 then cairo_curve_to(cr,x,y-radius, x,y, x-radius,y)
                elseif num == 4 then cairo_curve_to(cr,radius,y, x,y, 0,y-radius)
            end
        end        
    end   

    --check values and set default values
    if t.x == nil then t.x = 0 end
    if t.y == nil then t.y = 0 end
    if t.w == nil then t.w = conky_window.width end
    if t.h == nil then t.h = conky_window.height end
    if t.radius == nil then t.radius = 0 end
    if t.border == nil then t.border = 0 end
    if t.colour==nil then t.colour={{1,0xFFFFFF,0.5}} end
    if t.linear_gradient ~= nil then 
        if #t.linear_gradient ~= 4 then
            t.linear_gradient = {t.x,t.y,t.width,t.height}
        end
    end 
    if t.angle==nil then t.angle = 0 end

	if t.skew_x == nil then t.skew_x=0  end
	if t.skew_y == nil then  t.skew_y=0 end
	if t.scale_x==nil then t.scale_x=1 end
	if t.scale_y==nil then t.scale_y=1 end	
	if t.rot_x == nil then t.rot_x=0  end
	if t.rot_y == nil then  t.rot_y=0 end
    
    if t.operator == nil then t.operator = "over" end
    if (t_operators[t.operator]) == nil then
        print ("wrong operator :",t.operator)
        t.operator = "over"
    end
    
    if t.radial_gradient ~= nil then 
        if #t.radial_gradient ~= 6 then
            t.radial_gradient = {t.x,t.y,0, t.x,t.y, t.width}
        end
    end 
    
    for i=1, #t.colour do    
        if #t.colour[i]~=3 then 
            print ("error in color table")
            t.colour[i]={1,0xFFFFFF,1} 
        end
    end

    if t.corners == nil then t.corners={ {"line",0} } end
    local t_corners = {}
    local t_corners = table.copy(t.corners)
    --don't use t_corners=t.corners otherwise t.corners is altered

    --complete the t_corners table if needed
    for i=#t_corners+1,4 do    
        t_corners[i]=t_corners[#t_corners]
        local flag=false
        for j,v in pairs(table_corners) do flag=flag or (t_corners[i][1]==v) end 
        if not flag then print ("error in corners table :",t_corners[i][1]);t_corners[i][1]="curve"  end
    end

    --this way :    
    --    t_corners[1][4]=x    
    --    t_corners[2][3]=y
    --doesn't work
    t_corners[1]={t_corners[1][1],t_corners[1][2],0,0}
    t_corners[2]={t_corners[2][1],t_corners[2][2],t.w,0}
    t_corners[3]={t_corners[3][1],t_corners[3][2],t.w,t.h}    
    t_corners[4]={t_corners[4][1],t_corners[4][2],0,t.h}        

    t.no_gradient = (t.linear_gradient == nil ) and (t.radial_gradient == nil )

    cairo_save(cr)
    cairo_translate(cr, t.x, t.y)
    if t.rot_x~=0 or t.rot_y~=0 or t.angle~=0 then
        cairo_translate(cr,t.rot_x,t.rot_y)
        cairo_rotate(cr,t.angle*math.pi/180)
        cairo_translate(cr,-t.rot_x,-t.rot_y)
    end
    if t.scale_x~=1 or t.scale_y~=1 or t.skew_x~=0 or t.skew_y~=0 then
	    local matrix0 = cairo_matrix_t:create()
	    tolua.takeownership(matrix0)
	    cairo_matrix_init (matrix0, t.scale_x,math.pi*t.skew_y/180	, math.pi*t.skew_x/180	,t.scale_y,0,0)
	    cairo_transform(cr,matrix0)    
    end
    
    local tc=t_corners
    cairo_move_to(cr,tc[1][2],0)
    cairo_line_to(cr,t.w-tc[2][2],0)
    draw_corner(2,tc[2])
    cairo_line_to(cr,t.w,t.h-tc[3][2])
    draw_corner(3,tc[3])
    cairo_line_to(cr,tc[4][2],t.h)
    draw_corner(4,tc[4])
    cairo_line_to(cr,0,tc[1][2])
    draw_corner(1,tc[1])
    
    if t.no_gradient then
        cairo_set_source_rgba(cr,rgba_to_r_g_b_a(t.colour[1]))
    else
        if t.linear_gradient ~= nil then
            pat = cairo_pattern_create_linear (t.linear_gradient[1],t.linear_gradient[2],t.linear_gradient[3],t.linear_gradient[4])
        elseif t.radial_gradient ~= nil then
            pat = cairo_pattern_create_radial (t.radial_gradient[1],t.radial_gradient[2],t.radial_gradient[3],
            	t.radial_gradient[4],t.radial_gradient[5],t.radial_gradient[6])
        end
        for i=1, #t.colour do
            cairo_pattern_add_color_stop_rgba (pat, t.colour[i][1], rgba_to_r_g_b_a(t.colour[i]))
        end
        cairo_set_source (cr, pat)
        cairo_pattern_destroy(pat)
    end 
     
    cairo_set_operator(cr,t_operators[t.operator]) 

    if t.border>0 then
        cairo_close_path(cr)
        if t.dash ~= nil then cairo_set_dash(cr, t.dash, 1, 0.0) end
        cairo_set_line_width(cr,t.border)
        cairo_stroke(cr)
    else
        cairo_fill(cr)
    end

    cairo_restore(cr)
end

Offline

#1916 2023-07-16 07:24:49

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,641

Re: Show us your conky

conkyrc10

conky.config = {
--==============================================================================
--                                  conkyrc_8a

--  author  : CAYMUS
--  version : v20120420-09
--  license : Distributed under the terms of GNU GPL version 2 or later

--==============================================================================

	background = true,
	update_interval = 1,

	cpu_avg_samples = 2,
	net_avg_samples = 2,
	temperature_unit = 'celsius',

	double_buffer = true,
	no_buffers = true,
	text_buffer_size = 2048,

	gap_x = 10,
	gap_y = 50,
	minimum_width = 260, minimum_height = 700,
--maximum_width 190
	own_window = true,
	own_window_type = 'normal',--override
	own_window_transparent = true,
	own_window_hints = 'undecorated,skip_taskbar,skip_pager,below',--sticky,
	border_inner_margin = 0,
	border_outer_margin = 0,
	alignment = 'top_right',

	draw_shades = false,
	draw_outline = false,
	draw_borders = false,
	draw_graph_borders = false,

	override_utf8_locale = true,
	use_xft = true,
	font = '6x10:size=8',-- alle!
	xftalpha = 0.5,
	uppercase = false,

	default_color = '#8ca2b8', --c0c0c0',--778899  #666666
	color1 = '#888888',
	color2 = '#AAAAAA',
	color3 = '#DDDDDD',
	color4 = '#CC3333',

	lua_load = '~/.conky/scripts/conky_81.lua',
	lua_draw_hook_pre = 'main_rings',
--lua_draw_hook_pre main_box
--lua_draw_hook_post main_rings

};

conky.text = [[
${font 6x10:size=13:bold}${color #F09000}${exec cat `ls -atr /etc/lsb-release | tail -1` | grep "DISTRIB_ID" | cut -d= -f2} ${font 6x10:size=8:bold}${color3}${kernel}

${voffset 15}
${goto 40}${font 6x10:size=12:bold}${color3}CPU
${goto 25}${font 6x10:size=8:normal}${color}core 1:${goto 70}${cpu cpu1}%
${goto 25}core 2:${goto 70}${cpu cpu2}%
${goto 20}${top cpu 1}  / ${top cpu 2}

${voffset -80}
${goto 178}${font 6x10:size=12:bold}${color3}MEM
${goto 165}${font 6x10:size=8:normal}${color}RAM ${goto 200}${legacymem}
${goto 165}SWAP ${goto 200}${swap}

${voffset 70}
${goto 175}${font 6x10:size=12:bold}${color3}DISKS
${goto 160}${font 6x10:size=8:normal}${color}/Data${goto 200}${fs_used /media/DATEN}
${goto 160}/${goto 200}${fs_used /}

${voffset -110}
${goto 5}${color3}TOP CPU
${goto 5}${font 6x10:size=7:normal}${color2}${top name 1}${goto 70}${top pid 1}${goto 100}${top cpu 1}%
${goto 5}${color}${top name 2}${goto 70}${top pid 2}${goto 100}${top cpu 2}%
${goto 5}${top name 3}${goto 70}${top pid 3}${goto 100}${top cpu 3}%

${goto 5}${color3}TOP MEM
${goto 5}${font 6x10:size=7:normal}${color2}${top_mem name 1}${goto 70}${top_mem pid 1}${goto 100}${top_mem mem 1}%
${goto 5}${color}${top_mem name 2}${goto 70}${top_mem pid 2}${goto 100}${top_mem mem 2}%
${goto 5}${top_mem name 3}${goto 70}${top_mem pid 3}${goto 100}${top_mem mem 3}%

${voffset 0}
${goto 5}${font 6x10:size=12:bold}${color3}NET
${goto 5}${color1}${font 6x10:size=7:bold}LAN ${goto 70}${addr enp0s25}
${goto 5}${color}${font 6x10:size=7:normal}Down:${goto 70}${downspeed enp0s25}
${goto 5}${color}${font 6x10:size=7:normal}Up:${goto 70}${upspeed enp0s25}
${goto 5}Total Down ${goto 70}${totaldown enp0s25}
${goto 5}Total Up ${goto 70}${totalup enp0s25}

${goto 5}${color1}${font 6x10:size=7:bold}wifi ${goto 70}${addr wlp3s0}
${goto 5}${color}${font 6x10:size=7:normal}Down ${goto 70}${downspeed wlp3s0}
${goto 5}Up ${goto 70}${upspeed wlp3s0}
${goto 5}Total Down ${goto 70}${totaldown wlp3s0}
${goto 5}Total Up ${goto 70}${totalup wlp3s0}
${goto 5}AP ${wireless_essid wlp3s0} ${goto 70}Speed ${wireless_bitrate wlp3s0}
${goto 5}Mode ${goto 70}${wireless_mode wlp3s0} ${goto 125}Quality ${wireless_link_qual_perc wlp3s0}%

${goto 5}${font 6x10:size=7:bold}${color}open ports:   ${tcp_portmon 1 65535 count}
${goto 5}${font 6x10:size=7:bold}${color}URL${goto 220}PORT
${goto 5}${font 6x10:size=7:normal}${color1}${tcp_portmon 1 65535 rhost 0} ${goto 220} ${tcp_portmon 1 65535 rport 0}
${goto 5}${tcp_portmon 1 65535 rhost 1} ${goto 220} ${tcp_portmon 1 65535 rport 1}
${goto 5}${tcp_portmon 1 65535 rhost 2} ${goto 220} ${tcp_portmon 1 65535 rport 2}
${goto 5}${tcp_portmon 1 65535 rhost 3} ${goto 220} ${tcp_portmon 1 65535 rport 3}
${goto 5}${tcp_portmon 1 65535 rhost 4} ${goto 220} ${tcp_portmon 1 65535 rport 4}
${goto 5}${tcp_portmon 1 65535 rhost 5} ${goto 220} ${tcp_portmon 1 65535 rport 5}
${goto 5}${tcp_portmon 1 65535 rhost 6} ${goto 220} ${tcp_portmon 1 65535 rport 6}
${goto 5}${tcp_portmon 1 65535 rhost 7} ${goto 220} ${tcp_portmon 1 65535 rport 7}
${goto 5}${tcp_portmon 1 65535 rhost 8} ${goto 220} ${tcp_portmon 1 65535 rport 8}
${goto 5}${tcp_portmon 1 65535 rhost 9} ${goto 220} ${tcp_portmon 1 65535 rport 9}


${goto 5}${tcp_portmon 1 65535 rip  0} ${goto 220} ${tcp_portmon 1 65535 rport  0}
${goto 5}${tcp_portmon 1 65535 rip  1} ${goto 220} ${tcp_portmon 1 65535 rport  1}
${goto 5}${tcp_portmon 1 65535 rip  2} ${goto 220} ${tcp_portmon 1 65535 rport  2}
${goto 5}${tcp_portmon 1 65535 rip  3} ${goto 220} ${tcp_portmon 1 65535 rport  3}
${goto 5}${tcp_portmon 1 65535 rip  4} ${goto 220} ${tcp_portmon 1 65535 rport  4}
${goto 5}${tcp_portmon 1 65535 rip  5} ${goto 220} ${tcp_portmon 1 65535 rport  5}
${goto 5}${tcp_portmon 1 65535 rip  6} ${goto 220} ${tcp_portmon 1 65535 rport  6}
${goto 5}${tcp_portmon 1 65535 rip  7} ${goto 220} ${tcp_portmon 1 65535 rport  7}
${goto 5}${tcp_portmon 1 65535 rip  8} ${goto 220} ${tcp_portmon 1 65535 rport  8}
${goto 5}${tcp_portmon 1 65535 rip  9} ${goto 220} ${tcp_portmon 1 65535 rport  9}${font}${color}
]];

conky_81.lua

--[[ RINGS with SECTORS widget
	v1.1 by wlourf (07 Jan. 2011)
	edited by Caymus
	this widget draws a ring with differents effects 
	http://u-scripts.blogspot.com/2010/08/rings-sectors-widgets.html
	
To call the script in a conky, use, before TEXT
	lua_load /path/to/the/script/rings.lua
	lua_draw_hook_pre main_rings
and add one line (blank or not) after TEXT


Parameters are :
3 parameters are mandatory
name		- the name of the conky variable to display,
			  for example for {$cpu cpu0}, just write name="cpu"
arg			- the argument of the above variable,
			  for example for {$cpu cpu0}, just write arg="cpu0"
		  	  arg can be a numerical value if name=""
max			- the maximum value the above variable can reach,
			  for example for {$cpu cpu0}, just write max=100
	
Optional parameters:
xc,yc		- coordinates of the center of the ring,
			  default = middle of the conky window
radius		- external radius of the ring, in pixels,
			  default = quarter of the width of the conky window
thickness	- thickness of the ring, in pixels, default = 10 pixels
start_angle	- starting angle of the ring, in degrees, value can be negative,
			  default = 0 degree
end_angle	- ending angle of the ring, in degrees,
			  value must be greater than start_angle, default = 360 degrees
sectors		- number of sectors in the ring, default = 10
gap_sectors - gap between two sectors, in pixels, default = 1 pixel
cap			- the way to close a sector, available values are
				"p" for parallel , default value 
				"r" for radial (follow the radius)
inverse_arc	- if set to true, arc will be anticlockwise, default=false
border_size	- size of the border, in pixels, default = 0 pixel i.e. no border
fill_sector	- if set to true, each sector will be completely filled,
			  default=false, this parameter is inoperate if sectors=1
background	- if set to false, background will not be drawn, default=true
foreground	- if set to false, foreground will not be drawn, default=true

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

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

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

draw_me     - if set to false, text is not drawn (default = true or 1)
              it can be used with a conky string, if the string returns 1, the text is drawn :
              example : "${if_empty ${wireless_essid wlp3s0}}${else}1$endif",

v1.0 (08 Aug. 2010) original release
v1.1 (07 Jan. 2011) Add draw_me parameter and correct memory leaks, thanks to "Creamy Goodness"
                    text is parsed inside the function, not in the array of settings

--      This program is free software; you can redistribute it and/or modify
--      it under the terms of the GNU General Public License as published by
--      the Free Software Foundation version 3 (GPLv3)
--     
--      This program is distributed in the hope that it will be useful,
--      but WITHOUT ANY WARRANTY; without even the implied warranty of
--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--      GNU General Public License for more details.
--     
--      You should have received a copy of the GNU General Public License
--      along with this program; if not, write to the Free Software
--      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
--      MA 02110-1301, USA.		

]]


require 'cairo'

function conky_main_rings()
-- START PARAMETERS HERE
local rings_settings={

	{
	name="cpu",
	arg="cpu1",
	max=100,
	xc=60,
	yc=100,
	thickness=10,
	radius=60,
	start_angle=5,
	end_angle=175,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="cpu",
	arg="cpu2",
	max=100,
	xc=60,
	yc=100,
	thickness=10,
	radius=60,
	start_angle=185,
	end_angle=355,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="memperc",
	arg="",
	max=100,
	xc=200,
	yc=100,
	thickness=10,
	radius=60,
	start_angle=5,
	end_angle=175,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="swapperc",
	arg="",
	max=100,
	xc=200,
	yc=100,
	thickness=10,
	radius=60,
	start_angle=185,
	end_angle=355,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="fs_used_perc",
	arg="/media/DATEN",
	max=100,
	xc=200,
	yc=240,
	thickness=10,
	radius=60,
	start_angle=5,
	end_angle=175,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="fs_free_perc",
	arg="/",
	max=100,
	xc=200,
	yc=240,
	thickness=10,
	radius=60,
	start_angle=185,
	end_angle=355,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="downspeedf",
	arg="enp0s25",
	max=100,
	xc=220,
	yc=370,
	thickness=5,
	radius=30,
	start_angle=5,
	end_angle=175,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="upspeedf",
	arg="enp0s25",
	max=100,
	xc=220,
	yc=370,
	thickness=5,
	radius=30,
	start_angle=185,
	end_angle=355,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="downspeedf",
	arg="wlp3s0",
	max=100,
	xc=220,
	yc=445,
	thickness=5,
	radius=30,
	start_angle=5,
	end_angle=175,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

	{
	name="upspeedf",
	arg="wlp3s0",
	max=100,
	xc=220,
	yc=445,
	thickness=5,
	radius=30,
	start_angle=185,
	end_angle=355,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	},

}
--END OF PARAMETERS HERE

--main function

	if conky_window==nil then return end

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

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

	cairo_destroy(cr)

end




function draw_ring(cr, t)

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

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

	--check values
	local function setup(t)
		if t.name==nil and t.arg==nil then 
			print ("No input values ... use parameters 'name'" +
				" with 'arg' or only parameter 'arg' ") 
			return
		end

		if t.max==nil then
			print ("No maximum value defined, use 'max'")
			print ("for name=" .. t.name)
			print ("with arg=" .. t.arg)
			return
		end
		if t.name==nil then t.name="" end
		if t.arg==nil then t.arg="" end

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

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

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

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


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

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

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

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

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

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

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


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

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

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

		 cairo_restore(cr)

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

	cairo_restore(cr)
end


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

require 'cairo'
    
function conky_main_box()

    if conky_window==nil then return end

	---------------------- PARAMETERS BEGIN HERE
    local boxes_settings={
    --FIRST COLUMN
        --default colour and corner

    }


    ---------------------------- PARAMETERS END HERE
    
    local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    local cr=cairo_create(cs)
    
    if tonumber(conky_parse("$updates"))<5 then return end
    for i in pairs(boxes_settings) do
        draw_box (cr,boxes_settings[i])
    end
    cairo_destroy(cr)
    cairo_surface_destroy(cs)    
end

    
function draw_box(cr,t)

	if t.draw_me == true then t.draw_me = nil end
	if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end	

    local table_corners={"circle","curve","line"}

    local t_operators={
        clear   = CAIRO_OPERATOR_CLEAR,
        source  = CAIRO_OPERATOR_SOURCE,
        over    = CAIRO_OPERATOR_OVER,
        ["in"]      = CAIRO_OPERATOR_IN,
        out     = CAIRO_OPERATOR_OUT,
        atop    = CAIRO_OPERATOR_ATOP,
        dest    = CAIRO_OPERATOR_DEST,
        dest_over   = CAIRO_OPERATOR_DEST_OVER,
        dest_in = CAIRO_OPERATOR_DEST_IN,
        dest_out = CAIRO_OPERATOR_DEST_OUT,
        dest_atop = CAIRO_OPERATOR_DEST_ATOP,
        xor = CAIRO_OPERATOR_XOR,
        add = CAIRO_OPERATOR_ADD,
        saturate =  CAIRO_OPERATOR_SATURATE,
    }
        
    function rgba_to_r_g_b_a(tc)
        --tc={position,colour,alpha}
        local colour = tc[2]
        local alpha = tc[3]
        return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
    end

    function table.copy(t)
      local t2 = {}
      for k,v in pairs(t) do
       t2[k] = {v[1],v[2]}
      end
      return t2
    end

    function draw_corner(num,t)
        local shape=t[1]
        local radius=t[2]
        local x,y = t[3],t[4]
        if shape=="line" then
            if num == 1 then cairo_line_to(cr,radius,0) 
                elseif num == 2 then cairo_line_to(cr,x,radius) 
                elseif num == 3 then cairo_line_to(cr,x-radius,y)
                elseif num == 4 then cairo_line_to(cr,0,y-radius)
            end
        end
        if shape=="circle" then
		    local PI = math.pi
           if num == 1 then cairo_arc(cr,radius,radius,radius,-PI,-PI/2)
                elseif num == 2 then cairo_arc(cr,x-radius,y+radius,radius,-PI/2,0)
                elseif num == 3 then cairo_arc(cr,x-radius,y-radius,radius,0,PI/2) 
                elseif num == 4 then cairo_arc(cr,radius,y-radius,radius,PI/2,-PI)
            end
        end
        if shape=="curve" then
            if num == 1 then cairo_curve_to(cr,0,radius ,0,0 ,radius,0) 
                elseif num == 2 then cairo_curve_to(cr,x-radius,0, x,y, x,radius)
                elseif num == 3 then cairo_curve_to(cr,x,y-radius, x,y, x-radius,y)
                elseif num == 4 then cairo_curve_to(cr,radius,y, x,y, 0,y-radius)
            end
        end        
    end   

    --check values and set default values
    if t.x == nil then t.x = 0 end
    if t.y == nil then t.y = 0 end
    if t.w == nil then t.w = conky_window.width end
    if t.h == nil then t.h = conky_window.height end
    if t.radius == nil then t.radius = 0 end
    if t.border == nil then t.border = 0 end
    if t.colour==nil then t.colour={{1,0xFFFFFF,0.5}} end
    if t.linear_gradient ~= nil then 
        if #t.linear_gradient ~= 4 then
            t.linear_gradient = {t.x,t.y,t.width,t.height}
        end
    end 
    if t.angle==nil then t.angle = 0 end

	if t.skew_x == nil then t.skew_x=0  end
	if t.skew_y == nil then  t.skew_y=0 end
	if t.scale_x==nil then t.scale_x=1 end
	if t.scale_y==nil then t.scale_y=1 end	
	if t.rot_x == nil then t.rot_x=0  end
	if t.rot_y == nil then  t.rot_y=0 end
    
    if t.operator == nil then t.operator = "over" end
    if (t_operators[t.operator]) == nil then
        print ("wrong operator :",t.operator)
        t.operator = "over"
    end
    
    if t.radial_gradient ~= nil then 
        if #t.radial_gradient ~= 6 then
            t.radial_gradient = {t.x,t.y,0, t.x,t.y, t.width}
        end
    end 
    
    for i=1, #t.colour do    
        if #t.colour[i]~=3 then 
            print ("error in color table")
            t.colour[i]={1,0xFFFFFF,1} 
        end
    end

    if t.corners == nil then t.corners={ {"line",0} } end
    local t_corners = {}
    local t_corners = table.copy(t.corners)
    --don't use t_corners=t.corners otherwise t.corners is altered

    --complete the t_corners table if needed
    for i=#t_corners+1,4 do    
        t_corners[i]=t_corners[#t_corners]
        local flag=false
        for j,v in pairs(table_corners) do flag=flag or (t_corners[i][1]==v) end 
        if not flag then print ("error in corners table :",t_corners[i][1]);t_corners[i][1]="curve"  end
    end

    --this way :    
    --    t_corners[1][4]=x    
    --    t_corners[2][3]=y
    --doesn't work
    t_corners[1]={t_corners[1][1],t_corners[1][2],0,0}
    t_corners[2]={t_corners[2][1],t_corners[2][2],t.w,0}
    t_corners[3]={t_corners[3][1],t_corners[3][2],t.w,t.h}    
    t_corners[4]={t_corners[4][1],t_corners[4][2],0,t.h}        

    t.no_gradient = (t.linear_gradient == nil ) and (t.radial_gradient == nil )

    cairo_save(cr)
    cairo_translate(cr, t.x, t.y)
    if t.rot_x~=0 or t.rot_y~=0 or t.angle~=0 then
        cairo_translate(cr,t.rot_x,t.rot_y)
        cairo_rotate(cr,t.angle*math.pi/180)
        cairo_translate(cr,-t.rot_x,-t.rot_y)
    end
    if t.scale_x~=1 or t.scale_y~=1 or t.skew_x~=0 or t.skew_y~=0 then
	    local matrix0 = cairo_matrix_t:create()
	    tolua.takeownership(matrix0)
	    cairo_matrix_init (matrix0, t.scale_x,math.pi*t.skew_y/180	, math.pi*t.skew_x/180	,t.scale_y,0,0)
	    cairo_transform(cr,matrix0)    
    end
    
    local tc=t_corners
    cairo_move_to(cr,tc[1][2],0)
    cairo_line_to(cr,t.w-tc[2][2],0)
    draw_corner(2,tc[2])
    cairo_line_to(cr,t.w,t.h-tc[3][2])
    draw_corner(3,tc[3])
    cairo_line_to(cr,tc[4][2],t.h)
    draw_corner(4,tc[4])
    cairo_line_to(cr,0,tc[1][2])
    draw_corner(1,tc[1])
    
    if t.no_gradient then
        cairo_set_source_rgba(cr,rgba_to_r_g_b_a(t.colour[1]))
    else
        if t.linear_gradient ~= nil then
            pat = cairo_pattern_create_linear (t.linear_gradient[1],t.linear_gradient[2],t.linear_gradient[3],t.linear_gradient[4])
        elseif t.radial_gradient ~= nil then
            pat = cairo_pattern_create_radial (t.radial_gradient[1],t.radial_gradient[2],t.radial_gradient[3],
            	t.radial_gradient[4],t.radial_gradient[5],t.radial_gradient[6])
        end
        for i=1, #t.colour do
            cairo_pattern_add_color_stop_rgba (pat, t.colour[i][1], rgba_to_r_g_b_a(t.colour[i]))
        end
        cairo_set_source (cr, pat)
        cairo_pattern_destroy(pat)
    end 
     
    cairo_set_operator(cr,t_operators[t.operator]) 

    if t.border>0 then
        cairo_close_path(cr)
        if t.dash ~= nil then cairo_set_dash(cr, t.dash, 1, 0.0) end
        cairo_set_line_width(cr,t.border)
        cairo_stroke(cr)
    else
        cairo_fill(cr)
    end

    cairo_restore(cr)
end

Don't forget to adjust the LAN and Wifi interfaces!  wink

Edit: I "cleaned up" the conkyrc10 a bit and made it clearer code in the NET area  smile

Xs36Wx7t.png

Last edited by unklar (2023-07-16 12:47:02)

Offline

#1917 2023-07-17 13:41:59

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Show us your conky

Excellent unklar ...
No wifi here so that's commented out.

A tweaking process going on as I type

Hmmmmmmmm
Conky: statfs64 '/media/DATEN': No such file or directory

Also in the LUA script change:

arg="/media/DATEN",

To something on your system, for me it was:
arg="/media/5",

Must change font size, I need a microscope to see this.
lol  lol  lol


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1918 2023-07-17 16:55:00

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,641

Re: Show us your conky

Hello my friend!  wink

I have the summer slump and you should have the winter slump after Adam Ries.

Then we should align /media/DATEN/ and /media/5/ using 'unison' (which I'm always happy to recommend since mageia). The magnifying glass is free...  dsfgo1o.png

Offline

#1919 2023-07-17 19:12:21

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Show us your conky

Hello my friend.

Star Trek: Data's 10 Best Quotes, Ranked

01  "Mortality gives meaning to human life."
02 "This is just a thing... and things can be replaced. Lives cannot."
03 "Differences sometimes scare people."
04 "Prejudice is very human."
05 "I am superior, sir, in many ways, but I would gladly give it up to be human."
06  "The real secret is turning disadvantage into advantage."
07  "Could you please continue the petty bickering? I find it most amusing."
08 "Yes, Sir. I am attempting to fill a silent moment with non-relevant conversation."
09 "In the event of a water landing..."
10 "I would gladly risk feeling bad at times..."

and
11 I am Data, not DATEN nor /media/5

NOTE:
- All of the above is to be taken in fun and all data will be shredded since GUGL has announced all 'data' on the net is to be used for their AI machine: GUAI


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1920 2023-07-31 00:27:46

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 2,611

Re: Show us your conky

Tweaking an old conkyrc. Getting the sensor information updated:

COnky-Screenshot-2023-07-30-20-05-16.png

conky.config = {
--#############################################
-- Settings
--#############################################
	background = true,
	use_xft = true,
	font = 'Roboto Mono:Regular:size=11',
	xftalpha = 1.0,
	update_interval = 3.0,
	update_interval_on_battery = 10.0,
	total_run_times = 0,

	own_window = true,
	own_window_colour = '111112',
	own_window_transparent = true,
	-- own_window_type = 'normal/desktop/override/panel/dock'
    own_window_type = 'desktop',
    -- own_window_type = 'dock',
	own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
	own_window_class = 'ConkySystem',
	own_window_title = 'ConkySystem',
--#############################################
-- Compositing tips:
-- Conky can play strangely when used with
-- different compositors. I have found the
-- following to work well, but your mileage
-- may vary. Comment/uncomment to suit.
--#############################################

   -- -- compton/xfce transparency change own_window_transparent to false.
	-- own_window_argb_visual = true,
	-- own_window_argb_value = 55,

--#############################################

	no_buffers = true,
	uppercase = true,
	cpu_avg_samples = 2,
	override_utf8_locale = true,
	short_units = true,
	temperature_unit, celcius,
	imlib_cache_size = 0,
	pad_percents = 1,
	-- max_specials = '2048',
	max_user_text = 3200,
	text_buffer_size = 1024,
	no_buffers = true,
	if_up_strictness = 'address',
	double_buffer = true,
	draw_shades = false,
	draw_outline = false,
	draw_borders = false,
	draw_graph_borders = false,
	border_inner_margin = 16,
	border_outer_margin = 0,
	-- xinerama_head = eDP1,
	default_color = 'D4D4D4',
	default_shade_color = '131313',
	default_outline_color = '535353',
	color0 = '#FFFFFF',
	color1 = '#000000',
	color2 = '#909090',-- - gray
	color3 = '#FFFF00',-- - yellow
	color4 = '#0000FF',-- - blue
	color5 = '#00FF00',-- - green
	color6 = '#FFA500',-- - orange
	-- color7 match with default
	color7 = 'D4D4D4',
	color8 = 'DEAE00',-- - yellow orange
	color9 = 'DE1E00',-- - red

	minimum_width = 200, minimum_height = 0,
	maximum_width = 200,
	alignment = 'tr',
	gap_x = 24,
	gap_y = 24,

	-- ${alignr 8}${if_match ${cpu}<=50}${color7}${else}${if_match ${cpu}<=70}${color8}${else}${if_match ${cpu}>70}${color9}${endif}${endif}${endif}${cpu cpu0}%${color}

   -- doesn't work when docked in the slit or as panel --#
   -- lua_load = '~/conky/transbg.lua',
   -- lua_draw_hook_pre = 'draw_bg 6 0 0 0 0 0x070707 0.55',
};

conky.text = [[
UP:${alignr 8}${uptime_short}

${voffset 6}SSD0:${goto 96}${diskio_read /dev/sda}${alignr 8}${diskio_write /dev/sda}
${voffset 6}SSD1:${goto 96}${diskio_read /dev/nvme0n1}${alignr 8}${diskio_write /dev/nvme0n1}
${voffset 6}SSD1:${goto 96}${if_match ${hwmon 0 temp 1}<=59}${color7}${else}${if_match ${hwmon 0 temp 1}<=79}${color8}${else}${if_match ${hwmon 0 temp 1}>79}${color9}${endif}${endif}${endif}${hwmon 0 temp 1}°C${color}
${voffset 6}Mem:${alignr 8}${if_match ${memperc}<=50}${color7}${else}${if_match ${memperc}<=70}${color8}${else}${if_match ${memperc}>70}${color9}${endif}${endif}${endif}${memperc}%${color}
${color2}${hr 1}${color}
${voffset 6}CPU:${goto 96}${if_match ${hwmon 5 temp 1}<=59}${color7}${else}${if_match ${hwmon 5 temp 1}<=79}${color8}${else}${if_match ${hwmon 5 temp 1}>79}${color9}${endif}${endif}${endif}${hwmon 5 temp 1}°C${color} \
${alignr 8}${if_match ${cpu}<=50}${color7}${else}${if_match ${cpu}<=70}${color8}${else}${if_match ${cpu}>70}${color9}${endif}${endif}${endif}${cpu cpu0}%${color}
${voffset 6}Load:${goto 96}${loadavg}

${voffset 12}CPU0:${goto 96}${if_match ${hwmon 5 temp 2}<=59}${color7}${else}${if_match ${hwmon 5 temp 2}<=79}${color8}${else}${if_match ${hwmon 5 temp 2}>79}${color9}${endif}${endif}${endif}${hwmon 5 temp 2}°C${color} \
${alignr 8}${if_match ${cpu}<=50}${color7}${else}${if_match ${cpu}<=70}${color8}${else}${if_match ${cpu}>70}${color9}${endif}${endif}${endif}${cpu cpu1}%${color}
${voffset 6}CPU1:${goto 96}${if_match ${hwmon 5 temp 3}<=59}${color7}${else}${if_match ${hwmon 5 temp 3}<=79}${color8}${else}${if_match ${hwmon 5 temp 3}>79}${color9}${endif}${endif}${endif}${hwmon 5 temp 3}°C${color} \
${alignr 8}${if_match ${cpu}<=50}${color7}${else}${if_match ${cpu}<=70}${color8}${else}${if_match ${cpu}>70}${color9}${endif}${endif}${endif}${cpu cpu2}%${color}
${voffset 6}CPU2:${goto 96}${if_match ${hwmon 5 temp 4}<=59}${color7}${else}${if_match ${hwmon 5 temp 4}<=79}${color8}${else}${if_match ${hwmon 5 temp 4}>79}${color9}${endif}${endif}${endif}${hwmon 5 temp 4}°C${color} \
${alignr 8}${if_match ${cpu}<=50}${color7}${else}${if_match ${cpu}<=70}${color8}${else}${if_match ${cpu}>70}${color9}${endif}${endif}${endif}${cpu cpu3}%${color}
${voffset 6}CPU3:${goto 96}${if_match ${hwmon 5 temp 5}<=59}${color7}${else}${if_match ${hwmon 5 temp 5}<=79}${color8}${else}${if_match ${hwmon 5 temp 5}>79}${color9}${endif}${endif}${endif}${hwmon 5 temp 5}°C${color} \
${alignr 8}${if_match ${cpu}<=50}${color7}${else}${if_match ${cpu}<=70}${color8}${else}${if_match ${cpu}>70}${color9}${endif}${endif}${endif}${cpu cpu4}%${color}
${color2}${hr 1}${color}
${voffset 6}BAT:${goto 96}${execpi 120 acpi -b | awk '/Battery 0/ {print $3}' | cut -c1-4}${alignr 8}${if_match ${battery_percent BAT0}<=15}${color9}${blink ${battery_percent BAT0}%}${color}${else}${if_match ${battery_percent BAT0}<=33}${color8}${battery_percent BAT0}%${else}${if_match ${battery_percent BAT0}>33}${color7}${battery_percent BAT0}%${endif}${endif}${endif}${color}
${voffset 6}NET:${goto 96}${wireless_bitrate wlp2s0}${alignr 8}${wireless_link_qual_perc wlp2s0}%
${voffset 6}U:${offset 4}${upspeedf wlp2s0}
${voffset 6}D:${offset 4}${downspeedf wlp2s0}

]];

You must unlearn what you have learned.
    -- yoda

Online

Board footer

Powered by FluxBB