Logiciels » Autres logiciels Les conkys de Loutch
Adrien.D
Membre non connecté

Reprise du message précédent
Salut,les bulles se remplissent vraiment ?
Chapeau !!
Non, à ma connaissance Calculate Linux n'a rien par défaut embarqué... J'ai tout fait à la main

Config : PC Fixe : X470 GAMING PRO- AMD Ryzen 5 2600X - 16Go RAM - Radeon RX 560 (Pilote libre) -

Vice président de l'association COAGUL ("Côte-d’Or - Association Générale des Utilisateurs de Logiciels libres")
Webmaster de MageiaLinuxOnline uniquement. Pas de support de ma part.
loutch
Membre non connecté

RE
Oui les bulles se remplissent en passant du bleu clair au bleu foncé ,j'avais éssayé sans le bleu foncé mais si rien n'est indiqué ou avec un pourcentage très faible il ni avait pas de bulles .
Ca doit être une autre distro que Calculate qui en a un , alors chapeau pour le conky .
@+ Edité par loutch Le 16/02/2015 à 13h28
Adrien.D :
Salut,
les bulles se remplissent vraiment ?
Chapeau !!
Non, à ma connaissance Calculate Linux n'a rien par défaut embarqué... J'ai tout fait à la main
les bulles se remplissent vraiment ?
Chapeau !!
Non, à ma connaissance Calculate Linux n'a rien par défaut embarqué... J'ai tout fait à la main

Oui les bulles se remplissent en passant du bleu clair au bleu foncé ,j'avais éssayé sans le bleu foncé mais si rien n'est indiqué ou avec un pourcentage très faible il ni avait pas de bulles .
Ca doit être une autre distro que Calculate qui en a un , alors chapeau pour le conky .
@+ Edité par loutch Le 16/02/2015 à 13h28
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
lamontagne22
Membre non connecté

Tu peux regarder ici pour les couleurs officielles et pour télécharger les .png du logo sur fond transparent (ça donnera un fichier du genre : Logo_mageia_official_alpha.png). Honnêtement je voulais me pencher la dessus pour Mageia 6, mais je galère trop avec lua pour t'aider.
En tout cas merci pour ton temps et ton investissement la-dessus. Si j'avais les compétences, ça serait un projet qui m'aurait bien botté.
loutch
Membre non connecté

Bonsoir
Bien-sur on peut mettre ce que l'on veut , je n'ai fait qu'un petit truc tout simple j'ai pas voulu charger trop le chaudron sinon ça fait trop geek et ça peut prendre beaucoup de ressources.
@ admel
J'ai pris la même page mais en français pour les couleurs se sont les couleurs officielles et pour le chaudron c'est aussi l'officiel ( L'alpha3 le transparent ),j'ai juste enlevé les boules et le nom "mageia", on peut aussi garder le nom mais là je pense qu'avec celui-ci le conky devra être à gauche du bureau .
@+
PS j'ai aussi vu qu'il y avait une police officielle ,donc question : pourquoi n'est-elle pas par défaut dans mageia? Edité par loutch Le 16/02/2015 à 22h37
lamontagne22 :
Et peut être compléter uptime, exemple (simple suggestion) :{nodename} $actif depuis $uptime
Bien-sur on peut mettre ce que l'on veut , je n'ai fait qu'un petit truc tout simple j'ai pas voulu charger trop le chaudron sinon ça fait trop geek et ça peut prendre beaucoup de ressources.
@ admel
J'ai pris la même page mais en français pour les couleurs se sont les couleurs officielles et pour le chaudron c'est aussi l'officiel ( L'alpha3 le transparent ),j'ai juste enlevé les boules et le nom "mageia", on peut aussi garder le nom mais là je pense qu'avec celui-ci le conky devra être à gauche du bureau .
@+
PS j'ai aussi vu qu'il y avait une police officielle ,donc question : pourquoi n'est-elle pas par défaut dans mageia? Edité par loutch Le 16/02/2015 à 22h37
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
loutch
Membre non connecté

.gif)
Une partie à ajouter pour avoir l'heure en mode texte(n'est pas de moi trouvé sur le forum cruchbang et avec quelques une de mes modifications) .
Ne donne pas l'heure exacte mais toute les cinq minutes (mais c'est faisable).La particularité est que dans le talktime_fr.sf on peut remplacer le français par le patois de sa région.
La partie à ajouter(le chemin du .sh sera à modifier en fonction de votre configuration) :
Code TEXT :
${voffset -20}${font URW Chancery L:style=Bold:size=14}${alignc}${execpi 30 /home/romuald/.conky/blanc/talktime_fr.sh} ${alignc}${if_match ${time %u} == 1}lundi${else} ${if_match ${time %u} == 2}mardi${else} ${if_match ${time %u} == 3}mercredi${else} ${if_match ${time %u} == 4}jeudi${else} ${if_match ${time %u} == 5}vendredi${else} ${if_match ${time %u} == 6}samedi${else} dimanche${endif}${endif}${endif}${endif}${endif}${endif} ${if_match ${time %e} <= 9}${time %e}${else}${time %d}${endif} ${if_match ${time %m} == 01}janvier${else} ${if_match ${time %m} == 02}février${else} ${if_match ${time %m} == 03}mars${else} ${if_match ${time %m} == 04}avril${else} ${if_match ${time %m} == 05}mai${else} ${if_match ${time %m} == 06}juin${else} ${if_match ${time %m} == 07}juillet${else} ${if_match ${time %m} == 08}août${else} ${if_match ${time %m} == 09}septembre${else} ${if_match ${time %m} == 10}octobre${else} ${if_match ${time %m} == 11}novembre${else} décembre${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif} ${time %Y}
le talktime_fr.sh
Code TEXT :
#!/bin/sh # DC's english time 07/07/09 # Tweaked by Sector11 # Converted to French by Sector11 with help from ragamatrix # find current time t_hr=$(date +%-H) #echo $t_hr t_min=$(date +%-M) #echo $t_min #t_hr=9 #tester #t_min=17 #tester # is it time to ONE ( the only wierd case) if [ $t_hr -eq 12 ] && [ $t_min -gt 32 ] ;then # what minute is it case $t_min in 33|34|35|36|37) echo une heure moins vingt-cinq ;; 38|39|40|41|42) echo une heure moins vingt ;; 43|44|45|46|47) echo une heure moins le quart ;; 48|49|50|51|52) echo une heure moins dix ;; 53|54|55|56|57|58|59) echo une heure moins cinq ;; 58|59) echo presque une heure esac exit fi #echo $t_hr #add one hour for the "to" hour if [ $t_min -gt 32 ] ; then t_hr=$(($t_hr + 1)) # override t_hr fi #echo $t_hr # find out what hour it is and change into text case $t_hr in 0) t_hr_text=minuit ;; 1) t_hr_text="une heure" ;; 2) t_hr_text="deux heure" ;; 3) t_hr_text="trois heure" ;; 4) t_hr_text="quatre heure" ;; 5) t_hr_text="cinq heure" ;; 6) t_hr_text="six heure" ;; 7) t_hr_text="sept heure" ;; 8) t_hr_text="huit heure" ;; 9) t_hr_text="neuf heure" ;; 10) t_hr_text="dix heure" ;; 11) t_hr_text="onze heure" ;; 12) t_hr_text=midi ;; 13) t_hr_text="treize heure" ;; 14) t_hr_text="quatorze heure" ;; 15) t_hr_text="quinze heure" ;; 16) t_hr_text="seize heure" ;; 17) t_hr_text="dix-sept heure" ;; 18) t_hr_text="dix-huit heure" ;; 19) t_hr_text="dix-neuf heure" ;; 20) t_hr_text="vingt heure" ;; 21) t_hr_text="vingt et une heure" ;; 22) t_hr_text="vingt-deux heure" ;; 23) t_hr_text="vingt-trois heure" ;; esac # what minute is it case $t_min in 0|1|2) echo $t_hr_text ;; 3|4|5|6|7) echo $t_hr_text cinq ;; 8|9|10|11|12) echo $t_hr_text dix ;; 13|14|15|16|17) echo $t_hr_text un quart ;; 18|19|20|21|22) echo $t_hr_text vingt ;; 23|24|25|26|27) echo $t_hr_text vingt-cinq;; 28|29|30|31|32) echo $t_hr_text et demie ;; 33|34|35|36|37) echo $t_hr_text moins vingt-cinq ;; 38|39|40|41|42) echo $t_hr_text moins vingt ;; 43|44|45|46|47) echo $t_hr_text moins le quart ;; 48|49|50|51|52) echo $t_hr_text moins dix ;; 53|54|55|56|57) echo $t_hr_text moins cinq ;; 58|59) echo ± $t_hr_text ;; esac
et en image:

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

.gif)
Pour avoir la pochette avec amarok( pour un fond d'écran clair rajouter le draw bg)
La partie après TEXT
Code TEXT :
${if_running amarok}Amarok: ${voffset 3}${stippled_hr 1} ${execi 10 ~/.conky/amarok/getcover} ${execi 10 ~/.conky/amarok/Amarok artist} ${execi 10 ~/.conky/amarok/Amarok title} ${execi 10 ~/.conky/amarok/Amarok year} ${execi 1 ~/.conky/amarok/Amarok time} ${execibar 1 ~/.conky/amarok/Amarok progress} ${image ~/.conky/cover.png -p 55,185 -s 200x200 -n} $endif
Le getcover ( @ rendre éxécutable)
Code TEXT :
#!/bin/bash # get Amarok cover art of current track and transform into an album stack # copypasta from http://www.imagemagick.org/Usage/thumbnails/#polaroid # thanks to eightmillion for completely rewriting the script # http://ubuntuforums.org/showpost.php?p=8117609&postcount=9846 # edited by fireandfuel # requires: amarok >= 2.0, dbus, libqt4-dbus, perl # Temp directory must be full path. tempdir="$HOME/.conky/" tempfile="${tempdir}nowplaying" [ -d "$tempdir" ] || mkdir -p "$tempdir" #test if $tempdir exists, if not create it. [ -e "$tempfile" ] || touch "$tempfile" cover="$(qdbus org.kde.amarok /Player GetMetadata | grep arturl: | cut -c 16- | perl -MURI::Escape -lne 'print uri_unescape($_)')" if [[ -z "$cover" ]]; then #test if $cover was set, if not copy nocover.png to cover.png . hash=0 read oldhash < "$tempfile" cover="${tempdir}nocover.png" if [ "$oldhash" == "$hash" ];then : else cp "${cover}" "${tempdir}cover.png" echo 0 > "$tempfile" fi else hash=$(echo "$cover" | md5sum | cut -d" " -f 1) #Generate hash for current song. read oldhash < "$tempfile" if [ "$oldhash" == "$hash" ];then : else convert "${cover}" -resize 200x200 "${tempdir}cover.png" echo $hash > "$tempfile" fi fi exit
et l'image :

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

.gif)
Pour ceux que cela intéresse voici un lanceur pour l'utilisation d'un programme et de son conky .
Pour l'exemple j'ai pris le lecteur Audacious et son conky.
Voici le script @ rendre éxécutable mis dans votre Home :
Code TEXT :
#!/bin/bash PROG_NAME1="conky -c /home/$USER/.conky/audacious/conkyrc"# Nom du programme à démarrer/arrêter. PROG_NAME2="/usr/bin/audacious" # Nom du programme à démarrer/arrêter. PROCESSPID1=$(pgrep -f /home/$USER/.conky/audacious/conkyrc)# Récupère le PID du processus. PROCESSPID2=$(pgrep -f "usr/bin/audacious")# Récupére le PID du processus. if [[ "$PROCESSPID1" != "" && "$PROCESSPID2" != "" ]]; then# Si les deux processus existe alors on le(s) kill. kill $PROCESSPID1 && echo "Stop $PROG_NAME1 (PID: $PROCESSPID1)" kill $PROCESSPID2 && echo "Stop $PROG_NAME2 (PID: $PROCESSPID2)" else# Si aucun processus on démarre le programme. kill $PROCESSPID1 $PROG_NAME1 & echo "Start $PROG_NAME1" kill $PROCESSPID2 $PROG_NAME2 & echo "Start $PROG_NAME2" if [[ "$PROCESSPID1" == "" || "$PROCESSPID2" == "" ]]; then# Si un des processus n'existe pas alors on le(s) kill. kill $PROCESSPID1 && echo "Stop $PROG_NAME1 (PID: $PROCESSPID1)" kill $PROCESSPID2 && echo "Stop $PROG_NAME2 (PID: $PROCESSPID2)" echo "Il y a eu un souci au lancement tout a été coupé" fi fi exit 0
Ensuite on édite son menu pour y rajouter ce script avec une belle icône et on l'ajoute à son tableau de bord ou sa barre des tâches ou son bureau .
Un clic pour ouvrir et un reclic pour refermer le programme et son conky ,comme cela il ni à plus de conky ouvert et non actif.
.gif)
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
loutch
Membre non connecté

.gif)
Conky radiotray avec affichage d'un logo pour radio et pour le moment la pochette du titre joué dans loungeradio.
le conkyrc :
Code TEXT :
background yes use_xft yes xftfont URW Chancery L:style=Bold:size=11 xftalpha 1 update_interval 1.0 total_run_times 0 own_window yes own_window_transparent yes #own_window_color 000000 own_window_argb_visual yes #own_window_argb_value 0 own_window_type normal own_window_hints undecorated,below,skip_taskbar,skip_pager,sticky double_buffer yes minimum_size 250 250 maximum_width 250 text_buffer_size 2048 draw_shades no draw_outline no draw_borders no draw_graph_borders no default_color white default_outline_color white alignment top_right gap_x 0 gap_y 150 no_buffers yes uppercase no cpu_avg_samples 2 override_utf8_locale yes imlib_cache_size 0 # 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 color1 ffffff # color2 e8e8e8 # color3 6495ee # color4 cacaca # color5 e7e7e7 # color6 red lua_load ~/.conky/draw_bg/draw_bg.lua TEXT ${voffset -30}${font URW Chancery L:style=Bold:size=20}${alignc}Radiotray ${font}${lua conky_draw_bg 0 60 140 120 120 0x000000 0.99} ${texeci 60 ~/.conky/radiotray/loungeradio.sh} Radio : ${alignc}${font URW Chancery L:style=Bold:size=14}${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}$font En ce moment : ${font URW Chancery L:style=Bold:size=10}${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w40} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "RTL"}${image ~/.conky/radiotray/rtl.png -p 55,135 -s 120x120 -n}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "RTL2"}${image ~/.conky/radiotray/rtl2.jpg -p 55,135 -s 120x120 -n}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "HOTMIX80"}${image ~/.conky/radiotray/Hotmixradio-80.jpg -p 55,135 -s 120x120 -n}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "MAXI80"}${image ~/.conky/radiotray/maxi80.jpg -p 55,135 -s 120x120 -n}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "LOUNGERADIO"}${image ~/.conky/radiotray/loungeradio.jpg -p 55,135 -s 120x120 -n}${endif} ${endif}${endif}${endif}${endif}
le loungeradio.sh modifié pour n'afficher que la pochette .
Code TEXT :
#!/bin/bash #pulling info from loung-radio.com for conky by nlinedesignz(at)web(dot)de 2013 wget http://www.lounge-radio.com/code/pushed_files/now.html -O ~/.conky/radiotray/loungeradio.html >/dev/null 2>&1 && #artist=$(awk '/id="artist"/{getline; print}' ~/.conky/radiotray/loungeradio.html | sed "s/<div>|</div>//g") #album=$(awk '/id="album"/{getline; print}' ~/.conky/radiotray/loungeradio.html | sed "s/<div>|</div>//g") #track=$(awk '/id="track"/{getline; print}' ~/.conky/radiotray/loungeradio.html | sed "s/<div>|</div>//g") wget "http://www.lounge-radio.com/code/pushed_files/$(awk '/id="covercontainer"/{print}' ~/.conky/radiotray/loungeradio.html | sed -r 's/.*src="(.*)" width=.*/1/')" -O ~/.conky/radiotray/loungeradio.jpg >/dev/null 2>&1 && #echo '${image ~/loungeradio.jpg -p 42,42 -s 123x123 }'; #echo 'Artiste:' $artist #echo ' Titre:' $track #echo ' Album:' $album exit
En image
Loungeradio avec pochette en cours de lecture:

Une radio (hotmix80) avec son logo:

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

.gif)
Suite du conky radiotray ( ça fonctionne @ la louche mais ça fonctionne ) avec ajout de la pochette du morceau joué et logo de la radio.
conkyrc :
Code TEXT :
background yes use_xft yes xftfont URW Chancery L:style=Bold:size=11 xftalpha 1 update_interval 1.0 total_run_times 0 own_window yes own_window_transparent yes #own_window_color 000000 own_window_argb_visual yes #own_window_argb_value 0 own_window_type normal own_window_hints undecorated,below,skip_taskbar,skip_pager,sticky double_buffer yes minimum_size 250 320 maximum_width 250 text_buffer_size 2048 draw_shades no draw_outline no draw_borders no draw_graph_borders no default_color white default_outline_color white alignment top_right gap_x 0 gap_y 600 no_buffers yes uppercase no cpu_avg_samples 2 override_utf8_locale yes imlib_cache_size 0 # 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 color1 ffffff # color2 e8e8e8 # color3 6495ee # color4 cacaca # color5 e7e7e7 # color6 red lua_load ~/.conky/draw_bg/draw_bg.lua lua_load ~/.conky/conky-meteo/meteo_lua_2/scripts/meteo2.lua TEXT ${voffset -30}${font URW Chancery L:style=Bold:size=20}${alignc}Radiotray ${font} Radio : ${alignc}${font URW Chancery L:style=Bold:size=12}${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}$font ${alignc}${voffset 50}En ce moment : ${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w40 } ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "RTL"}${lua fDrawImage ~/.conky/radiotray/logos/rtl.png 100 50 50 50}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "HOTMIX80"}${lua fDrawImage ~/.conky/radiotray/logos/hotmix-80.png 100 50 50 50}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "MAXI80"}${lua fDrawImage ~/.conky/radiotray/logos/maxi80.png 100 50 50 50}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "RTL2"}${lua fDrawImage ~/.conky/radiotray/logos/rtl2.png 100 50 50 50}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "MAGNUM LA RADIO"}${lua fDrawImage ~/.conky/radiotray/logos/magnumradio.png 40 50 150 50}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "LOUNGERADIO"}${lua fDrawImage ~/.conky/radiotray/logos/image.png 100 50 50 50}${texeci 20 ~/.conky/radiotray/loungeradio/loungeradio.sh}${lua conky_draw_bg 0 50 160 150 150 0x000000 0.99}${image ~/.conky/radiotray/loungeradio/loungeradio.jpg -p 45,155 -s 150x150 -n}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "RFM"}${lua fDrawImage ~/.conky/radiotray/logos/rfm.png 100 50 50 50}${endif} ${endif}${endif}${endif}${endif}${endif} ${lua fDrawImage ~/.conky/radiotray/cover.png 50 160 120 120} ${voffset 600}${texeci 20 ~/.conky/radiotray/info_radio.sh} ${voffset -1000}
info_radio.sh (@ mettre dans le dossier du conky)
Code TEXT :
#!/bin/bash # Par Didier-T RepDestination="~/.conky/radiotray" #Indiquer ici le repertoire de destination ## Début script home=$(echo $HOME|sed 's///\//g') RepDestination=$(echo $RepDestination|sed "s/~/$home/") LOG="$RepDestination/artiste_titre.log" mapfile -t InfoRadio < $LOG radio=$(qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio) echo $radio if [[ "$radio" != "" ]] && [[ "$radio" != "${InfoRadio[0]}" ]]; then echo $radio > $LOG logo=$(python logo_radio.py --destination="$RepDestination" --radio="$radio") convert "$RepDestination/$logo" "$RepDestination/radio.png" fi titre=$(qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w40) echo $titre if [[ "$titre" != "" ]] && [[ "$titre" != "${InfoRadio[1]}" ]]; then echo $titre >> $LOG logo=$(python logo_radio.py --destination="$RepDestination" --radio="$titre") convert "$RepDestination/$logo" "$RepDestination/cover.png" fi
logo_radio.py (@ mettre dans le home]:
Code TEXT :
#!/usr/bin/python # -*- coding: utf-8 -*- # Par Didier-T import urllib2, getopt, simplejson, sys, os, urllib class Fonctions(): def __init__(self): self.arguments() self.recherche() def arguments(self): try: opts, args = getopt.getopt(sys.argv[1:], "r:d:h", ["radio=","destination=","help"]) except getopt.GetoptError as err: # Affiche l'aide et quitte le programme self.usage() sys.exit(2) if opts==[]: self.usage() sys.exit(2) self.getlist=[] self.fileout=0 for o, a in opts: if o in ("-r", "--radio"): self.radio=a if o in ("-d", "--destination"): self.destination=a elif o in ("-h", "--help"): self.usage() sys.exit() def usage(self): print("nUtilisation: logo_radio.py --radio="Nom de la radio"n Interroge google image et vous enregistre l'icone dans le repertoir courrant.n n -r, --radio Nom de la radio entre guillemetsn -d, --destination Repertoire de déstinationn -h, --help Affiche l'aiden ") def recherche(self): radio=self.radio.replace(" ", "%20") url = ('https://ajax.googleapis.com/ajax/services/search/images?'+ 'v=1.0&q=radio%20logo%20'+radio+'&newwindow=1&channel=fs&tbs=itp:clipart,ic:trans&tbm=isch&tbas=0') request = urllib2.Request(url, None) response = urllib2.urlopen(request) results = simplejson.load(response) try: _, ext = os.path.splitext(results['responseData']['results'][0]['url']) urllib.urlretrieve(results['responseData']['results'][0]['url'],self.destination+"/image"+ext) print("image"+ext) except: print("pas de résultat") sys.exit(1) def main(): Fonctions() if __name__ == '__main__': main()

Comme dit ça fonctionne @ la louche ça affiche parfois des images @ la place de la pochette suivant ce qui est affiché dans radiotray
donc si quelqu'un peut améliorer il est le bienvenu,


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

.gif)
Suite et fin pour radiotray
le conkyrc :
Code TEXT :
background yes use_xft yes xftfont URW Chancery L:style=Bold:size=11 xftalpha 1 update_interval 1.0 total_run_times 0 own_window yes own_window_transparent yes #own_window_color 000000 own_window_argb_visual yes #own_window_argb_value 0 own_window_type normal own_window_hints undecorated,below,skip_taskbar,skip_pager,sticky double_buffer yes minimum_size 250 250 maximum_width 250 text_buffer_size 2048 draw_shades no draw_outline no draw_borders no draw_graph_borders no default_color white default_outline_color white alignment top_right gap_x 0 gap_y 600 no_buffers yes uppercase no cpu_avg_samples 2 override_utf8_locale yes imlib_cache_size 0 # 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 color1 ffffff # color2 e8e8e8 # color3 6495ee # color4 cacaca # color5 e7e7e7 # color6 red lua_load ~/.conky/draw_bg/draw_bg.lua lua_load ~/.conky/conky-meteo/meteo_lua_2/scripts/meteo2.lua TEXT ${voffset -30}${font URW Chancery L:style=Bold:size=20}${alignc}Radiotray ${font} Radio : ${alignc}${font URW Chancery L:style=Bold:size=12}${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}$font ${alignc}${voffset 50}En ce moment : ${font URW Chancery L:style=Bold:size=10}${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w40 } ${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w40 > ~/.conky/radiotray/artiste_titre.txt} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "RTL"}${lua fDrawImage ~/.conky/radiotray/logos/rtl.png 100 50 50 50}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "HOTMIX80"}${lua fDrawImage ~/.conky/radiotray/logos/hotmix-80.png 100 50 50 50}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "MAXI80"}${lua fDrawImage ~/.conky/radiotray/logos/maxi80.png 100 50 50 50}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "RTL2"}${lua fDrawImage ~/.conky/radiotray/logos/rtl2.png 100 50 50 50}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "MAGNUM LA RADIO"}${lua fDrawImage ~/.conky/radiotray/logos/magnumradio.png 40 50 150 50}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "LOUNGERADIO"}${lua fDrawImage ~/.conky/radiotray/logos/image.png 100 50 50 50}${else} ${if_match "${execi 10 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio}" == "RFM"}${lua fDrawImage ~/.conky/radiotray/logos/rfm.png 100 50 50 50}${endif} ${endif}${endif}${endif}${endif}${endif}${endif} ${execi 10 ~/.conky/radiotray/pochette.sh} ${lua fDrawImage ~/.conky/radiotray/pochette.png 80 150 100 100} ${voffset -1000}
le pochette.sh(@ mettre dans le dossier radiotray):
Code TEXT :
#bin/bash titre=$(head -1 ~/.conky/radiotray/artiste_titre.txt) lienMiniature=$(wget -U'Googlebot-Image/1.0' -qO - "www.google.fr/search?q=$titre&tbm=isch" | perl -pe 's!.*?<img .*?src="([^"]*)".*!$1!') wget -qO miniatureGoogleImage $lienMiniature convert ~/miniatureGoogleImage ~/.conky/radiotray/pochette.png
.gif)
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
loutch
Membre non connecté

.gif)
Un script en lua pour afficher les images ou logos ou autre chose avec en plus la rotation .
@ mettre dans un dossier @ part comme cela la ligne d'appel sera la même pour tout les conky soit.
lua_load ~/.conky/lua/image.lua
Mise avant la partie TEXT des conkys .Cela permet d'avoir toutes les images ( obligatoirement une png) qui restent voyantes quel que soit le type de fond d'écran clair ou foncé.
Puis dans le conky j'appelle l'image ainsi:
${lua fDrawImage ~/.conky/radiotray/image.png 50 100 150 150 0 }
Ceci étant un exemple il faudra donc modifier le chemin de votre image à afficher
${lua fDrawImage= fonction lua
~/.conky/...= chemin de l'image @ afficher
50=position horizontale en partant de gauche
100=position verticale en partant du haut
150=hauteur de l'image
150=largeur de l'image
0=rotation de l'image (on peut ici ne rien mettre sinon 0.1 -1-1.5 ou autre jusqu'à la rotation désirée.
le script "image.lua"
Code TEXT :
-- De Didier-T require 'cairo' home = os.getenv ('HOME') --Fonction d'affichage function conky_fDrawImage(path,x,y,w,h,arc) path = string.gsub(path, "~", home) path = string.gsub(path, "$HOME", home) local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height) local function fDrawImage(path,x,y,w,h,arc) x=x+(w/2) y=y+(h/2) local img = cairo_image_surface_create_from_png(path) local w_img, h_img = cairo_image_surface_get_width (img), cairo_image_surface_get_height (img) local cr = cairo_create (cs) cairo_translate (cr, x, y) if arc then cairo_rotate (cr, arc) end cairo_scale (cr, w/w_img, h/h_img) cairo_set_source_surface (cr, img, -w_img/2, -h_img/2) cairo_paint (cr) cairo_destroy(cr) cairo_surface_destroy (img) end fDrawImage(path,x,y,w,h,arc) cairo_surface_destroy(cs) return "" end
.gif)
Linuxmint 19.1 Tessa - Mageia 7rc Mate sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 19.04 en xfce sur ASUS Rog STRIX
loutch
Membre non connecté

.gif)
Code TEXT :
background yes use_xft yes xftfont URW Chancery L:style=Bold:size=10 xftalpha 1 update_interval 1.0 total_run_times 0 own_window yes own_window_transparent yes own_window_argb_visual yes own_window_type normal own_window_hints undecorated,below,skip_taskbar,skip_pager double_buffer yes minimum_size 700 50 maximum_width 700 text_buffer_size 2048 draw_shades no draw_outline no draw_borders no draw_graph_borders no default_color ffffff default_outline_color black alignment top_left gap_x 50 gap_y 780 no_buffers yes uppercase no cpu_avg_samples 2 override_utf8_locale yes # Fonctionne uniquement avec les polices Fixes #use_spacer yes imlib_cache_size 0 uppercase no TEXT ${voffset 20}${color EAEAEA}${font GE Inspira:pixelsize=120}${time %H:%M}${font}${voffset -84}${offset 10}${color FFA300}${font GE Inspira:pixelsize=42}${time %d} ${voffset -15}${color EAEAEA}${font GE Inspira:pixelsize=22}${time %B} ${time %Y}${font}${voffset 24}${font GE Inspira:pixelsize=58}${offset -148}${time %A}${font} ${voffset 10}${offset 12}${font Ubuntu:pixelsize=12}${color FFA300}HD ${offset 9}$color${fs_free /} / ${fs_size /}${offset 30}${color FFA300}RAM ${offset 9}$color$mem / $memmax${offset 30}${color FFA300}CPU ${offset 9}$color${cpu cpu0}% ${voffset 70}

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

.gif)
Un petit avec du lua genre équalizer :
Code :
background yes
use_xft yes
xftfont URW Chancery L:style=Bold:size=10
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 400 250
maximum_width 400
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color ffffff
default_outline_color black
alignment tl
gap_x 20
gap_y 60
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes {color 87C9FF}
imlib_cache_size 0
uppercase no
lua_load ~/.conky/dna/lua/conky_eq.lua
lua_draw_hook_pre main_bars
TEXT
${voffset 20} ${goto 8}cpu ${goto 40}temp ${goto 77}carte ${goto 110}ram ${goto 144}home ${goto 182}root ${goto 215}down ${goto 256}up ${goto 287}wifi ${goto 318}disque
${goto 9}${cpu cpu0}% ${goto 40}${exec expr `cat /sys/class/hwmon/hwmon2/temp1_input` / 1000}°C ${goto 77}${acpitemp} C ${goto 110}${memperc}% ${goto 144}${fs_used_perc /home}% ${goto 182}${fs_free_perc}% ${goto 218}${downspeedf wlp2s0} ${goto 254}${upspeedf wlp2s0} ${goto 289}${wireless_link_qual_perc wlp2s0}% ${goto 320}${execi 120 hddtemp -n /dev/sda} °C
le lua :
Code :
--[[ Equalizer modified by plusdm 2012
Parameters are :
3 parameters are mandatory
name - the name of the conky variable to display, for example for {$cpu cpu0}, just write name="cpu"
arg - the argument of the above variable, for example for {$cpu cpu0}, just write arg="cpu0"
arg can be a numerical value if name=""
max - the maximum value the above variable can reach, for example, for {$cpu cpu0}, just write max=100
Optional parameters:
x,y - coordinates of the starting point of the bar, default = middle of the conky window
cap - end of cap line, possibles values are r,b,s (for round, butt, square), default="b"
http://www.cairographics.org/samples/set_line_cap/
angle - angle of rotation of the bar in degress, default = 0 (i.e. a vertical bar)
set to 90 for an horizontal bar
skew_x - skew bar around x axis, default = 0
skew_y - skew bar around y axis, default = 0
blocks - number of blocks to display for a bar (values >0) , default= 10
height - height of a block, default=10 pixels
width - width of a block, default=20 pixels
space - space between 2 blocks, default=2 pixels
angle_bar - this angle is used to draw a bar on a circular way (ok, this is no more a bar !) default=0
radius - for cicular bars, internal radius, default=0
with radius, parameter width has no more effect.
Colours below are defined into braces {colour in hexadecimal, alpha}
fg_colour - colour of a block ON, default= {0x00FF00,1}
bg_colour - colour of a block OFF, default = {0x00FF00,0.5}
alarm - threshold, values after this threshold will use alarm_colour colour , default=max
alarm_colour - colour of a block greater than alarm, default=fg_colour
smooth - (true or false), create a gradient from fg_colour to bg_colour, default=false
mid_colour - colours to add to gradient, with this syntax {position into the gradient (0 to1), colour hexa, alpha}
for example, this table {{0.25,0xff0000,1},{0.5,0x00ff00,1},{0.75,0x0000ff,1}} will add
3 colurs to gradient created by fg_colour and alarm_colour, default=no mid_colour
led_effect - add LED effects to each block, default=no led_effect
if smooth=true, led_effect is not used
possibles values : "r","a","e" for radial, parallelel, perdendicular to the bar (just try!)
led_effect has to be used with theses colours :
fg_led - middle colour of a block ON, default = fg_colour
bg_led - middle colour of a block OFF, default = bg_colour
alarm_led - middle colour of a block > ALARM, default = alarm_colour
reflection parameters, not available for circular bars
reflection_alpha - add a reflection effect (values from 0 to 1) default = 0 = no reflection
other values = starting opacity
reflection_scale - scale of the reflection (default = 1 = height of text)
reflection_length - length of reflection, define where the opacity will be set to zero
calues from 0 to 1, default =1
reflection - position of reflection, relative to a vertical bar, default="b"
possibles values are : "b","t","l","r" for bottom, top, left, right
draw_me - if set to false, text is not drawn (default = true or 1)
it can be used with a conky string, if the string returns 1, the text is drawn :
example : "${if_empty ${wireless_essid wlan0}}${else}1$endif",
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation version 3 (GPLv3)
]]
require 'cairo'
----------------START OF PARAMETERS ----------
function conky_main_bars()
local bars_settings={
{
name="cpu",
arg="cpu",
max=100,
alarm=80,
bg_colour={0xfffff,0.08},
fg_colour={0x6699cc,0.80},
alarm_colour={0xffffffcc,0.80},
x=5,y=45,
blocks=5,
height=4,width=25,
angle=360,
smooth=true,
cap="r",
skew_y=0,
space=4,
mid_colour={{0.5,0xfffff,0.60}}
},
{
name="exec",
arg="exec expr `cat /sys/class/hwmon/hwmon2/temp1_input` / 1000",
max=100,
alarm=80,
bg_colour={0xfffff,0.08},
fg_colour={0x6699cc,0.80},
alarm_colour={0xffffffcc,0.80},
x=40,y=45,
blocks=5,
height=4,width=25,
angle=360,
smooth=true,
cap="r",
skew_y=0,
space=4,
mid_colour={{0.5,0xfffff,0.60}}
},
{
name="hwmon",
arg="1 temp 1",
max=100,
alarm=80,
bg_colour={0xfffff,0.08},
fg_colour={0x6699cc,0.80},
alarm_colour={0xffffffcc,0.80},
x=75,y=45,
blocks=5,
height=4,width=25,
angle=360,
smooth=true,
cap="r",
skew_y=0,
space=4,
mid_colour={{0.5,0xfffff,0.60}}
},
{
name="memperc",
arg="memperc",
max=100,
alarm=80,
bg_colour={0xfffff,0.08},
fg_colour={0x6699cc,0.80},
alarm_colour={0xffffffcc,0.80},
x=110,y=45,
blocks=5,
height=4,width=25,
angle=360,
smooth=true,
cap="r",
skew_y=0,
space=4,
mid_colour={{0.5,0xfffff,0.60}}
},
{
name="fs_used_perc",
arg="/home",
max=100,
alarm=80,
bg_colour={0xfffff,0.08},
fg_colour={0x6699cc,0.80},
alarm_colour={0xffffffcc,0.80},
x=145,y=45,
blocks=5,
height=4,width=25,
angle=360,
smooth=true,
cap="r",
skew_y=0,
space=4,
mid_colour={{0.5,0xfffff,0.60}}
},
{
name="fs_used_perc",
arg="/",
max=100,
alarm=80,
bg_colour={0xfffff,0.08},
fg_colour={0x6699cc,0.80},
alarm_colour={0xffffffcc,0.80},
x=180,y=45,
blocks=5,
height=4,width=25,
angle=360,
smooth=true,
cap="r",
skew_y=0,
space=4,
mid_colour={{0.5,0xfffff,0.60}}
},
{
name="downspeedf",
arg="wlp2s0",
max=350,
alarm=160,
bg_colour={0xfffff,0.08},
fg_colour={0x6699cc,0.80},
alarm_colour={0xffffffcc,0.80},
x=215,y=45,
blocks=5,
height=4,width=25,
angle=360,
smooth=true,
cap="r",
skew_y=0,
space=4,
mid_colour={{0.5,0xfffff,0.60}}
},
{
name="upspeedf",
arg="wlp2s0",
max=100,
alarm=200,
bg_colour={0xfffff,0.08},
fg_colour={0x6699cc,0.80},
alarm_colour={0xffffffcc,0.80},
x=250,y=45,
blocks=5,
height=4,width=25,
angle=360,
smooth=true,
cap="r",
skew_y=0,
space=4,
mid_colour={{0.5,0xfffff,0.60}}
},
{
name="wireless_link_qual_perc",
arg="wlp2s0",
max=100,
alarm=80,
bg_colour={0xfffff,0.08},
fg_colour={0x6699cc,0.80},
alarm_colour={0xffffffcc,0.80},
x=285,y=45,
blocks=5,
height=4,width=25,
angle=360,
smooth=true,
cap="r",
skew_y=0,
space=4,
mid_colour={{0.5,0xfffff,0.60}}
},
{
name="execi",
arg="120 hddtemp -n /dev/sda",
max=100,
alarm=80,
bg_colour={0xfffff,0.08},
fg_colour={0x6699cc,0.80},
alarm_colour={0xfffffcc,0.80},
x=320,y=45,
blocks=5,
height=4,width=25,
angle=360,
smooth=true,
cap="r",
skew_y=0,
space=4,
reflection=4,
mid_colour={{0.5,0xfffff,0.60}}
},
}
-----------END OF PARAMETERS--------------
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)
--prevent segmentation error when reading cpu state
if tonumber(conky_parse('${updates}'))>3 then
for i in pairs(bars_settings) do
draw_multi_bar_graph(bars_settings[i])
end
end
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end
function draw_multi_bar_graph(t)
cairo_save(cr)
--check values
if t.draw_me == true then t.draw_me = nil end
if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end
if t.name==nil and t.arg==nil then
print ("No input values ... use parameters 'name' with 'arg' or only parameter 'arg' ")
return
end
if t.max==nil then
print ("No maximum value defined, use 'max'")
return
end
if t.name==nil then t.name="" end
if t.arg==nil then t.arg="" end
--set default values
if t.x == nil then t.x = conky_window.width/2 end
if t.y == nil then t.y = conky_window.height/2 end
if t.blocks == nil then t.blocks=10 end
if t.height == nil then t.height=10 end
if t.angle == nil then t.angle=0 end
t.angle = t.angle*math.pi/180
--line cap style
if t.cap==nil then t.cap = "b" end
local cap="b"
for i,v in ipairs({"s","r","b"}) do
if v==t.cap then cap=v end
end
local delta=0
if t.cap=="r" or t.cap=="s" then delta = t.height end
if cap=="s" then cap = CAIRO_LINE_CAP_SQUARE
elseif cap=="r" then
cap = CAIRO_LINE_CAP_ROUND
elseif cap=="b" then
cap = CAIRO_LINE_CAP_BUTT
end
--end line cap style
--if t.led_effect == nil then t.led_effect="r" end
if t.width == nil then t.width=20 end
if t.space == nil then t.space=2 end
if t.radius == nil then t.radius=0 end
if t.angle_bar == nil then t.angle_bar=0 end
t.angle_bar = t.angle_bar*math.pi/360 --halt angle
--colours
if t.bg_colour == nil then t.bg_colour = {0x00FF00,0.5} end
if #t.bg_colour~=2 then t.bg_colour = {0x00FF00,0.5} end
if t.fg_colour == nil then t.fg_colour = {0x00FF00,1} end
if #t.fg_colour~=2 then t.fg_colour = {0x00FF00,1} end
if t.alarm_colour == nil then t.alarm_colour = t.fg_colour end
if #t.alarm_colour~=2 then t.alarm_colour = t.fg_colour end
if t.mid_colour ~= nil then
for i=1, #t.mid_colour do
if #t.mid_colour[i]~=3 then
print ("error in mid_color table")
t.mid_colour[i]={1,0xFFFFFF,1}
end
end
end
if t.bg_led ~= nil and #t.bg_led~=2 then t.bg_led = t.bg_colour end
if t.fg_led ~= nil and #t.fg_led~=2 then t.fg_led = t.fg_colour end
if t.alarm_led~= nil and #t.alarm_led~=2 then t.alarm_led = t.fg_led end
if t.led_effect~=nil then
if t.bg_led == nil then t.bg_led = t.bg_colour end
if t.fg_led == nil then t.fg_led = t.fg_colour end
if t.alarm_led == nil then t.alarm_led = t.fg_led end
end
if t.alarm==nil then t.alarm = t.max end --0.8*t.max end
if t.smooth == nil then t.smooth = false end
if t.skew_x == nil then
t.skew_x=0
else
t.skew_x = math.pi*t.skew_x/180
end
if t.skew_y == nil then
t.skew_y=0
else
t.skew_y = math.pi*t.skew_y/180
end
if t.reflection_alpha==nil then t.reflection_alpha=0 end
if t.reflection_length==nil then t.reflection_length=1 end
if t.reflection_scale==nil then t.reflection_scale=1 end
--end of default values
local function rgb_to_r_g_b(col_a)
return ((col_a[1] / 0x10000) % 0x100) / 255., ((col_a[1] / 0x100) % 0x100) / 255., (col_a[1] % 0x100) / 255., col_a[2]
end
--functions used to create patterns
local function create_smooth_linear_gradient(x0,y0,x1,y1)
local pat = cairo_pattern_create_linear (x0,y0,x1,y1)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
if t.mid_colour ~=nil then
for i=1, #t.mid_colour do
cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
end
end
return pat
end
local function create_smooth_radial_gradient(x0,y0,r0,x1,y1,r1)
local pat = cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
if t.mid_colour ~=nil then
for i=1, #t.mid_colour do
cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
end
end
return pat
end
local function create_led_linear_gradient(x0,y0,x1,y1,col_alp,col_led)
local pat = cairo_pattern_create_linear (x0,y0,x1,y1) ---delta, 0,delta+ t.width,0)
cairo_pattern_add_color_stop_rgba (pat, 0.0, rgb_to_r_g_b(col_alp))
cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1.0, rgb_to_r_g_b(col_alp))
return pat
end
local function create_led_radial_gradient(x0,y0,r0,x1,y1,r1,col_alp,col_led,mode)
local pat = cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
if mode==3 then
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_alp))
cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))
else
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))
end
return pat
end
local function draw_single_bar()
--this fucntion is used for bars with a single block (blocks=1) but
--the drawing is cut in 3 blocks : value/alarm/background
--not zvzimzblr for circular bar
local function create_pattern(col_alp,col_led,bg)
local pat
if not t.smooth then
if t.led_effect=="e" then
pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
elseif t.led_effect=="a" then
pat = create_led_linear_gradient (t.width/2, 0,t.width/2,-t.height,col_alp,col_led)
elseif t.led_effect=="r" then
pat = create_led_radial_gradient (t.width/2, -t.height/2, 0, t.width/2,-t.height/2,t.height/1.5,col_alp,col_led,2)
else
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp))
end
else
if bg then
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(t.bg_colour))
else
pat = create_smooth_linear_gradient(t.width/2, 0, t.width/2,-t.height)
end
end
return pat
end
local y1=-t.height*pct/100
local y2,y3
if pct>(100*t.alarm/t.max) then
y1 = -t.height*t.alarm/100
y2 = -t.height*pct/100
if t.smooth then y1=y2 end
end
if t.angle_bar==0 then
--block for fg value
local pat = create_pattern(t.fg_colour,t.fg_led,false)
cairo_set_source(cr,pat)
cairo_rectangle(cr,0,0,t.width,y1)
cairo_fill(cr)
cairo_pattern_destroy(pat)
-- block for alarm value
if not t.smooth and y2 ~=nil then
pat = create_pattern(t.alarm_colour,t.alarm_led,false)
cairo_set_source(cr,pat)
cairo_rectangle(cr,0,y1,t.width,y2-y1)
cairo_fill(cr)
y3=y2
cairo_pattern_destroy(pat)
else
y2,y3=y1,y1
end
-- block for bg value
cairo_rectangle(cr,0,y2,t.width,-t.height-y3)
pat = create_pattern(t.bg_colour,t.bg_led,true)
cairo_set_source(cr,pat)
cairo_pattern_destroy(pat)
cairo_fill(cr)
end
end --end single bar
local function draw_multi_bar()
--function used for bars with 2 or more blocks
for pt = 1,t.blocks do
--set block y
local y1 = -(pt-1)*(t.height+t.space)
local light_on=false
--set colors
local col_alp = t.bg_colour
local col_led = t.bg_led
if pct>=(100/t.blocks) or pct>0 then --ligth on or not the block
if pct>=(pcb*(pt-1)) then
light_on = true
col_alp = t.fg_colour
col_led = t.fg_led
if pct>=(100*t.alarm/t.max) and (pcb*pt)>(100*t.alarm/t.max) then
col_alp = t.alarm_colour
col_led = t.alarm_led
end
end
end
--set colors
--have to try to create gradients outside the loop ?
local pat
if not t.smooth then
if t.angle_bar==0 then
if t.led_effect=="e" then
pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
elseif t.led_effect=="a" then
pat = create_led_linear_gradient (t.width/2, -t.height/2+y1,t.width/2,0+t.height/2+y1,col_alp,col_led)
elseif t.led_effect=="r" then
pat = create_led_radial_gradient (t.width/2, y1, 0, t.width/2,y1,t.width/1.5,col_alp,col_led,2)
else
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp))
end
else
if t.led_effect=="a" then
pat = create_led_radial_gradient (0, 0, t.radius+(t.height+t.space)*(pt-1),
0, 0, t.radius+(t.height+t.space)*(pt),
col_alp,col_led,3)
else
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp))
end
end
else
if light_on then
if t.angle_bar==0 then
pat = create_smooth_linear_gradient(t.width/2, t.height/2, t.width/2,-(t.blocks-0.5)*(t.height+t.space))
else
pat = create_smooth_radial_gradient(0, 0, (t.height+t.space), 0,0,(t.blocks+1)*(t.height+t.space),2)
end
else
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(t.bg_colour))
end
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
--draw a block
if t.angle_bar==0 then
cairo_move_to(cr,0,y1)
cairo_line_to(cr,t.width,y1)
else
cairo_arc( cr,0,0,
t.radius+(t.height+t.space)*(pt)-t.height/2,
-t.angle_bar -math.pi/2 ,
t.angle_bar -math.pi/2)
end
cairo_stroke(cr)
end
end
local function setup_bar_graph()
--function used to retrieve the value to display and to set the cairo structure
if t.blocks ~=1 then t.y=t.y-t.height/2 end
local value = 0
if t.name ~="" then
value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
--$to_bytes doesn't work when value has a decimal point,
--https://garage.maemo.org/plugins/ggit/browse.php/?p=monky;a=commitdiff;h=174c256c81a027a2ea406f5f37dc036fac0a524b;hp=d75e2db5ed3fc788fb8514121f67316ac3e5f29f
--http://sourceforge.net/tracker/index.php?func=detail&aid=3000865&group_id=143975&atid=757310
--conky bug?
--value = (conky_parse(string.format('${%s %s}', t.name, t.arg)))
--if string.match(value,"%w") then
-- value = conky_parse(string.format('${to_bytes %s}',value))
--end
else
value = tonumber(t.arg)
end
if value==nil then value =0 end
pct = 100*value/t.max
pcb = 100/t.blocks
cairo_set_line_width (cr, t.height)
cairo_set_line_cap (cr, cap)
cairo_translate(cr,t.x,t.y)
cairo_rotate(cr,t.angle)
local matrix0 = cairo_matrix_t:create()
tolua.takeownership(matrix0)
cairo_matrix_init (matrix0, 1,t.skew_y,t.skew_x,1,0,0)
cairo_transform(cr,matrix0)
--call the drawing function for blocks
if t.blocks==1 and t.angle_bar==0 then
draw_single_bar()
if t.reflection=="t" or t.reflection=="b" then cairo_translate(cr,0,-t.height) end
else
draw_multi_bar()
end
--dot for reminder
--[[
if t.blocks ~=1 then
cairo_set_source_rgba(cr,1,0,0,1)
cairo_arc(cr,0,t.height/2,3,0,2*math.pi)
cairo_fill(cr)
else
cairo_set_source_rgba(cr,1,0,0,1)
cairo_arc(cr,0,0,3,0,2*math.pi)
cairo_fill(cr)
end]]
--call the drawing function for reflection and prepare the mask used
if t.reflection_alpha>0 and t.angle_bar==0 then
local pat2
local matrix1 = cairo_matrix_t:create()
tolua.takeownership(matrix1)
if t.angle_bar==0 then
pts={-delta/2,(t.height+t.space)/2,t.width+delta,-(t.height+t.space)*(t.blocks)}
if t.reflection=="t" then
cairo_matrix_init (matrix1,1,0,0,-t.reflection_scale,0,-(t.height+t.space)*(t.blocks-0.5)*2*(t.reflection_scale+1)/2)
pat2 = cairo_pattern_create_linear (t.width/2,-(t.height+t.space)*(t.blocks),t.width/2,(t.height+t.space)/2)
elseif t.reflection=="r" then
cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,delta+2*t.width,0)
pat2 = cairo_pattern_create_linear (delta/2+t.width,0,-delta/2,0)
elseif t.reflection=="l" then
cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,-delta,0)
pat2 = cairo_pattern_create_linear (-delta/2,0,delta/2+t.width,-0)
else --bottom
cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(t.height+t.space)*(t.reflection_scale+1)/2)
pat2 = cairo_pattern_create_linear (t.width/2,(t.height+t.space)/2,t.width/2,-(t.height+t.space)*(t.blocks))
end
end
cairo_transform(cr,matrix1)
if t.blocks==1 and t.angle_bar==0 then
draw_single_bar()
cairo_translate(cr,0,-t.height/2)
else
draw_multi_bar()
end
cairo_set_line_width(cr,0.01)
cairo_pattern_add_color_stop_rgba (pat2, 0,0,0,0,1-t.reflection_alpha)
cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1)
if t.angle_bar==0 then
cairo_rectangle(cr,pts[1],pts[2],pts[3],pts[4])
end
cairo_clip_preserve(cr)
cairo_set_operator(cr,CAIRO_OPERATOR_CLEAR)
cairo_stroke(cr)
cairo_mask(cr,pat2)
cairo_pattern_destroy(pat2)
cairo_set_operator(cr,CAIRO_OPERATOR_OVER)
end --reflection
pct,pcb=nil
end --setup_bar_graph()
--start here !
setup_bar_graph()
cairo_restore(cr)
end
il faudra modifier la partie internet dans le conkyrc et dans le lua en fonction de votre configuration.

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

.gif)
Pour ceux qui utilise Music On Console (moc)
Le script qui lance le conky et mocp avec son interface dans la console( remplacer konsole par console ou autre suivant votre environnement)
Code :
#!/bin/bash
PROG_NAME1="conky -c /home/$USER/.conky/moc/conkyrc" # Nom du programme à démarrer/arrêter.
PROG_NAME2="/usr/bin/konsole -e /usr/bin/mocp" # Nom du programme à démarrer/arrêter.
PROCESSPID1=$(pgrep -f /home/$USER/.conky/moc/conkyrc) # Récupère le PID du processus.
PROCESSPID2=$(pgrep -f "/usr/bin/mocp") # Récupére le PID du processus.
if [[ "$PROCESSPID1" != "" && "$PROCESSPID2" != "" ]]; then # Si les deux processus existe alors on le(s) kill.
kill $PROCESSPID1 && echo "Stop $PROG_NAME1 (PID: $PROCESSPID1)"
kill $PROCESSPID2 && echo "Stop $PROG_NAME2 (PID: $PROCESSPID2)"
else # Si aucun processus on démarre le programme.
kill $PROCESSPID1
$PROG_NAME1 &
echo "Start $PROG_NAME1"
kill $PROCESSPID2
$PROG_NAME2 &
echo "Start $PROG_NAME2"
if [[ "$PROCESSPID1" == "" || "$PROCESSPID2" == "" ]]; then # Si un des processus n'existe pas alors on le(s) kill.
kill $PROCESSPID1 && echo "Stop $PROG_NAME1 (PID: $PROCESSPID1)"
kill $PROCESSPID2 && echo "Stop $PROG_NAME2 (PID: $PROCESSPID2)"
echo "Il y a eu un souci au lancement tout a été coupé"
fi
fi
exit 0
le conkyrc:
Code :
background yes
use_xft yes
xftfont URW Chancery L:style=Bold:size=10
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 310 500
maximum_width 310
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color ffffff #ffd579
default_outline_color black
default_bar_size 230 6
alignment tl
gap_x 0
gap_y 200
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes
imlib_cache_size 0
uppercase no
TEXT
${font URW Chancery L:style=Bold:size=20}${alignc}Music On Console $font
Artiste : ${goto 150}${moc_artist}
Album : ${goto 150}${moc_album}
Titre : ${goto 150}${moc_song}
${goto 40}${execbar mocp -Q '%cs/%ts*100' | bc -l}
${voffset -20}0:00 ${goto 280}${moc_totaltime}
${goto 140}${moc_curtime}

avec la fenêtre réduite:

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

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

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