#901 Le 02/04/2015, à 14:41
- ibrahim54
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonjour,
Je me permets de vous écrire ENCORE car je cherche une chose que je n'arrive pas a faire.
J'aimerai améliorer mon conky et me servir de variable pour faire des opérations simples.
Comme additionner ou multiplier des chiffres donnés.
Par exemple :
$nb_pommes = 75
$pommes_mange = 5
$reste_pommes = $nb_pommes - $pommes_mange
Comment pouvoir mettre ceci sous forme de conky en limitant les scripts qui on tendances a ralentir conky chez moi ^^
Merci de votre aide.
Ibrahim
P.S. : non je ne veux pas mettre de pommes sur mon conky ;-)
mon poste info : Dual-screen 27+17" ; i3-2100, 16Go de ram (Windows 10)
mon poste nomade : Lenovo ThinkPad X260 (Ubuntu 22.04)
Musée : Lenovo ThinkPad X200 (Ubuntu 21.10)
Hors ligne
#902 Le 02/04/2015, à 18:39
- Yberamos
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonjour daniel38100,
Je fais sans doute quelque chose mal, mais que je lance le script, il me renvoie :
[yberamos@Portable ~]$ python tweeter.py email="##########" password="#########"
Traceback (most recent call last):
File "tweeter.py", line 6, in <module>
import mechanize
ImportError: No module named 'mechanize'
Je ne sais pas si cela pose problème, mais il y a une virgule dans mon mot de passe (dans le doute, je précise).
Hors ligne
#903 Le 02/04/2015, à 22:55
- daniel38100
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonjour daniel38100,
Je fais sans doute quelque chose mal, mais que je lance le script, il me renvoie :[yberamos@Portable ~]$ python tweeter.py email="##########" password="#########" Traceback (most recent call last): File "tweeter.py", line 6, in <module> import mechanize ImportError: No module named 'mechanize'
Je ne sais pas si cela pose problème, mais il y a une virgule dans mon mot de passe (dans le doute, je précise).
non c'est pas ça le problème il faut que tu installe le module mechanize et surement bs4
sudo apt-get install python-bs4 python-mechanize
mais je travail sur un script via l'API de tweeter ce sera sûrement plus simple
Dernière modification par daniel38100 (Le 02/04/2015, à 22:57)
Hors ligne
#904 Le 03/04/2015, à 05:55
- Didier-T
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonjour,
Je me permets de vous écrire ENCORE car je cherche une chose que je n'arrive pas a faire.
J'aimerai améliorer mon conky et me servir de variable pour faire des opérations simples.
Comme additionner ou multiplier des chiffres donnés.
Par exemple :
$nb_pommes = 75
$pommes_mange = 5
$reste_pommes = $nb_pommes - $pommes_mangeComment pouvoir mettre ceci sous forme de conky en limitant les scripts qui on tendances a ralentir conky chez moi ^^
Merci de votre aide.
Ibrahim
P.S. : non je ne veux pas mettre de pommes sur mon conky ;-)
Bonjour ibrahim54,
conky ne sait pas faire d’opération mathématique, n'y géré de variable.
Il te faudra donc passer soit :
- par un script (quelque soit son langage).
- par un code lua, ce dernier étant le plus indiqué pour conky, car il s'intègre a son fonctionnement et ne freine normalement pas conky.
Si tu as besoins d'aide n'hésite pas a nous donner le détails de ton projet.
A+,
Didier.
Hors ligne
#905 Le 05/04/2015, à 12:15
- Raphanel
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonjour tout le monde!
J'ai une petite question à poser vis à vis des possibilités de Conky. J'ai un serveur nas en réseau et j'aimerai savoir si il existe un moyen d'avoir des conky permettant d'avoir les données comme sur cette image d'un post précédent http://forum.ubuntu-fr.org/viewtopic.ph … #p12890531
mais du serveur nas sans avoir la fenêtre d'administration tout le temps ouverte?
Cordialement
Raphanel
Dernière modification par Raphanel (Le 05/04/2015, à 12:16)
Hors ligne
#906 Le 07/04/2015, à 14:09
- daniel38100
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonjour tout le monde!
J'ai une petite question à poser vis à vis des possibilités de Conky. J'ai un serveur nas en réseau et j'aimerai savoir si il existe un moyen d'avoir des conky permettant d'avoir les données comme sur cette image d'un post précédent http://forum.ubuntu-fr.org/viewtopic.ph … #p12890531
mais du serveur nas sans avoir la fenêtre d'administration tout le temps ouverte?
Cordialement
Raphanel
si c'est sûrement possible en utilisant conky avec un script externe après il faudrait les caractéristique de ton serveur
(j'ai pas tout a fait bien saisie la question et je connais pas trop le NAS)
Hors ligne
#907 Le 08/04/2015, à 21:20
- Ferod
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonjour,
A mon tour de poser une petite question. J'ai un conky où j'affiche les infos habituelles sur une image qui me sers de fond pour qu'on puisse lire les infos et ne pas être dépendant du fond d'écran. La particularité de mon conky c'est que je change la couleur de l'image de fond de mon conky en fonction de mon fond d'écran (j'utilise le thème elegance pour gnome shell dont la couleur s'adapte au fond d'écran que l'on choisi). Donc j'ai adapté mon script pour changer l'image de fond. J'aimerai maintenant pouvoir changer la couleur du texte car le fond de l'image peut être très sombre ou très claire. C'est pas très compliqué de le faire il suffit de changer "default_color 000000" par "default_color ffffff" avec une commande sed et c'est bon. Le problème c'est qu'en touchant au fichier ~/.conkyrc il disparait et réapparait un peu plus tard. J'aimerai que ça se fasse sans disparition / réapparition mais je ne sais pas comment faire.
J'ai fait quelques recherches et j'ai vu qu'on pouvait inclure un fichier (d'après la page de doc : http://conky.sourceforge.net/variables.html). Mais je ne sais pas m'en servir.
En fait je me dis qu'en gardant le fichier ~/.conkyrc intact (je modifierais qu'un fichier inclus), je ne le forcerai pas recharger le conky.
Pour info voici le conky que j'utilise avec un fond plutôt sombre :
http://forum.ubuntu-fr.org/viewtopic.ph … #p18403481
Le même aujourd'hui avec un fond d'écran plutôt clair :
http://pix.toile-libre.org/?img=1428521435.png
L'image de fond a été un peu modifiée entre les deux versions.
Merci pour votre aide.
"When I was in the military, they gave me a medal for killing
two men, and a descharge for loving one !" Leonard Matlovich
Hors ligne
#908 Le 19/04/2015, à 17:48
- enebre
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonjour,
Comment pourrais-je régler le fond d'un conky pour une transparence à 50% par exemple, mais sans lua.
Merci
Hors ligne
#909 Le 19/04/2015, à 18:43
- chepioq
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Cela est indépendant de lua, cela se règle dans la configuration avant TEXT, avec la variable own_window_argb_value :
When ARGB visuals are enabled, this use this to modify the alpha value used. Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
Donc si tu mets
own_window_argb_value 127
Tu devrais avoir 50% de transparence
Tout est dans tout et réciproquement....
Hors ligne
#910 Le 19/04/2015, à 21:29
- enebre
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
bonsoir chepioq,
merci pour ton aide, mais ais-je oublié quelque chose, car je n'ai pas l'effet désiré, le conky reste transparent ?
background true
use_xft yes
xftfont Sans:size=7
xftalpha 0.5
update_interval 10
#total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_argb_value 127
#own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager,below
double_buffer yes
minimum_size 280 800
maximum_width 280
text_buffer_size 512
#draw_shades no
#draw_outline no
#draw_borders no
draw_graph_borders yes
default_color white
#default_shade_color black
#default_outline_color white
alignment tr
short_units
gap_x 3
gap_y 35
no_buffers yes
#uppercase no
cpu_avg_samples 2
net_avg_samples 2
#override_utf8_locale yes
Dernière modification par enebre (Le 19/04/2015, à 21:31)
Hors ligne
#911 Le 19/04/2015, à 21:35
- Didier-T
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonsoir enebre,
il faudrait que tu retire ceci
own_window_transparent yes
Hors ligne
#912 Le 19/04/2015, à 21:42
- enebre
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonsoir Didier_T,
Je viens d'appliquer ta correction mais le conky reste transparent.
J'essaye d'utiliser ce script comme fond d'écran, mais mon conky en devient illisible c'est pour cette raison qu'un fond semi-transparent serait, je crois, plus approprié.
Et aussi sur
ce script
, je ne suis pas encore certain qu'il fonctionne bien, peut être qu'avec l'adressage complet des dossiers ça fonctionnera...
#!/bin/bash
cd /home/ombre/.gnome2/
while [ 1 ]; do
COUNTER=0
while [ $COUNTER -lt 60 ]; do
wget http://static.die.net/earth/mercator/1600.jpg -O world.jpg --user-agent="Mozilla/5.0"
temp=$(stat -c%s /home/ombre/.gnome2/world.jpg)
if [[ $temp > 1000 ]]
then rm /home/ombre/.gnome2/world_sunlight_Wallpaper.jpg
mv /home/ombre/.gnome2/world.jpg /home/ombre/.gnome2/world_sunlight_Wallpaper.jpg
break
fi
sleep 50
let COUNTER=COUNTER +1
done
sleep 3600
done
Dernière modification par enebre (Le 19/04/2015, à 21:54)
Hors ligne
#913 Le 20/04/2015, à 04:37
- enebre
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonjour Didier, chepioq,
Ce matin au reboot le correctif own_window_transparent yes à été appliqué au conky.
Merci, c'est très chouette.
Et le script earthweather est lui aussi fonctionnel
Dernière modification par enebre (Le 29/04/2016, à 13:30)
Hors ligne
#914 Le 20/04/2015, à 06:23
- chepioq
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Je viens de tester et chez moi cela fonctionne sans ton script, juste avec own_window_argb_value 150 et en commentant la ligne #own_window_transparent yes comme l'indique Didier-T
Tout est dans tout et réciproquement....
Hors ligne
#915 Le 20/04/2015, à 16:17
- enebre
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
chepioq bonjour,
ben oui, comme Didier à expliqué ça fonctionne pour le conky, mais tu as raison le script de earthweather ne fonctionne pas, il charge la page mais ne change pas l'affichage.
Vois-tu ou se trouve le pavé qui bloque ?
#!/bin/bash
cd /home/ombre/.gnome2/
while [ 1 ]; do
COUNTER=0
while [ $COUNTER -lt 60 ]; do
wget http://static.die.net/earth/mercator/1600.jpg -O world.jpg --user-agent="Mozilla/5.0"
temp=$(stat -c%s /home/ombre/.gnome2/world.jpg)
if [[ $temp > 1000 ]]
then rm /home/ombre/.gnome2/world_sunlight_Wallpaper.jpg
mv /home/ombre/.gnome2/world.jpg /home/ombre/.gnome2/world_sunlight_Wallpaper.jpg
break
fi
sleep 50
let COUNTER=COUNTER +1
done
sleep 3600
done
Hors ligne
#916 Le 20/04/2015, à 17:34
- Didier-T
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonjour enebre,
tu devrais regarder ici.
je suis un peu loin de mon PC pour les congés, il m'est donc impossible de t'aider plus.
A+,
Didier.
Hors ligne
#917 Le 20/04/2015, à 17:38
- enebre
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Ok, merci Didier, je vais regarder si j'arrive à adapter le script.
Bonnes vacances
Hors ligne
#918 Le 20/04/2015, à 18:54
- chepioq
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Voici un petit conky qui affiche la date et l'heure mais sous forme écrite (par exemple vingt heure moins vingt).
J'ai repris un script de Sector11, http://crunchbang.org/forums/viewtopic. … 6909&p=332, post #8287 et suivant.
Un petit aperçu :
L'heure est à 5 minutes près, mais on peut modifier le script pour que cela soit plus précis.
Le conky:
background no
use_xft yes
xftfont MgOpen Modata L:size=10:bold
update_interval 1
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent no
own_window_argb_value 150
own_window_argb_visual yes
own_window_hints undecorate,skip_taskbar,skip_pager,below
double_buffer yes
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_color white
alignment top_right
minimum_size 600 0
maximum_width 600
#minimum_size 230 0
#maximum_width 230
gap_x 12
gap_y 250
no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
use_spacer right
text_buffer_size 1024
color0 00f5ff #bleu turquoise
color1 cf1c00 #rouge brique
color2 cd5555 #rose foncé
color3 11B3F8 #bleu ciel
color4 0000ff #bleu foncé
color5 176e88 #bleu-gris
color6 ff4500 #orange foncé
color7 00FF00 #vert tendre
color8 FF8000 #orange
color9 FF0000 #rouge
TEXT
${alignc}${execpi 30 /home/dominique/test/talktime_fr.sh}
${alignc}${if_match ${time %u} == 1}lundi${else}\
${if_match ${time %u} == 2}mardi${else}\
${if_match ${time %u} == 3}mercredi${else}\
${if_match ${time %u} == 4}jeudi${else}\
${if_match ${time %u} == 5}vendredi${else}\
${if_match ${time %u} == 6}samedi${else}\
dimanche${endif}${endif}${endif}${endif}${endif}${endif} \
${if_match ${time %e} <= 9}${time %e}${else}${time %d}${endif} \
${if_match ${time %m} == 01}janvier${else}\
${if_match ${time %m} == 02}février${else}\
${if_match ${time %m} == 03}mars${else}\
${if_match ${time %m} == 04}avril${else}\
${if_match ${time %m} == 05}mai${else}\
${if_match ${time %m} == 06}juin${else}\
${if_match ${time %m} == 07}juillet${else}\
${if_match ${time %m} == 08}août${else}\
${if_match ${time %m} == 09}septembre${else}\
${if_match ${time %m} == 10}octobre${else}\
${if_match ${time %m} == 11}novembre${else}\
décembre${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif} \
${time %Y}
le script : talktime_fr.sh
#!/bin/sh
# DC's english time 07/07/09
# Tweaked by Sector11
# Converted to French by Sector11 with help from ragamatrix
# More French help by: chepioq
# find current time
t_hr=$(date +%-H)
#echo $t_hr
t_min=$(date +%-M)
#echo $t_min
#t_hr=9 #tester
#t_min=17 #tester
# is it time to ONE ( the only wierd case)
if [ $t_hr -eq 12 ] && [ $t_min -gt 32 ] ;then
# what minute is it
case $t_min in
33|34|35|36|37)
echo une heure moins vingt-cinq ;;
38|39|40|41|42)
echo une heure moins vingt ;;
43|44|45|46|47)
echo une heure moins le quart ;;
48|49|50|51|52)
echo une heure moins dix ;;
53|54|55|56|57|58|59)
echo une heure moins cinq ;;
58|59)
echo presque une heure
esac
exit
fi
#echo $t_hr
#add one hour for the "to" hour
if [ $t_min -gt 32 ] ; then
t_hr=$(($t_hr + 1)) # override t_hr
fi
#echo $t_hr
# find out what hour it is and change into text
case $t_hr in
0)
t_hr_text=minuit ;;
1)
t_hr_text="une heure" ;;
2)
t_hr_text="deux heure" ;;
3)
t_hr_text="trois heure" ;;
4)
t_hr_text="quatre heure" ;;
5)
t_hr_text="cinq heure" ;;
6)
t_hr_text="six heure" ;;
7)
t_hr_text="sept heure" ;;
8)
t_hr_text="huit heure" ;;
9)
t_hr_text="neuf heure" ;;
10)
t_hr_text="dix heure" ;;
11)
t_hr_text="onze heure" ;;
12)
t_hr_text=midi ;;
13)
t_hr_text="treize heure" ;;
14)
t_hr_text="quatorze heure" ;;
15)
t_hr_text="quinze heure" ;;
16)
t_hr_text="seize heure" ;;
17)
t_hr_text="dix-sept heure" ;;
18)
t_hr_text="dix-huit heure" ;;
19)
t_hr_text="dix-neuf heure" ;;
20)
t_hr_text="vingt heure" ;;
21)
t_hr_text="vingt et une heure" ;;
22)
t_hr_text="vingt-deux heure" ;;
23)
t_hr_text="vingt-trois heure" ;;
esac
# what minute is it
case $t_min in
0|1|2)
echo $t_hr_text ;;
3|4|5|6|7)
echo $t_hr_text cinq ;;
8|9|10|11|12)
echo $t_hr_text dix ;;
13|14|15|16|17)
echo $t_hr_text et quart ;;
18|19|20|21|22)
echo $t_hr_text vingt ;;
23|24|25|26|27)
echo $t_hr_text vingt-cinq;;
28|29|30|31|32)
echo $t_hr_text et demie ;;
33|34|35|36|37)
echo $t_hr_text moins vingt-cinq ;;
38|39|40|41|42)
echo $t_hr_text moins vingt ;;
43|44|45|46|47)
echo $t_hr_text moins le quart ;;
48|49|50|51|52)
echo $t_hr_text moins dix ;;
53|54|55|56|57)
echo $t_hr_text moins cinq ;;
58|59)
echo ± $t_hr_text ;;
esac
Le 21/04/2015:
--correction d'un léger bug qui empêchait l'affichage des heures de 0 à 9.
Dernière modification par chepioq (Le 21/04/2015, à 10:08)
Tout est dans tout et réciproquement....
Hors ligne
#919 Le 22/04/2015, à 20:10
- Ferod
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Suite de mon problème évoqué un peu plus sur cette page (http://forum.ubuntu-fr.org/viewtopic.ph … #p19584741). Mon problème était de changer la couleur du texte de mon conky sans que conky redémarre. Je me suis "contenté" de transférer dans le script lua tout ce que j'avais dans le .conkyrc (principalement l'affichage de la météo, de la température CPU, etc...). Donc maintenant tout l'affichage de texte se fait via le script lua et je peux changer la couleur directement dans le fichier lua.
L'inconvénient maintenant c'est qu'il prend un peu plus de cpu puisque j'affiche la météo toute les secondes alors qu'avant c'était toutes les 10 minutes. Enfin c'est pas sûr peut être que je me fais des idées.
Il n'y a plus que le graphique des débit internet qui me manque à transcrire mais là je sèche un peu. Je vais voir si je peux pas trouver déjà faite dans ce post.
"When I was in the military, they gave me a medal for killing
two men, and a descharge for loving one !" Leonard Matlovich
Hors ligne
#920 Le 22/04/2015, à 20:45
- Didier-T
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonsoir Ferod,
pourais tu nous poster ton scrit lua, ainsi que ton conky.
Merci.
Hors ligne
#921 Le 22/04/2015, à 21:17
- Ferod
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Pas de problème. Le voici :
.conkyrc
######################
# - Conky settings - #
######################
update_interval 1
total_run_times 0
net_avg_samples 1
cpu_avg_samples 1
imlib_cache_size 0
double_buffer yes
no_buffers yes
#####################
# - Text settings - #
#####################
use_xft yes
xftfont Ubuntu:size=9
override_utf8_locale yes
text_buffer_size 2048
#############################
# - Window specifications - #
#############################
own_window_class Conky
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#own_window_argb_visual yes
#own_window_argb_value 100
alignment tr
gap_x -2
gap_y 180
minimum_size 350 450
default_bar_size 60 10
# - Graphics settings - #
#########################
draw_shades no
default_color ffffff
default_shade_color 1d1d1d
color0 ffffff
color1 ffffff
color2 ffffff
lua_load ~/.conky/script.lua
lua_draw_hook_pre main
TEXT
${voffset 0}
#---DATE & HEURE----
#---METEO----
${execi 600 ~/.conky/meteo_update.sh}
#---CPU ET RAM----
#---DISQUE DUR----
#---DEBIT INTERNET----
${if_up eth0}
${voffset 255}
${alignr 40}${upspeedgraph eth0 8,100 ffffff ffffff}
${alignr 40}${downspeedgraph eth0 8,100 ffffff ffffff}
${endif}
#---MUSIQUE----
${if_running clementine}
${color}
$endif
#---IMAGES----
${image ~/.conky/base.png -p 10,0 -s 339x86}${image ~/.conky/base.png -p 10,73 -s 339x86}${image ~/.conky/base.png -p 10,146 -s 339x86}${image ~/.conky/base.png -p 10,219 -s 339x86}${image ~/.conky/base.png -p 10,292 -s 339x86}${image ~/.conky/base.png -p 10,365 -s 339x86}${image ~/.conky/calendar.png -p 28,20 -s 45x45}${image ~/.conky/weather.png -p 28,93 -s 45x45}${image ~/.conky/emblem-system.png -p 28,166 -s 45x45}${image ~/.conky/folder.png -p 28,239 -s 45x45}${image ~/.conky/nm-signal-75.png -p 28,312 -s 45x45}${image ~/.conky/emblem-sound.png -p 28,385 -s 45x45}
meteo_update.sh
#!/bin/bash
#
# Ce script stocke les données météos dans plusieurs fichiers pour qu'ils soient affichées ensuite dans conky
date +%a > ~/.conky/meteo.jour
for jour in `seq 2 7` ; do
date --date="+$(($jour-1)) day" +%a >> ~/.conky/meteo.jour
done
w3m -dump "http://api.openweathermap.org/data/2.5/weather?q=Toulouse&mode=xml&units=metric" > ~/.conky/meteo.1
w3m -dump "http://api.openweathermap.org/data/2.5/forecast/daily?q=Toulouse&mode=xml&units=metric&cnt=7" > ~/.conky/meteo.7
grep "weather number" ~/.conky/meteo.1 | cut -d\" -f2 > ~/.conky/meteo.cond
grep "symbol number" ~/.conky/meteo.7 | cut -d\" -f2 | sed -e '1d' >> ~/.conky/meteo.cond
grep "temperature value" ~/.conky/meteo.1 | cut -d\" -f2 | cut -d. -f1 > ~/.conky/meteo.temp
grep "temperature" ~/.conky/meteo.7 | cut -d\" -f2 | cut -d. -f1 | sed -e '1d' >> ~/.conky/meteo.temp
grep "pressure value" ~/.conky/meteo.1 | cut -d\" -f2 | cut -d. -f1 > ~/.conky/meteo.pres
grep "pressure" ~/.conky/meteo.7 | cut -d\" -f4 | cut -d. -f1 | sed -e '1d' >> ~/.conky/meteo.pres
meteo_display.sh
#!/bin/bash
# Ce script permet d'afficher les infos dans conky. Les paramètres sont les suivant
# $1 = jour : renvoie le nom du jour $2
# $1 = pression : renvoie la pression du jour $2
# $1 = temperature : renvoie la temperature du jour $2
# $1 = meteo : renvoie la météo du jour $2
#
#
if [ $1 = "jour" ] ; then
res_jour=`sed -n $(($2))p ~/.conky/meteo.jour`
echo $res_jour
elif [ $1 = "pression" ] ; then
res_pression=`sed -n $(($2))p ~/.conky/meteo.pres`
echo $res_pression
elif [ $1 = "temperature" ] ; then
res_temp=`sed -n $(($2))p ~/.conky/meteo.temp`
echo $res_temp
elif [ $1 = "meteo" ] ; then
condition=`sed -n $(($2))p ~/.conky/meteo.cond`
case $condition in
"200"|"201"|"202"|"230"|"231"|"232"|"906")
meteo="i" ;;
"210"|"211"|"212")
meteo="f" ;;
"221"|"731"|"900")
meteo="W" ;;
"300"|"301"|"302"|"310"|"311"|"312"|"321")
meteo="G" ;;
"500"|"501"|"520")
meteo="g" ;;
"502"|"503"|"504"|"521"|"522")
meteo="h" ;;
"511"|"600"|"601"|"611"|"621")
meteo="k" ;;
"602")
meteo="j" ;;
"701"|"711")
meteo="J" ;;
"721")
meteo="I" ;;
"741")
meteo="F" ;;
"800")
meteo="a" ;;
"801")
meteo="b" ;;
"802")
meteo="c" ;;
"803")
meteo="d" ;;
"804")
meteo="e" ;;
"901"|"902")
meteo="V" ;;
"903")
meteo="x" ;;
"904")
meteo="z" ;;
"905")
meteo="v" ;;
esac
echo $meteo
else
echo "Err"
fi
sensors.sh
#!/bin/bash
if [ $1 = 1 ] ; then
temp=`sensors | grep 'Core 0' | cut -c 18-19`
else
temp=`sensors | grep 'Core 1' | cut -c 18-19`
fi
echo $temp
sript.lua
--this is a lua script for use in conky
require 'cairo'
--------------------------------------------------------------------------------
-- horloge DONNÉES
-- HEURE
clock_h = {
{
name='time', arg='%H', max_value=12,
x=200, y=48,
graph_radius=20,
graph_thickness=2,
graph_unit_angle=30, graph_unit_thickness=30,
graph_bg_colour=0xffffff, graph_bg_alpha=0.2,
graph_fg_colour=0xffffff, graph_fg_alpha=1.0,
txt_radius=20,
txt_weight=1, txt_size=11.0,
txt_fg_colour=0xffffff, txt_fg_alpha=0.8,
graduation_radius=20,
graduation_thickness=3, graduation_mark_thickness=2,
graduation_unit_angle=30,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.3,
},
}
-- MINUTES
clock_m = {
{
name='time', arg='%M', max_value=60,
x=200, y=48,
graph_radius=25,
graph_thickness=2,
graph_unit_angle=6, graph_unit_thickness=6,
graph_bg_colour=0xffffff, graph_bg_alpha=0.2,
graph_fg_colour=0xffffff, graph_fg_alpha=1.0,
txt_radius=35,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0xffffff, txt_fg_alpha=0.6,
graduation_radius=57,
graduation_thickness=0, graduation_mark_thickness=2,
graduation_unit_angle=30,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.3,
},
}
-- SECONDES
clock_s = {
{
name='time', arg='%S', max_value=60,
x=200, y=48,
graph_radius=30,
graph_thickness=2,
graph_unit_angle=6, graph_unit_thickness=2,
graph_bg_colour=0xffffff, graph_bg_alpha=0.0,
graph_fg_colour=0xffffff, graph_fg_alpha=1.0,
txt_radius=40,
txt_weight=0, txt_size=9.0,
txt_fg_colour=0xffffff, txt_fg_alpha=0.6,
graduation_radius=0,
graduation_thickness=0, graduation_mark_thickness=0,
graduation_unit_angle=0,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.0,
},
}
--------------------------------------------------------------------------------
-- jauge DONNÉES
gauge = {
{
name='downspeedf', arg='', max_value=100,
x=40, y=160,
graph_radius=0,
graph_thickness=0,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xffffff, graph_fg_alpha=0.0,
hand_fg_colour=0xEF5A29, hand_fg_alpha=0.8,
txt_radius=34,
txt_weight=1, txt_size=10.0,
txt_fg_colour=0xEF5A29, txt_fg_alpha=0.0,
graduation_radius=0,
graduation_thickness=4, graduation_mark_thickness=2,
graduation_unit_angle=27,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.3,
-- caption='download',
caption_weight=1, caption_size=8.0,
caption_fg_colour=0xffffff, caption_fg_alpha=0.5,
},
{
name='upspeedf', arg='', max_value=100,
x=40, y=160,
graph_radius=0,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xffffff, graph_fg_alpha=0.0,
hand_fg_colour=0xffffff, hand_fg_alpha=0.6,
txt_radius=10,
txt_weight=0, txt_size=9.0,
txt_fg_colour=0xffffff, txt_fg_alpha=0.0,
graduation_radius=0,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.3,
-- caption='upload',
caption_weight=1, caption_size=8.0,
caption_fg_colour=0xffffff, caption_fg_alpha=0.5,
},
}
settings_table = {
{
name='fs_used_perc', arg='/home',
x=120, y=255, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=17,
thickness=3,
start_angle=-180,
end_angle=180
},
{
name='fs_used_perc', arg='/',
x=205, y=255, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=17,
thickness=3,
start_angle=-180,
end_angle=180
},
{
name='fs_used_perc', arg='/media/Documents',
x=290, y=255, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=17,
thickness=3,
start_angle=-180,
end_angle=180
},
{
name='memperc', arg='',
x=290, y=205, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=25,
thickness=5,
start_angle=-90,
end_angle=90
},
{
name='cpu', arg='cpu1',
x=125, y=205, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=25,
thickness=2,
start_angle=-90,
end_angle=90
},
{
name='cpu', arg='cpu2',
x=125, y=205, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=20,
thickness=2,
start_angle=-90,
end_angle=90
},
}
-------------------------------------------------------------------------------
-- position_de_l'angle
-- convertit les degrés, rotation et rad (0 degré est en haut / nord)
--
function angle_to_position(start_angle, current_angle)
local pos = current_angle + start_angle
return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end
-------------------------------------------------------------------------------
-- rgb_to_r_g_b
-- convertit la couleur de hexa en décimal
--
function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
-------------------------------------------------------------------------------
-- draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_start_angle = data['graph_start_angle']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
local graph_end_angle = (max_value * graph_unit_angle) % 360
-- background ring
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- arc of value
local val = value % (max_value + 1)
local start_arc = 0
local stop_arc = 0
local i = 1
while i <= val do
start_arc = (graph_unit_angle * i) - graph_unit_thickness
stop_arc = (graph_unit_angle * i)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = start_arc
-- hand
start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
stop_arc = (graph_unit_angle * val)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
cairo_stroke(display)
-- graduations marks
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = graph_end_angle / graduation_unit_angle
local i = 0
while i < nb_graduation do
cairo_set_line_width(display, graduation_thickness)
start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
-- text
local txt_radius = data['txt_radius']
local txt_weight, txt_size = data['txt_weight'], data['txt_size']
local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
cairo_set_font_size (display, txt_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
cairo_show_text (display, value)
cairo_stroke (display)
-- caption
local caption = data['caption']
local caption_weight, caption_size = data['caption_weight'], data['caption_size']
local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
cairo_set_font_size (display, caption_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
cairo_move_to (display, x + tox + 5, y + toy + 1)
-- bad hack but not enough time !
if graph_start_angle < 105 then
cairo_move_to (display, x + tox - 30, y + toy + 1)
end
cairo_show_text (display, caption)
cairo_stroke (display)
end
-------------------------------------------------------------------------------
-- draw_clock_ring
-- affichage horloge
--
function draw_clock_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
-- fond de l'anneau
cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi)
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- valeur arc
local val = (value % max_value)
local i = 1
while i <= val do
cairo_arc(display, x, y, graph_radius,( ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360) )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2))
cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = (graph_unit_angle * i) - graph_unit_thickness
-- graduations
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = 360 / graduation_unit_angle
local i = 1
while i <= nb_graduation do
cairo_set_line_width(display, graduation_thickness)
cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
end
-------------------------------------------------------------------------------
-- go_clock_rings
-- loads data and displays clock
--
function go_clock_rings(display)
local function load_clock_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_clock_ring(display, data, value)
end
for i in pairs(clock_h) do
load_clock_rings(display, clock_h[i])
end
for i in pairs(clock_m) do
load_clock_rings(display, clock_m[i])
end
for i in pairs(clock_s) do
load_clock_rings(display, clock_s[i])
end
end
-------------------------------------------------------------------------------
-- go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
local function load_gauge_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_gauge_ring(display, data, value)
end
for i in pairs(gauge) do
load_gauge_rings(display, gauge[i])
end
end
-------------------------------------------------------------------------------
-- displays rings
--
--
function draw_ring(cr,t,pt)
local w,h=conky_window.width,conky_window.height
local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']
local angle_0=sa*(2*math.pi/360)-math.pi/2
local angle_f=ea*(2*math.pi/360)-math.pi/2
local t_arc=t*(angle_f-angle_0)
cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
cairo_set_line_width(cr,ring_w)
cairo_stroke(cr)
cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
cairo_stroke(cr)
end
function display_text()
red,green,blue,alpha=1,1,1,1
font_slant=CAIRO_FONT_SLANT_NORMAL
font_normal=CAIRO_FONT_WEIGHT_NORMAL
font_bold=CAIRO_FONT_WEIGHT_BOLD
----------------------------------
--[[###########################################
Heure et Date
##############################################]]
font_ville="Ubuntu"
font_size_ville=11
ville="Toulouse"
x_ville,y_ville=100,27
cairo_select_font_face (cr, font_ville, font_slant, font_normal);
cairo_set_font_size (cr, font_size_ville)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_ville,y_ville)
cairo_show_text (cr,ville)
cairo_stroke (cr)
font_heure="Ubuntu"
font_size_heure=12
heure=conky_parse("${time %H:%M}")
x_heure,y_heure=185,52
cairo_select_font_face (cr, font_heure, font_slant, font_bold);
cairo_set_font_size (cr, font_size_heure)
cairo_move_to (cr,x_heure,y_heure)
cairo_show_text (cr,heure)
cairo_stroke (cr)
font_jour="Ubuntu"
font_size_jour=12
jour=conky_parse("${time %A}") --${time %A}
x_jour,y_jour=280,31
cairo_select_font_face (cr, font_jour, font_slant, font_normal);
cairo_set_font_size (cr, font_size_jour)
cairo_move_to (cr,x_jour,y_jour)
cairo_show_text (cr,jour)
cairo_stroke (cr)
font_mois="Ubuntu"
font_size_mois=12
mois=conky_parse("${time %B}") --${time %B}
x_mois,y_mois=280,42
cairo_select_font_face (cr, font_mois, font_slant, font_normal);
cairo_set_font_size (cr, font_size_mois)
cairo_move_to (cr,x_mois,y_mois)
cairo_show_text (cr,mois)
cairo_stroke (cr)
font_day="Ubuntu"
font_size_day=32
day=conky_parse("${time %d}")
x_day,y_day=245,42
cairo_select_font_face (cr, font_day, font_slant, font_normal);
cairo_set_font_size (cr, font_size_day)
cairo_move_to (cr,x_day,y_day)
cairo_show_text (cr,day)
cairo_stroke (cr)
font_year="Ubuntu"
font_size_year=32
year=conky_parse("${time %Y}")
x_year,y_year=245,72
cairo_select_font_face (cr, font_year, font_slant, font_normal);
cairo_set_font_size (cr, font_size_year)
cairo_move_to (cr,x_year,y_year)
cairo_show_text (cr,year)
cairo_stroke (cr)
--[[###########################################
Météo
##############################################]]
font_meteo="Weather"
font_size_meteo=65
meteo=conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 1}")
x_meteo,y_meteo=105,73
cairo_select_font_face (cr, font_meteo, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo,y_meteo)
cairo_show_text (cr,meteo)
cairo_stroke (cr)
font_temp_jour="Ubuntu"
font_size_temp_jour=11
temp=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 1}")
pressu=conky_parse("${execi 10 ~/.conky/meteo_display.sh pression 1}")
temp_jour=temp.."°C-"..pressu.." hPa"
x_temp_jour,y_temp_jour=92,75
cairo_select_font_face (cr, font_temp_jour, font_slant, font_normal);
cairo_set_font_size (cr, font_size_temp_jour)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_temp_jour,y_temp_jour)
cairo_show_text (cr,temp_jour)
cairo_stroke (cr)
-- prévision metéo jour
font_meteo1="Weather"
font_size_meteo1=50
meteo1=conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 2}")
x_meteo1,y_meteo1=95,140
cairo_select_font_face (cr, font_meteo1, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo1)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo1,y_meteo1)
cairo_show_text (cr,meteo1)
cairo_stroke (cr)
font_meteo2="Weather"
font_size_meteo2=50
meteo2=conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 3}")
x_meteo2,y_meteo2=135,140
cairo_select_font_face (cr, font_meteo2, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo2)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo2,y_meteo2)
cairo_show_text (cr,meteo2)
cairo_stroke (cr)
font_meteo3="Weather"
font_size_meteo3=50
meteo3=conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 4}")
x_meteo3,y_meteo3=175,140
cairo_select_font_face (cr, font_meteo3, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo3)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo3,y_meteo3)
cairo_show_text (cr,meteo3)
cairo_stroke (cr)
font_meteo4="Weather"
font_size_meteo4=50
meteo4=conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 5}")
x_meteo4,y_meteo4=215,135
cairo_select_font_face (cr, font_meteo4, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo4)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo4,y_meteo4)
cairo_show_text (cr,meteo4)
cairo_stroke (cr)
font_meteo5="Weather"
font_size_meteo5=50
meteo5=conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 6}")
x_meteo5,y_meteo5=255,140
cairo_select_font_face (cr, font_meteo5, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo5)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo5,y_meteo5)
cairo_show_text (cr,meteo5)
cairo_stroke (cr)
font_meteo6="Weather"
font_size_meteo6=50
meteo6=conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 7}")
x_meteo6,y_meteo6=295,140
cairo_select_font_face (cr, font_meteo6, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo6)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo6,y_meteo6)
cairo_show_text (cr,meteo6)
cairo_stroke (cr)
-- affichage du jour
font_meteo1="Ubuntu"
font_size_meteo1=11
meteo1=conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 2}")
x_meteo1,y_meteo1=100,100
cairo_select_font_face (cr, font_meteo1, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo1)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo1,y_meteo1)
cairo_show_text (cr,meteo1)
cairo_stroke (cr)
font_meteo2="Ubuntu"
font_size_meteo2=11
meteo2=conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 3}")
x_meteo2,y_meteo2=140,100
cairo_select_font_face (cr, font_meteo2, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo2)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo2,y_meteo2)
cairo_show_text (cr,meteo2)
cairo_stroke (cr)
font_meteo3="Ubuntu"
font_size_meteo3=11
meteo3=conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 4}")
x_meteo3,y_meteo3=180,100
cairo_select_font_face (cr, font_meteo3, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo3)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo3,y_meteo3)
cairo_show_text (cr,meteo3)
cairo_stroke (cr)
font_meteo4="Ubuntu"
font_size_meteo4=11
meteo4=conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 5}")
x_meteo4,y_meteo4=220,100
cairo_select_font_face (cr, font_meteo4, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo4)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo4,y_meteo4)
cairo_show_text (cr,meteo4)
cairo_stroke (cr)
font_meteo5="Ubuntu"
font_size_meteo5=11
meteo5=conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 6}")
x_meteo5,y_meteo5=260,100
cairo_select_font_face (cr, font_meteo5, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo5)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo5,y_meteo5)
cairo_show_text (cr,meteo5)
cairo_stroke (cr)
font_meteo6="Ubuntu"
font_size_meteo6=11
meteo6=conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 7}")
x_meteo6,y_meteo6=300,100
cairo_select_font_face (cr, font_meteo6, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo6)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo6,y_meteo6)
cairo_show_text (cr,meteo6)
cairo_stroke (cr)
-- prévision température jour
font_meteo1="Ubuntu"
font_size_meteo1=12
meteo1=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 2}").."°C"
x_meteo1,y_meteo1=100,147
cairo_select_font_face (cr, font_meteo1, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo1)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo1,y_meteo1)
cairo_show_text (cr,meteo1)
cairo_stroke (cr)
font_meteo2="Ubuntu"
font_size_meteo2=12
meteo2=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 3}").."°C"
x_meteo2,y_meteo2=140,147
cairo_select_font_face (cr, font_meteo2, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo2)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo2,y_meteo2)
cairo_show_text (cr,meteo2)
cairo_stroke (cr)
font_meteo3="Ubuntu"
font_size_meteo3=12
meteo3=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 4}").."°C"
x_meteo3,y_meteo3=180,147
cairo_select_font_face (cr, font_meteo3, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo3)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo3,y_meteo3)
cairo_show_text (cr,meteo3)
cairo_stroke (cr)
font_meteo4="Ubuntu"
font_size_meteo4=12
meteo4=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 5}").."°C"
x_meteo4,y_meteo4=220,147
cairo_select_font_face (cr, font_meteo4, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo4)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo4,y_meteo4)
cairo_show_text (cr,meteo4)
cairo_stroke (cr)
font_meteo5="Ubuntu"
font_size_meteo5=12
meteo5=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 6}").."°C"
x_meteo5,y_meteo5=260,147
cairo_select_font_face (cr, font_meteo5, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo5)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo5,y_meteo5)
cairo_show_text (cr,meteo5)
cairo_stroke (cr)
font_meteo6="Ubuntu"
font_size_meteo6=12
meteo6=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 7}").."°C"
x_meteo6,y_meteo6=300,147
cairo_select_font_face (cr, font_meteo6, font_slant, font_normal);
cairo_set_font_size (cr, font_size_meteo6)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_meteo6,y_meteo6)
cairo_show_text (cr,meteo6)
cairo_stroke (cr)
--[[###########################################
CPU Temperature et RAM
##############################################]]
font_titre="Ubuntu"
font_size_titre=15
titre="CPU Température RAM"
x_titre,y_titre=105,175
cairo_select_font_face (cr, font_titre, font_slant, font_normal);
cairo_set_font_size (cr, font_size_titre)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_titre,y_titre)
cairo_show_text (cr,titre)
cairo_stroke (cr)
font_cpu="Ubuntu"
font_size_cpu=12
cpu1=conky_parse("${cpu cpu1}")
cpu2=conky_parse("${cpu cpu2}")
cpu=cpu1.."% / "..cpu2.."%"
x_cpu,y_cpu=100,220
cairo_select_font_face (cr, font_cpu, font_slant, font_normal);
cairo_set_font_size (cr, font_size_cpu)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_cpu,y_cpu)
cairo_show_text (cr,cpu)
cairo_stroke (cr)
font_temp="Ubuntu"
font_size_temp=12
T1=conky_parse("${execi 30 ~/.conky/sensors.sh 1}")
T2=conky_parse("${execi 30 ~/.conky/sensors.sh 2}")
temp1="T1 : "..T1.."°C"
temp2="T2 : "..T2.."°C"
x_temp1,y_temp1=180,200
x_temp2,y_temp2=180,215
cairo_select_font_face (cr, font_temp, font_slant, font_normal);
cairo_set_font_size (cr, font_size_temp)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_temp1,y_temp1)
cairo_show_text (cr,temp1)
cairo_move_to (cr,x_temp2,y_temp2)
cairo_show_text (cr,temp2)
cairo_stroke (cr)
font_ram_perc="Ubuntu"
font_size_ram_perc=17
ram=conky_parse("${memperc}")
ram_perc=ram.."%"
x_ram_perc,y_ram_perc=275,205
cairo_select_font_face (cr, font_ram_perc, font_slant, font_normal);
cairo_set_font_size (cr, font_size_ram_perc)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_ram_perc,y_ram_perc)
cairo_show_text (cr,ram_perc)
cairo_stroke (cr)
font_memo="Ubuntu"
font_size_memo=11
mem_prise=conky_parse("${mem}")
mem_libre=conky_parse("${memeasyfree}")
memo=mem_prise.."/"..mem_libre
x_memo,y_memo=250,220
cairo_select_font_face (cr, font_memo, font_slant, font_normal);
cairo_set_font_size (cr, font_size_memo)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_memo,y_memo)
cairo_show_text (cr,memo)
cairo_stroke (cr)
--[[###########################################
Espace disponible
##############################################]]
font_esp_perc="Ubuntu"
font_size_esp_perc=15
espace1=conky_parse("${fs_used_perc /home}")
espace2=conky_parse("${fs_used_perc /}")
espace3=conky_parse("${fs_used_perc /media/Documents}")
esp_perc=espace1.."% "..espace2.."% "..espace3.."%"
x_esp_perc,y_esp_perc=108,260
cairo_select_font_face (cr, font_esp_perc, font_slant, font_normal);
cairo_set_font_size (cr, font_size_esp_perc)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_esp_perc,y_esp_perc)
cairo_show_text (cr,esp_perc)
cairo_stroke (cr)
font_esp_nom="Ubuntu"
font_size_esp_nom=11
esp_nom="home : Racine : Docs :"
x_esp_nom,y_esp_nom=105,285
cairo_select_font_face (cr, font_esp_nom, font_slant, font_normal);
cairo_set_font_size (cr, font_size_esp_nom)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_esp_nom,y_esp_nom)
cairo_show_text (cr,esp_nom)
cairo_stroke (cr)
font_esp_mem="Ubuntu"
font_size_esp_mem=11
esp_mem1=conky_parse("${fs_free /home}")
esp_mem2=conky_parse("${fs_free /}")
esp_mem3=conky_parse("${fs_free /media/Documents}")
esp_mem=esp_mem1.." free "..esp_mem2.." free "..esp_mem3.." free"
x_esp_mem,y_esp_mem=105,295
cairo_select_font_face (cr, font_esp_mem, font_slant, font_normal);
cairo_set_font_size (cr, font_size_esp_mem)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_esp_mem,y_esp_mem)
cairo_show_text (cr,esp_mem)
cairo_stroke (cr)
--[[###########################################
Débit internet
##############################################]]
font_up="Ubuntu"
font_size_up=12
up_eth0=conky_parse("${upspeed eth0}")
down_eth0=conky_parse("${downspeed eth0}")
up="Up : "..up_eth0
down="Down : "..down_eth0
x_up,y_up=100,330
x_down,y_down=100,345
cairo_select_font_face (cr, font_up, font_slant, font_normal);
cairo_set_font_size (cr, font_size_up)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_up,y_up)
cairo_show_text (cr,up)
cairo_move_to (cr,x_down,y_down)
cairo_show_text (cr,down)
cairo_stroke (cr)
font_total="Ubuntu"
font_size_total=12
up_total=conky_parse("${totalup eth0}")
down_total=conky_parse("${totaldown eth0}")
total="Total Up / Down : "..up_total.." / "..down_total
x_total,y_total=100,360
cairo_select_font_face (cr, font_total, font_slant, font_normal);
cairo_set_font_size (cr, font_size_total)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_total,y_total)
cairo_show_text (cr,total)
cairo_stroke (cr)
--[[###########################################
Musique
##############################################]]
font_album="Ubuntu"
font_size_album=11
album=conky_parse("${execi 5 python2 ~/.conky/anowplaying.py -l}")
x_album,y_album=100,400
cairo_select_font_face (cr, font_album, font_slant, font_normal);
cairo_set_font_size (cr, font_size_album)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_album,y_album)
cairo_show_text (cr,album)
cairo_stroke (cr)
font_titre_mus="Ubuntu"
font_size_titre_mus=11
titre_mus=conky_parse("${execi 5 python2 ~/.conky/anowplaying.py -t}")
x_titre_mus,y_titre_mus=100,415
cairo_select_font_face (cr, font_titre_mus, font_slant, font_normal);
cairo_set_font_size (cr, font_size_titre_mus)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_titre_mus,y_titre_mus)
cairo_show_text (cr,titre_mus)
cairo_stroke (cr)
font_temp_mus="Ubuntu"
font_size_temp_mus=11
temp_ecoule=conky_parse("${execi 5 python2 ~/.conky/anowplaying.py -e}")
temp_total=conky_parse("${execi 5 python2 ~/.conky/anowplaying.py -m}")
indic_temp=temp_ecoule.." / "..temp_total
x_temp,y_temp=100,430
cairo_select_font_face (cr, font_temp_mus, font_slant, font_normal);
cairo_set_font_size (cr, font_size_temp_mus)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x_temp,y_temp)
cairo_show_text (cr,indic_temp)
cairo_stroke (cr)
end
function draw_graph(display,data,max_value,table_length,blx,bly,red,green,blue,alpha,width,cheight)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_set_line_width (cr,width)
for i=1,table_length do
--calculate bar height
bar_height=(cheight/max_value)*data[i]
--set start position for each bar, and modify with the value of "i"
cairo_move_to (cr,blx+(width/2)+((i-1)*width),bly)
--draw relative line, y becomes equal to bar height and must be negative to draw up
cairo_rel_line_to (cr,0,bar_height*-1)
--draw the line
cairo_stroke (cr)
end
end--of function draw_graph
function conky_main()
if conky_window == nil then
return
end
local function setup_rings(cr,pt)
local str=''
local value=0
str=string.format('${%s %s}',pt['name'],pt['arg'])
str=conky_parse(str)
value=tonumber(str)
if value == nil then value = 0 end
pct=value/pt['max']
draw_ring(cr,pct,pt)
end
local cs = cairo_xlib_surface_create(conky_window.display,
conky_window.drawable,
conky_window.visual,
conky_window.width,
conky_window.height)
cr = cairo_create(cs)
local display = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates==4 then
up_table={}
down_table={}
end
if updates>5 then
display_text()
go_clock_rings(display)
go_gauge_rings(display)
for i in pairs(settings_table) do
setup_rings(cr,settings_table[i])
end
--début fonction historique upload
blx,bly=100,200
gvalue=conky_parse('${upspeed eth0}')
max_value=7
red,green,blue,alpha=1,1,1,1--fully opaque white
width=2
cheight=150
table_length=10
table_length=20
for i = 1, tonumber(table_length) do
if up_table[i+1]==nil then up_table[i+1]=0 end
up_table[i]=up_table[i+1]
if i==table_length then
up_table[table_length]=tonumber(conky_parse('${upspeed eth0}'))
end
end
draw_graph(display,up_table,max_value,table_length,blx,bly,red,green,blue,alpha,width,cheight)
end
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end
anowplaying
#!/usr/bin/env python2
#-*- coding: ascii -*-
#
# anowplaying.py
#
# Connects to dbus and retrieves
# information about the currently
# playing track in amarok.
#
import dbus, optparse, shutil, commands
import unicodedata
def unaccent(str):
return unicodedata.normalize('NFKD', str).encode('ascii', 'ignore')
if __name__ == '__main__':
'''Check if clementine is running'''
output = commands.getoutput('ps -A')
if 'clementine' not in output:
raise SystemExit
'''Get system bus'''
bus = dbus.SessionBus()
amarok = bus.get_object('org.mpris.clementine', '/Player')
amarokdict = amarok.GetMetadata()
'''Set up the command line parser'''
usage = 'usage: %prog [options]'
parser = optparse.OptionParser(usage=usage)
parser.add_option('-a', '--artist', action='store_true', help='artist name')
parser.add_option('-t', '--title', action='store_true', help='title of the track')
parser.add_option('-l', '--album', action='store_true', help='album name')
parser.add_option('-g', '--genre', action='store_true', help='genre of the current track')
parser.add_option('-y', '--year', action='store_true', help='year of the track')
parser.add_option('-m', '--mtime', action='store_true', help='time of the track')
parser.add_option('-r', '--rtime', action='store_true', help='remaining time for the track')
parser.add_option('-e', '--etime', action='store_true', help='elapsed time for the track')
parser.add_option('-p', '--progress', action='store_true', help='progress of the track')
parser.add_option('-n', '--track', action='store_true', help='track number')
parser.add_option('-b', '--bitrate', action='store_true', help='bitrate of the track')
parser.add_option('-s', '--sample', action='store_true', help='sample rate of the track')
parser.add_option('-c', '--cover', metavar='filename', help='copy cover art to destination file')
'''Get the parser options printed'''
(opts, args) = parser.parse_args()
if opts.artist and amarokdict.has_key('artist') :
print amarokdict['artist']
if opts.title and amarokdict.has_key('title'):
nomTitre = unaccent(amarokdict['title'][0:50])
print nomTitre
if opts.album and amarokdict.has_key('album'):
nomAlbum = unaccent(amarokdict['album'][0:35])
print nomAlbum
if opts.genre and amarokdict.has_key('genre'):
print amarokdict['genre']
if opts.year and amarokdict.has_key('year'):
print amarokdict['year']
if opts.track and amarokdict.has_key('tracknumber'):
print amarokdict['tracknumber']
if opts.bitrate and amarokdict.has_key('audio-bitrate'):
print amarokdict['audio-bitrate']
if opts.sample :
print amarokdict['audio-samplerate']
'''Manage time stuff'''
cpos = mt = mtime = etime = rtime = progress = None
if (opts.etime or opts.rtime or opts.mtime or opts.progress) and amarokdict.has_key('mtime'):
cpos = amarok.PositionGet()/1000
mt = amarokdict['mtime']/1000
mtime = str(mt/60)+":"+str(mt%60) if mt%60>9 else str(mt/60)+":0"+str(mt%60)
etime = str(cpos/60)+":"+str(cpos%60) if cpos%60>9 else str(cpos/60)+":0"+str(cpos%60)
rtime = str((mt-cpos)/60)+":"+str((mt-cpos)%60) if (mt-cpos)%60>9 else str((mt-cpos)/60)+":0"+str((mt-cpos)%60)
progress= float(cpos)/float(mt)*100
if opts.etime and etime is not None:
print etime
if opts.rtime and rtime is not None:
print rtime
if opts.mtime and mtime is not None:
print mtime
if opts.progress and progress is not None:
print progress
if opts.cover :
cover = amarokdict['arturl']
if cover != "" :
try :
shutil.copyfile(cover.replace('file://', ''), opts.cover)
print ""
except Exception, e:
print e
print ""
else :
print ""
J'ai rassemblé les images ici :
http://www.partage-facile.com/WWCWPQSFN … y.zip.html
D'autre part j'utilise un script pour mettre à jour mon fond d'écran et adapter la couleur du fond conky à l'image.
Il est en cours de changement en ce moment avec tout le transfert lua donc avec plein de trucs commentés...
#!/bin/bash
#
#
#
prefixe=`date +%Y-%m-%d`
if [ -z $1 ] ; then
wget -q http://www.goodfon.su/1920x1200/ -O index.html
sed -e 's/itemprop/\nitemprop/g' index.html | grep ^itemprop | grep "img src" > liste_wlppr
numAleatoire=$[($RANDOM % ($[20 - 1] + 1)) + 1]
image=`sed -n $((numAleatoire))p liste_wlppr | cut -d\" -f4 | sed -e 's/wallpaper/original/g;s/middle/1920x1080/g'`
#echo $image
wget -q -U firefox $image
nomImage=`basename $image`
nomFinal=$prefixe"_"$nomImage
cp $nomImage /media/Documents/personnalisation_pc/Wallpaper/wlppr/$nomFinal
mv $nomImage ~/Images/$nomFinal
rm index.html liste_wlppr
else
if [ -e "$1" ] ; then
verif=`echo $1 | grep \/`
if [ -z $verif ] ; then
echo "tata"
nomImage=$1
nomFinal=$prefixe"_"$nomImage
cp $PWD/$1 /media/Documents/personnalisation_pc/Wallpaper/wlppr/$nomFinal
cp $PWD/$1 ~/Images/$nomFinal
else
echo "toto"
nomImage=`basename $1`
nomFinal=$prefixe"_"$nomImage
cp $1 /media/Documents/personnalisation_pc/Wallpaper/wlppr/$nomFinal
cp $1 ~/Images/$nomFinal
fi
elif [ $1 = "live" ] ; then
wget -q http://wlppr.com/live.1920x1200.jpg
nomImage=live.1920x1200.jpg
nomFinal=$prefixe"_"$nomImage
cp $nomImage /media/Documents/personnalisation_pc/Wallpaper/wlppr/$nomFinal
cp $nomImage ~/Images/$nomFinal
rm $nomImage
else
exit 0
fi
fi
## calcul de la luminance sur le wlppr actuel :
# image_old=`gsettings get org.gnome.desktop.background picture-uri | sed -e "s_'__g;s_file://__g"`
# rgb_old=`convert $image_old -resize 3x3 -filter cubic -fuzz 15% -brightness-contrast 15% -colorspace RGB -format '%[pixel:s]' info:-`
# red_old=`echo $rgb_old | cut -d\( -f2 | cut -d, -f1`
# gre_old=`echo $rgb_old | cut -d\( -f2 | cut -d, -f2`
# blu_old=`echo $rgb_old | cut -d\( -f2 | cut -d, -f3 | cut -d\) -f1`
# lumi_old=$(echo "$red_old * 0.2126 + $gre_old * 0.7152 + $blu_old * 0.0722" | bc)
# lumi_old=${lumi_old%.*}
gsettings set org.gnome.desktop.background picture-uri "file:///home/sebastien/Images/$nomFinal"
gsettings set org.gnome.desktop.screensaver picture-uri "file:///home/sebastien/Images/$nomFinal"
RgbHighlight=`convert ~/Images/$nomFinal -resize 3x3 -filter cubic -fuzz 15% -brightness-contrast 15% -colorspace RGB -format '%[pixel:s]' info:-`
txRedHighlight=`echo $RgbHighlight | cut -d\( -f2 | cut -d, -f1`
txGreenHighlight=`echo $RgbHighlight | cut -d\( -f2 | cut -d, -f2`
txBlueHighlight=`echo $RgbHighlight | cut -d\( -f2 | cut -d, -f3 | cut -d\) -f1`
luminance=$(echo "$txRedHighlight * 0.2126 + $txGreenHighlight * 0.7152 + $txBlueHighlight * 0.0722" | bc -l)
luminance=${luminance%.*}
txRedBack=$((txRedHighlight*20/45))
txGreenBack=$((txGreenHighlight*20/45))
txBlueBack=$((txBlueHighlight*20/45))
if [ $luminance -gt 180 ] ; then
sed -e 's/0xffffff/0x000000/g:s/1,1,1,1/0,0,0,1/g' ~/.conky/script_modele.lua > ~/.conky/script.lua
else
cp ~/.conky/script_modele.lua ~/.conky/script.lua
fi
#if [[ "$luminance" -gt 180 && "$lumi_old" -gt 180 ]] ; then
# echo ""
#elif [[ "$luminance" -lt 180 && "$lumi_old" -lt 180 ]] ; then
# echo ""
#else
# if [[ "$luminance" -gt 180 ]] ; then
# cp ~/.conky/template_conkyrc ~/.conkyrc
# cp ~/.conky/template_conky_orange ~/.conky/conky_orange.lua
# else
# sed -e 's/000000/ffffff/g' ~/.conky/template_conkyrc > ~/.conkyrc
# sed -e 's/0x000000/0xffffff/g' ~/.conky/template_conky_orange > ~/.conky/conky_orange.lua
# fi
#fi
##if [ $luminance -gt 180 ] ; then
## cp ~/.conky/template_conkyrc ~/.conkyrc
## cp ~/.conky/template_conky_orange ~/.conky/conky_orange.lua
##else
## sed -e 's/000000/ffffff/g' ~/.conky/template_conkyrc > ~/.conkyrc
## sed -e 's/0x000000/0xffffff/g' ~/.conky/template_conky_orange > ~/.conky/conky_orange.lua
##fi
convert ~/.conky/base_init.png -fuzz 30% -fill "rgb($txRedHighlight,$txGreenHighlight,$txBlueHighlight)" -opaque 'rgb(255,0,0)' ~/.conky/temp.png
convert ~/.conky/temp.png -fuzz 20% -fill "rgb($txRedBack,$txGreenBack,$txBlueBack)" -opaque 'rgb(0,0,255)' ~/.conky/base.png
rm ~/.conky/temp.png
Si tu as des suggestions d'améliorations n'hésites pas à m'en suggérer. Je suis sûr qu'il y doit y avoir moyen de factoriser certaines choses dans mon script lua...
"When I was in the military, they gave me a medal for killing
two men, and a descharge for loving one !" Leonard Matlovich
Hors ligne
#922 Le 22/04/2015, à 22:03
- Didier-T
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
re,
en effet, il y des trucs qui pourraient être amélioré.
Je suis actuellement en congé loin de mon PC, mais tu pourrais déjà te passer du script suivant "meteo_display.sh" et l'intégrer à "sript.Lua", après s'est surtout de l'utilisation de fonction dans le script lua.
Si tu coince, je regarderais a mon retour de congé.
A+,
Didier.
Hors ligne
#923 Le 26/04/2015, à 08:46
- Ferod
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
C'est bon je viens de passer par une fonction pour afficher le texte. Le script gagne en lisibilité !
--this is a lua script for use in conky
require 'cairo'
--------------------------------------------------------------------------------
-- horloge DONNÉES
-- HEURE
clock_h = {
{
name='time', arg='%H', max_value=12,
x=200, y=48,
graph_radius=20,
graph_thickness=2,
graph_unit_angle=30, graph_unit_thickness=30,
graph_bg_colour=0xffffff, graph_bg_alpha=0.2,
graph_fg_colour=0xffffff, graph_fg_alpha=1.0,
txt_radius=20,
txt_weight=1, txt_size=11.0,
txt_fg_colour=0xffffff, txt_fg_alpha=0.8,
graduation_radius=20,
graduation_thickness=3, graduation_mark_thickness=2,
graduation_unit_angle=30,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.3,
},
}
-- MINUTES
clock_m = {
{
name='time', arg='%M', max_value=60,
x=200, y=48,
graph_radius=25,
graph_thickness=2,
graph_unit_angle=6, graph_unit_thickness=6,
graph_bg_colour=0xffffff, graph_bg_alpha=0.2,
graph_fg_colour=0xffffff, graph_fg_alpha=1.0,
txt_radius=35,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0xffffff, txt_fg_alpha=0.6,
graduation_radius=57,
graduation_thickness=0, graduation_mark_thickness=2,
graduation_unit_angle=30,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.3,
},
}
-- SECONDES
clock_s = {
{
name='time', arg='%S', max_value=60,
x=200, y=48,
graph_radius=30,
graph_thickness=2,
graph_unit_angle=6, graph_unit_thickness=2,
graph_bg_colour=0xffffff, graph_bg_alpha=0.0,
graph_fg_colour=0xffffff, graph_fg_alpha=1.0,
txt_radius=40,
txt_weight=0, txt_size=9.0,
txt_fg_colour=0xffffff, txt_fg_alpha=0.6,
graduation_radius=0,
graduation_thickness=0, graduation_mark_thickness=0,
graduation_unit_angle=0,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.0,
},
}
--------------------------------------------------------------------------------
-- jauge DONNÉES
gauge = {
{
name='downspeedf', arg='', max_value=100,
x=40, y=160,
graph_radius=0,
graph_thickness=0,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xffffff, graph_fg_alpha=0.0,
hand_fg_colour=0xEF5A29, hand_fg_alpha=0.8,
txt_radius=34,
txt_weight=1, txt_size=10.0,
txt_fg_colour=0xEF5A29, txt_fg_alpha=0.0,
graduation_radius=0,
graduation_thickness=4, graduation_mark_thickness=2,
graduation_unit_angle=27,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.3,
-- caption='download',
caption_weight=1, caption_size=8.0,
caption_fg_colour=0xffffff, caption_fg_alpha=0.5,
},
{
name='upspeedf', arg='', max_value=100,
x=40, y=160,
graph_radius=0,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xffffff, graph_fg_alpha=0.0,
hand_fg_colour=0xffffff, hand_fg_alpha=0.6,
txt_radius=10,
txt_weight=0, txt_size=9.0,
txt_fg_colour=0xffffff, txt_fg_alpha=0.0,
graduation_radius=0,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.3,
-- caption='upload',
caption_weight=1, caption_size=8.0,
caption_fg_colour=0xffffff, caption_fg_alpha=0.5,
},
}
settings_table = {
{
name='fs_used_perc', arg='/home',
x=120, y=255, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=17,
thickness=3,
start_angle=-180,
end_angle=180
},
{
name='fs_used_perc', arg='/',
x=205, y=255, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=17,
thickness=3,
start_angle=-180,
end_angle=180
},
{
name='fs_used_perc', arg='/media/Documents',
x=290, y=255, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=17,
thickness=3,
start_angle=-180,
end_angle=180
},
{
name='memperc', arg='',
x=290, y=205, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=25,
thickness=5,
start_angle=-90,
end_angle=90
},
{
name='cpu', arg='cpu1',
x=125, y=205, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=25,
thickness=2,
start_angle=-90,
end_angle=90
},
{
name='cpu', arg='cpu2',
x=125, y=205, max=100,
bg_colour=0xffffff, bg_alpha=0.2,
fg_colour=0xffffff, fg_alpha=1.0,
radius=20,
thickness=2,
start_angle=-90,
end_angle=90
},
}
-------------------------------------------------------------------------------
-- position_de_l'angle
-- convertit les degrés, rotation et rad (0 degré est en haut / nord)
--
function angle_to_position(start_angle, current_angle)
local pos = current_angle + start_angle
return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end
-------------------------------------------------------------------------------
-- rgb_to_r_g_b
-- convertit la couleur de hexa en décimal
--
function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
-------------------------------------------------------------------------------
-- draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_start_angle = data['graph_start_angle']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
local graph_end_angle = (max_value * graph_unit_angle) % 360
-- background ring
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- arc of value
local val = value % (max_value + 1)
local start_arc = 0
local stop_arc = 0
local i = 1
while i <= val do
start_arc = (graph_unit_angle * i) - graph_unit_thickness
stop_arc = (graph_unit_angle * i)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = start_arc
-- hand
start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
stop_arc = (graph_unit_angle * val)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
cairo_stroke(display)
-- graduations marks
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = graph_end_angle / graduation_unit_angle
local i = 0
while i < nb_graduation do
cairo_set_line_width(display, graduation_thickness)
start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
-- text
local txt_radius = data['txt_radius']
local txt_weight, txt_size = data['txt_weight'], data['txt_size']
local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
cairo_set_font_size (display, txt_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
cairo_show_text (display, value)
cairo_stroke (display)
-- caption
local caption = data['caption']
local caption_weight, caption_size = data['caption_weight'], data['caption_size']
local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
cairo_set_font_size (display, caption_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
cairo_move_to (display, x + tox + 5, y + toy + 1)
-- bad hack but not enough time !
if graph_start_angle < 105 then
cairo_move_to (display, x + tox - 30, y + toy + 1)
end
cairo_show_text (display, caption)
cairo_stroke (display)
end
-------------------------------------------------------------------------------
-- draw_clock_ring
-- affichage horloge
--
function draw_clock_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
-- fond de l'anneau
cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi)
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- valeur arc
local val = (value % max_value)
local i = 1
while i <= val do
cairo_arc(display, x, y, graph_radius,( ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360) )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2))
cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = (graph_unit_angle * i) - graph_unit_thickness
-- graduations
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = 360 / graduation_unit_angle
local i = 1
while i <= nb_graduation do
cairo_set_line_width(display, graduation_thickness)
cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
end
-------------------------------------------------------------------------------
-- go_clock_rings
-- loads data and displays clock
--
function go_clock_rings(display)
local function load_clock_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_clock_ring(display, data, value)
end
for i in pairs(clock_h) do
load_clock_rings(display, clock_h[i])
end
for i in pairs(clock_m) do
load_clock_rings(display, clock_m[i])
end
for i in pairs(clock_s) do
load_clock_rings(display, clock_s[i])
end
end
-------------------------------------------------------------------------------
-- go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
local function load_gauge_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_gauge_ring(display, data, value)
end
for i in pairs(gauge) do
load_gauge_rings(display, gauge[i])
end
end
-------------------------------------------------------------------------------
-- displays rings
--
--
function draw_ring(cr,t,pt)
local w,h=conky_window.width,conky_window.height
local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']
local angle_0=sa*(2*math.pi/360)-math.pi/2
local angle_f=ea*(2*math.pi/360)-math.pi/2
local t_arc=t*(angle_f-angle_0)
cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
cairo_set_line_width(cr,ring_w)
cairo_stroke(cr)
cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
cairo_stroke(cr)
end
function draw_line(alpha,progress,x_ligne,y_ligne,longueur)
red,green,blue=1,1,1
-- double dashes[]={1.}
cairo_set_source_rgba (cr,1,1,1,alpha)
cairo_set_line_width (cr, 8.0)
-- cairo_set_dash(cr,dashes,1,0)
cairo_move_to (cr, x_ligne, y_ligne)
cairo_line_to (cr, x_ligne+longueur*progress/100, y_ligne)
cairo_stroke (cr)
end
function affiche_texte(police,taille,x,y,texte)
red,green,blue,alpha=1,1,1,1
cairo_select_font_face (cr, police, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
cairo_set_font_size (cr, taille)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,x,y)
cairo_show_text (cr,texte)
cairo_stroke (cr)
end
function graph_line()
--upload
draw_line(0.2,100,210,325,110)
ratio_upload=tonumber(conky_parse("${upspeedf eth0}")/38*100)
draw_line(1,ratio_upload,210,325,110)
--download
draw_line(0.2,100,210,340,110)
ratio_upload=tonumber(conky_parse("${downspeedf eth0}")/302*100)
draw_line(1,ratio_upload,210,340,110)
-- lecture musique
draw_line(0.2,100,170,426,150)
progress=tonumber(conky_parse("${execi 5 python2 ~/.conky/anowplaying.py -p}"))
draw_line(1,progress,170,426,150)
end
function display_text()
--[[###########################################
Heure et Date
##############################################]]
affiche_texte("Ubuntu",11,100,27,"Toulouse")
affiche_texte("Ubuntu",12,185,52,conky_parse("${time %H:%M}")) --heure
affiche_texte("Ubuntu",12,282,34,conky_parse("${time %A}")) --nom du jour
affiche_texte("Ubuntu",12,282,45,conky_parse("${time %B}")) --nom du mois
affiche_texte("Ubuntu",32,245,45,conky_parse("${time %d}")) --numeros du jour
affiche_texte("Ubuntu",32,245,71,conky_parse("${time %Y}")) --année
--[[###########################################
Météo
##############################################]]
affiche_texte("Weather",65,105,73,conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 1}"))
temp=conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 1}")
pressu=conky_parse("${execi 10 ~/.conky/meteo_display.sh pression 1}")
temp_jour=temp.."°C-"..pressu.." hPa"
affiche_texte("Ubuntu",11,92,75,temp_jour)
-- prévision metéo jour
affiche_texte("Weather",50,95,140,conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 2}"))
affiche_texte("Weather",50,135,140,conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 3}"))
affiche_texte("Weather",50,175,140,conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 4}"))
affiche_texte("Weather",50,215,140,conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 5}"))
affiche_texte("Weather",50,255,140,conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 6}"))
affiche_texte("Weather",50,295,140,conky_parse("${execi 10 ~/.conky/meteo_display.sh meteo 7}"))
-- affichage du jour
affiche_texte("Ubuntu",11,100,100,conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 2}"))
affiche_texte("Ubuntu",11,140,100,conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 3}"))
affiche_texte("Ubuntu",11,180,100,conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 4}"))
affiche_texte("Ubuntu",11,220,100,conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 5}"))
affiche_texte("Ubuntu",11,260,100,conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 6}"))
affiche_texte("Ubuntu",11,300,100,conky_parse("${execi 10 ~/.conky/meteo_display.sh jour 7}"))
-- prévision température jour
affiche_texte("Ubuntu",12,100,147,conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 2}").."°C")
affiche_texte("Ubuntu",12,140,147,conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 3}").."°C")
affiche_texte("Ubuntu",12,180,147,conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 4}").."°C")
affiche_texte("Ubuntu",12,220,147,conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 5}").."°C")
affiche_texte("Ubuntu",12,260,147,conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 6}").."°C")
affiche_texte("Ubuntu",12,300,147,conky_parse("${execi 10 ~/.conky/meteo_display.sh temperature 7}").."°C")
--[[###########################################
CPU Temperature et RAM
##############################################]]
affiche_texte("Ubuntu",15,105,175,"CPU Température RAM")
cpu1=conky_parse("${cpu cpu1}")
cpu2=conky_parse("${cpu cpu2}")
cpu=cpu1.."% / "..cpu2.."%"
affiche_texte("Ubuntu",12,100,220,cpu)
T1=conky_parse("${execi 30 ~/.conky/sensors.sh 1}")
T2=conky_parse("${execi 30 ~/.conky/sensors.sh 2}")
temp1="T1 : "..T1.."°C"
temp2="T2 : "..T2.."°C"
affiche_texte("Ubuntu",12,180,200,temp1)
affiche_texte("Ubuntu",12,180,215,temp2)
affiche_texte("Ubuntu",17,275,205,conky_parse("${memperc}").."%")
affiche_texte("Ubuntu",11,250,220,conky_parse("${mem}").."/"..conky_parse("${memeasyfree}"))
--[[###########################################
Espace disponible
##############################################]]
espace1=conky_parse("${fs_used_perc /home}")
espace2=conky_parse("${fs_used_perc /}")
espace3=conky_parse("${fs_used_perc /media/Documents}")
esp_perc=espace1.."% "..espace2.."% "..espace3.."%"
affiche_texte("Ubuntu",15,108,260,esp_perc)
affiche_texte("Ubuntu",11,105,285,"home : Racine : Docs :")
esp_mem1=conky_parse("${fs_free /home}")
esp_mem2=conky_parse("${fs_free /}")
esp_mem3=conky_parse("${fs_free /media/Documents}")
esp_mem=esp_mem1.." free "..esp_mem2.." free "..esp_mem3.." free"
affiche_texte("Ubuntu",11,105,295,esp_mem)
--[[###########################################
Débit internet
##############################################]]
affiche_texte("Ubuntu",12,100,330,"Up : "..conky_parse("${upspeed eth0}"))
affiche_texte("Ubuntu",12,100,345,"Down : "..conky_parse("${downspeed eth0}"))
up_total=conky_parse("${totalup eth0}")
down_total=conky_parse("${totaldown eth0}")
affiche_texte("Ubuntu",12,100,360,"Total Up / Down : "..up_total.." / "..down_total)
--[[###########################################
Musique
##############################################]]
affiche_texte("Ubuntu",11,100,400,conky_parse("${execi 5 python2 ~/.conky/anowplaying.py -l}"))
affiche_texte("Ubuntu",11,100,415,conky_parse("${execi 5 python2 ~/.conky/anowplaying.py -t}"))
temp_ecoule=conky_parse("${execi 5 python2 ~/.conky/anowplaying.py -e}")
temp_total=conky_parse("${execi 5 python2 ~/.conky/anowplaying.py -m}")
indic_temp=temp_ecoule.." / "..temp_total
affiche_texte("Ubuntu",11,100,430,indic_temp)
end
function conky_main()
if conky_window == nil then
return
end
local function setup_rings(cr,pt)
local str=''
local value=0
str=string.format('${%s %s}',pt['name'],pt['arg'])
str=conky_parse(str)
value=tonumber(str)
if value == nil then value = 0 end
pct=value/pt['max']
draw_ring(cr,pct,pt)
end
local cs = cairo_xlib_surface_create(conky_window.display,
conky_window.drawable,
conky_window.visual,
conky_window.width,
conky_window.height)
cr = cairo_create(cs)
local display = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
display_text()
graph_line()
go_clock_rings(display)
go_gauge_rings(display)
for i in pairs(settings_table) do
setup_rings(cr,settings_table[i])
end
end
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end
"When I was in the military, they gave me a medal for killing
two men, and a descharge for loving one !" Leonard Matlovich
Hors ligne
#924 Le 27/04/2015, à 11:54
- chepioq
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Un nouveau petit conky météo, d'après un travail de Nili, sur http://crunchbang.org/forums/viewtopic. … 6909&p=333 , réponse #8314 et suivante.
Je l'ai mis en français, et pour ceux qui seraient intéressé, j'ai mis en ligne sur Mega un zip comprenant le conky et le dossier des icônes :
https://mega.co.nz/#!AYcUgZCS!MWpZHiHC4 … nlk4SW531s
++EDIT++
Petite précision qui a son importance, et que j'ai oublié de signaler, ce conky est pour la ville ou j'habite, pour la votre il faut récupérer votre WOEID sur ce site : http://woeid.rosselliot.co.nz/ en indiquant votre ville et votre pays, et remplacer, dans la première ligne après TEXT du conky, le nombre en rouge par votre WOEID
${execi 300 curl -s "http://weather.yahooapis.com/forecastrss?w=576999&u=c&d=8" | ........
Dernière modification par chepioq (Le 06/05/2015, à 16:57)
Tout est dans tout et réciproquement....
Hors ligne
#925 Le 28/04/2015, à 15:46
- OcB
Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes
Bonjour à tous,
j'aimerai ouvrir 3 conkys différents, pour cela j'ai crée le script suivant :
#!/bin/sh
conky -c ~/.conkyrc
conky -c ~/.conkyrc2
conky -c ~/.conkyrc3
Les 2 premier s'ouvrent bien mais pas le 3ème. il s'ouvre une fois que j'ai fermé les 2 premier (avec ctrl + c dans le terminale) et j'ai cette erreur :
CConky: received SIGINT or SIGTERM to terminate. bye!
Conky: received SIGINT or SIGTERM to terminate. bye!
Conky: /home/OcB/.conkyrc3: 41: no such configuration: 'border_margin'
Conky: desktop window (1e0001d) is subwindow of root window (2b9)
Conky: window type - override
Conky: drawing to created window (0x2c00001)
Conky: drawing to double buffer
Les 3 conkys :
# System stats bar
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# fiddle with window
use_spacer right
# Use Xft?
use_xft yes
xftfont unDotum:size=8
xftalpha 0.8
text_buffer_size 2048
# Update interval in seconds
update_interval 3.0
# Minimum size of text area
minimum_size 250 5
maximum_width 255
# Draw shades?
draw_shades no
# Text stuff
draw_outline no # amplifies text if yes
draw_borders no
uppercase no # set to yes if you want all text to be in uppercase
# Stippled borders?
stippled_borders 3
# border margins
border_margin 9
# set to yes if you want Conky to be forked in the background
background yes
# border width
border_width 10
# Default colors
default_color ffffff
# Text alignment, other possible values are commented
alignment top_left
# Gap between borders of screen
gap_x 70
gap_y 30
# stuff after 'TEXT' will be formatted on screen
TEXT
${color #ffffff}${font Radio Space:size=24}CPU
${voffset -25}$font $color
CPU1 ${cpu cpu1}% ${color #a6a6a6}${cpubar cpu1}$color
CPU2 ${cpu cpu2}% ${color #a6a6a6}${cpubar cpu2}$color
Temp : ${execi 8 sensors | grep "Core 0" | cut -c15-16}° - ${execi 8 sensors | grep "Core 1" | cut -c15-16}° / Vcore : ${execi 8 sensors | grep in1 | cut -c15-20}
CPUivore
${top_mem name 1}${alignr}${top cpu 1} %
${top_mem name 2}${alignr}${top cpu 2} %
${top_mem name 3}${alignr}${top cpu 3} %
${top_mem name 4}${alignr}${top cpu 4} %
# System stats bar
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# fiddle with window
use_spacer right
# Use Xft?
use_xft yes
xftfont unDotum:size=8
xftalpha 0.8
text_buffer_size 2048
# Update interval in seconds
update_interval 3.0
# Minimum size of text area
minimum_size 250 5
maximum_width 255
# Draw shades?
draw_shades no
# Text stuff
draw_outline no # amplifies text if yes
draw_borders no
uppercase no # set to yes if you want all text to be in uppercase
# Stippled borders?
stippled_borders 3
# border margins
border_margin 9
# border width
border_width 10
# Default colors
default_color ffffff
# Text alignment, other possible values are commented
alignment top_left
# Gap between borders of screen
gap_x 405
gap_y 30
# stuff after 'TEXT' will be formatted on screen
TEXT
${color #ffffff}${font Radio Space:size=24}RAM / DD
${voffset -25}$font $color
RAM: $alignc $mem / $memmax $alignr $memperc%
${color #a6a6a6}$membar$color
/ $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_used_perc /}%
${color #a6a6a6}${fs_bar /}$color
Home $alignc ${fs_used /home} / ${fs_size /home} $alignr ${fs_used_perc /home}%
${color #a6a6a6}${fs_bar /home}$color
# System stats bar
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# fiddle with window
use_spacer right
# Use Xft?
use_xft yes
xftfont unDotum:size=8
xftalpha 0.8
text_buffer_size 2048
# Update interval in seconds
update_interval 3.0
# Minimum size of text area
minimum_size 250 5
maximum_width 255
# Draw shades?
draw_shades no
# Text stuff
draw_outline no # amplifies text if yes
draw_borders no
uppercase no # set to yes if you want all text to be in uppercase
# Stippled borders?
stippled_borders 3
# border margins
border_margin 9
# border width
border_width 10
# Default colors
default_color ffffff
# Text alignment, other possible values are commented
# alignment top_left
# Gap between borders of screen
gap_x 800
gap_y 30
# stuff after 'TEXT' will be formatted on screen
TEXT
${color #ffffff}${font Radio Space:size=24}RAM / DD
${voffset -25}$font $color
RAM: $alignc $mem / $memmax $alignr $memperc%
${color #a6a6a6}$membar$color
/ $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_used_perc /}%
${color #a6a6a6}${fs_bar /}$color
Home $alignc ${fs_used /home} / ${fs_size /home} $alignr ${fs_used_perc /home}%
${color #a6a6a6}${fs_bar /home}$color
Quel est le problème SVP ?
Merci
Hors ligne