Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1601 Le 24/06/2012, à 15:12

A.

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonjour,

J'aimerais ajouter la météo sur mon bureau via un conky.
J'ai vu qu'il y avait un pack d'installation réalisé par Didier-T, mais dont l'apparence ne me convient pas. Et je ne sais pas vraiment comment le modifier pour arriver à un résultat plus sobre.

Dans l'idée, j'aimerais quelque chose qui ressemble à ce que présente Vinz60400 ou au conky de Bishop.
Malheureusement Vinz60400 n'a pas (encore ?) donné de détails et le conky de Bishop utilise weather.com.

Hors ligne

#1602 Le 24/06/2012, à 16:03

enebre

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

A.
As tu regardé le conky cronograph.Didier vient d'en faire un pack.
capturedcran-24062012-204946.php
c'est le résultat de son pack un peu modifié.

Dernière modification par enebre (Le 24/06/2012, à 23:06)

Hors ligne

#1603 Le 24/06/2012, à 18:13

A.

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

J'ai aussi vu ce pack, oui.
Il est assez sympa, mais je reste sur les exemples que j'ai cité.
Ça me permettra d'ajouter quelques lignes sans dépendre du cadre (de l'horloge ou du l'interface Androïd) et ce sera simple.

Hors ligne

#1604 Le 24/06/2012, à 19:03

enebre

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Oui je comprend, c'est pas du tout pareil, ton conky est très complet point vue météo, partageras tu les fichiers sur le forum, je suis intéressé à l'étudier.
Je viens d'essayer le pack fourni par Didier, il à corrigé le script et le résultat est très beau en icônes couleurs.
Juste à adapter les colorations du crono au goût de chacun et il est parfait, pour ce qu'il propose en infos multiples.

Dernière modification par enebre (Le 24/06/2012, à 19:06)

Hors ligne

#1605 Le 24/06/2012, à 19:17

Phyllinux

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

@ A.

Je pense que tu pourras trouver ton bonheur en allant voir dans ce fil de forum en anglais :
Forum TeoBigusDickus
Au premier post, il y a tous ses scripts avec des aperçus de ce que cela donne.

Sinon, tu peux venir voir ici :
Alternative à weather.com
La moindre des choses, c'est de faire de la pub pour le forum où je suis un posteur actif wink
où tu pourras également trouver toute une variante de possibilités et différentes versions, avec le même 'moteur' du script lua écrit et mis à jour régulièrement par DIdier-T.

modération: je me suis permis de remplacer http://forum.ubuntu-fr.org par un . ce qui permet d'avoir un hyper lien (utilisateur de kubuntu-fr.org ne passe pas sur ubuntu-fr.org)

Dernière modification par ljere (Le 24/06/2012, à 20:07)


The ship is sinking normally...

Hors ligne

#1606 Le 24/06/2012, à 22:38

A.

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Les scripts de TeoBigusDickus ont l'air pas mal, mais il y a un lien HS donc il manque certains scripts. Dommage.

Pour l'alternative à weather.com, j'ai déjà vu et testé le pack de Didier-T mais je n'ai aucune idée de comment le modifier pour arriver à quelque chose qui ressemble à ce que j'ai cité.

Hors ligne

#1607 Le 25/06/2012, à 08:53

Phyllinux

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

A. a écrit :

Les scripts de TeoBigusDickus ont l'air pas mal, mais il y a un lien HS donc il manque certains scripts. Dommage.

Pour l'alternative à weather.com, j'ai déjà vu et testé le pack de Didier-T mais je n'ai aucune idée de comment le modifier pour arriver à quelque chose qui ressemble à ce que j'ai cité.

Si des liens sont HS, il suffit de le signaler à Téo sur le forum. Téo est très réactif et traitera la demande dans la journée. Anglais obligatoire, même si Téo est Grec smile.
Par la suite, pour la réalisation du conky, Téo répond à toutes les questions relatives à un de ses scripts et aide en cas de difficulté.


The ship is sinking normally...

Hors ligne

#1608 Le 25/06/2012, à 19:34

A.

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Merci, je viens de le contacter pour essayer d'utiliser son script.

Hors ligne

#1609 Le 01/07/2012, à 21:22

Vinz60400

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Salut à tous ...

Veuillez m’excusez pour mon retard pris !!!

Vos demande étant mis en attente, je n'allais pas vous oubliez !!!

Voici un tutoriel pour mettre en place mon conky

--------------------------------------------------------------------------------.

Tous d'abord il vous faut installé les paquets conky et conkyforecast "sudo apt-get install  le-paquet"

--------------------------------------------------------------------------------.

Avant propos

Conkyrc1 / conky  gauche
Conkyrc2  / conky droite
Conkyrc3 / conky milieu

Dans le dossier ~/ crée un  dossier conky avec en contenue (Conkyrc 1 / 2 / 3  + Fêtes) script ci-dessous

.conkyrc1

# temps pour fermer conky en seconde. 0 = toujours actif 
total_run_times 0

# affiche le texte sur la sortie standard
out_to_console no

# réglage de la mémoire, pour éviter le clignotement
double_buffer yes
# Soustraire les mémoires tampons de la mémoire utiliser
no_buffers yes
text_buffer_size 1024

# taux de rafraichissement de la fenêtre (en secondes)
update_interval 1

# nombre d'échantillons à utiliser pour calculer la moyenne d'utilisation
cpu_avg_samples 1
net_avg_samples 2

# taille et positon - largeur/hauteur
alignment top_left
minimum_size 300 500
maximum_width 300

# écart avec le bord x=gauche ou droit y= haut ou bas
gap_x 100
gap_y 22

# afficher les ombres
draw_shades no
# afficher des contours
draw_outline no
# contours autour des blocs de texte
draw_borders no
# largeur du contour
border_width 1
# largeur des marges
border_margin 1

#pour que conky tourne en arrière plan background no pour les tests
background yes

# utiliser sa propre fenêtre
own_window yes
#type de fenêtre : normal(avec le cadre) / override / desktop
own_window_type override # normal / override / desktop
#pseudo transparence si vous avez des icones sous le conky elle ne seront plus accessible une fois conky activé
own_window_transparent yes

# Utiliser Xft (polices lissées etc)
use_xft yes
xftalpha .1
override_utf8_locale yes # force UTF8

#police a utiliser : use_xft doit être a "yes"
xftfont saxMono:size=9 #OCR A Std:size=6
# Tout le texte en majuscule
uppercase no

# Ajoute des espaces après certains objets pour éviter de les faire bouger.
# Fonctionne uniquement avec les polices Fixes
use_spacer yes

# Taille des pointillés
stippled_borders 5

# Couleurs
default_color FFFFFF #blanc
default_shade_color 333333
default_outline_color black

color3 cf1c00 #rouge
color2 66FF00 #vert
color1 176e88 #bleu

${font Visitor TT1 BRK : pixelsize=12}${color1}${alignc}${exec cat /etc/lsb-release | grep "NAME" | cut -d "=" -f2} Inside${font}



TEXT



${font Visitor TT1 BRK : pixelsize=12}${color1}Time${font}
${color3}${voffset -5}${hr}    
${offset 15}${color1}Time :    ${alignc}                                                                 ${color3}${time %H : %M : %S}
${offset 15}${color1}Date :${alignc}             ${time %A %d %B %Y}
${offset 15}Week :                         ${alignc}                             ${color2}${time %V} ${color1}out of 53

${font Visitor TT1 BRK : pixelsize=12}${color1}System${alignr}${exec cat /etc/lsb-release | grep "DES" | cut -d "=" -f2 | sed 's/"//g' | sed 's/ /_/g'}${font}
${color3}${voffset -5}${hr}
${offset 15}${color1}Uptime  :  ${alignc}                                                        ${color3}${uptime}
${offset 15}${color1}Kernel  :  ${alignc}                                    ${sysname} ${color2}${kernel}
${offset 15}${color1}Machine :  ${alignc}                                    ${nodename} ${machine}

${font Visitor TT1 BRK : pixelsize=12}${color1}Temperatures${alignr}Scan${font}
${color3}${voffset -5}${hr}
${offset 15}${color1}Ubuntu :      ${alignc} ${color3}${exec hddtemp -n /dev/sdc6}°C${alignr}${color1}Open ports : ${color3}${tcp_portmon 1 65535 count}
${offset 15}${color1}MV :           ${alignc} ${color3}${exec hddtemp -n /dev/sda1}°C${alignr}${color1}Open ports : ${color3}${tcp_portmon 1 65535 count}
${offset 15}${color1}Games :       ${alignc} ${color3}${exec hddtemp -n /dev/sdb1}°C${alignr}${color1}Open ports : ${color3}${tcp_portmon 1 65535 count}
${offset 15}${color1}Sev7n :       ${alignc} ${color3}${exec hddtemp -n /dev/sdd2}°C${alignr}${color1}Open ports : ${color3}${tcp_portmon 1 65535 count}

${font Visitor TT1 BRK : pixelsize=12}${color1}CPU_Activity${color3}${alignc}${cpu cpu}%${font}
${color3}${voffset -5}${hr}
${offset 15}${color1}Core 1 : ${freq_g 1} GHz - ${color3}${cpu cpu1}% ${color1}${cpubar cpu1}
${offset 15}${cpugraph cpu1 25,285 176e88 66FF00}
${offset 15}Core 2 : ${freq_g 2} GHz - ${color3}${cpu cpu2}% ${color1}${cpubar cpu2}
${offset 15}${cpugraph cpu2 25,285 176e88 66FF00}
${offset 15}Core 3 : ${freq_g 2} GHz - ${color3}${cpu cpu3}% ${color1}${cpubar cpu2}
${offset 15}${cpugraph cpu2 25,285 176e88 66FF00}
${offset 15}Core 4 : ${freq_g 2} GHz - ${color3}${cpu cpu4}% ${color1}${cpubar cpu2}
${offset 15}${cpugraph cpu2 25,285 176e88 66FF00}

${font Visitor TT1 BRK : pixelsize=12}${color1}Memory_Activity${font}
${color3}${voffset -5}${hr}
${offset 15}${color1}RAM : ${alignc} $mem / $memmax -  ${color3}$memperc% ${color1}${membar}
${offset 15}SW :${alignc}    $swap / $swapmax  -  ${color3}$swapperc% ${color1}${swapbar}

${font Visitor TT1 BRK : pixelsize=12}${color1}Disk_Activity${font}
${color3}${voffset -5}${hr}
${offset 15}${color1}sdc6 activity /root
${offset 30}Read : ${color2}${diskio_read sdc6}${goto 172}${color1}Write : ${color2}${diskio_write sdc6}
${offset 30}${color1}${diskiograph_read sdc6 25,130 176e88 66FF00}${alignr}${diskiograph_write sdc6 25,130 176e88 66FF00}
${offset 15}sda6 activity /home
${offset 30}Read : ${color2}${diskio_read sdc1}${goto 172}${color1}Write : ${color2}${diskio_write sdc1}
${offset 30}${color1}${diskiograph_read sdc1 25,130 176e88 66FF00}${alignr}${diskiograph_write sdc1 25,130 176e88 66FF00}
${offset 15}sda6 activity /Games
${offset 30}Read : ${color2}${diskio_read sdb1}${goto 172}${color1}Write : ${color2}${diskio_write sdb1}
${offset 30}${color1}${diskiograph_read sdb1 25,130 176e88 66FF00}${alignr}${diskiograph_write sdb1 25,130 176e88 66FF00}
${offset 15}sda6 activity /MV
${offset 30}Read : ${color2}${diskio_read sda1}${goto 172}${color1}Write : ${color2}${diskio_write sda1}
${offset 30}${color1}${diskiograph_read sda1 25,130 176e88 66FF00}${alignr}${diskiograph_write sda1 25,130 176e88 66FF00}
${offset 15}sda6 activity /Sev7n
${offset 30}Read : ${color2}${diskio_read sdd2}${goto 172}${color1}Write : ${color2}${diskio_write sdd2}
${offset 30}${color1}${diskiograph_read sdd21 25,130 176e88 66FF00}${alignr}${diskiograph_write sdd2 25,130 176e88 66FF00}

.conkyrc2

# temps pour fermer conky en seconde. 0 = toujours actif 
total_run_times 0

# affiche le texte sur la sortie standard
out_to_console no

# réglage de la mémoire, pour éviter le clignotement
double_buffer yes
# Soustraire les mémoires tampons de la mémoire utiliser
no_buffers yes
text_buffer_size 1024

# taux de rafraichissement de la fenêtre (en secondes)
update_interval 1

# nombre d'échantillons à utiliser pour calculer la moyenne d'utilisation
cpu_avg_samples 4
net_avg_samples 2

# taille et positon - largeur/hauteur
alignment top_left
minimum_size 300 200
maximum_width 300

# écart avec le bord x=gauche ou droit y= haut ou bas
gap_x 900
gap_y 70

# afficher les ombres
draw_shades no
# afficher des contours
draw_outline no
# contours autour des blocs de texte
draw_borders no
# largeur du contour
border_width 1
# largeur des marges
border_margin 1

#pour que conky tourne en arrière plan background no pour les tests
background yes

# utiliser sa propre fenêtre
own_window yes
#type de fenêtre : normal(avec le cadre) / override / desktop
own_window_type override

#pseudo transparence si vous avez des icones sous le conky elle ne seront plus accessible une fois conky activé
own_window_transparent yes

# Utiliser Xft (polices lissées etc)
use_xft yes
xftalpha .1
override_utf8_locale yes # force UTF8

#police a utiliser : use_xft doit être a "yes"
xftfont saxMono:size=9 #OCR A Std:size=6
# Tout le texte en majuscule
uppercase no

# Taille des pointillés
stippled_borders 5

# Ajoute des espaces après certains objets pour éviter de les faire bouger.
# Fonctionne uniquement avec les polices Fixes
use_spacer yes

# Couleurs
default_color FFFFFF #blanc
default_shade_color 333333
default_outline_color black

color3 cf1c00 #rouge
color2 66FF00 #vert
color1 176e88 #bleu

${color1}XPCox : ${color1}${exec /home/math/Script/VM | grep "%"} OQP - ${color3}${exec /home/math/Script/VM | grep "Mo"} ${color2}libre

TEXT
${font Visitor TT1 BRK : pixelsize=12}${color1}Files_System_sda${font}
${color3}${voffset -5}${hr}
${offset 15}${color1}/root${alignc} : Busy ${color2}${fs_used_perc /}% ${color1}- Free ${color3}${fs_free /}
${offset 15}${color1}/home${alignc} : Busy ${color2}${fs_used_perc /home}% ${color1}- Free ${color3}${fs_free /home}
${offset 15}${color1}/MV${alignc} : Busy ${color2}${fs_used_perc /media/Machine_Virtuel}% ${color1}- Free ${color3}${fs_free /media/Machine_Virtuel}
${offset 15}${color1}/Games${alignc} :Busy ${color2}${fs_used_perc /media/Games}% ${color1}- Free ${color3}${fs_free /media/Games}
${offset 15}${color1}/Sev7n${alignc} :Busy ${color2}${fs_used_perc /media/sdd2}% ${color1}- Free ${color3}${fs_free /media/sdd2}


${font Visitor TT1 BRK : pixelsize=12}${color1}Files_System_USB${font}
${color3}${voffset -5}${hr}
${offset 15}${color1}Cibox 16GO${alignc} : ${if_mounted /media/CIBOX}Used ${color2}${fs_used_perc /media/CIBOX}% ${color1}- Free ${color3}${fs_free /media/CIBOX}${else}Déconnecté${endif}
${offset 15}${color1}film ${alignc} : ${if_mounted /media/film}Used ${color2}${fs_used_perc /media/film}% ${color1}- Free ${color3}${fs_free /media/film}${else}Déconnecté${endif}


${if_existing /proc/net/route eth3}${font Visitor TT1 BRK : pixelsize=12}${color1}Network${alignc}${color3}${wireless_link_qual eth3}%${font}
${color3}${voffset -5}${hr}
${offset 15}${color1}Interface. :${alignc} ${color2}${gw_iface}${color1}     ${wireless_essid eth3}    hylamaison.no-ip.org
${offset 15}${color1}I.P. Loc.  :${alignr}${color2}${addr eth3}
${offset 15}${color1}I.P. Pas.  :${alignr}${color1}${gw_ip}
${offset 15}${color1}I.P. Pub.  :${alignr}${texeci 3600 wget http://checkip.dyndns.org -O - -o /dev/null | cut -d : -f 2 | cut -d \< -f 1}${else}${font Visitor TT1 BRK : pixelsize=12}${color1}Network${font}

${color3}${voffset -5}${hr}


${color1}${alignc}** Aucune connexion disponible **

${endif}

${font Visitor TT1 BRK : pixelsize=12}${color1}Transfers${font}
${color3}${voffset -5}${hr}
${offset 15}${color1}Upload : ${color3}${upspeed wlan0}ko/s${alignr}${totalup eth3}
${offset 15}${color1}${upspeedgraph eth3 25,285 176e88 66FF00}
${offset 15}Download : ${color3}${downspeed eth3}ko/s${alignr}${totaldown eth3}
${offset 15}${color1}${downspeedgraph eth3 25,285 176e88 66FF00}$

${font Visitor TT1 BRK : pixelsize=12}${color1}Saints${font}
${color3}${voffset -5}${hr}
${color1}Aujourd'hui, bonne fête aux                       ${offset -196}${color2}${exec /home/vincent/conky/Fêtes}

${font Visitor TT1 BRK : pixelsize=12}${color1}Calendar${alignr}Local_Hour${font}
${color3}${voffset -5}${hr}
${color2}${font monaco:pixelsize=12}${offset 62}${execi 1800 date +%^B | cut -c1}${execi 1800 date +%B | cut -c2-} ${time (%m)}
${color1}${execpi 60 DJS=`date +%_d`; cal | sed '/./!d' | sed '1d'  | sed 's/$/                     /' | fold -w 21 | sed -n '/^.\{21\}/p' | sed 's/^/  /' | sed /" $DJS "/s/" $DJS "/" "'${color2}'"$DJS"'${color3}'" "/}

${font Sans:size=25}${color1}${offset 215}${voffset -80}${time %H}${color2}${offset 1}${voffset -15}${font Sans:size=9}${time :%M:%S}
${offset 260}${color3}Heures

.conkyrc3

# temps pour fermer conky en seconde. 0 = toujours actif 
total_run_times 0

# affiche le texte sur la sortie standard
out_to_console no

# réglage de la mémoire, pour éviter le clignotement
double_buffer yes
# Soustraire les mémoires tampons de la mémoire utiliser
no_buffers yes
text_buffer_size 1024

# taux de rafraichissement de la fenêtre (en secondes)
update_interval 1

# nombre d'échantillons à utiliser pour calculer la moyenne d'utilisation
cpu_avg_samples 1
net_avg_samples 2

# taille et positon - largeur/hauteur
alignment top_left
minimum_size 300 500
maximum_width 300

# écart avec le bord x=gauche ou droit y= haut ou bas
gap_x 500
gap_y -5

# afficher les ombres
draw_shades no
# afficher des contours
draw_outline no
# contours autour des blocs de texte
draw_borders no
# largeur du contour
border_width 1
# largeur des marges
border_margin 1

#pour que conky tourne en arrière plan background no pour les tests
background yes

# utiliser sa propre fenêtre
own_window yes
#type de fenêtre : normal(avec le cadre) / override / desktop
own_window_type override # normal / override / desktop
#pseudo transparence si vous avez des icones sous le conky elle ne seront plus accessible une fois conky activé
own_window_transparent yes

# Utiliser Xft (polices lissées etc)
use_xft yes
xftalpha .1
override_utf8_locale yes # force UTF8

#police a utiliser : use_xft doit être a "yes"
xftfont saxMono:size=9 #OCR A Std:size=6
# Tout le texte en majuscule
uppercase no

# Ajoute des espaces après certains objets pour éviter de les faire bouger.
# Fonctionne uniquement avec les polices Fixes
use_spacer yes

# Taille des pointillés
stippled_borders 5

# Couleurs
default_color FFFFFF #blanc
default_shade_color 333333
default_outline_color black

color3 cf1c00 #rouge
color2 66FF00 #vert
color1 176e88 #bleu

${font Visitor TT1 BRK : pixelsize=12}${color1}${alignc}${exec cat /etc/lsb-release | grep "NAME" | cut -d "=" -f2} Inside${font}



TEXT

${font Visitor TT1 BRK : pixelsize=12}${color1}Processes${font}
${color3}${voffset -5}${hr}
${offset 15}${color1}Processes : ${processes} ${alignr}Running : ${color2}$running_processes

${font Visitor TT1 BRK : pixelsize=12}${color1}Top_CPU${font}
${color3}${voffset -5}${hr}
${offset 15}${color2}${top name 1}${color3}${goto 150}${top cpu 1}%${alignr}${color1}${top pid 1}
${offset 15}${color2}${top name 2}${color3}${goto 150}${top cpu 2}%${alignr}${color1}${top pid 2}
${offset 15}${color2}${top name 3}${color3}${goto 150}${top cpu 3}%${alignr}${color1}${top pid 3}
${offset 15}${color2}${top name 4}${color3}${goto 150}${top cpu 4}%${alignr}${color1}${top pid 4}
${offset 15}${color2}${top name 5}${color3}${goto 150}${top cpu 5}%${alignr}${color1}${top pid 5}
${offset 15}${color2}${top name 6}${color3}${goto 150}${top cpu 6}%${alignr}${color1}${top pid 6}
${offset 15}${color2}${top name 7}${color3}${goto 150}${top cpu 7}%${alignr}${color1}${top pid 7}
${offset 15}${color2}${top name 8}${color3}${goto 150}${top cpu 8}%${alignr}${color1}${top pid 8}
${offset 15}${color2}${top name 9}${color3}${goto 150}${top cpu 9}%${alignr}${color1}${top pid 9}
${offset 15}${color2}${top name 10}${color3}${goto 150}${top cpu 10}%${alignr}${color1}${top pid 10}

${font Visitor TT1 BRK : pixelsize=12}${color1}Top_RAM${font}
${color3}${voffset -5}${hr}
${offset 15}${color2}${top_mem name 1}${color3}${goto 150}${top_mem mem 1}%${alignr}${color1}${top_mem pid 1}
${offset 15}${color2}${top_mem name 2}${color3}${goto 150}${top_mem mem 2}%${alignr}${color1}${top_mem pid 2}
${offset 15}${color2}${top_mem name 3}${color3}${goto 150}${top_mem mem 3}%${alignr}${color1}${top_mem pid 3}
${offset 15}${color2}${top_mem name 4}${color3}${goto 150}${top_mem mem 4}%${alignr}${color1}${top_mem pid 4}
${offset 15}${color2}${top_mem name 5}${color3}${goto 150}${top_mem mem 5}%${alignr}${color1}${top_mem pid 5}
${offset 15}${color2}${top_mem name 6}${color3}${goto 150}${top_mem mem 6}%${alignr}${color1}${top_mem pid 6}
${offset 15}${color2}${top_mem name 7}${color3}${goto 150}${top_mem mem 7}%${alignr}${color1}${top_mem pid 7}
${offset 15}${color2}${top_mem name 8}${color3}${goto 150}${top_mem mem 8}%${alignr}${color1}${top_mem pid 8}
${offset 15}${color2}${top_mem name 9}${color3}${goto 150}${top_mem mem 9}%${alignr}${color1}${top_mem pid 9}
${offset 15}${color2}${top_mem name 10}${color3}${goto 150}${top_mem mem 10}%${alignr}${color1}${top_mem pid 10}


${offset -5}${color3}${font Ubuntu:style=CleanCut:size=10} ${voffset -2}${font Ubuntu:style=Bold:size=11}Météo
${font} ${hr}${color1}

${execpi 1800 conkyForecast --location=FRXX0076 --template=~/.conky/conkyForecast.template}

Sans oublié nôtre fichier "Fêtes"

#!/bin/bash
# Version 1.3
# Ce script permet d'obtenir les fêtes de chaque jour, sans internet.
# Possibilité de varier les couleurs en jouant avec le offset de conky.

# Récupère les prénoms de la commande console "calendar"
N=`calendar -f /usr/share/calendar/fr_FR/calendar.fetes -A0 | grep "N'" | cut -d " " -f6`
A=`calendar -f /usr/share/calendar/fr_FR/calendar.fetes -A0 | grep "Aujourd'hui" | cut -d " " -f7 | tr -d "."`
B=`calendar -f /usr/share/calendar/fr_FR/calendar.fetes -A0 | grep "Bonne" | cut -d " " -f6`

NB=`echo $N $A $B | wc -w`

[ "$NB" -ge 2 ] && echo "                            "$N $A $B | fold -s -w 44 && exit 0
echo "                            "$N $A $B | fold -s -w 44
echo

exit 0

Après vous devrait joué avec les Gap X et Y pour le placement du conky ...!
Pour avoir le terminal sur le bureau tu installe Tilda et tu le paramétré sous une interface graphique dans Applications / Accessoires / Tilda

Crée un dossier ".conky"

Dans ce dossier crée un fichier nommé "conkyForecast.template" (script ci-dessous)

${voffset 5}${goto 10}${font ConkyWeather:style=Bold:size=40}[--datatype=WF]${font}
${voffset 5}${goto 20}[--datatype=HT --hideunits --centeredwidth=3]/[--datatype=LT --hideunits --centeredwidth=3]
${voffset 10}${goto 10}${font ConkyWindNESW:size=40}[--datatype=BS]${font}
${voffset 5}${goto 10}[--datatype=WS --imperial] - [--datatype=WD]
${voffset -145}${goto 100}${color1}${font Bitstream Vera Sans Mono:style=Bold:size=14}[--datatype=CT]${font}
${voffset 10}${goto 100}${color3}Station: ${color1}[--datatype=OB]
${goto 100}${color3}Pluie : ${color1}[--datatype=PC]
${goto 100}${color3}UV : ${color1}[--datatype=UI] - [--datatype=UT]
${goto 100}${color3}Humidité : ${color1}[--datatype=HM]
${goto 100}${color3}Point de rosée : ${color1}[--datatype=DP]
${goto 100}${color3}Lever/Coucher : ${color1}[--datatype=SR] / [--datatype=SS]
${goto 100}${color3}Pression Atmosphérique : ${color1}[--datatype=BR] - [--datatype=BD]
${goto 100}${color3}Lune : ${color1}[--datatype=MP]
${voffset 25}${goto 25}[--datatype=DW --startday=1 --shortweekday]${goto 100}[--datatype=DW --startday=2 --shortweekday]${goto 175}[--datatype=DW --startday=3 --shortweekday]${goto 250}[--datatype=DW --startday=4 --shortweekday]
${voffset 10}${goto 10}${font ConkyWeather:size=32}[--datatype=WF --startday=1 --endday=4 --spaces=3]${font}
${voffset 15}${goto 15}[--datatype=HT --startday=1 --hideunits --centeredwidth=3]/[--datatype=LT --startday=1 --hideunits --centeredwidth=3]${goto 90}[--datatype=HT --startday=2 --hideunits --centeredwidth=3]/[--datatype=LT --startday=2 --hideunits --centeredwidth=3]${goto 170}[--datatype=HT --startday=3 --hideunits --centeredwidth=3]/[--datatype=LT --startday=3 --hideunits --centeredwidth=3]${goto 245}[--datatype=HT --startday=4 --hideunits --centeredwidth=3]/[--datatype=LT --startday=4 --hideunits --centeredwidth=3]
${color3}${font Bitstream Vera Sans Mono:size=7}${alignr 20}Dernière mise à jour: [--datatype=LU]${font}

Toujours dans le dossier ".conky" re-crée un dossier "pix" ou dedans vous placerez l'image ci-dessous.

thermo1-150x150.png


J'ai éaloré un petit script de démarrage automatiaquement

Dans le ~/ crée un dossier ".bin" et ensuite crée un fichier à l'intérieur du ".bin" un fichier nommé "conkystart.sh"

#!/bin/bash
killall conky
sleep 20
conky -c ~/conky/.conkyrc &
conky -c ~/conky/.conkyrc2 &
conky -c ~/conky/.conkyrc3 &
exit

N'oubliez pas de méttre dans vos applications de démarrage cette commande "bash .bin/conkystart.sh" qui va vous permettre d'exécuté le fichier qui ce trouve dans le .bin (conkystart.sh).



Hey Voilà !!! big_smile

Pour plus de renseignement n'hésitez pas à mettre un post ...


Le manuel disait « Nécessite Windows XP ou mieux ». J ’ai donc installé Linux.
Quand la vie apporte des questions, Google donne les réponses

Hors ligne

#1610 Le 01/07/2012, à 21:35

Vinz60400

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

A. a écrit :

Bonjour,

J'aimerais ajouter la météo sur mon bureau via un conky.
J'ai vu qu'il y avait un pack d'installation réalisé par Didier-T, mais dont l'apparence ne me convient pas. Et je ne sais pas vraiment comment le modifier pour arriver à un résultat plus sobre.

Dans l'idée, j'aimerais quelque chose qui ressemble à ce que présente Vinz60400 ou au conky de Bishop.
Malheureusement Vinz60400 n'a pas (encore ?) donné de détails et le conky de Bishop utilise weather.com.

Salut,

Voila mon retour sur le forum après une absence !!!
J'ai fait  un tuto pour mettre en place mon conky !!!

Dernière modification par Vinz60400 (Le 01/07/2012, à 21:38)


Le manuel disait « Nécessite Windows XP ou mieux ». J ’ai donc installé Linux.
Quand la vie apporte des questions, Google donne les réponses

Hors ligne

#1611 Le 01/07/2012, à 21:38

Vinz60400

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Après avoir fait correctement mon tuto à la lettre:D !

Voici ce que ça donne !!!

Conky Final


Le manuel disait « Nécessite Windows XP ou mieux ». J ’ai donc installé Linux.
Quand la vie apporte des questions, Google donne les réponses

Hors ligne

#1612 Le 05/07/2012, à 16:10

zn23

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

bon après un bon fignolage plus de soucis particulier avec ce conky tout con

#if mixerbar does not work add 'snd-mixer-oss' in /etc/modules#
##${color #ff00ff}${font Ubuntu:pixelsize=11.5}${alignc}${hwmon 0 temp 1}C°
##rhythmebox-client %td variable does not work [url]https://bugzilla.gnome.org/show_bug.cgi?id=674897[/url]  
background no
use_xft yes
font snap-7
xftfont Ubuntu:pixelsize=9
xftalpha 0.9
text_buffer_size 2048
out_to_console no
update_interval 1
total_run_times 0
draw_shades no
draw_outline no
draw_borders no
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints below,sticky,skip_taskbar,skip_pager
double_buffer yes
alignment bottom_right
gap_x 5
gap_y -40
no_buffers yes
minimum_size 5 5
maximum_width 150
short_units yes
use_spacer right
default_bar_size 75 2
TEXT                  
${voffset 60}${color white}${font Ubuntu:style=Bold:pixelsize=58}${time %H:%M}${font}
${voffset -2}${color lightgrey}${font Ubuntu:size=7}${alignc}${uptime}${font}
${color white}${font Ubuntu:style=Bold:pixelsize=10}${alignc}SYSTEM${font}
${color white}${voffset -10}${cpubar cpu7 2,52}${alignr}${cpubar cpu8 2,52}
${color lightgrey}${font Ubuntu:size=8}Hostname${alignr}${nodename}${font}
${color lightgrey}${font Ubuntu:size=8}Release${alignr}${pre_exec cat /etc/lsb-release|grep REL|cut -d= -f2}
${color lightgrey}${font Ubuntu:size=8}Kernel${alignr}${kernel}
${font Ubuntu:style=Bold:pixelsize=20}${voffset -10}${if_match ${cpu} >0}${color green}${else}${color grey}${endif}-${if_match ${cpu} >5}${color green}${else}${color grey}${endif}-${if_match ${cpu} >10}${color green}${else}${color grey}${endif}-${if_match ${cpu} >15}${color green}${else}${color grey}${endif}-${if_match ${cpu} >20}${color green}${else}${color grey}${endif}-${if_match ${cpu} >25}${color green}${else}${color grey}${endif}-${if_match ${cpu} >30}${color green}${else}${color grey}${endif}-${if_match ${cpu} >35}${color green}${else}${color grey}${endif}-${if_match ${cpu} >40}${color green}${else}${color grey}${endif}-${if_match ${cpu} >45}${color yellow}${else}${color grey}${endif}- ${if_match ${cpu} >50}${color yellow}${else}${color grey}${endif}-${if_match ${cpu} >55}${color yellow}${else}${color grey}${endif}-${if_match ${cpu} >60}${color yellow}${else}${color grey}${endif}-${if_match ${cpu} >65}${color orange}${else}${color grey}${endif}-${if_match ${cpu} >70}${color orange}${else}${color grey}${endif}- ${if_match ${cpu} >75}${color red}${else}${color grey}${endif}-${if_match ${cpu} >80}${color red}${else}${color grey}${endif}-${if_match ${cpu} >85}${color red}${else}${color grey}${endif}-${if_match ${cpu} >90}${color red}${else}${color grey}${endif}-${if_match ${cpu} >95}${color red}${else}${color grey}${endif}-${font}
${font Ubuntu:style=Bold:pixelsize=20}${voffset -15}${if_match ${cpu cpu1} >0}${color green}${else}${color grey}${endif}-${if_match ${cpu cpu1} >5}${color green}${else}${color grey}${endif}-${if_match ${cpu cpu1} >10}${color green}${else}${color grey}${endif}-${if_match ${cpu cpu1} >15}${color green}${else}${color grey}${endif}-${if_match ${cpu cpu1} >20}${color green}${else}${color grey}${endif}-${if_match ${cpu cpu1} >25}${color green}${else}${color grey}${endif}-${if_match ${cpu cpu1} >30}${color green}${else}${color grey}${endif}-${if_match ${cpu cpu1} >35}${color green}${else}${color grey}${endif}-${if_match ${cpu cpu1} >40}${color green}${else}${color grey}${endif}-${if_match ${cpu cpu1} >45}${color yellow}${else}${color grey}${endif}- ${if_match ${cpu cpu1} >50}${color yellow}${else}${color grey}${endif}-${if_match ${cpu cpu1} >55}${color yellow}${else}${color grey}${endif}-${if_match ${cpu cpu1} >60}${color yellow}${else}${color grey}${endif}-${if_match ${cpu cpu1} >65}${color orange}${else}${color grey}${endif}-${if_match ${cpu cpu1} >70}${color orange}${else}${color grey}${endif}- ${if_match ${cpu cpu1} >75}${color red}${else}${color grey}${endif}-${if_match ${cpu cpu1} >80}${color red}${else}${color grey}${endif}-${if_match ${cpu cpu1} >85}${color red}${else}${color grey}${endif}-${if_match ${cpu cpu1} >90}${color red}${else}${color grey}${endif}-${if_match ${cpu cpu1} >95}${color red}${else}${color grey}${endif}-${font} 
${voffset -8}${font Ubuntu:style=Bold:size=7}${color green}${loadavg 1}${alignc -10}${color yellow}${loadavg 2}${alignr}${color red}${loadavg 3}${font}
${voffset -4}${color lightgrey}${membar 2,72}${alignr}${swapbar 2,72}
${voffset -5} 
${color white}${font Ubuntu:style=Bold:pixelsize=10}${alignc}FILESYSTEM${font}
${color white}${voffset -10}${cpubar cpu7 2,42}${alignr}${cpubar cpu8 2,42}
${color lightgrey}${font Ubuntu:size=8}Ubuntu ${color red}${font Ubuntu:style=Bold:size=7} ${hwmon 0 temp 1}°${color lightgrey}${alignr}${fs_bar 3,90 /}${font}
${color lightgrey}${font Ubuntu:size=8}Home    ${color yellow}${font Ubuntu:style=Bold:size=7} ${hddtemp /dev/sda}° ${color lightgrey}${alignr}${fs_bar 3,90 /home/zniavre/}${font}
${voffset -8}
${color lightgrey}${font Ubuntu:size=8}Disk 1   ${color green}${font Ubuntu:style=Bold:size=7} ${hddtemp /dev/sdb}° ${color lightgrey}${alignr}${fs_bar 3,90 /media/Disk1/}${font}
${color lightgrey}${font Ubuntu:size=8}Disk 2   ${color green}${font Ubuntu:style=Bold:size=7} ${hddtemp /dev/sdb}° ${color lightgrey}${alignr}${fs_bar 3,90 /media/Disk2/}${font}
${voffset -5}
${color white}${font Ubuntu:style=Bold:pixelsize=10}${alignc}NETWORK
${color white}${voffset -10}${cpubar cpu7 2,48}${alignr}${cpubar cpu8 2,48}
${color lightgrey}${font Ubuntu:size=8}Ip network ${alignr} ${color white}${addr wlan0}${font}
${color white}${font Ubuntu:size=8}${wireless_essid wlan0} ${alignr} ${color lightgrey}${font Ubuntu:size=8}${color red}${wireless_link_qual_perc wlan0}${color lightgrey}%${font}
${voffset 1}${alignc}${color grey}${execi 3600 wget -q -O /dev/stdout [url]http://checkip.dyndns.org[/url]/ | cut -d : -f 2- | cut -d \< -f -1}
${color lightgrey}${font PizzaDude Bullets:pixelsize=11}U ${font}${color white}${font Ubuntu:size=8}${downspeedf wlan0}k/s${color lightgrey}${alignr 8}${font PizzaDude Bullets:pixelsize=11}O ${font}${color white}${font Ubuntu:size=8}${upspeedf wlan0}k/s${font}
${color white}${font Ubuntu:size=8}    ${totaldown wlan0}${color lightgrey}${font PizzaDude Bullets:pixelsize=13} T ${font}${alignr 18}${font Ubuntu:size=8}${color white}${totalup wlan0}${color lightgrey}${font PizzaDude Bullets:pixelsize=13} N ${font}
${color white}${font Ubuntu:style=Bold:pixelsize=11}${alignc}DATE${font}
${color white}${voffset -10}${cpubar cpu7 2,57}${alignr}${cpubar cpu8 2,57}
${color white}${font Ubuntu Mono:size=10}${alignc -6}${execpi 60 VinDSL_Cal_8b=$(( $(date +%-d) - 1 ));VinDSL_Cal_8=$(date +%-d); cal -h | sed -e '1d' -e 's/\<'"$VinDSL_Cal_8"'\>/&${color grey}/' -e 's/\<'"$VinDSL_Cal_8b"'\>/&${color red}/'}${font}
${voffset -18}
${color white}${font Ubuntu:style=Bold:pixelsize=10}${alignc}RhythmBox${font}
${color white}${voffset -10}${cpubar cpu7 2,45}${alignr}${cpubar cpu8 2,45}
${if_running rhythmbox}${color white}${font Ubuntu:style=Bold:size=14}${alignc}${execi 5 rhythmbox-client --print-playing-format %at}${font}
${color lightgrey}${font Ubuntu:size=11} ${alignc}${execi 5 rhythmbox-client --no-start --no-present --print-playing-format %aa}${font}
${color white}${font Ubuntu:size=9} ${alignc}${execi 5 rhythmbox-client --no-start --no-present --print-playing-format %tt}${font}
${color red}${font Ubuntu:style=Bold:size=8}${alignc} ${exec rhythmbox-client --no-start --no-present --print-playing-format %te}${font}${endif}
${color white}${font Ubuntu:style=Bold:pixelsize=11}${alignc}zni-A-vre${font}
${color white}${voffset -10}${cpubar cpu7 2,48}${alignr}${cpubar cpu8 2,48}

${voffset -5}${font PizzaDude Bullets:pixelsize=13}${alignc}${if_match ${exec /home/zniavre/bin/.conkydesk} ==1}${color red}${else}${color grey}${endif}Y  ${if_match ${exec /home/zniavre/bin/.conkydesk} ==2}${color red}${else}${color grey}${endif} Y  ${if_match ${exec /home/zniavre/bin/.conkydesk} ==3}${color red}${else}${color grey}${endif} Y  ${if_match ${exec /home/zniavre/bin/.conkydesk} ==4}${color red}${else}${color grey}${endif} Y${font}

j'ai pu mettre des intervales de 5% plutot que de 10% pour le cpu ce qui le rend plus reactif et precis

hHzri.png

modif1 ça faisait longtemps je souhaité ajouter un 'truc' pour avoir le numéro du bureau (utilisant gnome & compiz)
grâce à avelldiroll qui m'a concocté un script bash c'est fait . ( sur cette base : http://superuser.com/questions/264281/w … -have-four )

#!/bin/bash
dimensions=$(xdpyinfo | awk '$1=="dimensions:"{print $2}')
screen_width=${dimensions%x*}
info=( $(wmctrl -d | awk '{print $4, $6}') )
desktop_width=${info[0]%x*}
viewports=$(( desktop_width / screen_width ))
current_vp=$(( ${info[1]%,*} / screen_width ))
echo $(($current_vp + 1))

chmod +x sur le fichier et hop
(là j'ai mis des ronds mais avec 1 2 3 4 ca marche aussi bien)
voila si ca peut aider un gars (ou pas)

salutations à tous

Dernière modification par zn23 (Le 07/07/2012, à 22:12)


tu peux y mettre tout le fûmier que tu veux , pour un chêne centenaire, faut cent ans ...

Hors ligne

#1613 Le 09/07/2012, à 23:52

los_tintinos

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonsoir,


je poste ici suite a un autre  fils ou j'avais un problème spécifique et je ne voulais pas encombrer celui-ci avec ca.... enfin je me comprend

Voici mon conky librement inspiré d'un conky htc style trouvé sur le net que j'ai arrangé à ma sauce.,

# -- Conky settings -- #
    background no
    update_interval 1

    cpu_avg_samples 2
    net_avg_samples 2

    override_utf8_locale yes

    double_buffer yes
    no_buffers yes

    text_buffer_size 2048
    imlib_cache_size 0

    short_units yes

    # -- Window specifications -- #

    own_window yes
    own_window_type normal
    own_window_transparent yes
    own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

    border_inner_margin 0
    border_outer_margin 0

    minimum_size 310 310
    maximum_width 310
    

    alignment tr
    gap_x -25
    gap_y 20

    # -- Graphics settings -- #
    draw_shades no
    draw_outline no
    draw_borders no
    draw_graph_borders yes

    # -- Text settings -- #
    use_xft yes
    xftfont MaiandraGD:size=24
    xftalpha 0.4

    uppercase no

    default_color 8b8b8b

lua_load /home/seb/conky/v9000/v9000.lua
lua_draw_hook_pre weather
lua_load /home/seb/conky/v9000/weather_script.lua

        TEXT
${voffset 30}${font Helvetica LT Std :style=Condensed:size=60}${color 434343}${goto 40}${time %H}${goto 140}${time %M}${font Helvetica LT Std :size=15:style=condensed}${color 808080}${goto 227}${time %S}
${voffset 50}${color whitesmoke}${font Helvetica LT Std :size=8}${alignr 115}${time %A}, ${time %e} ${time %B} ${time %G}

${image /home/seb/conky/.images/base.png -p 12,30 -s 270x210}
${image /home/seb/conky/.images/flip_bg.png -p 30,10 -s 100x110}
${image /home/seb/conky/.images/flip_bg.png -p 130,10 -s 100x110}











${voffset -45}${color whitesmoke}${font Helvetica LT Std :size=8:weight=bold}${goto 30}Process${goto 120}MEM${goto 205}CPU
${font Helvetica LT Std :size=8}${goto 30}${top name 1}${goto 115}${top mem 1}%${goto 200}${top cpu 1}%
${goto 30}${top name 2}${goto 115}${top mem 2}%${goto 200}${top cpu 2}%
${goto 30}${top name 3}${goto 115}${top mem 3}%${goto 200}${top cpu 3}%

${voffset 20}${font Helvetica LT Std :size=8}${goto 30}Machine:${goto 80}$nodename
${goto 30}Distro:${goto 80}${pre_exec cat /etc/issue.net}
${goto 30}Kernel:${goto 80}$kernel

${goto 30}CPU1:${goto 80}${freq_g 1}GHz${goto 145}CPU2:${goto 190}${freq_g 2}GHz
${goto 30}CPU3:${goto 80}${freq_g 3}GHz${goto 145}CPU4:${goto 190}${freq_g 4}GHz
${goto 30}Temp:${goto 80}${exec sensors|grep 'temp2'|awk '{print $2}'}
${goto 30}RAM: ${goto 70}${mem} / ${memmax}${goto 145}SWAP: ${goto 190}${swap} / ${swapmax}

${goto 30}Local IP:${goto 80}${addr wlan0}
${goto 30}Strength:${goto 80}${wireless_link_qual_perc wlan0}%${goto 120}${wireless_bitrate wlan0}

${image /home/seb/conky/.images/base.png -p 12,270 -s 270x230}




${voffset -32}${font Helvetica LT Std :size=6:weight=bold}${goto 200}${time %b}
${voffset 2}${font Helvetica LT Std :size=14}${color 434343}${goto 197}${time %e}
${voffset -8}${font Helvetica LT Std :size=8}${color white}${execpi 10 conkyGoogleCalendar -u xxxxxxxxxxxxxxxxx@gmail.com --limit=3 --dateformat="%a, %d %b" --timeformat="%H:%M" --indent=8 --nowho}

${image /home/seb/conky/.images/base.png -p 12,530 -s 270x130}
${image /home/seb/conky/.images/calendar-icon.png -p 190,505 -s 37x40}




${goto 30}M@il: ${execpi 30 python ~/conky/conkyscripts/gmail_parser.py xxxxxxxxxxxxxxx@gmail.com MDPBal 2}


${image /home/seb/conky/.images/base.png -p 12,670 -s 270x105}
${image /home/seb/conky/.images/email.png -p 190,660 -s 37x40}

Le script me permettant de le lancer :

#! /bin/bash

killall conky
sleep 20
conky -c /home/seb/conky/.conkyrc 
exit

et voici ce que ca donne :

conky htc

Donc il ne reste qu'un soucis, c'est l'affichage des objets des mail qui dépassent de la boite quand ils sont trop long, j'ai pas encore trouvé comment l’éviter.

Enfin, j'ai une dernière idée saugrenue c'est de rendre cliquable le conky. Par exemple je clique sur la meteo,ça m'ouvre une page web meteo, sur le mail, ça m'ouvre les mail. Ca serait vraimrnt beton comme système, c'est possible ???


"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio

Hors ligne

#1614 Le 10/07/2012, à 08:56

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonjour

Pour rendre le script cliquable, tu peut utiliser le script que j'ai poster ici, attention ton conky doit être en mode normale et porter un nom qui devra être renseigné dans le script lua.

Si tu veux un exemple fonctionnelle, il y a un lien a la fin du message.

Pour le soucis de taille de message, je dirais qu'il faut en couper un bout de 40 caractères.

echo $textaimprimer| cut -c1-40

Je n'aurais pas accès à mon poste (linux) avant la fin du mois, je ne peut donc pas tester les lignes de commandes.

Hors ligne

#1615 Le 10/07/2012, à 09:30

los_tintinos

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

salut,
Merci beaucoup, je vais étudier tout ca.
Mais si j'ai bien compris, il faudrait que je coupe mon conky en autant de partie que je veux de clic ?

Je vais m'y atteler tout de suite...


"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio

Hors ligne

#1616 Le 10/07/2012, à 09:38

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

los_tintinos a écrit :

salut,
Merci beaucoup, je vais étudier tout ca.
Mais si j'ai bien compris, il faudrait que je coupe mon conky en autant de partie que je veux de clic ?

Je vais m'y atteler tout de suite...

Il ne faut pas découper ton conky, mais définir des zones de clics avec les actions associées (dans le fichier lua)

Hors ligne

#1617 Le 12/07/2012, à 10:36

los_tintinos

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Salut,
Ok, merci, même si j'avais deja coupé mon conky en 3, je trouvais pas pas trop pratique...

Sinon, je galére et je debutte dans la "programation". J'essaie de comprendre par moi-même mais je coince pas mal par moment...
Par exemple pour couper le texte avec la commande "echo..." je n'y arrive pas. Comment je dois l'inclure pour que cela fonctionne. Dois-je la mettre dans le conkyrc ou le script python qui concerne les mails ?
Quand à la zone de clic, je pense avoir réussis à mettre le script en place mais je ne connais pas la commande pour lancer un lien internet quand je clic sur la zone. Je suppose que c'est une commande OS mais je ne trouve pas laquelle :-((
Désolé d'être aussi débutant mais j'apprend vite -)


"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio

Hors ligne

#1618 Le 12/07/2012, à 14:10

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

los_tintinos a écrit :

Salut,
Ok, merci, même si j'avais deja coupé mon conky en 3, je trouvais pas pas trop pratique...

Sinon, je galére et je debutte dans la "programation". J'essaie de comprendre par moi-même mais je coince pas mal par moment...
Par exemple pour couper le texte avec la commande "echo..." je n'y arrive pas. Comment je dois l'inclure pour que cela fonctionne. Dois-je la mettre dans le conkyrc ou le script python qui concerne les mails ?
Quand à la zone de clic, je pense avoir réussis à mettre le script en place mais je ne connais pas la commande pour lancer un lien internet quand je clic sur la zone. Je suppose que c'est une commande OS mais je ne trouve pas laquelle :-((
Désolé d'être aussi débutant mais j'apprend vite -)

Sur le forum ont est tous un peut débutant, donc ne t'excuse pas de vouloir apprendre smile

je suis un peut loin de mon pc et le post au quel j'ai actuellement accès est sous Windows, donc je ne peut pas tester les solutions que je propose.

Peut tu me copier le contenu de ton script en python, c'est lui qu'il faudra modifier, mais pas avec la ligne que je t'ai donné (elle est pour bash)

Hors ligne

#1619 Le 12/07/2012, à 19:44

los_tintinos

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

bonsoir,
alors j'ai un peu bosser et je commence a bien le prendre en main, j'ai modifier la meteo pour l'avoir en francais et les saint du jour.
Donc je vous livre mon conky et les scripts qui vont bien avec (j'espere ne pas en oublier avec tous ces essais, j'en ai un peu partout...)
Deja l'allure finale :

Conky HTC

Ensuite le Conky :

 -- Conky settings -- #
    background no
    update_interval 1

    cpu_avg_samples 2
    net_avg_samples 2

    override_utf8_locale yes

    double_buffer yes
    no_buffers yes

    text_buffer_size 2048
    imlib_cache_size 0

    short_units yes

    # -- Window specifications -- #

    own_window yes
    own_window_title htc
    own_window_type normal
    own_window_transparent yes
    own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

    border_inner_margin 0
    border_outer_margin 0

    minimum_size 310 310
    maximum_width 310
    

    alignment tr
    gap_x O
    gap_y 0

    # -- Graphics settings -- #
    draw_shades no
    draw_outline no
    draw_borders no
    draw_graph_borders yes

    # -- Text settings -- #
    use_xft yes
    xftfont MaiandraGD:size=24
    xftalpha 0.4

    uppercase no

    default_color 8b8b8b

lua_load /home/seb/conky/v9000/v9000.lua
lua_draw_hook_pre weather
lua_load /home/seb/conky/v9000/weather_script.lua
lua_load /home/seb/conky/conkyscripts/Clic_info.lua

        TEXT
${voffset 30}${font Helvetica LT Std :style=Condensed:size=60}${color 434343}${goto 60}${time %H}${goto 160}${time %M}${voffset -20}${font Helvetica LT Std :size=15:style=condensed}${color 434343}${goto 247}${time %S}








${voffset -5}${color whitesmoke}${font Helvetica LT Std :size=8}${offset 50}${time %A}, ${time %e} ${time %B} ${time %G}${color1} Aujourd'hui St. ${offset -90}${exec /home/seb/conky/conkyscripts/Saints}

${image /home/seb/conky/.images/base.png -p 12,30 -s 270x230}
${image /home/seb/conky/.images/flip_bg.png -p 50,10 -s 100x110}
${image /home/seb/conky/.images/flip_bg.png -p 150,10 -s 100x110}

${voffset -40}${color whitesmoke}${font Helvetica LT Std :size=8:weight=bold}${goto 30}Process${goto 120}MEM${goto 205}CPU
${font Helvetica LT Std :size=8}${goto 30}${top name 1}${goto 115}${top mem 1}%${goto 200}${top cpu 1}%
${goto 30}${top name 2}${goto 115}${top mem 2}%${goto 200}${top cpu 2}%
${goto 30}${top name 3}${goto 115}${top mem 3}%${goto 200}${top cpu 3}%

${voffset 20}${font Helvetica LT Std :size=8}${goto 30}Machine:${goto 80}$nodename 
${goto 30}Distro:${goto 80}${pre_exec cat /etc/issue.net}
${goto 30}Kernel:${goto 80}$kernel

${goto 30}CPU1:${goto 80}${freq_g 1}GHz${goto 145}CPU2:${goto 190}${freq_g 2}GHz
${goto 30}CPU3:${goto 80}${freq_g 3}GHz${goto 145}CPU4:${goto 190}${freq_g 4}GHz
${goto 30}Temp:${goto 80}${exec sensors|grep 'temp2'|awk '{print $2}'}
${goto 30}RAM: ${goto 70}${mem} / ${memmax}${goto 145}SWAP: ${goto 190}${swap} / ${swapmax}

${goto 30}Local IP:${goto 80}${addr wlan0}
${goto 30}Strength:${goto 80}${wireless_link_qual_perc wlan0}%${goto 120}${wireless_bitrate wlan0}

${image /home/seb/conky/.images/base.png -p 12,270 -s 270x230}




${voffset -32}${font Helvetica LT Std :size=6:weight=bold}${goto 200}${time %b}
${voffset 2}${font Helvetica LT Std :size=14}${color 434343}${goto 197}${time %e}
${voffset -8}${font Helvetica LT Std :size=8}${color white}${execpi 10 conkyGoogleCalendar -u VOTREMAIL@gmail.com --limit=3 --dateformat="%a, %d %b" --timeformat="%H:%M" --indent=8 --nowho}

${image /home/seb/conky/.images/base.png -p 12,530 -s 270x130}
${image /home/seb/conky/.images/calendar-icon.png -p 190,505 -s 37x40}




${goto 30}M@il: ${execpi 30 python ~/conky/conkyscripts/gmail_parser.py VOTREMAIL@gmail.com VOTREMDP 0}


${image /home/seb/conky/.images/base.png -p 12,670 -s 270x50}
${image /home/seb/conky/.images/email.png -p 190,660 -s 37x40}

${lua click}

Les scripts pour les mails, finalement je ne fait qu'afficher le nombre de mail comme ca je n'ai plus de soucis de longeur de texte mais je veux bien la solution pour les raccourcir ;-)

Le script python pour les mail google :

## check-gmail.py -- A command line util to check GMail -*- Python -*-
## modified to display mailbox summary for conky

# ======================================================================
# Copyright (C) 2006 Baishampayan Ghose <b.ghose@ubuntu.com>
# Modified 2008 Hunter Loftis <hbloftis@uncc.edu>
# Time-stamp: Mon Jul 31, 2006 20:45+0530
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
# ======================================================================

import sys
import urllib             # For BasicHTTPAuthentication
import feedparser         # For parsing the feed
from textwrap import wrap

_URL = "https://mail.google.com/gmail/feed/atom"

uname = sys.argv[1]
password = sys.argv[2]
maxlen = sys.argv[3]

urllib.FancyURLopener.prompt_user_passwd = lambda self, host, realm: (uname, password)
    
def auth():
    '''The method to do HTTPBasicAuthentication'''
    opener = urllib.FancyURLopener()
    f = opener.open(_URL)
    feed = f.read()
    return feed


def readmail(feed, maxlen):
    '''Parse the Atom feed and print a summary'''
    atom = feedparser.parse(feed)
    print '${color1} %s emails non lus\n' % (len(atom.entries))
    for i in range(min(len(atom.entries), maxlen)):
        #print '          ${color2}%s : ' % atom.entries[i].author
        print '          ${color2}%s' % atom.entries[i].title    
#uncomment the following line if you want to show the name of the sender
        
    #if len(atom.entries) > maxlen:
    #    print '     ${color2}...'

if __name__ == "__main__":
    f = auth()  # Do auth and then get the feed
    readmail(f, int(maxlen)) # Let the feed be chewed by feedparser

Le scripts pour le meteo (il y en a 3)

V9000_config.lua

--SETTINGS AND PREFERENCES--SETTINGS AND PREFERENCES--SETTINGS AND PREFERENCES
function weather_settings()--#### DO NOT EDIT THIS LINE #################
--#######################################################################
local secs=1800--set update interval
local web="http://www.intellicast.com/Local/Forecast.aspx?unit=C&location=FRXX0047"--insert unit=C& after aspx? for C
--get web address by going to the intellicast site and entering your location in the box
--for version 3 you must get click on "Extended Forecast" to get the necessary address
--set location of weather images (replace "benjamin" with your own username)
local weathericons="/home/seb/conky/v9000/additional_files/weathericons/"
--short conditions setup
--this section allows you to set your own shorter terms to replace the terms foud in conditions
--to use for current: now["conditions_short"], now["conditions_short_caps"], now["conditions_short_lc"]
--to use for forecast: conditions_short[n], conditions_short_caps[n], conditions_short_lc[n]
--ALSO USE THIS TABLE TO ENTER CONDITIONS TRANSLATIONS
con_short={--start of table, put entries below in form eg: ["Thunderstorm"]="T.Strm",
["Wind Early"]="Brise",--remember to put a comma at the end of every entry
["Showers/Wnd"]="Pluie",
["Snow Showers"]="Av.Neige",
["Thunderstorm"]="Orage",
["Few Snow Showers"]="Neige",
["Partly Cloudy"]="Nuageux",
["Mostly Cloudy"]="Couvert",
["Mostly Sunny"]="Soleil",
["Rain/Snow"]="Pluvieux",
["Rain/Thunderstorm"]="Orageux",
["PM Rn/Snow"]="F neige",
["PM Showers"]="F averses",
["Showers Late"]="F pluie",
["AM Rn/Snow"]="Pluies",
["AM Light Snow"]="Neigeux",
["AM T.Strms/Wind"]="Tempête",
["Light Rain"]="Crachin",
["Mostly Clear"]="Variable",
["Rain"]="Pluie",
["Shower"]="Averse",
}--this bracket closes the table
--the script is capable of converting between several unit types
--set how many decimal places you want the conversions to show
local decimal_places=1
--some weather data options need to come with their own units attached as they can be NA on occasion
--set here what you want to have for units, or set "" for nothing
--include preceeding spaces if any for formatting
local visibility_unit=" mi"
local wind_mph_unit=" mph"
local wind_km_unit=" kmh"
local wind_kts_unit=" kts"
local ceiling_unit=" ft"
local wind_degrees_unit="°"
--do you want the script to use translation tables?
--set 1 if you want to translate, 0 if not.
--the translation tables are located at the bottom of the script in  function called "translate_tables"
--these tables are in addition to the con_short table which can be used to translate weather conditions and data options units settings 
local translate=0
--NOTE if you make changes to these settings, they will only take effect at the next weather update
--or after killall conky and restart
--#######################################################################
return {secs,web,weathericons,con_short,decimal_places,visibility_unit,wind_mph_unit,wind_km_unit,wind_kts_unit,ceiling_unit,wind_degrees_unit,translate}
end--OF SETTINGS AND PREFERENCES ########################################
--#######################################################################

weather_script.lua

--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION-
_G.weather_script = function()--#### DO NOT EDIT THIS LINE ##############
--#######################################################################
--these tables hold the coordinates for each repeat do not edit #########
top_left_x_coordinate={}--###############################################
top_left_y_coordinate={}--###############################################
--#######################################################################
--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
default_font="Helvetica LT Std"--font must be in quotes
default_font_size=12
default_color=0xffffff--white
default_alpha=1--fully opaque
default_image_width=50
default_image_height=50
--END OF DEFAULTS #######################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE

out({fs=8,x=120,y=237,txt="Last Update: "..now["time"]})
image({x=105,y=85,h=90,w=90,file=now["weather_icon"]})
--output of data options
out({x=40,y=130,txt=now["conditions_short"]})
out({x=220,y=130,txt=now["wind_km"]})
out({x=40,y=145,txt=now["temp"].."° / "..now["feels_like"].."°"})
out({x=220,y=145,txt=high_temp[1].."° / "..low_temp[1].."°"})

--start of weather forecast repeat section
--set start forecast day
start_day=1
--set total forecast days you want to display
number_of_days=4
topy=175
ygap=0
--set coordinates for top lef corners for each repeat
top_left_x_coordinate[1],top_left_y_coordinate[1]=40,topy
top_left_x_coordinate[2],top_left_y_coordinate[2]=100,topy
top_left_x_coordinate[3],top_left_y_coordinate[3]=160,topy
top_left_x_coordinate[4],top_left_y_coordinate[4]=220,topy
--########################################################################################
for i=start_day,number_of_days-(start_day-1) do--start of day repeat, do not edit ########
tlx=top_left_x_coordinate[i]--sets top left x position for each repeat ###################
tly=top_left_y_coordinate[i]--sets top left y position for each repeat ###################
--########################################################################################
out({fs=10,x=tlx+5,y=tly,txt=forecast_day_short[i]})
image({x=tlx,y=tly+2,h=30,w=30,file=weather_icon[i]})
out({fs=10,x=tlx,y=tly+38,txt=high_temp[i].."°/"..low_temp[i].."°"})
out({fs=10,x=tlx,y=tly+52,txt=conditions_short[i]})
--########################################################################################
end--of forecast repeat section ##########################################################
--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################
function hg_to_hpa(hg_pressure)
--convert inches of hg to pascals
local pa=tonumber(hg_pressure)*3386.389
--convert to hpa, 1hpa=100pa
local hpa=pa/100
--round hpa to 2 decimal places
local mult = 10^2
return math.floor(hpa * mult + 0.5) / mult
end


V9000.lua :

--weather v9000 by mrpeachy 01/10/12
require 'cairo'
require 'imlib2'
--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP
username = os.getenv("USERNAME")
--username = "yourusername"
package.path = '/home/seb/conky/.v9000_config.lua'
require '.v9000_config'
--END SETUP--END SETUP--END SETUP--END SETUP--END SETUP--END SETUP--END SETUP--END---
--######## main function ########### 
function conky_weather()--##########
--##################################
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
--#########################################################################################################
local display_script=1 -- set 1 for seperate display script, 0 to enter at bottom, default = 1
settings_table=weather_settings()
local secs=settings_table[1]
local web=settings_table[2]
local weathericons=settings_table[3]
con_short=settings_table[4]
decimal_places=settings_table[5] -- dont localize
local visibility_unit=settings_table[6]
local wind_mph_unit=settings_table[7]
local wind_km_unit=settings_table[8]
local wind_kts_unit=settings_table[9]
local ceiling_unit=settings_table[10]
local wind_degrees_unit=settings_table[11]
local translate=settings_table[12]--]]
local testing=0--this setting is for script testing, if not in testing set to 0
--#########################################################################################################
--############start of timed section#######################################################################
--#########################################################################################################
local updates=tonumber(conky_parse('${updates}'))
local timer=(updates %secs)+1
--#######################################
if timer==secs or updates==6 then--######
--#######################################
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A565 '10 Day Forecast' | sed 's/%//g'")
allweather=f:read("*a")
f:close()
allweather=string.gsub(allweather,"[\n\r]","")
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A120 '>Current Conditions&nbsp' | sed 's/%//g'")
nowweather=f:read("*a")
f:close()
nowweather=string.gsub(nowweather,"[\n\r]","")
processall=1
processnow=1
end--of timed data gathering section
--#####################################################
--in case curl craps up it should retry until it works
local testall=string.find(allweather,"%a")
local testnow=string.find(nowweather,"%a")
if testall==nil then
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A565 '10 Day Forecast' | sed 's/%//g'")
allweather=f:read("*a")
f:close()
allweather=string.gsub(allweather,"[\n\r]","")
processall=1
end
-----------------------------------------
if testnow==nil then
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A120 '>Current Conditions&nbsp' | sed 's/%//g'")
nowweather=f:read("*a")
f:close()
nowweather=string.gsub(nowweather,"[\n\r]","")
processnow=1
end
--end or curl reruns
local testall=string.find(allweather,"%a")
local testnow=string.find(nowweather,"%a")
--LOAD TRANSLATE TABLES IF TRANSLATE SETTING = 1
if translate==1 then
monthshort={}
monthnames={}
dayshort={}
daysnames={}
neswtext={}
tsuffix={}
uvtext={}
moonphases={}
translate_tables()
else
dayshort={Monday="Lun",Tuesday="Mar",Wednesday="Merc",Thursday="Jeu",Friday="Vend",Saturday="Sam",Sunday="Dim"}
monthshort={January="Jan",February="Feb",March="Mar",April="Apr",May="May",June="Jun",July="Jul",August="Aug",September="Sep",October="Oct",November="Nov",December="Dec"}
end
--end if translate =1
if testall~=nil and testnow~=nil and processall==1 and processnow==1 then
--process data
--intellicast to conky weather icon conversion
wimage={
wx_65="32",
wx_66="30",
wx_67="26",
wx_68="32",
wx_69="28",
wx_70="20",
wx_71="32",
wx_72="21",
wx_73="36",
wx_74="14",
wx_75="28",
wx_76="18",
wx_77="14",
wx_78="23",
wx_79="05",
wx_80="15",
wx_81="15",
wx_82="11",
wx_83="16",
wx_84="00",
wx_85="32",
wx_86="25",
wx_87="09",
wx_88="05",
wx_89="18",
wx_90="18",
wx_91="39",
wx_92="39",
wx_93="39",
wx_94="39",
wx_95="37",
wx_96="37",
wx_97="31",
wx_98="29",
wx_99="27",
wx_100="47",
wx_101="47",
wx_102="33",
wx_103="26",
wx_104="20",
wx_105="45",
wx_106="45",
wx_107="11",
wx_108="46",
wx_109="46",
wx_110="06",
wx_111="18",
wx_112="06",
wx_113="46",
wx_114="46",
wx_115="31",
wx_116="47",
}--end w image table
--convert intellicast icons to weather font
wfont={
wx_65="a",
wx_66="c",
wx_67="f",
wx_68="a",
wx_69="d",
wx_70="0",
wx_71="a",
wx_72="9",
wx_73="5",
wx_74="p",
wx_75="d",
wx_76="w",
wx_77="p",
wx_78="6",
wx_79="x",
wx_80="8",
wx_81="8",
wx_82="h",
wx_83="q",
wx_84="m",
wx_85="a",
wx_86="-",
wx_87="h",
wx_88="x",
wx_89="w",
wx_90="w",
wx_91="g",
wx_92="g",
wx_93="g",
wx_94="g",
wx_95="k",
wx_96="k",
wx_97="A",
wx_98="C",
wx_99="D",
wx_100="K",
wx_101="K",
wx_102="B",
wx_103="f",
wx_104="0",
wx_105="G",
wx_106="G",
wx_107="h",
wx_108="O",
wx_109="O",
wx_110="x",
wx_111="w",
wx_112="x",
wx_113="O",
wx_114="O",
wx_115="A",
wx_116="K",
}--end w font table
--conversion day and month tables
moonfontt={
["New"]="@",
["Full"]="=",
["First Quarter"]="T",
["Last Quarter"]="G",
["Waning Gibbous"]="D",
["Waning Crescent"]="J",
["Waxing Crescent"]="Q",
["Waxing Gibbous"]="W",
}--end of moon font table
windfontt={
S="9",
SSW=":",
SW=";",
WSW="<",
W="=",
WNW=">",
NW="?",
NNW="@",
N="1",
NNE="2",
NE="3",
ENE="4",
E="5",
ESE="6",
SE="7",
SSE="8"
}--end of wind direction font table
--setup tables for forecast weather
forecast_day={}
forecast_day_caps={}
forecast_day_lc={}
forecast_day_short={}
forecast_day_short_caps={}
forecast_day_short_lc={}
forecast_month={}
forecast_month_caps={}
forecast_month_lc={}
forecast_month_short={}
forecast_month_short_caps={}
forecast_month_short_lc={}
forecast_date={}
weather_icon={}
weather_font={}
high_temp={}
low_temp={}
conditions={}
conditions_caps={}
conditions_lc={}
conditions_short={}
conditions_short_caps={}
conditions_short_lc={}
sun_rise={}
sun_rise_lc={}
sun_rise_time={}
moon_rise={}
moon_rise_lc={}
moon_rise_time={}
moon_rise_ampm={}
moon_rise_ampm_lc={}
sun_set={}
sun_set_lc={}
sun_set_time={}
moon_set={}
moon_set_lc={}
moon_set_time={}
moon_set_ampm={}
moon_set_ampm_lc={}
humidity={}
precipitation={}
snow={}
cloud_cover={}
moon_phase={}
moon_phase_caps={}
moon_phase_lc={}
moon_font={}
wind_mph={}
wind_km={}
wind_kts={}
wind_font={}
wind_deg={}
wind_nesw={}
uv_index_num={}
uv_index_txt={}
uv_index_txt_caps={}
uv_index_txt_lc={}
-----------------
--extract information into tables
local start=0
local f=1
while f~=nil do
--match forecast day name and date
local s,f,t=string.find(allweather,"<td colspan=\"2\"><strong>([%a,%s%d]*)</strong></td>",start)
    if t~=nil then
    --split name from month and date
    local a,b,day=string.find(t,"(%a*),%s")
    local a,b,month=string.find(t,",%s(%a*)%s")
    local a,b,date=string.find(t,"(%d*)$")
    --ser day names, regular, caps, lowercase and short
    table.insert(forecast_day_short,dayshort[day])
    table.insert(forecast_day_short_caps,string.upper(dayshort[day]))
    table.insert(forecast_day_short_lc,string.lower(dayshort[day]))
        if translate==1 then
        day=daynames[day]
        else
        day=day
        end
    table.insert(forecast_day,day)
    table.insert(forecast_day_caps,string.upper(day))
    table.insert(forecast_day_lc,string.lower(day))
    --set month types
    table.insert(forecast_month_short,monthshort[month])
    table.insert(forecast_month_short_caps,string.upper(monthshort[month]))
    table.insert(forecast_month_short_lc,string.lower(monthshort[month]))
        if translate==1 then
        month=monthnames[month]
        else
        month=month
        end
    table.insert(forecast_month,month)
    table.insert(forecast_month_caps,string.upper(month))
    table.insert(forecast_month_lc,string.lower(month))
    --set date
    table.insert(forecast_date,date)
    end--if t~= nil
--intellicast weather icon match
local s,f,t=string.find(allweather,"40_white/(wx_[%d]*).png\"",start)
--convert to conkyweather icon
    if t~=nil then
    table.insert(weather_icon,weathericons..wimage[t]..".png")
    --convert to weather font
    table.insert(weather_font,wfont[t])
    end
--match conditions
local s,f,t=string.find(allweather," /><br />([%a%s%p]*)</td>",start)
    if t~=nil then
    table.insert(conditions,t)
    table.insert(conditions_caps,string.upper(t))
    table.insert(conditions_lc,string.lower(t))
    --set short versions--------------------------------
    local cons=t
        for k,v in pairs(con_short) do
        cons=string.gsub(cons,k,v)
        end
    table.insert(conditions_short,cons)
    table.insert(conditions_short_caps,string.upper(cons))
    table.insert(conditions_short_lc,string.lower(cons))
    -----------------------------------------------------
    end
--match high temp
local s,f,t=string.find(allweather,"\"Hi\">([%p%d]*)&deg",start)
table.insert(high_temp,t)
--match low temp
local s,f,t=string.find(allweather,"\"Lo\">([%p%d]*)&deg",start)
table.insert(low_temp,t)
--match sun rise times
local s,f,t=string.find(allweather,"Rise:</strong> (%d*:%d*%s%u%u)</td>",start)
    if t~=nil then
    --get time only
    local a,b,tm=string.find(t,"([%d%p]*)")
    --get suffix only
    local a,b,suf=string.find(t,"(%u%u)")
        if translate==1 then
        suf=tsuffix[suf]
        else
        suf=suf
        end
    table.insert(sun_rise,tm..suf)
    table.insert(sun_rise_lc,string.lower(tm..suf))
    table.insert(sun_rise_time,tm)
    end
--match sun set times
local s,f,t=string.find(allweather,"Set:</strong> (%d*:%d*%s%u%u)</td>",f)
    if t~=nil then    
    --get time only
    local a,b,tm=string.find(t,"([%d%p]*)")
    --get suffix only
    local a,b,suf=string.find(t,"(%u%u)")
        if translate==1 then
        suf=tsuffix[suf]
        else
        suf=suf
        end
    table.insert(sun_set,tm..suf)
    table.insert(sun_set_lc,string.lower(tm..suf))
    table.insert(sun_set_time,tm)
    end
--moon rise
local s,f,t=string.find(allweather,"Rise:</strong> (%d*:%d*%s%u%u)</td>",f)
    if t~=nil then
    --get time only
    local a,b,tm=string.find(t,"([%d%p]*)")
    --get suffix only
    local a,b,suf=string.find(t,"(%u%u)")
        if translate==1 then
        suf=tsuffix[suf]
        else
        suf=suf
        end
    table.insert(moon_rise,tm..suf)
    table.insert(moon_rise_lc,string.lower(tm..suf))
    table.insert(moon_rise_time,tm)
    table.insert(moon_rise_ampm,suf)
    table.insert(moon_rise_ampm_lc,string.lower(suf))
    end
--moon set
local s,f,t=string.find(allweather,"Set:</strong> (%d*:%d*%s%u%u)</td>",f)
    if t~=nil then
    --get time only
    local a,b,tm=string.find(t,"([%d%p]*)")
    --get suffix only
    local a,b,suf=string.find(t,"(%u%u)")
        if translate==1 then
        suf=tsuffix[suf]
        else
        suf=suf
        end
    table.insert(moon_set,tm..suf)
    table.insert(moon_set_lc,string.lower(tm..suf))
    table.insert(moon_set_time,tm)
    table.insert(moon_set_ampm,suf)
    table.insert(moon_set_ampm_lc,string.lower(suf))
    end
--match uv index
local s,f,tuv=string.find(allweather,"UV Index:</strong> (%d*%s*%(%a*%)) <br />",start)
    if tuv~=nil then
    --get just number
    local a,b,unm=string.find(tuv,"(%d*)%s*%(%a*%)")
    --get just text
    local a,b,utx=string.find(tuv,"%d*%s*%((%a*)%)")
    table.insert(uv_index_num,unm)
        if translate==1 then
        utx=uvindextext[utx]
        else
        utx=utx
        end
    table.insert(uv_index_txt,utx)
    table.insert(uv_index_txt_caps,string.upper(utx))
    table.insert(uv_index_txt_lc,string.lower(utx))
    end
--match humidity
local s,f,t=string.find(allweather,"Humidity:</strong> (%d*)<br />",start)
table.insert(humidity,t)
--match ppt
local s,f,t=string.find(allweather,"Precipitation:</strong> (%d*)<br />",start)
table.insert(precipitation,t)
--match snow %
local s,f,t=string.find(allweather,"Snow Probability:</strong>%s*(%d*)<br />",start)
table.insert(snow,t)
--match cloud coveage
local s,f,t=string.find(allweather,"Cloud Coverage:</strong> (%d*)<br />",start)
table.insert(cloud_cover,t)
--match moon phase
local s,f,t=string.find(allweather,"Moon Phase:</strong> ([%a%s]*) <br />",start)
--set moon phase text
    if t~= nil then
    --set moon phase font
    table.insert(moon_font,moonfontt[t])
        if translate==1 then
        t=moonphases[t]
        else
        t=t
        end
    table.insert(moon_phase,t)
    table.insert(moon_phase_caps,string.upper(t))
    table.insert(moon_phase_lc,string.lower(t))
    end
--match wind speeds
local s,f,t=string.find(allweather,"Wind Speed:</strong> (%d*)Mph",start)
table.insert(wind_mph,t)
local s,f,t=string.find(allweather,"Mph%s*%((%d*)Km,",start)
table.insert(wind_km,t)
local s,f,t=string.find(allweather,"Km,%s*(%d*)Kts%)",start)
table.insert(wind_kts,t)
--match wind direction
local s,f,twd=string.find(allweather,"Wind Direction:</strong> ([%d&;%s%(%a%)]*)%s*</div>",start)
    if twd~=nil then
    local a,b,tdeg=string.find(twd,"(%d*)&deg;")
    table.insert(wind_deg,tdeg)
    --match wind font and nesw   
    local a,b,tnesw=string.find(twd,"%((%a*)%)")
    table.insert(wind_font,windfontt[tnesw])
        if translate==1 then
        tnesw=neswtext[tnesw]
        else
        tnesw=tnesw
        end
    table.insert(wind_nesw,tnesw)
    end
if f==nil then break end
start=f
end--while
--#########################################################################################################################################
--end--of timed section
--format now weather
--extract current data
now={}
monthlong={Jan="January",Feb="February",Mar="March",Apr="April",May="May",Jun="June",Jul="July",Aug="August",Sep="September",Oct="October",Nov="November",Dec="December"}
local s,f,tnow=string.find(nowweather,"<div style=\"float:right;color:#666;\">  As of ([%d%p%a%s]*) %(Local Time%)")
local s,f,t=string.find(tnow,"(%d*%p%d*%s%a*) on")
--get time only
local a,b,ntm=string.find(t,"(%d*%p%d*)")
--get suffix only
local a,b,nsf=string.find(t,"(%u%u)")
if translate==1 then
suf=tsuffix[nsf]
else
suf=nsf
end
now["time"]=ntm..suf
now["time_lc"]=string.lower(ntm..suf)
now["time_num"]=ntm
now["time_ampm"]=suf
now["time_ampm_lc"]=string.lower(suf)
--get day
local s,f,t=string.find(tnow,"on (%a*)%s%d*")
if translate==1 then
day=daynames[t]
else
day=t
end
now["day"]=day
now["day_caps"]=string.upper(day)
now["day_lc"]=string.lower(day)
--short day names
local ds=dayshort[t]
now["day_short"]=ds
now["day_short_caps"]=string.upper(ds)
now["day_short_lc"]=string.lower(ds)
--get date
local s,f,t=string.find(tnow,"%s(%d%d)%s")
now["date"]=t
--get months
local s,f,t=string.find(tnow,"%d%d%s(%a*)%s%d")
if translate==1 then
mnth=monthlong[t]
now["month_short"]=monthshort[mnth]
now["month_short_caps"]=string.upper(monthshort[mnth])
now["month_short_lc"]=string.lower(monthshort[mnth])
mnth=monthnames[mnth]
else
now["month_short"]=t
now["month_short_caps"]=string.upper(t)
now["month_short_lc"]=string.lower(t)
mnth=monthlong[t]
end
now["month"]=mnth
now["month_caps"]=string.upper(mnth)
now["month_lc"]=string.lower(mnth)
--get year
local s,f,t=string.find(tnow,"%a%a%a%s(%d%d%d%d)")
now["year"]=t
--get weather icon
local s,f,t=string.find(nowweather,"40_white/(wx_[%d]*)%ppng%p%stitle=%p")
now["weather_icon"]=weathericons..wimage[t]..".png"
now["weather_font"]=wfont[t]
--class=%pIcon%p /> ([%a%s]*)%s*</td>
local s,f,t=string.find(nowweather,"class=%pIcon%p /> ([%a%s%p]*)%s*%s*</td>%s*<td class=%pEmpty%p>&nbsp;")
now["conditions"]=t
now["conditions_caps"]=string.upper(t)
now["conditions_lc"]=string.lower(t)
--set short versions------------------------
local cons=t
for k,v in pairs(con_short) do
cons=string.gsub(cons,k,v)
end
now["conditions_short"]=cons
now["conditions_short_caps"]=string.upper(cons)
now["conditions_short_lc"]=string.lower(cons)
--------------------------------------------
local s,f,t=string.find(nowweather,"Temperature\">([%p%d]*)&deg")
now["temp"]=t
local s,f,t=string.find(nowweather,">Feels Like: ([%p%d]*)&deg;</a>")
now["feels_like"]=t
local s,f,t=string.find(nowweather,">Wind Chill: </a></td>%s*<td>([%p%d]*)&deg;</td>")
now["wind_chill"]=t
local s,f,t=string.find(nowweather,">Ceiling: </a></td>%s*<td>([%a%d]*)</td>")
if t~="Unl" then
local s,f,t=string.find(t,"([%d%p]*)")
tc=t..ceiling_unit
else
tc=t
end
now["ceiling"]=tc
now["ceiling_caps"]=string.upper(tc)
now["ceiling_lc"]=string.lower(tc)
--get heat index
local s,f,t=string.find(nowweather,">Heat Index: </a></td>%s*<td>([%p%d]*)&deg;</td>")
now["heat_index"]=t
--get visibility
local s,f,t=string.find(nowweather,">Visibility: </a></td>%s*<td>([%a%d%p]*)</td>")
if t~="Unl" then
local s,f,t=string.find(t,"([%d%p]*)")
tv=t..visibility_unit
else
tv=t
end
now["visibility"]=tv
now["visibility_caps"]=string.upper(tv)
--get dew point
local s,f,t=string.find(nowweather,">Dew Point: </a></td>%s*<td>([%p%d]*)&deg;</td>")
now["dew_point"]=t
--get wind speed
local s,f,t=string.find(nowweather,">Wind: </a></td>%s*<td>(%d*)mph</td>")
now["wind_mph"]=t..wind_mph_unit
now["wind_mph_caps"]=string.upper(t..wind_mph_unit)
--convert mph to km and knots #################################################
--[[1 mile per hour = 0.869 international nautical mile per hour (knot)
     1 mile per hour = 1.609 kilometers per hour
     1 mile per hour = 0.4470 meter per second
     1 knot = 1.852 kilometers per hour
     1 knot = 0.5144 meter per second
     1 meter per second = 3.6 kilometers per hour]]
now["wind_km"]=round(tonumber(t)*1.609)..wind_km_unit
now["wind_km_caps"]=string.upper(round(tonumber(t)*1.609)..wind_km_unit)
now["wind_kts"]=round(tonumber(t)*0.869)..wind_kts_unit
now["wind_kts_caps"]=string.upper(round(tonumber(t)*0.869)..wind_kts_unit)
--#############################################################################
if tonumber(t)==0 then
windtest=0
else
windtest=1
end
local s,f,t=string.find(nowweather,">Humidity: </a></td>%s*<td>(%d*)</td>")
now["humidity"]=t
local s,f,twd=string.find(nowweather,">Direction: </a></td>%s*<td style=[%p%a]*>([%d&;%s%(%a%)]*)</td>%s*</tr>")
local a,b,t=string.find(twd,"(%d*)&deg;")
if windtest==1 then
now["wind_deg"]=t..wind_degrees_unit
else
now["wind_deg"]="NA"
end
--set wind font
local a,b,t=string.find(twd,"%((%a*)%)")
if windtest==1 then
now["wind_nesw"]=t
now["wind_font"]=windfontt[t]
else
now["wind_nesw"]="NA"
now["wind_font"]=windfontt["N"]
end
--get pressure
local s,f,t=string.find(nowweather,">Pressure: </a></td>%s*<td>([%d%p]*)\"</td>")
now["pressure"]=t
--convert pressures ########################################################
--[[ 1 inch of mercury = 25.4 mm of mercury = 33.86 millibars
     = 33.86 hectoPascals]]
now["pressure_mb"]=round(tonumber(t)*33.86)
--##########################################################################
local s,f,t=string.find(nowweather,">Gusts: </a></td>%s*<td>([%d%a]*)</td>")
if t~="NA" then
local s,f,t=string.find(t,"(%d*)")
tg=t..wind_mph_unit
tgkm=round(tonumber(t)*1.609)..wind_km_unit
tgkts=round(tonumber(t)*0.869)..wind_kts_unit
else
tg=t
tgkm=t
tgkts=t
end
now["wind_gusts"]=tg
now["wind_gusts_caps"]=string.upper(tg)
--convert gusts from mph to km and knots ###################################
now["wind_gusts_km"]=tgkm
now["wind_gusts_km_caps"]=string.upper(tgkm)
now["wind_gusts_kts"]=tgkts
now["wind_gusts_kts_caps"]=string.upper(tgkts)
--##########################################################################
--get hourly forecast options hour1--------------------
--get day 1 bit
s,f,hfc=string.find(nowweather,"<td class=%pHour%p%sstyle=%ppadding%pleft([%a%d%p%s]*)%pdeg%p</strong>",1)
--get time and conditions
--<strong>1 PM</strong><br />%s*P Cloudy%s*</td>%s*<td class=%pHour%p
local a,b,t=string.find(hfc,"<strong>([%d%p]*)[%s%a]*</strong><br",1)
--print (a,b,t)
now["fc_hour1_time"]=t
local a,b,t=string.find(hfc,"<strong>[%d%p%s]*([%a]*)</strong><br",1)
now["fc_hour1_ampm"]=t
now["fc_hour1_ampm_lc"]=string.lower(t)
local a,b,t=string.find(hfc,"</strong><br%s/>%s*([%p%s%a]*)%s*</td>%s*<td class=%pHour%p",1)
now["fc_hour1_cond"]=t
now["fc_hour1_cond_lc"]=string.lower(t)
now["fc_hour1_cond_caps"]=string.upper(t)
--get weather icon and font
local a,b,t=string.find(hfc,"32_white/(wx_[%d]*)%ppng%p%stitle=%p",1)
now["fc_hour1_wicon"]=weathericons..wimage[t]..".png"
now["fc_hour1_wfont"]=wfont[t]
--get temperature
--><strong>-5&deg;</strong></td>
local a,b,t=string.find(hfc,"><strong>([%p%d]*)&deg;</strong></td>",1)
now["fc_hour1_temp"]=t
--end of hour1 data gathering--repeat 2 more times
--get hourly forecast options hour2--------------------
local start=tonumber(b)
--get time and conditions
--<strong>1 PM</strong><br />%s*P Cloudy%s*</td>%s*<td class=%pHour"%p
local a,b,t=string.find(hfc,"<strong>([%d%p]*)[%s%a]*</strong><br",start)
now["fc_hour2_time"]=t
local a,b,t=string.find(hfc,"<strong>[%d%p%s]*([%a]*)</strong><br",start)
now["fc_hour2_ampm"]=t
now["fc_hour2_ampm_lc"]=string.lower(t)
local a,b,t=string.find(hfc,"</strong><br%s/>%s*([%a%s%p]*)%s*</td>%s*<td class=%pHour%p",start)
now["fc_hour2_cond"]=t
now["fc_hour2_cond_lc"]=string.lower(t)
now["fc_hour2_cond_caps"]=string.upper(t)
--get weather icon and font
local a,b,t=string.find(hfc,"32_white/(wx_[%d]*)%ppng%p%stitle=%p",start)
now["fc_hour2_wicon"]=weathericons..wimage[t]..".png"
now["fc_hour2_wfont"]=wfont[t]
--get temperature
--><strong>-5&deg;</strong></td>
local a,b,t=string.find(hfc,"><strong>([%p%d]*)&deg;</strong></td>",start)
now["fc_hour2_temp"]=t
--end of hour2 data gathering--repeat 1 more times
--get hourly forecast options hour3--------------------
local start=tonumber(b)
--get time and conditions
--<strong>1 PM</strong><br />%s*P Cloudy%s*</td>%s*<td class=%pHour"%p
local a,b,t=string.find(hfc,"<strong>([%d%p]*)[%s%a]*</strong><br",start)
now["fc_hour3_time"]=t
local a,b,t=string.find(hfc,"<strong>[%d%p%s]*([%a]*)</strong><br",start)
now["fc_hour3_ampm"]=t
now["fc_hour3_ampm_lc"]=string.lower(t)
local a,b,t=string.find(hfc,"</strong><br%s/>%s*([%a%s%p]*)%s*</td>%s*<td class=%pHour%p",start)
now["fc_hour3_cond"]=t
now["fc_hour3_cond_lc"]=string.lower(t)
now["fc_hour3_cond_caps"]=string.upper(t)
--get weather icon and font
local a,b,t=string.find(hfc,"32_white/(wx_[%d]*)%ppng%p%stitle=%p",start)
now["fc_hour3_wicon"]=weathericons..wimage[t]..".png"
now["fc_hour3_wfont"]=wfont[t]
--get temperature
--><strong>-5&deg;</strong></td>
local a,b,t=string.find(hfc,"><strong>([%p%d]*)",start)
now["fc_hour3_temp"]=t
--end of hour3 data gathering--finished for all hours
--###############end of data processing########################
if testing==0 then
processall=0
processnow=0
print ("processing complete")
elseif testing==1 then
processall=1
processnow=1
end
--######################################
end--of data processing section ########
--######################################
if testnow~=nil and testall~=nil and display_script==1 then
_G.weather_script()--uncomment this line to use the seperate display script method
elseif testnow~=nil and testall~=nil and display_script==0 then
weather_display()
end
--######################################
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
--################################
end-- end main function ##########
--################################
function round(num)
local idp=default_decimal_places
  local mult = 10^(idp or 0)
  return math.floor(num * mult + 0.5) / mult
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 xout(txj)--c,a,f,fs,x,y,txt,j
c=nil
c=txj.c
if c==nil then c=default_color end
alpha=nil
a=txj.a
if a==nil then a=default_alpha end
f=nil
f=txj.f
if f==nil then f=default_font end
fs=nil
fs=txj.fs
if fs==nil then fs=default_font_size end
x=nil
x=txj.x
if x==nil then x=0 end
y=nil
y=txj.y
if y==nil then y=0 end
txt=nil
txt=txj.txt
if txt==nil then txt="set txt" end
j=nil
j=txj.j
if j==nil then j="l" end
local function col(c,a)
return ( (c/0x10000) % 0x100)/255,( (c/0x100) % 0x100)/255,(c % 0x100)/255,a
end--local function
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fs)
local text=string.gsub(txt," ","_")
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local wx=extents.width
cairo_set_source_rgba (cr,col(c,a))
if j=="l" then
cairo_move_to (cr,x,y)
adx=wx
elseif j=="c" then
cairo_move_to (cr,x-(wx/2),y)
adx=wx/2
elseif j=="r" then
cairo_move_to (cr,x-wx,y)
adx=0
end
cairo_show_text (cr,txt)
cairo_stroke (cr)
nextx=nil
nextx=adx+x
return nextx
end--function xout ###################################################################
function out(tx)--####################################################
c=nil
c=tx.c
if c==nil then c=default_color end
a=nil
a=tx.a
if a==nil then a=default_alpha end
f=nil
f=tx.f
if f==nil then f=default_font end
fs=nil
fs=tx.fs
if fs==nil then fs=default_font_size end
x=nil
x=tx.x
if x==nil then x=0 end
y=nil
y=tx.y
if y==nil then y=0 end
txt=nil
txt=tx.txt
if txt==nil then txt="set txt" end
local function col(c,a)
return ( (c/0x10000) % 0x100)/255,( (c/0x100) % 0x100)/255,(c % 0x100)/255,a
end--local function
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fs)
cairo_set_source_rgba (cr,col(c,a))
cairo_move_to (cr,x,y)
cairo_show_text (cr,txt)
cairo_stroke (cr)
end--function out ###################################################################
function image(im)--#################################################################
x=nil
x=im.x
if x==nil then x=0 end
y=nil
y=im.y
if y==nil then y=0 end
w=nil
w=im.w
if w==nil then w=default_image_width end
h=nil
h=im.h
if h==nil then h=default_image_height end
file=nil
file=tostring(im.file)
if file==nil then print("set image file") end
---------------------------------------------
local show = imlib_load_image(file)
if show == nil then return end
imlib_context_set_image(show)
if tonumber(w)==0 then 
width=imlib_image_get_width() 
else
width=tonumber(w)
end
if tonumber(h)==0 then 
height=imlib_image_get_height() 
else
height=tonumber(h)
end
imlib_context_set_image(show)
local scaled=imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), width, height)
imlib_free_image()
imlib_context_set_image(scaled)
imlib_render_image_on_drawable(x, y)
imlib_free_image()
show=nil
end--function image ##################################################################
function translate_tables()
--TRANSLATION TABLES - only edit the second, the one after the =
--translate NESW text
neswtext={
S="testS",
SSW="tsetSSW",
SW="testSW",
WSW="testWSW",
W="testW",
WNW="testWNW",
NW="testNW",
NNW="testNNW",
N="testN",
NNE="testNNE",
NE="testNE",
ENE="testENE",
E="testE",
ESE="testESE",
SE="testSE",
SSE="testSSE",
}--end of  N E S W text table
--translate time suffix
tsuffix={
AM="testAM",
PM="testPM",
}--end of time suffix table
--enter translations for uv index text
uvindextext={
["Low"]="testLow",
["Moderate"]="testModerate",
["High"]="testHigh",
["Very High"]="testVery High",--format is different because of the space in the text
["Extreme"]="testExtreme",
}--end of uv text table
--enter translations for moonpahse
moonphases={
["New"]="testNew",
["Full"]="testFull",
["First Quarter"]="testFirst Quarter",
["Last Quarter"]="testLast Quarter",
["Waning Gibbous"]="testWaning Gibbous",
["Waning Crescent"]="testWaning Crescent",
["Waxing Crescent"]="testWaxing Crescent",
["Waxing Gibbous"]="testWaxing Gibbous",
}--end of moon phase table
--enter translations for day names
daynames={
Monday="testMonday",
Tuesday="testTuesday",
Wednesday="testWednesday",
Thursday="testThursday",
Friday="testFriday",
Saturday="testSaturday",
Sunday="testSunday",
}--end day names table
--enter translations for short day names
dayshort={
Monday="testLun",
Tuesday="testMar",
Wednesday="testMerc",
Thursday="testJeudi",
Friday="testVend",
Saturday="testSam",
Sunday="testDim"
}--end short day names table
--enter translation for month names
monthnames={
January="testJanuary",
February="testFebruary",
March="testMarch",
April="testApril",
May="testMay",
June="testJune",
July="testJuly",
August="testAugust",
September="testSeptember",
October="testOctober",
November="testNovember",
December="testDecember"
}--end of month name translations
monthshort={
January="testJan",
February="testFeb",
March="testMar",
April="testApr",
May="testMay",
June="testJun",
July="testJul",
August="testAug",
September="testSep",
October="testOct",
November="testNov",
December="testDec"
}--end of short month name translations
--END OF TRANSLATIONS
end--of translate tables function ####################################################
--END OF SCRIPT

conky weather :

##############################################
#  Settings
##############################################
max_specials 10000
max_user_text 1500000
background no
use_xft yes
#xftfont Sans:size=12
#xftalpha 1
font Mono:size=8
total_run_times 0
own_window yes
own_window_argb_visual yes
own_window_transparent yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 250 600
maximum_width 250
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 top_right
gap_x 10
gap_y 10
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
color1 86acad #darker blue
color2 b1c9c9 #lighter blue
text_buffer_size 100000
top_name_width 10
update_interval 1

lua_load /mnt/data/v9000/v9000.lua
lua_draw_hook_pre weather
lua_load /mnt/data/v9000/weather_script.lua

TEXT

Voila, il ne me reste qu'a bien integrer les clics, deja j'ai mis les balises dans le conky, est-ce bon ?

Bye,


"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio

Hors ligne

#1620 Le 12/07/2012, à 21:52

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonsoir,
Je viens de regarder les scripts que tu as posté, décidément j'aime de plus en plus le taf de mrpeachy, dommage je suis une burne en anglais.

pour le script en python

## check-gmail.py -- A command line util to check GMail -*- Python -*-
## modified to display mailbox summary for conky

# ======================================================================
# Copyright (C) 2006 Baishampayan Ghose <b.ghose@ubuntu.com>
# Modified 2008 Hunter Loftis <hbloftis@uncc.edu>
# Time-stamp: Mon Jul 31, 2006 20:45+0530
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
# ======================================================================

import sys
import urllib             # For BasicHTTPAuthentication
import feedparser         # For parsing the feed
from textwrap import wrap

_URL = "https://mail.google.com/gmail/feed/atom"

uname = sys.argv[1]
password = sys.argv[2]
maxlen = sys.argv[3]
Nbcar = sys.argv[4]

urllib.FancyURLopener.prompt_user_passwd = lambda self, host, realm: (uname, password)
    
def auth():
    '''The method to do HTTPBasicAuthentication'''
    opener = urllib.FancyURLopener()
    f = opener.open(_URL)
    feed = f.read()
    return feed


def readmail(feed, maxlen):
    '''Parse the Atom feed and print a summary'''
    atom = feedparser.parse(feed)
    print '${color1} %s emails non lus\n' % (len(atom.entries))
    for i in range(min(len(atom.entries), maxlen)):
        #print '          ${color2}%s : ' % atom.entries[i].author
        print '          ${color2}%s' % atom.entries[i].title[:Nbcar]
#uncomment the following line if you want to show the name of the sender
        
    #if len(atom.entries) > maxlen:
    #    print '     ${color2}...'

if __name__ == "__main__":
    f = auth()  # Do auth and then get the feed
    readmail(f, int(maxlen)) # Let the feed be chewed by feedparser

J'ai ajouté un quatrième argument qui si tous vas bien te servira a limiter le nombre de caractères affiché dans le retour du titre

pour l'appeler dans ton conky une ligne de ce type :

${goto 30}M@il: ${execpi 30 python ~/conky/conkyscripts/gmail_parser.py VOTREMAIL@gmail.com VOTREMDP 3 40}

devrait afficher les 40 premiers caractères du titre des 3 premiers messages

Hors ligne

#1621 Le 16/07/2012, à 23:21

los_tintinos

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

bonsoir,
J'ai bien réussi a couper les textes pour mes mails mais si des accents sont dans les textes je me retrouve avec une erreure ASCI. Je n'arrive pas a trouver comment faire pour qu'il puissent m'afficher les caracteres francais....
Voici l'erreur qu'il me met....

Traceback (most recent call last):
  File "/home/seb/conky/conkyscripts/gmail_parser.py", line 48, in <module>
    readmail(f, int(maxlen)) # Let the feed be chewed by feedparser
  File "/home/seb/conky/conkyscripts/gmail_parser.py", line 40, in readmail
    print '          ${color2}    - %s...' % atom.entries[i].title[:Nbcar]
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 27: ordinal not in range(128)

"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio

Hors ligne

#1622 Le 17/07/2012, à 05:56

Maneithel

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Suivre cette discussion

Hors ligne

#1623 Le 17/07/2012, à 08:44

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

los_tintinos a écrit :

bonsoir,
J'ai bien réussi a couper les textes pour mes mails mais si des accents sont dans les textes je me retrouve avec une erreure ASCI. Je n'arrive pas a trouver comment faire pour qu'il puissent m'afficher les caracteres francais....
Voici l'erreur qu'il me met....

Traceback (most recent call last):
  File "/home/seb/conky/conkyscripts/gmail_parser.py", line 48, in <module>
    readmail(f, int(maxlen)) # Let the feed be chewed by feedparser
  File "/home/seb/conky/conkyscripts/gmail_parser.py", line 40, in readmail
    print '          ${color2}    - %s...' % atom.entries[i].title[:Nbcar]
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 27: ordinal not in range(128)

Tu y tient beaucoup aux accents ?
Si non la solution n'est pas bien compliqué a mettre en œuvre, du moins en théorie, il suffirait de créer une fonction pour remplacé les caractères accentués par des caractère non accentués

Hors ligne

#1624 Le 17/07/2012, à 10:32

los_tintinos

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

salut,

C'est pas que j'y tienne absolument mais quand il y a des accents dans les titres des mails, il n'affichent rien et même font planter le script. Je me voit mal demander à tous mes contacts de ne plus m'envoyer de mails avec des accents....
Sinon afficher sans accents ne me gêne pas trop, mais je ne sait pas si le problème est resolvable par ce biais. Il semble que se soit le scripts qui ne puisse pas lire le langage d'origine sur Gmail. J'ai vu des trucs a droite a gauche mais je n'arrive pas à le mettre en place...


"Le hardware c'est ce qu'on frappe quand le software plante" Dicton geek
"Quand les mouettes ont pieds il est temps de virer" Dicton breton
"Sauver un arbre, bouffer un castor" Dicton Bio

Hors ligne

#1625 Le 17/07/2012, à 10:55

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

los_tintinos a écrit :

salut,

C'est pas que j'y tienne absolument mais quand il y a des accents dans les titres des mails, il n'affichent rien et même font planter le script. Je me voit mal demander à tous mes contacts de ne plus m'envoyer de mails avec des accents....
Sinon afficher sans accents ne me gêne pas trop, mais je ne sait pas si le problème est resolvable par ce biais. Il semble que se soit le scripts qui ne puisse pas lire le langage d'origine sur Gmail. J'ai vu des trucs a droite a gauche mais je n'arrive pas à le mettre en place...

Je regarderais sa de plus près en rentrant de congés.
en attendant voici une piste qui pourra peut être te servir.
la fonction re.sub(caractère a remplacé, caractère de remplacement, texte a travailler)
semble être ce qu'il y a de plus souple (elle permet d'employer des fonctions entant qu'arguments)

Hors ligne