Vos Conky
Postez ici vos conkys ou des petits bouts et demandes d'aide.
Discussions Libres

loutch Membre non connecté
-
- Voir le profil du membre loutch
- Inscrit le : 07/07/2010
- Groupes :
Reprise du message précédent
.gif)
le dernier tout en un 4 à 5 %au repos
En image:

.gif)
Édité par loutch Le 28/01/2013 à 23h12
Linuxmint 24.02 Xia - Mageia 9 xfce et plasma sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX

Lotherath Membre non connecté
-
- Voir le profil du membre Lotherath
- Inscrit le : 21/11/2011
- Groupes :

le code:
Caché :
background yes
use_xft yes
xftfont Sans:size=8
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,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 250 800
maximum_width 250
text_buffer_size 4096
draw_shades yes
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
#white
color1 white
#white
color2 white
#white
color3 white
#blue
color4 white
#red
color5 white
# Lua Load #
#lua_load ~/.conky/ring.lua
#lua_draw_hook_pre clock_rings
TEXT
Mageia Linux 2
Kernel: ${color white}$kernel
#Utilisation moyenne des 2 cores
#${color red}${cpugraph cpu0}
${color white}Core 1 $alignr Core 2
${color red}${cpugraph cpu1 25,120} $alignr${cpugraph cpu2 25,120}
${color white} FREQUENCES % d'utilisation
Frequence totale: ${color FF8000}${freq_g}Ghz ${color white}${cpu cpu0}% ${color red}${alignr}${cpubar cpu0 5,50}
${color white}Frequence (Core 1): ${color FF8000}${freq_g cpu1}Ghz ${color white}${cpu cpu1}% ${color red}${alignr}${cpubar cpu1 5,50}
${color white}Frequence (Core 2): ${color FF8000}${freq_g cpu2}Ghz ${color white}${cpu cpu2}% ${color red}${alignr}${cpubar cpu2 5,50}
${color white} MEMOIRE:
${color3}RAM:${color2} $mem/$memmax ${goto 150}$memperc% ${goto 185}${color 00408A}${membar}${color2}
${color3}SWAP:${color2} ${swap} / ${swapmax} ${goto 150} ${swapperc}%${goto 185}${color 00408A}${swapbar}
${color white} MACHINE:
${color white}Vitesse ventilateur processeurs: ${color FF8000}${hwmon 0 fan 1} RPM
${color}Temperature CPU 1: ${color FF8000}${hwmon 0 temp 1}°C
${color}Temperature CPU 2: ${color FF8000}${hwmon 0 temp 2}°C
${color}Temperature carte graphique: ${color FF8000}${exec nvidia-settings -q GPUCoreTemp -t}°C
${color white}Temperature disque dur: ${color FF8000}${execi 10 hddtemp -n /dev/sda}°C
${color3}CHARGE: ${hr}${color2}
Nombre de processus en cours: ${color FF8000}$processes ${color white}Run: ${color FF8000}$running_processes CPU Temp: ${execi 1100 cat /proc/acpi/thermal_zone/THRM/temperature | grep -o "[0-9]* C"}
${color3}Processus$alignr${color2}${color3} PID CPU MEM${color2}
${top name 1} $alignr${top pid 1} ${top cpu 1} ${top mem 1}
${color #CACACA}${top name 2} $alignr${top pid 2} ${top cpu 2} ${top mem 2}
${color #A2A2A2}${top name 3} $alignr${top pid 3} ${top cpu 3} ${top mem 3}
${color #787878}${top name 4} $alignr${top pid 4} ${top cpu 4} ${top mem 4}
${color3}Memoire vive$alignr${color2}${color3} PID CPU MEM${color2}
${top_mem name 1} $alignr${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${color #CACACA}${top_mem name 2} $alignr${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${color #A2A2A2}${top_mem name 3} $alignr${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
${color #787878}${top_mem name 4} $alignr${top_mem pid 4} ${top_mem cpu 4} ${top_mem mem 4}
${color3}RESEAU: ${hr}${color2}
${color3}${alignc}Adresse Ip eth0 : ${color FF8000}${addr eth0}${color2}
${color3}Down:${color2} ${totaldown eth0}${goto 120}${downspeedf eth0}k/s
${color3}Up:${color2} ${totalup eth0}${goto 120}${upspeedf eth0}k/s
${downspeedgraph eth0 25,120 ffc11f 8b4b0b}$alignr${upspeedgraph eth0 25,120 ffc11f 8b4b0b}
${voffset -28}${goto 50}DOWN${goto 190}UP
#${font sans-serif:size=8,weight:bold}${color}IP${alignr}PORT
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 0}${alignr 1}${tcp_portmon 1 65535 rport 0}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 1}${alignr 1}${tcp_portmon 1 65535 rport 1}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 2}${alignr 1}${tcp_portmon 1 65535 rport 2}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 3}${alignr 1}${tcp_portmon 1 65535 rport 3}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 4}${alignr 1}${tcp_portmon 1 65535 rport 4}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 5}${alignr 1}${tcp_portmon 1 65535 rport 5}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 6}${alignr 1}${tcp_portmon 1 65535 rport 6}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 7}${alignr 1}${tcp_portmon 1 65535 rport 7}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 8}${alignr 1}${tcp_portmon 1 65535 rport 8}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 9}${alignr 1}${tcp_portmon 1 65535 rport 9}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 10}${alignr 1}${tcp_portmon 1 65535 rport 10}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 11}${alignr 1}${tcp_portmon 1 65535 rport 11}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 12}${alignr 1}${tcp_portmon 1 65535 rport 12}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 13}${alignr 1}${tcp_portmon 1 65535 rport 13}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 14}${alignr 1}${tcp_portmon 1 65535 rport 14}
use_xft yes
xftfont Sans:size=8
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,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 250 800
maximum_width 250
text_buffer_size 4096
draw_shades yes
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
#white
color1 white
#white
color2 white
#white
color3 white
#blue
color4 white
#red
color5 white
# Lua Load #
#lua_load ~/.conky/ring.lua
#lua_draw_hook_pre clock_rings
TEXT
Mageia Linux 2
Kernel: ${color white}$kernel
#Utilisation moyenne des 2 cores
#${color red}${cpugraph cpu0}
${color white}Core 1 $alignr Core 2
${color red}${cpugraph cpu1 25,120} $alignr${cpugraph cpu2 25,120}
${color white} FREQUENCES % d'utilisation
Frequence totale: ${color FF8000}${freq_g}Ghz ${color white}${cpu cpu0}% ${color red}${alignr}${cpubar cpu0 5,50}
${color white}Frequence (Core 1): ${color FF8000}${freq_g cpu1}Ghz ${color white}${cpu cpu1}% ${color red}${alignr}${cpubar cpu1 5,50}
${color white}Frequence (Core 2): ${color FF8000}${freq_g cpu2}Ghz ${color white}${cpu cpu2}% ${color red}${alignr}${cpubar cpu2 5,50}
${color white} MEMOIRE:
${color3}RAM:${color2} $mem/$memmax ${goto 150}$memperc% ${goto 185}${color 00408A}${membar}${color2}
${color3}SWAP:${color2} ${swap} / ${swapmax} ${goto 150} ${swapperc}%${goto 185}${color 00408A}${swapbar}
${color white} MACHINE:
${color white}Vitesse ventilateur processeurs: ${color FF8000}${hwmon 0 fan 1} RPM
${color}Temperature CPU 1: ${color FF8000}${hwmon 0 temp 1}°C
${color}Temperature CPU 2: ${color FF8000}${hwmon 0 temp 2}°C
${color}Temperature carte graphique: ${color FF8000}${exec nvidia-settings -q GPUCoreTemp -t}°C
${color white}Temperature disque dur: ${color FF8000}${execi 10 hddtemp -n /dev/sda}°C
${color3}CHARGE: ${hr}${color2}
Nombre de processus en cours: ${color FF8000}$processes ${color white}Run: ${color FF8000}$running_processes CPU Temp: ${execi 1100 cat /proc/acpi/thermal_zone/THRM/temperature | grep -o "[0-9]* C"}
${color3}Processus$alignr${color2}${color3} PID CPU MEM${color2}
${top name 1} $alignr${top pid 1} ${top cpu 1} ${top mem 1}
${color #CACACA}${top name 2} $alignr${top pid 2} ${top cpu 2} ${top mem 2}
${color #A2A2A2}${top name 3} $alignr${top pid 3} ${top cpu 3} ${top mem 3}
${color #787878}${top name 4} $alignr${top pid 4} ${top cpu 4} ${top mem 4}
${color3}Memoire vive$alignr${color2}${color3} PID CPU MEM${color2}
${top_mem name 1} $alignr${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${color #CACACA}${top_mem name 2} $alignr${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${color #A2A2A2}${top_mem name 3} $alignr${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
${color #787878}${top_mem name 4} $alignr${top_mem pid 4} ${top_mem cpu 4} ${top_mem mem 4}
${color3}RESEAU: ${hr}${color2}
${color3}${alignc}Adresse Ip eth0 : ${color FF8000}${addr eth0}${color2}
${color3}Down:${color2} ${totaldown eth0}${goto 120}${downspeedf eth0}k/s
${color3}Up:${color2} ${totalup eth0}${goto 120}${upspeedf eth0}k/s
${downspeedgraph eth0 25,120 ffc11f 8b4b0b}$alignr${upspeedgraph eth0 25,120 ffc11f 8b4b0b}
${voffset -28}${goto 50}DOWN${goto 190}UP
#${font sans-serif:size=8,weight:bold}${color}IP${alignr}PORT
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 0}${alignr 1}${tcp_portmon 1 65535 rport 0}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 1}${alignr 1}${tcp_portmon 1 65535 rport 1}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 2}${alignr 1}${tcp_portmon 1 65535 rport 2}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 3}${alignr 1}${tcp_portmon 1 65535 rport 3}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 4}${alignr 1}${tcp_portmon 1 65535 rport 4}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 5}${alignr 1}${tcp_portmon 1 65535 rport 5}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 6}${alignr 1}${tcp_portmon 1 65535 rport 6}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 7}${alignr 1}${tcp_portmon 1 65535 rport 7}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 8}${alignr 1}${tcp_portmon 1 65535 rport 8}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 9}${alignr 1}${tcp_portmon 1 65535 rport 9}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 10}${alignr 1}${tcp_portmon 1 65535 rport 10}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 11}${alignr 1}${tcp_portmon 1 65535 rport 11}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 12}${alignr 1}${tcp_portmon 1 65535 rport 12}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 13}${alignr 1}${tcp_portmon 1 65535 rport 13}
#${font sans-serif:size=8,weight:normal}${color1}${tcp_portmon 1 65535 rip 14}${alignr 1}${tcp_portmon 1 65535 rport 14}
Édité par Lotherath Le 16/02/2013 à 12h24
Mon PC: tour assemblée maison avec carte mère Asus, dual-core Amd athlon 5500 plus (avec ventirad Zalman pour refroidir la bête), 4 Go de ram, carte graphique MSI GT 630, disque dur 500 Go - 100 % Mageia avec KDE.

Adrien.D Membre non connecté
-
- Voir le profil du membre Adrien.D
- Inscrit le : 30/05/2011
- Site internet
- Groupes :


Mais bon, pour un non initié au langage perl, le script serait imbuvable.
Il va rechercher sur le site divia.fr les infos des prochains passages d'un de mes arrêts

(Rafraichissement toutes les 30 secondes)
Reste à optimiser le code et rendre le script personnalisable, puisque les variables sont en dur dedans


Config : PC Fixe : X470 GAMING PRO- AMD Ryzen 5 2600X - 16Go RAM - Radeon RX 560 (Pilote libre) - Gentoo Linux - GNOME Desktop - Kernel 5.10 LTS
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !


Adrien.D Membre non connecté
-
- Voir le profil du membre Adrien.D
- Inscrit le : 30/05/2011
- Site internet
- Groupes :
Il faut voir 3 trucs
![:]](/images/smileys/8.gif)
- Avoir une NVidia
- Avoir installé les pilotes proprio d'installés
- Avoir nvidia-settings d'installé.
Code BASH :
urpmf nvidia-settings | grep bin/nvidia-settings x11-driver-video-nvidia-current:/usr/bin/nvidia-settings x11-driver-video-nvidia-current:/usr/lib64/nvidia-current/bin/nvidia-settings x11-driver-video-nvidia-current:/usr/bin/nvidia-settings x11-driver-video-nvidia-current:/usr/lib64/nvidia-current/bin/nvidia-settings x11-driver-video-nvidia96xx:/usr/bin/nvidia-settings x11-driver-video-nvidia96xx:/usr/lib64/nvidia96xx/bin/nvidia-settings x11-driver-video-nvidia173:/usr/bin/nvidia-settings x11-driver-video-nvidia173:/usr/lib64/nvidia173/bin/nvidia-settings
Pour les partitions Windows, ça peut être utile si on a des documents communs Windows/Linux dessus ?
Merci

Config : PC Fixe : X470 GAMING PRO- AMD Ryzen 5 2600X - 16Go RAM - Radeon RX 560 (Pilote libre) - Gentoo Linux - GNOME Desktop - Kernel 5.10 LTS
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !


thierryR Membre non connecté
-
- Voir le profil du membre thierryR
- Inscrit le : 02/02/2010
- Site internet
débusqueur de bugs et chercheur en améliorations
Amicalement vôtre.
Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

loutch Membre non connecté
-
- Voir le profil du membre loutch
- Inscrit le : 07/07/2010
- Groupes :
.gif)
modification du conkyr et ajout d'un second pour la météo:
conkyrc météo
Caché :
# -- Conky settings -- #
background no
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
double_buffer yes
no_buffers no
text_buffer_size 2048
# -- Window specifications -- #
own_window_argb_visual yes
own_window_class normal
own_window_title Meteo
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
minimum_size 450 250
maximum_width 455
alignment tr
gap_x 50
gap_y 680
# -- 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
# -- Déclaration template -- #
template0 ${lua fDrawImage ~/.conky/conky-meteo/meteo6jours/fon/1 2 3 4 5} # -- images fond -- #
template1 ${lua Meteo_1 2 3 4 5 6} # -- gestion météo --#
template2 ${lua Meteo_1 2 3 4 5 6 7} # -- icônes météo -- 2=répertoire icônes 3=position 4=taille 5=jour (pour les prévisions) #
template3 ${lua Lune_1}
template4 ${lua_parse Images_1 2 3 60 4} # -- Appelle image -- 2=position 3=taille 4=jour (pour les prévisions) #
lua_load ~/.conky/conky-meteo/meteo_lua_2/scripts/meteo2.lua
lua_startup_hook init ~/.conky/conky-meteo/meteo6jours/meteo.cfg
TEXT
#### Lancement du script récupérant les données météo ####
${template1 Maj}
#### Premier cadre ####
##### Heure #####
${voffset -55}${font LED_mono :style=Medium:size=20}${color white}${goto 30}${time %H}:${goto 68}${time %M}${font LED_mono :size=25:style=Medium}${color white}${goto 235}
##### Heure mise à jour #####
${voffset 0}${color white}${font Helvetica LT Std :size=8}${alignc 96}Dernière mise à jour : ${template1 Heure}h${template1 Minute}
##### Date et Saints du jour #####
${voffset -65}${color white}${font Helvetica LT Std :size=12:style=Bold}${alignc -108}${exec date "+%A %d %B %Y"|sed 's/^.| [a-z]/U&/g'}
##### Affichage infos vent ######
${voffset 20}${color white}${font Helvetica LT Std:style=Bold:size=9}${goto 340}Vent : ${template1 VentDirP}
${color white}${font Helvetica LT Std:style=Bold:size=9}${goto 340}Vitesse : ${template1 VentForce} km/h
${goto 340}Pluie : ${template1 Jour_NivPrec 1} mm
##### ville #####
${voffset 6}${goto 15}${font Helvetica LT Std :size=10 style:bold}${color white}${template1 Ville} : ${font Helvetica LT Std :size=10}${color white}${template1 CondMeteo}${font Helvetica LT Std :size=10} / ${template1 TempAct}°C
##### Affichage temperature #####
${alignc 187}${voffset -5}${font Ubuntu :size=8:style=bold}${color red}${template1 Jour_Temp 2}°${color white}/${color lightblue}${template1 Nuit_Temp 2}°
${alignc 112}${voffset -13}${color red}${template1 Jour_Temp 3}°${color white}/${color lightblue}${template1 Nuit_Temp 3}°
${alignc 37}${voffset -13}${color red}${template1 Jour_Temp 4}°${color white}/${color lightblue}${template1 Nuit_Temp 4}°
${alignc -38}${voffset -13}${color red}${template1 Jour_Temp 5}°${color white}/${color lightblue}${template1 Nuit_Temp 5}°
${alignc -113}${voffset -13}${color red}${template1 Jour_Temp 6}°${color white}/${color lightblue}${template1 Nuit_Temp 6}°
${alignc -188}${voffset -13}${color red}${template1 Jour_Temp 7}°${color white}/${color lightblue}${template1 Nuit_Temp 7}°
##### Affichage vitesse du vent #####
${alignc 187}${font Ubuntu :size=8:style=bold}${color white}${voffset 39}${template1 Jour_VentForce 2}${font Ubuntu :size=6:style=bold} km/h
${alignc 112}${voffset -12}${font Ubuntu :size=8:style=bold}${template1 Jour_VentForce 3}${font Ubuntu :size=6:style=bold} km/h
${alignc 37}${voffset -12}${font Ubuntu :size=8:style=bold}${template1 Jour_VentForce 4}${font Ubuntu :size=6:style=bold} km/h
${alignc -38}${voffset -12}${font Ubuntu :size=8:style=bold}${template1 Jour_VentForce 5}${font Ubuntu :size=6:style=bold} km/h
${alignc -113}${font Ubuntu :size=8:style=bold}${voffset -12}${template1 Jour_VentForce 6}${font Ubuntu :size=6:style=bold} km/h
${alignc -188}${font Ubuntu :size=8:style=bold}${voffset -12}${template1 Jour_VentForce 7}${font Ubuntu :size=6:style=bold} km/h
##### Affichage Date #####
${voffset -2}${font Ubuntu :size=10}${color white}${alignc 187}${template1 Jour %a_%d 2}
${voffset -16}${alignc 112}${template1 Jour %a_%d 3}
${voffset -16}${alignc 37}${template1 Jour %a_%d 4}
${voffset -16}${alignc -38}${template1 Jour %a_%d 5}
${voffset -16}${alignc -113}${template1 Jour %a_%d 6}
${voffset -16}${alignc -188}${template1 Jour %a_%d 7}
#### Affichage des cadres utilisés dans le conky ####
${voffset -935}
#### premier cadre ####
${template0 base.png 0 40 450 110}
${template0 flip_bg.png 24 10 100 100}
${template0 flip_bg.png 134 10 100 100}
#### Second cadre ####
${template0 base.png 0 155 450 80}
#### icônes premier cadre ####
${template2 IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 205 75 132 70}
#### icônes Second cadre ####
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 0 168 75 45 2}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 75 168 75 45 3}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 150 168 75 45 4}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 225 168 75 45 5}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 300 168 75 45 6}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 375 168 75 45 7}
background no
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
double_buffer yes
no_buffers no
text_buffer_size 2048
# -- Window specifications -- #
own_window_argb_visual yes
own_window_class normal
own_window_title Meteo
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
minimum_size 450 250
maximum_width 455
alignment tr
gap_x 50
gap_y 680
# -- 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
# -- Déclaration template -- #
template0 ${lua fDrawImage ~/.conky/conky-meteo/meteo6jours/fon/1 2 3 4 5} # -- images fond -- #
template1 ${lua Meteo_1 2 3 4 5 6} # -- gestion météo --#
template2 ${lua Meteo_1 2 3 4 5 6 7} # -- icônes météo -- 2=répertoire icônes 3=position 4=taille 5=jour (pour les prévisions) #
template3 ${lua Lune_1}
template4 ${lua_parse Images_1 2 3 60 4} # -- Appelle image -- 2=position 3=taille 4=jour (pour les prévisions) #
lua_load ~/.conky/conky-meteo/meteo_lua_2/scripts/meteo2.lua
lua_startup_hook init ~/.conky/conky-meteo/meteo6jours/meteo.cfg
TEXT
#### Lancement du script récupérant les données météo ####
${template1 Maj}
#### Premier cadre ####
##### Heure #####
${voffset -55}${font LED_mono :style=Medium:size=20}${color white}${goto 30}${time %H}:${goto 68}${time %M}${font LED_mono :size=25:style=Medium}${color white}${goto 235}
##### Heure mise à jour #####
${voffset 0}${color white}${font Helvetica LT Std :size=8}${alignc 96}Dernière mise à jour : ${template1 Heure}h${template1 Minute}
##### Date et Saints du jour #####
${voffset -65}${color white}${font Helvetica LT Std :size=12:style=Bold}${alignc -108}${exec date "+%A %d %B %Y"|sed 's/^.| [a-z]/U&/g'}
##### Affichage infos vent ######
${voffset 20}${color white}${font Helvetica LT Std:style=Bold:size=9}${goto 340}Vent : ${template1 VentDirP}
${color white}${font Helvetica LT Std:style=Bold:size=9}${goto 340}Vitesse : ${template1 VentForce} km/h
${goto 340}Pluie : ${template1 Jour_NivPrec 1} mm
##### ville #####
${voffset 6}${goto 15}${font Helvetica LT Std :size=10 style:bold}${color white}${template1 Ville} : ${font Helvetica LT Std :size=10}${color white}${template1 CondMeteo}${font Helvetica LT Std :size=10} / ${template1 TempAct}°C
##### Affichage temperature #####
${alignc 187}${voffset -5}${font Ubuntu :size=8:style=bold}${color red}${template1 Jour_Temp 2}°${color white}/${color lightblue}${template1 Nuit_Temp 2}°
${alignc 112}${voffset -13}${color red}${template1 Jour_Temp 3}°${color white}/${color lightblue}${template1 Nuit_Temp 3}°
${alignc 37}${voffset -13}${color red}${template1 Jour_Temp 4}°${color white}/${color lightblue}${template1 Nuit_Temp 4}°
${alignc -38}${voffset -13}${color red}${template1 Jour_Temp 5}°${color white}/${color lightblue}${template1 Nuit_Temp 5}°
${alignc -113}${voffset -13}${color red}${template1 Jour_Temp 6}°${color white}/${color lightblue}${template1 Nuit_Temp 6}°
${alignc -188}${voffset -13}${color red}${template1 Jour_Temp 7}°${color white}/${color lightblue}${template1 Nuit_Temp 7}°
##### Affichage vitesse du vent #####
${alignc 187}${font Ubuntu :size=8:style=bold}${color white}${voffset 39}${template1 Jour_VentForce 2}${font Ubuntu :size=6:style=bold} km/h
${alignc 112}${voffset -12}${font Ubuntu :size=8:style=bold}${template1 Jour_VentForce 3}${font Ubuntu :size=6:style=bold} km/h
${alignc 37}${voffset -12}${font Ubuntu :size=8:style=bold}${template1 Jour_VentForce 4}${font Ubuntu :size=6:style=bold} km/h
${alignc -38}${voffset -12}${font Ubuntu :size=8:style=bold}${template1 Jour_VentForce 5}${font Ubuntu :size=6:style=bold} km/h
${alignc -113}${font Ubuntu :size=8:style=bold}${voffset -12}${template1 Jour_VentForce 6}${font Ubuntu :size=6:style=bold} km/h
${alignc -188}${font Ubuntu :size=8:style=bold}${voffset -12}${template1 Jour_VentForce 7}${font Ubuntu :size=6:style=bold} km/h
##### Affichage Date #####
${voffset -2}${font Ubuntu :size=10}${color white}${alignc 187}${template1 Jour %a_%d 2}
${voffset -16}${alignc 112}${template1 Jour %a_%d 3}
${voffset -16}${alignc 37}${template1 Jour %a_%d 4}
${voffset -16}${alignc -38}${template1 Jour %a_%d 5}
${voffset -16}${alignc -113}${template1 Jour %a_%d 6}
${voffset -16}${alignc -188}${template1 Jour %a_%d 7}
#### Affichage des cadres utilisés dans le conky ####
${voffset -935}
#### premier cadre ####
${template0 base.png 0 40 450 110}
${template0 flip_bg.png 24 10 100 100}
${template0 flip_bg.png 134 10 100 100}
#### Second cadre ####
${template0 base.png 0 155 450 80}
#### icônes premier cadre ####
${template2 IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 205 75 132 70}
#### icônes Second cadre ####
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 0 168 75 45 2}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 75 168 75 45 3}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 150 168 75 45 4}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 225 168 75 45 5}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 300 168 75 45 6}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 375 168 75 45 7}

.gif)
Édité par loutch Le 28/04/2013 à 18h16
Linuxmint 24.02 Xia - Mageia 9 xfce et plasma sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX

thierryR Membre non connecté
-
- Voir le profil du membre thierryR
- Inscrit le : 02/02/2010
- Site internet
débusqueur de bugs et chercheur en améliorations
Amicalement vôtre.
Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

loutch Membre non connecté
-
- Voir le profil du membre loutch
- Inscrit le : 07/07/2010
- Groupes :
Linuxmint 24.02 Xia - Mageia 9 xfce et plasma sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX

loutch Membre non connecté
-
- Voir le profil du membre loutch
- Inscrit le : 07/07/2010
- Groupes :
.gif)
Premier éssais avec du lua :

.gif)
Linuxmint 24.02 Xia - Mageia 9 xfce et plasma sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX

loutch Membre non connecté
-
- Voir le profil du membre loutch
- Inscrit le : 07/07/2010
- Groupes :
.gif)
Pour ce que cela intérraissent un petit lua pour ajouter un fond au conky pour mieux le voir avec des fonds clairs
Créer un fichier texte et le nommer :
draw_bg.lua
et y coller ceci :
Caché :
--[[
Background by londonali1010 (2009)
This script draws a background to the Conky window. It covers the whole of the Conky window, but you can specify rounded corners, if you wish.
To call this script in Conky, use (assuming you have saved this script to ~/scripts/):
lua_load ~/scripts/draw_bg.lua
lua_draw_hook_pre draw_bg
Changelog:
+ v1.0 -- Original release (07.10.2009)
]]
-- Change these settings to affect your background.
-- "corner_r" is the radius, in pixels, of the rounded corners. If you don't want rounded corners, use 0.
corner_r=0
-- Set the colour and transparency (alpha) of your background.
bg_colour=0x000000
bg_alpha=0.3
require 'cairo'
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function conky_draw_bg()
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)
cairo_move_to(cr,corner_r,0)
cairo_line_to(cr,w-corner_r,0)
cairo_curve_to(cr,w,0,w,0,w,corner_r)
cairo_line_to(cr,w,h-corner_r)
cairo_curve_to(cr,w,h,w,h,w-corner_r,h)
cairo_line_to(cr,corner_r,h)
cairo_curve_to(cr,0,h,0,h,0,h-corner_r)
cairo_line_to(cr,0,corner_r)
cairo_curve_to(cr,0,0,0,0,corner_r,0)
cairo_close_path(cr)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))
cairo_fill(cr)
end
Background by londonali1010 (2009)
This script draws a background to the Conky window. It covers the whole of the Conky window, but you can specify rounded corners, if you wish.
To call this script in Conky, use (assuming you have saved this script to ~/scripts/):
lua_load ~/scripts/draw_bg.lua
lua_draw_hook_pre draw_bg
Changelog:
+ v1.0 -- Original release (07.10.2009)
]]
-- Change these settings to affect your background.
-- "corner_r" is the radius, in pixels, of the rounded corners. If you don't want rounded corners, use 0.
corner_r=0
-- Set the colour and transparency (alpha) of your background.
bg_colour=0x000000
bg_alpha=0.3
require 'cairo'
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function conky_draw_bg()
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)
cairo_move_to(cr,corner_r,0)
cairo_line_to(cr,w-corner_r,0)
cairo_curve_to(cr,w,0,w,0,w,corner_r)
cairo_line_to(cr,w,h-corner_r)
cairo_curve_to(cr,w,h,w,h,w-corner_r,h)
cairo_line_to(cr,corner_r,h)
cairo_curve_to(cr,0,h,0,h,0,h-corner_r)
cairo_line_to(cr,0,corner_r)
cairo_curve_to(cr,0,0,0,0,corner_r,0)
cairo_close_path(cr)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))
cairo_fill(cr)
end
modifier bg_alpha en fonction de l'opacité que vous voulez (0.1 clair 1= opaque)
puis rajouter ceci avant TEXT dans votre conkyrc:
lua_load ~/.conky/draw_bg.lua (attention ceci est mon chemin à modifier en fonction de votre chemin)
lua_draw_hook_pre draw_bg
Ca donne ceci :

.gif)
Édité par loutch Le 27/05/2013 à 15h10
Linuxmint 24.02 Xia - Mageia 9 xfce et plasma sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX

Adrien.D Membre non connecté
-
- Voir le profil du membre Adrien.D
- Inscrit le : 30/05/2011
- Site internet
- Groupes :
Petit ajout, le nom du système d'exploitation, qui récupère le nom et la version de la distrib via la commande
Code BASH :
lsb_release -d | cut -f2
Ainsi, ça s'adapte à n'importe quelle distrib

Caché :
background yes
use_xft yes
xftfont Sans: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,sticky
double_buffer yes
minimum_size 400 400
maximum_width 300
text_buffer_size 1200
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 10
gap_y 10
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
#
color1 white
#
color2 orange
#
color3 white
#
color4 lightblue
#cornflowerblue
# Lua Load #
#lua_load ~/.conky/ring.lua
#lua_draw_hook_pre clock_rings
TEXT
${font Sans:size=8}${color3}Système d'exploitation : ${goto 150}${color2}${exec lsb_release -d | cut -f2 }
${color3}Kernel: ${color2}${exec expr `uname -r | cut -d- -f1`} ${goto 150}${color3}Archi:${color2} $machine
${color3}Uptime:${color2} $uptime ${goto 150}${color3}Charge:${color2} $loadavg
${color3}Processus: ${color2} $processes${color3}${goto 150}En cours: ${color2} $running_processes
${color3}CPU: ${hr}${color2}
${color3}Frequence :${color2} ${freq_g} GHz
${color3}Core 1:${color2} ${cpu cpu0}%${goto 85}${color4}${cpubar cpu0 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 0' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 0' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}Core 2:${color2} ${cpu cpu1}%${goto 85}${color4}${cpubar cpu1 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 1' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 1' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}Core 3:${color2} ${cpu cpu2}%${goto 85}${color4}${cpubar cpu2 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 2' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 2' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}Core 4:${color2} ${cpu cpu3}%${goto 85}${color4}${cpubar cpu3 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 3' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 3' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}Core 5:${color2} ${cpu cpu4}%${goto 85}${color4}${cpubar cpu4 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 0' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 0' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}Core 6:${color2} ${cpu cpu5}%${goto 85}${color4}${cpubar cpu5 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 1' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 1' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}Core 7:${color2} ${cpu cpu6}%${goto 85}${color4}${cpubar cpu6 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 2' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 2' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}Core 8:${color2} ${cpu cpu7}%${goto 85}${color4}${cpubar cpu7 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 3' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 3' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}MEMOIRE: ${hr}${color2}
${color3}RAM:${goto 40}${color2} $mem / $memmax ${goto 170}$memperc% ${goto 200}${color4}${membar}${color2}
${color3}SWAP:${goto 40}${color2} ${swap} / ${swapmax} ${goto 170} ${swapperc}%${goto 200}${color4}${swapbar}
${color3}ESPACE DISQUE:${hr}${color2}
${color3}Racine ${color2}${goto 50}${fs_used /} / ${fs_size /} ${goto 170}${fs_used_perc /}% ${goto 200}${color4}${fs_bar /}${color2}
${color3}Home ${color2}${goto 50}${fs_used /home} / ${fs_size /home} ${goto 170}${fs_used_perc /home}% ${goto 200}${color4}${fs_bar /home}${color2}
${color3}DATA ${color2}${goto 50}${fs_used /media/DATA} / ${fs_size /media/DATA} ${goto 170}${fs_used_perc /media/DATA}% ${goto 200}${color4}${fs_bar /media/DATA}${color2}
${color3}RESEAU: ${hr}${color2}
${color3}Ethernet : ${color2}${addr eth0}
${color3}Download :${color2} ${downspeedf eth0}k/s ${goto 175}${color3}Upload :${color2} ${upspeedf eth0}k/s
${color3}Wi-Fi : ${color2}${addr wlan0}
${color3}Download :${color2} ${downspeedf wlan0}k/s ${goto 175}${color3}Upload :${color2} ${upspeedf wlan0}k/s
${color3}IP Publique : ${color2}${texeci 3600 wget http://checkip.dyndns.org -O - -o /dev/null | cut -d : -f 2 | cut -d < -f 1}
use_xft yes
xftfont Sans: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,sticky
double_buffer yes
minimum_size 400 400
maximum_width 300
text_buffer_size 1200
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 10
gap_y 10
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
#
color1 white
#
color2 orange
#
color3 white
#
color4 lightblue
#cornflowerblue
# Lua Load #
#lua_load ~/.conky/ring.lua
#lua_draw_hook_pre clock_rings
TEXT
${font Sans:size=8}${color3}Système d'exploitation : ${goto 150}${color2}${exec lsb_release -d | cut -f2 }
${color3}Kernel: ${color2}${exec expr `uname -r | cut -d- -f1`} ${goto 150}${color3}Archi:${color2} $machine
${color3}Uptime:${color2} $uptime ${goto 150}${color3}Charge:${color2} $loadavg
${color3}Processus: ${color2} $processes${color3}${goto 150}En cours: ${color2} $running_processes
${color3}CPU: ${hr}${color2}
${color3}Frequence :${color2} ${freq_g} GHz
${color3}Core 1:${color2} ${cpu cpu0}%${goto 85}${color4}${cpubar cpu0 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 0' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 0' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}Core 2:${color2} ${cpu cpu1}%${goto 85}${color4}${cpubar cpu1 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 1' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 1' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}Core 3:${color2} ${cpu cpu2}%${goto 85}${color4}${cpubar cpu2 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 2' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 2' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}Core 4:${color2} ${cpu cpu3}%${goto 85}${color4}${cpubar cpu3 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 3' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 3' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}Core 5:${color2} ${cpu cpu4}%${goto 85}${color4}${cpubar cpu4 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 0' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 0' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}Core 6:${color2} ${cpu cpu5}%${goto 85}${color4}${cpubar cpu5 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 1' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 1' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}Core 7:${color2} ${cpu cpu6}%${goto 85}${color4}${cpubar cpu6 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 2' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 2' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}Core 8:${color2} ${cpu cpu7}%${goto 85}${color4}${cpubar cpu7 6,60}${color2}${goto 170}${exec expr `sensors | grep 'Core 3' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}°C${goto 200}${color4}${execbar expr `sensors | grep 'Core 3' | cut -d+ -f2 | cut -d( -f1 | cut -d. -f1`}${color2}
${color3}MEMOIRE: ${hr}${color2}
${color3}RAM:${goto 40}${color2} $mem / $memmax ${goto 170}$memperc% ${goto 200}${color4}${membar}${color2}
${color3}SWAP:${goto 40}${color2} ${swap} / ${swapmax} ${goto 170} ${swapperc}%${goto 200}${color4}${swapbar}
${color3}ESPACE DISQUE:${hr}${color2}
${color3}Racine ${color2}${goto 50}${fs_used /} / ${fs_size /} ${goto 170}${fs_used_perc /}% ${goto 200}${color4}${fs_bar /}${color2}
${color3}Home ${color2}${goto 50}${fs_used /home} / ${fs_size /home} ${goto 170}${fs_used_perc /home}% ${goto 200}${color4}${fs_bar /home}${color2}
${color3}DATA ${color2}${goto 50}${fs_used /media/DATA} / ${fs_size /media/DATA} ${goto 170}${fs_used_perc /media/DATA}% ${goto 200}${color4}${fs_bar /media/DATA}${color2}
${color3}RESEAU: ${hr}${color2}
${color3}Ethernet : ${color2}${addr eth0}
${color3}Download :${color2} ${downspeedf eth0}k/s ${goto 175}${color3}Upload :${color2} ${upspeedf eth0}k/s
${color3}Wi-Fi : ${color2}${addr wlan0}
${color3}Download :${color2} ${downspeedf wlan0}k/s ${goto 175}${color3}Upload :${color2} ${upspeedf wlan0}k/s
${color3}IP Publique : ${color2}${texeci 3600 wget http://checkip.dyndns.org -O - -o /dev/null | cut -d : -f 2 | cut -d < -f 1}
Config : PC Fixe : X470 GAMING PRO- AMD Ryzen 5 2600X - 16Go RAM - Radeon RX 560 (Pilote libre) - Gentoo Linux - GNOME Desktop - Kernel 5.10 LTS
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !


lichkuan Membre non connecté
-
- Voir le profil du membre lichkuan
- Inscrit le : 05/09/2013
Superbes Conkies !!!!
Est-ce que vous quriez conky-mqnqger en RPM ou en source ?
Merci

loutch Membre non connecté
-
- Voir le profil du membre loutch
- Inscrit le : 07/07/2010
- Groupes :
.gif)
Mon dernier sur Mageia 2 KDE 64 avec une horloge (2 lua , un pour les cadrans et un autre pour faire défiler les heures.)

le conkyrc:
Caché :
background no
use_xft yes
xftfont DejaVu Sans :size=8
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 300 2
maximum_width 300
text_buffer_size 1024
draw_shades no
draw_outline no
draw_borders no
border_width 1
draw_graph_borders no
default_color c8c8c8
default_outline_color cacaca
alignment top_right
gap_x 0
gap_y 0
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
#
color1 white
#
color2 e8e8e8
#
color3 6495ee
#
color4 cacaca
#
color5 e7e7e7
#
color6 red
#cornflowerblue
# Lua Load #
#lua_load ~/.conky/ring.lua
#lua_draw_hook_pre clock_rings
lua_load ~/.conky/horloge.lua
lua_draw_hook_post main_rings
lua_load ~/.conky/grey.lua
lua_draw_hook_pre main
#lua_load ~/.conky/draw_bg.lua
#lua_draw_hook_pre draw_bg
TEXT
${font Sans:size=8}${color3}Kernel:${color2}$kernel
${color3}Uptime:${color2}$uptime
${color3}Processus:${color2}$processes${color3}${alignr}En cours: ${color2} $running_processes
${color3}KDE: ${color2}4.8.5
${color3}${hr}
${color3}Core 1:${color2} ${cpu cpu0}%${color2}${goto 90}${freq_g 1} GHz ${color6}${cpugraph 12,140 cpu1}
${color3}Temp :${color2} ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp1_input` / 1000}°C ${goto 120}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} > 55000}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} < 61000}${color orange}${else}${color red}${endif}${else}${color 6495ee}${endif}${execbar expr `cat /sys/class/hwmon/hwmon1/device/temp2_input` / 1000}${goto 120}${color4}${execbar echo 0}
${color3}Core 2:${color2} ${cpu cpu1}%${color2}${goto 90}${freq_g 2} GHz ${color6}${cpugraph 12,140 cpu2}
${color3}Temp :${color2} ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input` / 1000}°C ${goto 120}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} > 55000}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} < 61000}${color orange}${else}${color red}${endif}${else}${color 6495ee}${endif}${execbar expr `cat /sys/class/hwmon/hwmon1/device/temp1_input` / 1000}${goto 120}${color4}${execbar echo 0}
${color3}Core 3:${color2} ${cpu cpu2}%${color2}${goto 90}${freq_g 3} GHz ${color6}${cpugraph 12,140 cpu3}
${color3}Temp :${color2} ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp1_input` / 1000}°C ${goto 120}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} > 55000}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} < 61000}${color orange}${else}${color red}${endif}${else}${color 6495ee}${endif}${execbar expr `cat /sys/class/hwmon/hwmon1/device/temp2_input` / 1000}${goto 120}${color4}${execbar echo 0}
${color3}Core 4:${color2} ${cpu cpu3}%${color2}${goto 90}${freq_g 4} GHz ${color6}${cpugraph 12,140 cpu4}
${color3}Temp :${color2} ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input` / 1000}°C ${goto 120}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} > 55000}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} < 61000}${color orange}${else}${color red}${endif}${else}${color 6495ee}${endif}${execbar expr `cat /sys/class/hwmon/hwmon1/device/temp2_input` / 1000}${goto 120}${color4}${execbar echo 0}
${color3}${hr}
${color3}Ram : ${color2} $mem/$memmax ${goto 150}$memperc% ${goto 200}${color3}${membar 6,100}${goto 200}${color4}${wireless_link_bar 6,100 echo 0}
${color3}Swap: ${color2} ${swap} / ${swapmax} ${goto 150} ${swapperc}%${goto 200}${color3}${swapbar 6,100}${goto 200}${color4}${wireless_link_bar 6,100 echo 0}
${color3}${hr}
${color3}Quality:${goto 100}${color2}${wireless_link_qual_perc wlan0}%${goto 200}${color3}${wireless_link_bar 6,100 wlan0}${goto 200}${color5}${wireless_link_bar 6,100 wlan0 echo 0}
${color3}Down :${goto 100}${color2}${totaldown wlan0}${goto 195}${color5}${downspeedf wlan0}k/s
${color3}Up :${goto 100}${color2}${totalup wlan0}${goto 195}${color5}${upspeedf wlan0}k/s
${color3}URL${goto 130}NB PORTS OUVERTS:${color1}${tcp_portmon 1 65535 count}${goto 300}
${color2}${tcp_portmon 1 65535 rip 0}${goto 210}${tcp_portmon 1 65535 rport 0}
${color2}${tcp_portmon 1 65535 rip 1}${goto 210}${tcp_portmon 1 65535 rport 1}
${color2}${tcp_portmon 1 65535 rip 2}${goto 210}${tcp_portmon 1 65535 rport 2}
${color2}${tcp_portmon 1 65535 rip 3}${goto 210}${tcp_portmon 1 65535 rport 3}
${color2}${tcp_portmon 1 65535 rip 4}${goto 210}${tcp_portmon 1 65535 rport 4}
${color2}${tcp_portmon 1 65535 rip 5}${goto 210}${tcp_portmon 1 65535 rport 5}
${color3}${hr}
${color3}Processus CPU ${color3}PID CPU MEM
${color6}${top name 1} ${goto 120}${top pid 1}${goto 185}${top cpu 1}${goto 250}${top mem 1}
${color2}${top name 2} ${goto 120}${top pid 2}${goto 185}${top cpu 2}${goto 250}${top mem 2}
${color2}${top name 3} ${goto 120}${top pid 3}${goto 185}${top cpu 3}${goto 250}${top mem 3}
${color2}${top name 4} ${goto 120}${top pid 4}${goto 185}${top cpu 4}${goto 250}${top mem 4}
${color3}Processus MEM ${color3}PID CPU MEM
${color6}${top_mem name 1} ${goto 120}${top_mem pid 1}${goto 185}${top_mem cpu 1}${goto 250}${top_mem mem 1}
${color2}${top_mem name 2} ${goto 120}${top_mem pid 2}${goto 185}${top_mem cpu 2}${goto 250}${top_mem mem 2}
${color2}${top_mem name 3} ${goto 120}${top_mem pid 3}${goto 185}${top_mem cpu 3}${goto 250}${top_mem mem 3}
${color2}${top_mem name 4} ${goto 120}${top_mem pid 4}${goto 185}${top_mem cpu 4}${goto 250}${top_mem mem 4}
${color3}${hr}
${color3}Température Carte : ${color2}${hwmon 0 temp 1} °C
${color3}Température Disque : ${color2}${execi 10 hddtemp -n /dev/sda} °C
${color3}${hr}
${color3}Racine :${color5}${fs_used /} / ${fs_size /} ${goto 200}${fs_used_perc /}%
${color3}Home :${color5}${fs_used /home} / ${fs_size /home} ${goto 200}${fs_used_perc /home}%
${color3}Racine
${offset 30}${goto 02}Lecture: ${color2}${diskio_read sda6}${goto 118}${color3}Ecriture : ${color2}${diskio_write sda6}
${offset 30}${goto 5}${color1}${diskiograph_read sda6 10,90 0000ff ff0000}${goto 120}${diskiograph_write sda6 10,90 0000ff ff0000}
${color3}Home
${offset 30}${goto 02}Lecture: ${color2}${diskio_read sda8}${goto 118}${color3}Ecriture: ${color2}${diskio_write sda8}${goto 285}
${offset 30}${goto 5}${color1}${diskiograph_read sda8 10,90 0000ff ff0000}${goto 120}${diskiograph_write sda8 10,90 0000ff ff0000}
${color3}${hr}
${offset 15}${color3}Semaine : ${goto 150} ${color2}${time %V}
${offset 15}${color3}Jour : ${goto 150} ${color2}${time %A}
${font courier:style=bold:size=9}${color1}${execpi 300 TODAY=`date +%_d` ; cal -s | sed s/sa$/sa$'${color3}'/ | sed s/"$TODAY"'b'/'${color6}'"$TODAY"'${color1}'/}
#${goto 165}${color FF0000}${font caviar dreams:size=12}${time %H}:${color1}${time %M}:${color cornflowerblue}${time %S}
background no
use_xft yes
xftfont DejaVu Sans :size=8
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 300 2
maximum_width 300
text_buffer_size 1024
draw_shades no
draw_outline no
draw_borders no
border_width 1
draw_graph_borders no
default_color c8c8c8
default_outline_color cacaca
alignment top_right
gap_x 0
gap_y 0
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
#
color1 white
#
color2 e8e8e8
#
color3 6495ee
#
color4 cacaca
#
color5 e7e7e7
#
color6 red
#cornflowerblue
# Lua Load #
#lua_load ~/.conky/ring.lua
#lua_draw_hook_pre clock_rings
lua_load ~/.conky/horloge.lua
lua_draw_hook_post main_rings
lua_load ~/.conky/grey.lua
lua_draw_hook_pre main
#lua_load ~/.conky/draw_bg.lua
#lua_draw_hook_pre draw_bg
TEXT
${font Sans:size=8}${color3}Kernel:${color2}$kernel
${color3}Uptime:${color2}$uptime
${color3}Processus:${color2}$processes${color3}${alignr}En cours: ${color2} $running_processes
${color3}KDE: ${color2}4.8.5
${color3}${hr}
${color3}Core 1:${color2} ${cpu cpu0}%${color2}${goto 90}${freq_g 1} GHz ${color6}${cpugraph 12,140 cpu1}
${color3}Temp :${color2} ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp1_input` / 1000}°C ${goto 120}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} > 55000}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} < 61000}${color orange}${else}${color red}${endif}${else}${color 6495ee}${endif}${execbar expr `cat /sys/class/hwmon/hwmon1/device/temp2_input` / 1000}${goto 120}${color4}${execbar echo 0}
${color3}Core 2:${color2} ${cpu cpu1}%${color2}${goto 90}${freq_g 2} GHz ${color6}${cpugraph 12,140 cpu2}
${color3}Temp :${color2} ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input` / 1000}°C ${goto 120}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} > 55000}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} < 61000}${color orange}${else}${color red}${endif}${else}${color 6495ee}${endif}${execbar expr `cat /sys/class/hwmon/hwmon1/device/temp1_input` / 1000}${goto 120}${color4}${execbar echo 0}
${color3}Core 3:${color2} ${cpu cpu2}%${color2}${goto 90}${freq_g 3} GHz ${color6}${cpugraph 12,140 cpu3}
${color3}Temp :${color2} ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp1_input` / 1000}°C ${goto 120}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} > 55000}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} < 61000}${color orange}${else}${color red}${endif}${else}${color 6495ee}${endif}${execbar expr `cat /sys/class/hwmon/hwmon1/device/temp2_input` / 1000}${goto 120}${color4}${execbar echo 0}
${color3}Core 4:${color2} ${cpu cpu3}%${color2}${goto 90}${freq_g 4} GHz ${color6}${cpugraph 12,140 cpu4}
${color3}Temp :${color2} ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input` / 1000}°C ${goto 120}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} > 55000}${if_match ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp2_input`} < 61000}${color orange}${else}${color red}${endif}${else}${color 6495ee}${endif}${execbar expr `cat /sys/class/hwmon/hwmon1/device/temp2_input` / 1000}${goto 120}${color4}${execbar echo 0}
${color3}${hr}
${color3}Ram : ${color2} $mem/$memmax ${goto 150}$memperc% ${goto 200}${color3}${membar 6,100}${goto 200}${color4}${wireless_link_bar 6,100 echo 0}
${color3}Swap: ${color2} ${swap} / ${swapmax} ${goto 150} ${swapperc}%${goto 200}${color3}${swapbar 6,100}${goto 200}${color4}${wireless_link_bar 6,100 echo 0}
${color3}${hr}
${color3}Quality:${goto 100}${color2}${wireless_link_qual_perc wlan0}%${goto 200}${color3}${wireless_link_bar 6,100 wlan0}${goto 200}${color5}${wireless_link_bar 6,100 wlan0 echo 0}
${color3}Down :${goto 100}${color2}${totaldown wlan0}${goto 195}${color5}${downspeedf wlan0}k/s
${color3}Up :${goto 100}${color2}${totalup wlan0}${goto 195}${color5}${upspeedf wlan0}k/s
${color3}URL${goto 130}NB PORTS OUVERTS:${color1}${tcp_portmon 1 65535 count}${goto 300}
${color2}${tcp_portmon 1 65535 rip 0}${goto 210}${tcp_portmon 1 65535 rport 0}
${color2}${tcp_portmon 1 65535 rip 1}${goto 210}${tcp_portmon 1 65535 rport 1}
${color2}${tcp_portmon 1 65535 rip 2}${goto 210}${tcp_portmon 1 65535 rport 2}
${color2}${tcp_portmon 1 65535 rip 3}${goto 210}${tcp_portmon 1 65535 rport 3}
${color2}${tcp_portmon 1 65535 rip 4}${goto 210}${tcp_portmon 1 65535 rport 4}
${color2}${tcp_portmon 1 65535 rip 5}${goto 210}${tcp_portmon 1 65535 rport 5}
${color3}${hr}
${color3}Processus CPU ${color3}PID CPU MEM
${color6}${top name 1} ${goto 120}${top pid 1}${goto 185}${top cpu 1}${goto 250}${top mem 1}
${color2}${top name 2} ${goto 120}${top pid 2}${goto 185}${top cpu 2}${goto 250}${top mem 2}
${color2}${top name 3} ${goto 120}${top pid 3}${goto 185}${top cpu 3}${goto 250}${top mem 3}
${color2}${top name 4} ${goto 120}${top pid 4}${goto 185}${top cpu 4}${goto 250}${top mem 4}
${color3}Processus MEM ${color3}PID CPU MEM
${color6}${top_mem name 1} ${goto 120}${top_mem pid 1}${goto 185}${top_mem cpu 1}${goto 250}${top_mem mem 1}
${color2}${top_mem name 2} ${goto 120}${top_mem pid 2}${goto 185}${top_mem cpu 2}${goto 250}${top_mem mem 2}
${color2}${top_mem name 3} ${goto 120}${top_mem pid 3}${goto 185}${top_mem cpu 3}${goto 250}${top_mem mem 3}
${color2}${top_mem name 4} ${goto 120}${top_mem pid 4}${goto 185}${top_mem cpu 4}${goto 250}${top_mem mem 4}
${color3}${hr}
${color3}Température Carte : ${color2}${hwmon 0 temp 1} °C
${color3}Température Disque : ${color2}${execi 10 hddtemp -n /dev/sda} °C
${color3}${hr}
${color3}Racine :${color5}${fs_used /} / ${fs_size /} ${goto 200}${fs_used_perc /}%
${color3}Home :${color5}${fs_used /home} / ${fs_size /home} ${goto 200}${fs_used_perc /home}%
${color3}Racine
${offset 30}${goto 02}Lecture: ${color2}${diskio_read sda6}${goto 118}${color3}Ecriture : ${color2}${diskio_write sda6}
${offset 30}${goto 5}${color1}${diskiograph_read sda6 10,90 0000ff ff0000}${goto 120}${diskiograph_write sda6 10,90 0000ff ff0000}
${color3}Home
${offset 30}${goto 02}Lecture: ${color2}${diskio_read sda8}${goto 118}${color3}Ecriture: ${color2}${diskio_write sda8}${goto 285}
${offset 30}${goto 5}${color1}${diskiograph_read sda8 10,90 0000ff ff0000}${goto 120}${diskiograph_write sda8 10,90 0000ff ff0000}
${color3}${hr}
${offset 15}${color3}Semaine : ${goto 150} ${color2}${time %V}
${offset 15}${color3}Jour : ${goto 150} ${color2}${time %A}
${font courier:style=bold:size=9}${color1}${execpi 300 TODAY=`date +%_d` ; cal -s | sed s/sa$/sa$'${color3}'/ | sed s/"$TODAY"'b'/'${color6}'"$TODAY"'${color1}'/}
#${goto 165}${color FF0000}${font caviar dreams:size=12}${time %H}:${color1}${time %M}:${color cornflowerblue}${time %S}
le lua cadran :
Caché :
--[[
Ring Meters by londonali1010 (2009)
This script draws percentage meters as rings. It is fully customisable; all options are described in the script.
IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 145 uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num>5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num>3; conversely if you update Conky every 0.5s, you should use update_num>10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.
To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
lua_load ~/scripts/rings-v1.2.lua
lua_draw_hook_pre ring_stats
Changelog:
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)
]]
require 'cairo'
function conky_main_rings()
if (os.date("%l"))=='12' then
heure=(os.date("%M")/60)
else
heure=(os.date("%l"))+(os.date("%M")/60)
end
-- START PARAMETERS HERE
local rings_settings={
{
name="",
arg=heure,
max=11.99,
xc=230,
yc=780,
radius=57,
thickness=5,
gap_sectors=5,
sectors=12,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0xFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
fg_colour2={{0,0XFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
bd_colour1={{0,0XFF0000,1},{0.5,0xFF0000,1}, {1,0xFF0000,1}},
},
{
name="",
arg=(os.date("%M"))+(os.date("%S")/60),
max=59.99,
xc=230,
yc=780,
radius=50,
thickness=5,
start_angle=0,
end_angle=360,
gap_sectors=1,
sectors=60,
fill_sector=false,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0XFFFFFF,0},{0.5,0XFFFFFF,1}, {1,0XFFFFFF,0}},
fg_colour2={{0,0xFFFFFF,0},{0.5,0xFFFFFF,1}, {1,0xFFFFFF,0}},
bd_colour1={{0,0XFFFFFF,1},{0.5,0xFFFFFF,1}, {1,0xFFFFFF,1}},
},
{
name="time",
arg="%S",
max=60,
xc=230,
yc=780,
radius=43,
thickness=5,
start_angle=0,
end_angle=360,
sectors=60,
fill_sector=false,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{1,0X6495EE,1},{1,0x6495EE,1}, {1,0x6495EE,1}},
fg_colour2={{1,0X6495EE,1},{1,0x6495EE,1}, {1,0x6495EE,1}},
bd_colour1={{0,0X6495EE,1},{0.5,0x6495EE,1}, {1,0x6495EE,1}},
},
}
--END OF PARAMETERS HERE
--main function
--if conky_window==nil then return end
local cs=cairo_xlib_surface_create(conky_window.display,
conky_window.drawable,
conky_window.visual, conky_window.width, conky_window.height)
local cr=cairo_create(cs)
if tonumber(conky_parse('${updates}'))>3 then
for i in pairs(rings_settings) do
draw_ring(cr,rings_settings[i])
end
end
cairo_destroy(cr)
end
function draw_ring(cr, t)
local function rgba_to_r_g_b_a(tcolour)
local colour,alpha=tcolour[2],tcolour[3]
return ((colour / 0x10000) % 0x100) / 255.,
((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
local function calc_delta(tcol1,tcol2)
--calculate deltas P R G B A to table_colour 1
for x = 1, #tcol1 do
tcol1[x].dA = 0
tcol1[x].dP = 0
tcol1[x].dR = 0
tcol1[x].dG = 0
tcol1[x].dB = 0
if tcol2~=nil and #tcol1 == #tcol2 then
local r1,g1,b1,a1 = rgba_to_r_g_b_a(tcol1[x])
local r2,g2,b2,a2 = rgba_to_r_g_b_a(tcol2[x])
tcol1[x].dP = (tcol2[x][1]-tcol1[x][1])/t.sectors
tcol1[x].dR = (r2-r1)/t.sectors
tcol1[x].dG = (g2-g1)/t.sectors
tcol1[x].dB = (b2-b1)/t.sectors
tcol1[x].dA = (a2-a1)/t.sectors
end
end
return tcol1
end
--check values
local function setup(t)
if t.name==nil and t.arg==nil then
print ("No input values ... use parameters 'name'" +
" with 'arg' or only parameter 'arg' ")
return
end
if t.max==nil then
print ("No maximum value defined, use 'max'")
print ("for name=" .. t.name)
print ("with arg=" .. t.arg)
return
end
if t.name==nil then t.name="" end
if t.arg==nil then t.arg="" end
if t.xc==nil then t.xc=conky_window.width/2 end
if t.yc==nil then t.yc=conky_window.height/2 end
if t.thickness ==nil then t.thickness = 10 end
if t.radius ==nil then t.radius =conky_window.width/4 end
if t.start_angle==nil then t.start_angle =0 end
if t.end_angle==nil then t.end_angle=360 end
if t.bg_colour1==nil then
t.bg_colour1={{0,0x00ffff,0.1},{0.5,0x00FFFF,0.5},{1,0x00FFFF,0.1}}
end
if t.fg_colour1==nil then
t.fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1},{1,0x00FF00,0.1}}
end
if t.bd_colour1==nil then
t.bd_colour1={{0,0xFFFF00,0.5},{0.5,0xFFFF00,1},{1,0xFFFF00,0.5}}
end
if t.sectors==nil then t.sectors=10 end
if t.gap_sectors==nil then t.gap_sectors=1 end
if t.fill_sector==nil then t.fill_sector=false end
if t.sectors==1 then t.fill_sector=false end
if t.border_size==nil then t.border_size=0 end
if t.cap==nil then t.cap="p" end
--some checks
if t.thickness>t.radius then t.thickness=t.radius*0.1 end
t.int_radius = t.radius-t.thickness
--check colors tables
for i=1, #t.bg_colour1 do
if #t.bg_colour1[i]~=3 then t.bg_colour1[i]={1,0xFFFFFF,0.5} end
end
for i=1, #t.fg_colour1 do
if #t.fg_colour1[i]~=3 then t.fg_colour1[i]={1,0xFF0000,1} end
end
for i=1, #t.bd_colour1 do
if #t.bd_colour1[i]~=3 then t.bd_colour1[i]={1,0xFFFF00,1} end
end
if t.bg_colour2~=nil then
for i=1, #t.bg_colour2 do
if #t.bg_colour2[i]~=3 then t.bg_colour2[i]={1,0xFFFFFF,0.5} end
end
end
if t.fg_colour2~=nil then
for i=1, #t.fg_colour2 do
if #t.fg_colour2[i]~=3 then t.fg_colour2[i]={1,0xFF0000,1} end
end
end
if t.bd_colour2~=nil then
for i=1, #t.bd_colour2 do
if #t.bd_colour2[i]~=3 then t.bd_colour2[i]={1,0xFFFF00,1} end
end
end
if t.start_angle>=t.end_angle then
local tmp_angle=t.end_angle
t.end_angle= t.start_angle
t.start_angle = tmp_angle
-- print ("inversed angles")
if t.end_angle-t.start_angle>360 and t.start_angle>0 then
t.end_angle=360+t.start_angle
print ("reduce angles")
end
if t.end_angle+t.start_angle>360 and t.start_angle<=0 then
t.end_angle=360+t.start_angle
print ("reduce angles")
end
if t.int_radius<0 then t.int_radius =0 end
if t.int_radius>t.radius then
local tmp_radius=t.radius
t.radius=t.int_radius
t.int_radius=tmp_radius
print ("inversed radius")
end
if t.int_radius==t.radius then
t.int_radius=0
print ("int radius set to 0")
end
end
t.fg_colour1 = calc_delta(t.fg_colour1,t.fg_colour2)
t.bg_colour1 = calc_delta(t.bg_colour1,t.bg_colour2)
t.bd_colour1 = calc_delta(t.bd_colour1,t.bd_colour2)
end
if t.draw_me == true then t.draw_me = nil end
if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end
--initialize table
setup(t)
--initialize cairo context
cairo_save(cr)
cairo_translate(cr,t.xc,t.yc)
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND)
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND)
--get value
local value = 0
if t.name ~="" then
value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
else
value = tonumber(t.arg)
end
if value==nil then value =0 end
--initialize sectors
--angle of a sector :
local angleA = ((t.end_angle-t.start_angle)/t.sectors)*math.pi/180
--value of a sector :
local valueA = t.max/t.sectors
--first angle of a sector :
local lastAngle = t.start_angle*math.pi/180
local function draw_sector(type_arc,angle0,angle,valpc, idx)
--this function draws a portion of arc
--type of arc, angle0 = strating angle, angle= angle of sector,
--valpc = percentage inside the sector, idx = sctor number #
local tcolor
if type_arc=="bg" then --background
if valpc==1 then return end
tcolor=t.bg_colour1
elseif type_arc=="fg" then --foreground
if valpc==0 then return end
tcolor=t.fg_colour1
elseif type_arc=="bd" then --border
tcolor=t.bd_colour1
end
--angles equivalents to gap_sector
local ext_delta=math.atan(t.gap_sectors/(2*t.radius))
local int_delta=math.atan(t.gap_sectors/(2*t.int_radius))
--angles of arcs
local ext_angle=(angle-ext_delta*2)*valpc
local int_angle=(angle-int_delta*2)*valpc
--define colours to use for this sector
if #tcolor==1 then
--plain color
local vR,vG,vB,vA = rgba_to_r_g_b_a(tcolor[1])
cairo_set_source_rgba(cr,vR+tcolor[1].dR*idx,
vG+tcolor[1].dG*idx,
vB+tcolor[1].dB*idx,
vA+tcolor[1].dA*idx )
else
--radient color
local pat=cairo_pattern_create_radial(0,0,t.int_radius,0,0,t.radius)
for i=1, #tcolor do
local vP,vR,vG,vB,vA = tcolor[i][1], rgba_to_r_g_b_a(tcolor[i])
cairo_pattern_add_color_stop_rgba (pat,
vP+tcolor[i].dP*idx,
vR+tcolor[i].dR*idx,
vG+tcolor[i].dG*idx,
vB+tcolor[i].dB*idx,
vA+tcolor[i].dA*idx )
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
end
--start drawing
cairo_save(cr)
--x axis is parrallel to start of sector
cairo_rotate(cr,angle0-math.pi/2)
local ri,re = t.int_radius ,t.radius
--point A
local angle_a
if t.cap == "p" then
angle_a = int_delta
if t.inverse_arc and type_arc ~="bg" then
angle_a = angle-int_angle-int_delta
end
if not(t.inverse_arc) and type_arc =="bg" then
angle_a = int_delta+int_angle
end
else --t.cap=="r"
angle_a = ext_delta
if t.inverse_arc and type_arc~="bg" then
angle_a = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_a = ext_delta+ext_angle
end
end
local ax,ay = ri*math.cos(angle_a),ri*math.sin(angle_a)
--point B
local angle_b = ext_delta
if t.cap == "p" then
if t.inverse_arc and type_arc ~="bg" then
angle_b = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_b = ext_delta+ext_angle
end
else
if t.inverse_arc and type_arc ~="bg" then
angle_b = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_b = ext_delta+ext_angle
end
end
local bx,by = re*math.cos(angle_b),re*math.sin(angle_b)
-- EXTERNAL ARC B --> C
local b0,b1
if t.inverse_arc then
if type_arc=="bg" then
b0,b1= ext_delta, angle-ext_delta-ext_angle
else
b0,b1= angle-ext_angle-ext_delta, angle-ext_delta
end
else
if type_arc=="bg" then
b0,b1= ext_delta+ext_angle, angle-ext_delta
else
b0,b1= ext_delta, ext_angle+ext_delta
end
end
---POINT D
local angle_c, angle_d
if t.cap == "p" then
angle_d = angle-int_delta
if t.inverse_arc and type_arc=="bg" then
angle_d = angle-int_delta-int_angle
end
if not(t.inverse_arc) and type_arc~="bg" then
angle_d=int_delta+int_angle
end
else
angle_d = angle-ext_delta
if t.inverse_arc and type_arc=="bg" then
angle_d =angle-ext_delta-ext_angle
end
if not(t.inverse_arc) and type_arc~="bg" then
angle_d = ext_angle+ext_delta
end
end
local dx,dy = ri*math.cos(angle_d),ri*math.sin(angle_d)
-- INTERNAL ARC D --> A
local d0,d1
if t.cap=="p" then
if t.inverse_arc then
if type_arc=="bg" then
d0,d1= angle-int_delta-int_angle,int_delta
else
d0,d1= angle-int_delta, angle- int_angle-int_delta
end
else
if type_arc=="bg" then
d0,d1= angle-int_delta, int_delta+int_angle
else
d0,d1= int_delta+int_angle, int_delta
end
end
else
if t.inverse_arc then
if type_arc=="bg" then
d0,d1= angle-ext_delta-ext_angle,ext_delta
else
d0,d1= angle-ext_delta, angle- ext_angle-ext_delta
end
else
if type_arc=="bg" then
d0,d1= angle-ext_delta,ext_delta+ext_angle
else
d0,d1= ext_angle+ext_delta, ext_delta
end
end
end
--draw sector
cairo_move_to(cr,ax,ay)
cairo_line_to(cr,bx,by)
cairo_arc(cr,0,0,re,b0,b1)
cairo_line_to(cr,dx,dy)
cairo_arc_negative(cr,0,0,ri,d0,d1)
cairo_close_path (cr);
--stroke or fill sector
if type_arc=="bd" then
cairo_set_line_width(cr,t.border_size)
cairo_stroke(cr)
else
cairo_fill(cr)
end
cairo_restore(cr)
end
--draw sectors
local n0,n1,n2 = 1,t.sectors,1
if t.inverse_arc then n0,n1,n2 = t.sectors,1,-1 end
local index = 0
for i = n0,n1,n2 do
index = index +1
local valueZ=1
local cstA, cstB = (i-1),i
if t.inverse_arc then cstA,cstB = (t.sectors-i), (t.sectors-i+1) end
if value>valueA *cstA and value<valueA*cstB then
if not t.fill_sector then
valueZ = (value-valueA*cstA)/valueA
end
else
if value<valueA*cstB then valueZ=0 end
end
local start_angle= lastAngle+(i-1)*angleA
if t.foreground ~= false then
draw_sector("fg",start_angle,angleA,valueZ, index)
end
if t.background ~= false then
draw_sector("bg",start_angle,angleA,valueZ, i)
end
if t.border_size>0 then draw_sector("bd",start_angle,angleA,1, i) end
end
cairo_restore(cr)
end
--[[END OF RING-SECTORS WIDGET]]
--[[
Ring Meters by londonali1010 (2009)
This script draws percentage meters as rings. It is fully customisable; all options are described in the script.
IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 145 uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num>5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num>3; conversely if you update Conky every 0.5s, you should use update_num>10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.
To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
lua_load ~/scripts/rings-v1.2.lua
lua_draw_hook_pre ring_stats
Changelog:
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)
]]
require 'cairo'
function conky_main_rings()
if (os.date("%l"))=='12' then
heure=(os.date("%M")/60)
else
heure=(os.date("%l"))+(os.date("%M")/60)
end
-- START PARAMETERS HERE
local rings_settings={
{
name="",
arg=heure,
max=11.99,
xc=230,
yc=780,
radius=57,
thickness=5,
gap_sectors=5,
sectors=12,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0xFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
fg_colour2={{0,0XFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
bd_colour1={{0,0XFF0000,1},{0.5,0xFF0000,1}, {1,0xFF0000,1}},
},
{
name="",
arg=(os.date("%M"))+(os.date("%S")/60),
max=59.99,
xc=230,
yc=780,
radius=50,
thickness=5,
start_angle=0,
end_angle=360,
gap_sectors=1,
sectors=60,
fill_sector=false,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0XFFFFFF,0},{0.5,0XFFFFFF,1}, {1,0XFFFFFF,0}},
fg_colour2={{0,0xFFFFFF,0},{0.5,0xFFFFFF,1}, {1,0xFFFFFF,0}},
bd_colour1={{0,0XFFFFFF,1},{0.5,0xFFFFFF,1}, {1,0xFFFFFF,1}},
},
{
name="time",
arg="%S",
max=60,
xc=230,
yc=780,
radius=43,
thickness=5,
start_angle=0,
end_angle=360,
sectors=60,
fill_sector=false,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{1,0X6495EE,1},{1,0x6495EE,1}, {1,0x6495EE,1}},
fg_colour2={{1,0X6495EE,1},{1,0x6495EE,1}, {1,0x6495EE,1}},
bd_colour1={{0,0X6495EE,1},{0.5,0x6495EE,1}, {1,0x6495EE,1}},
},
}
--END OF PARAMETERS HERE
--main function
--if conky_window==nil then return end
local cs=cairo_xlib_surface_create(conky_window.display,
conky_window.drawable,
conky_window.visual, conky_window.width, conky_window.height)
local cr=cairo_create(cs)
if tonumber(conky_parse('${updates}'))>3 then
for i in pairs(rings_settings) do
draw_ring(cr,rings_settings[i])
end
end
cairo_destroy(cr)
end
function draw_ring(cr, t)
local function rgba_to_r_g_b_a(tcolour)
local colour,alpha=tcolour[2],tcolour[3]
return ((colour / 0x10000) % 0x100) / 255.,
((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
local function calc_delta(tcol1,tcol2)
--calculate deltas P R G B A to table_colour 1
for x = 1, #tcol1 do
tcol1[x].dA = 0
tcol1[x].dP = 0
tcol1[x].dR = 0
tcol1[x].dG = 0
tcol1[x].dB = 0
if tcol2~=nil and #tcol1 == #tcol2 then
local r1,g1,b1,a1 = rgba_to_r_g_b_a(tcol1[x])
local r2,g2,b2,a2 = rgba_to_r_g_b_a(tcol2[x])
tcol1[x].dP = (tcol2[x][1]-tcol1[x][1])/t.sectors
tcol1[x].dR = (r2-r1)/t.sectors
tcol1[x].dG = (g2-g1)/t.sectors
tcol1[x].dB = (b2-b1)/t.sectors
tcol1[x].dA = (a2-a1)/t.sectors
end
end
return tcol1
end
--check values
local function setup(t)
if t.name==nil and t.arg==nil then
print ("No input values ... use parameters 'name'" +
" with 'arg' or only parameter 'arg' ")
return
end
if t.max==nil then
print ("No maximum value defined, use 'max'")
print ("for name=" .. t.name)
print ("with arg=" .. t.arg)
return
end
if t.name==nil then t.name="" end
if t.arg==nil then t.arg="" end
if t.xc==nil then t.xc=conky_window.width/2 end
if t.yc==nil then t.yc=conky_window.height/2 end
if t.thickness ==nil then t.thickness = 10 end
if t.radius ==nil then t.radius =conky_window.width/4 end
if t.start_angle==nil then t.start_angle =0 end
if t.end_angle==nil then t.end_angle=360 end
if t.bg_colour1==nil then
t.bg_colour1={{0,0x00ffff,0.1},{0.5,0x00FFFF,0.5},{1,0x00FFFF,0.1}}
end
if t.fg_colour1==nil then
t.fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1},{1,0x00FF00,0.1}}
end
if t.bd_colour1==nil then
t.bd_colour1={{0,0xFFFF00,0.5},{0.5,0xFFFF00,1},{1,0xFFFF00,0.5}}
end
if t.sectors==nil then t.sectors=10 end
if t.gap_sectors==nil then t.gap_sectors=1 end
if t.fill_sector==nil then t.fill_sector=false end
if t.sectors==1 then t.fill_sector=false end
if t.border_size==nil then t.border_size=0 end
if t.cap==nil then t.cap="p" end
--some checks
if t.thickness>t.radius then t.thickness=t.radius*0.1 end
t.int_radius = t.radius-t.thickness
--check colors tables
for i=1, #t.bg_colour1 do
if #t.bg_colour1[i]~=3 then t.bg_colour1[i]={1,0xFFFFFF,0.5} end
end
for i=1, #t.fg_colour1 do
if #t.fg_colour1[i]~=3 then t.fg_colour1[i]={1,0xFF0000,1} end
end
for i=1, #t.bd_colour1 do
if #t.bd_colour1[i]~=3 then t.bd_colour1[i]={1,0xFFFF00,1} end
end
if t.bg_colour2~=nil then
for i=1, #t.bg_colour2 do
if #t.bg_colour2[i]~=3 then t.bg_colour2[i]={1,0xFFFFFF,0.5} end
end
end
if t.fg_colour2~=nil then
for i=1, #t.fg_colour2 do
if #t.fg_colour2[i]~=3 then t.fg_colour2[i]={1,0xFF0000,1} end
end
end
if t.bd_colour2~=nil then
for i=1, #t.bd_colour2 do
if #t.bd_colour2[i]~=3 then t.bd_colour2[i]={1,0xFFFF00,1} end
end
end
if t.start_angle>=t.end_angle then
local tmp_angle=t.end_angle
t.end_angle= t.start_angle
t.start_angle = tmp_angle
-- print ("inversed angles")
if t.end_angle-t.start_angle>360 and t.start_angle>0 then
t.end_angle=360+t.start_angle
print ("reduce angles")
end
if t.end_angle+t.start_angle>360 and t.start_angle<=0 then
t.end_angle=360+t.start_angle
print ("reduce angles")
end
if t.int_radius<0 then t.int_radius =0 end
if t.int_radius>t.radius then
local tmp_radius=t.radius
t.radius=t.int_radius
t.int_radius=tmp_radius
print ("inversed radius")
end
if t.int_radius==t.radius then
t.int_radius=0
print ("int radius set to 0")
end
end
t.fg_colour1 = calc_delta(t.fg_colour1,t.fg_colour2)
t.bg_colour1 = calc_delta(t.bg_colour1,t.bg_colour2)
t.bd_colour1 = calc_delta(t.bd_colour1,t.bd_colour2)
end
if t.draw_me == true then t.draw_me = nil end
if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end
--initialize table
setup(t)
--initialize cairo context
cairo_save(cr)
cairo_translate(cr,t.xc,t.yc)
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND)
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND)
--get value
local value = 0
if t.name ~="" then
value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
else
value = tonumber(t.arg)
end
if value==nil then value =0 end
--initialize sectors
--angle of a sector :
local angleA = ((t.end_angle-t.start_angle)/t.sectors)*math.pi/180
--value of a sector :
local valueA = t.max/t.sectors
--first angle of a sector :
local lastAngle = t.start_angle*math.pi/180
local function draw_sector(type_arc,angle0,angle,valpc, idx)
--this function draws a portion of arc
--type of arc, angle0 = strating angle, angle= angle of sector,
--valpc = percentage inside the sector, idx = sctor number #
local tcolor
if type_arc=="bg" then --background
if valpc==1 then return end
tcolor=t.bg_colour1
elseif type_arc=="fg" then --foreground
if valpc==0 then return end
tcolor=t.fg_colour1
elseif type_arc=="bd" then --border
tcolor=t.bd_colour1
end
--angles equivalents to gap_sector
local ext_delta=math.atan(t.gap_sectors/(2*t.radius))
local int_delta=math.atan(t.gap_sectors/(2*t.int_radius))
--angles of arcs
local ext_angle=(angle-ext_delta*2)*valpc
local int_angle=(angle-int_delta*2)*valpc
--define colours to use for this sector
if #tcolor==1 then
--plain color
local vR,vG,vB,vA = rgba_to_r_g_b_a(tcolor[1])
cairo_set_source_rgba(cr,vR+tcolor[1].dR*idx,
vG+tcolor[1].dG*idx,
vB+tcolor[1].dB*idx,
vA+tcolor[1].dA*idx )
else
--radient color
local pat=cairo_pattern_create_radial(0,0,t.int_radius,0,0,t.radius)
for i=1, #tcolor do
local vP,vR,vG,vB,vA = tcolor[i][1], rgba_to_r_g_b_a(tcolor[i])
cairo_pattern_add_color_stop_rgba (pat,
vP+tcolor[i].dP*idx,
vR+tcolor[i].dR*idx,
vG+tcolor[i].dG*idx,
vB+tcolor[i].dB*idx,
vA+tcolor[i].dA*idx )
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
end
--start drawing
cairo_save(cr)
--x axis is parrallel to start of sector
cairo_rotate(cr,angle0-math.pi/2)
local ri,re = t.int_radius ,t.radius
--point A
local angle_a
if t.cap == "p" then
angle_a = int_delta
if t.inverse_arc and type_arc ~="bg" then
angle_a = angle-int_angle-int_delta
end
if not(t.inverse_arc) and type_arc =="bg" then
angle_a = int_delta+int_angle
end
else --t.cap=="r"
angle_a = ext_delta
if t.inverse_arc and type_arc~="bg" then
angle_a = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_a = ext_delta+ext_angle
end
end
local ax,ay = ri*math.cos(angle_a),ri*math.sin(angle_a)
--point B
local angle_b = ext_delta
if t.cap == "p" then
if t.inverse_arc and type_arc ~="bg" then
angle_b = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_b = ext_delta+ext_angle
end
else
if t.inverse_arc and type_arc ~="bg" then
angle_b = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_b = ext_delta+ext_angle
end
end
local bx,by = re*math.cos(angle_b),re*math.sin(angle_b)
-- EXTERNAL ARC B --> C
local b0,b1
if t.inverse_arc then
if type_arc=="bg" then
b0,b1= ext_delta, angle-ext_delta-ext_angle
else
b0,b1= angle-ext_angle-ext_delta, angle-ext_delta
end
else
if type_arc=="bg" then
b0,b1= ext_delta+ext_angle, angle-ext_delta
else
b0,b1= ext_delta, ext_angle+ext_delta
end
end
---POINT D
local angle_c, angle_d
if t.cap == "p" then
angle_d = angle-int_delta
if t.inverse_arc and type_arc=="bg" then
angle_d = angle-int_delta-int_angle
end
if not(t.inverse_arc) and type_arc~="bg" then
angle_d=int_delta+int_angle
end
else
angle_d = angle-ext_delta
if t.inverse_arc and type_arc=="bg" then
angle_d =angle-ext_delta-ext_angle
end
if not(t.inverse_arc) and type_arc~="bg" then
angle_d = ext_angle+ext_delta
end
end
local dx,dy = ri*math.cos(angle_d),ri*math.sin(angle_d)
-- INTERNAL ARC D --> A
local d0,d1
if t.cap=="p" then
if t.inverse_arc then
if type_arc=="bg" then
d0,d1= angle-int_delta-int_angle,int_delta
else
d0,d1= angle-int_delta, angle- int_angle-int_delta
end
else
if type_arc=="bg" then
d0,d1= angle-int_delta, int_delta+int_angle
else
d0,d1= int_delta+int_angle, int_delta
end
end
else
if t.inverse_arc then
if type_arc=="bg" then
d0,d1= angle-ext_delta-ext_angle,ext_delta
else
d0,d1= angle-ext_delta, angle- ext_angle-ext_delta
end
else
if type_arc=="bg" then
d0,d1= angle-ext_delta,ext_delta+ext_angle
else
d0,d1= ext_angle+ext_delta, ext_delta
end
end
end
--draw sector
cairo_move_to(cr,ax,ay)
cairo_line_to(cr,bx,by)
cairo_arc(cr,0,0,re,b0,b1)
cairo_line_to(cr,dx,dy)
cairo_arc_negative(cr,0,0,ri,d0,d1)
cairo_close_path (cr);
--stroke or fill sector
if type_arc=="bd" then
cairo_set_line_width(cr,t.border_size)
cairo_stroke(cr)
else
cairo_fill(cr)
end
cairo_restore(cr)
end
--draw sectors
local n0,n1,n2 = 1,t.sectors,1
if t.inverse_arc then n0,n1,n2 = t.sectors,1,-1 end
local index = 0
for i = n0,n1,n2 do
index = index +1
local valueZ=1
local cstA, cstB = (i-1),i
if t.inverse_arc then cstA,cstB = (t.sectors-i), (t.sectors-i+1) end
if value>valueA *cstA and value<valueA*cstB then
if not t.fill_sector then
valueZ = (value-valueA*cstA)/valueA
end
else
if value<valueA*cstB then valueZ=0 end
end
local start_angle= lastAngle+(i-1)*angleA
if t.foreground ~= false then
draw_sector("fg",start_angle,angleA,valueZ, index)
end
if t.background ~= false then
draw_sector("bg",start_angle,angleA,valueZ, i)
end
if t.border_size>0 then draw_sector("bd",start_angle,angleA,1, i) end
end
cairo_restore(cr)
end
--[[END OF RING-SECTORS WIDGET]]
le lua heure mn sec :
Caché :
--==============================================================================
-- conky_grey.lua
--
-- author : SLK
-- version : v2011062101
-- license : Distributed under the terms of GNU GPL version 2 or later
--
--==============================================================================
require 'cairo'
--------------------------------------------------------------------------------
-- clock DATA
-- HOURS
clock_h = {
{
name='time', arg='%H', max_value=12,
x=230, y=780,
graph_radius=33,
graph_thickness=3,
graph_unit_angle=30, graph_unit_thickness=30,
graph_bg_colour=0xffffff, graph_bg_alpha=0.0,
graph_fg_colour=0xff8000, graph_fg_alpha=0.0,
txt_radius=68,
txt_weight=1, txt_size=12.0,
txt_fg_colour=0xff0000, txt_fg_alpha=1,
graduation_radius=33,
graduation_thickness=6, graduation_mark_thickness=2,
graduation_unit_angle=30,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=1,
},
}
-- MINUTES
clock_m = {
{
name='time', arg='%M', max_value=60,
x=230, y=780,
graph_radius=37,
graph_thickness=2,
graph_unit_angle=6, graph_unit_thickness=6,
graph_bg_colour=0xffffff, graph_bg_alpha=0,
graph_fg_colour=0x00ff00, graph_fg_alpha=0.0,
txt_radius=30,
txt_weight=1, txt_size=12.0,
txt_fg_colour=0xffffff, txt_fg_alpha=1,
graduation_radius=37,
graduation_thickness=0, graduation_mark_thickness=2,
graduation_unit_angle=30,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0,
},
}
-- SECONDS
clock_s = {
{
name='time', arg='%S', max_value=60,
x=230, y=780,
graph_radius=30,
graph_thickness=2,
graph_unit_angle=6, graph_unit_thickness=2,
graph_bg_colour=0xffffff, graph_bg_alpha=0.0,
graph_fg_colour=0x6495ee, graph_fg_alpha=0.0,
txt_radius=30,
txt_weight=1, txt_size=12.0,
txt_fg_colour=0x6495ee, txt_fg_alpha=1,
graduation_radius=0,
graduation_thickness=0, graduation_mark_thickness=0,
graduation_unit_angle=0,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
},
}
--------------------------------------------------------------------------------
-- gauge DATA
-------------------------------------------------------------------------------
-- rgb_to_r_g_b
-- converts color in hexa to decimal
--
function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
-------------------------------------------------------------------------------
-- angle_to_position
-- convert degree to rad and rotate (0 degree is top/north)
--
function angle_to_position(start_angle, current_angle)
local pos = current_angle + start_angle
return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end
-------------------------------------------------------------------------------
-- draw_clock_ring
-- displays clock
--
function draw_clock_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
-- background ring
cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi)
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- arc of value
local val = (value % max_value)
local i = 1
while i <= val do
cairo_arc(display, x, y, graph_radius,( ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360) )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2))
cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = (graph_unit_angle * i) - graph_unit_thickness
-- graduations marks
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = 360 / graduation_unit_angle
local i = 1
while i <= nb_graduation do
cairo_set_line_width(display, graduation_thickness)
cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
-- text
local txt_radius = data['txt_radius']
local txt_weight, txt_size = data['txt_weight'], data['txt_size']
local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
local movex = txt_radius * (math.cos((angle * 2 * math.pi / 360)-(math.pi/2)))
local movey = txt_radius * (math.sin((angle * 2 * math.pi / 360)-(math.pi/2)))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight);
cairo_set_font_size (display, txt_size);
cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha));
cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3);
cairo_show_text (display, value);
cairo_stroke (display);
end
-------------------------------------------------------------------------------
-- draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_start_angle = data['graph_start_angle']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
local graph_end_angle = (max_value * graph_unit_angle) % 360
-- background ring
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- arc of value
local val = value % (max_value + 1)
local start_arc = 0
local stop_arc = 0
local i = 1
while i <= val do
start_arc = (graph_unit_angle * i) - graph_unit_thickness
stop_arc = (graph_unit_angle * i)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = start_arc
-- hand
start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
stop_arc = (graph_unit_angle * val)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
cairo_stroke(display)
-- graduations marks
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = graph_end_angle / graduation_unit_angle
local i = 0
while i < nb_graduation do
cairo_set_line_width(display, graduation_thickness)
start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
-- text
local txt_radius = data['txt_radius']
local txt_weight, txt_size = data['txt_weight'], data['txt_size']
local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
cairo_set_font_size (display, txt_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
cairo_show_text (display, value)
cairo_stroke (display)
-- caption
local caption = data['caption']
local caption_weight, caption_size = data['caption_weight'], data['caption_size']
local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
cairo_set_font_size (display, caption_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
cairo_move_to (display, x + tox + 5, y + toy + 1)
-- bad hack but not enough time !
if graph_start_angle < 105 then
cairo_move_to (display, x + tox - 30, y + toy + 1)
end
cairo_show_text (display, caption)
cairo_stroke (display)
end
-------------------------------------------------------------------------------
-- go_clock_rings
-- loads data and displays clock
--
function go_clock_rings(display)
local function load_clock_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_clock_ring(display, data, value)
end
for i in pairs(clock_h) do
load_clock_rings(display, clock_h[i])
end
for i in pairs(clock_m) do
load_clock_rings(display, clock_m[i])
end
for i in pairs(clock_s) do
load_clock_rings(display, clock_s[i])
end
end
-------------------------------------------------------------------------------
-- go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
local function load_gauge_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_gauge_ring(display, data, value)
end
for i in pairs(gauge) do
load_gauge_rings(display, gauge[i])
end
end
-------------------------------------------------------------------------------
-- MAIN
function conky_main()
if conky_window == nil then
return
end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local display = cairo_create(cs)
local updates = conky_parse('${updates}')
update_num = tonumber(updates)
if update_num > 5 then
go_clock_rings(display)
go_gauge_rings(display)
end
cairo_surface_destroy(cs)
cairo_destroy(display)
end
-- conky_grey.lua
--
-- author : SLK
-- version : v2011062101
-- license : Distributed under the terms of GNU GPL version 2 or later
--
--==============================================================================
require 'cairo'
--------------------------------------------------------------------------------
-- clock DATA
-- HOURS
clock_h = {
{
name='time', arg='%H', max_value=12,
x=230, y=780,
graph_radius=33,
graph_thickness=3,
graph_unit_angle=30, graph_unit_thickness=30,
graph_bg_colour=0xffffff, graph_bg_alpha=0.0,
graph_fg_colour=0xff8000, graph_fg_alpha=0.0,
txt_radius=68,
txt_weight=1, txt_size=12.0,
txt_fg_colour=0xff0000, txt_fg_alpha=1,
graduation_radius=33,
graduation_thickness=6, graduation_mark_thickness=2,
graduation_unit_angle=30,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=1,
},
}
-- MINUTES
clock_m = {
{
name='time', arg='%M', max_value=60,
x=230, y=780,
graph_radius=37,
graph_thickness=2,
graph_unit_angle=6, graph_unit_thickness=6,
graph_bg_colour=0xffffff, graph_bg_alpha=0,
graph_fg_colour=0x00ff00, graph_fg_alpha=0.0,
txt_radius=30,
txt_weight=1, txt_size=12.0,
txt_fg_colour=0xffffff, txt_fg_alpha=1,
graduation_radius=37,
graduation_thickness=0, graduation_mark_thickness=2,
graduation_unit_angle=30,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0,
},
}
-- SECONDS
clock_s = {
{
name='time', arg='%S', max_value=60,
x=230, y=780,
graph_radius=30,
graph_thickness=2,
graph_unit_angle=6, graph_unit_thickness=2,
graph_bg_colour=0xffffff, graph_bg_alpha=0.0,
graph_fg_colour=0x6495ee, graph_fg_alpha=0.0,
txt_radius=30,
txt_weight=1, txt_size=12.0,
txt_fg_colour=0x6495ee, txt_fg_alpha=1,
graduation_radius=0,
graduation_thickness=0, graduation_mark_thickness=0,
graduation_unit_angle=0,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
},
}
--------------------------------------------------------------------------------
-- gauge DATA
-------------------------------------------------------------------------------
-- rgb_to_r_g_b
-- converts color in hexa to decimal
--
function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
-------------------------------------------------------------------------------
-- angle_to_position
-- convert degree to rad and rotate (0 degree is top/north)
--
function angle_to_position(start_angle, current_angle)
local pos = current_angle + start_angle
return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end
-------------------------------------------------------------------------------
-- draw_clock_ring
-- displays clock
--
function draw_clock_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
-- background ring
cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi)
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- arc of value
local val = (value % max_value)
local i = 1
while i <= val do
cairo_arc(display, x, y, graph_radius,( ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360) )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2))
cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = (graph_unit_angle * i) - graph_unit_thickness
-- graduations marks
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = 360 / graduation_unit_angle
local i = 1
while i <= nb_graduation do
cairo_set_line_width(display, graduation_thickness)
cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
-- text
local txt_radius = data['txt_radius']
local txt_weight, txt_size = data['txt_weight'], data['txt_size']
local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
local movex = txt_radius * (math.cos((angle * 2 * math.pi / 360)-(math.pi/2)))
local movey = txt_radius * (math.sin((angle * 2 * math.pi / 360)-(math.pi/2)))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight);
cairo_set_font_size (display, txt_size);
cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha));
cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3);
cairo_show_text (display, value);
cairo_stroke (display);
end
-------------------------------------------------------------------------------
-- draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_start_angle = data['graph_start_angle']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
local graph_end_angle = (max_value * graph_unit_angle) % 360
-- background ring
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- arc of value
local val = value % (max_value + 1)
local start_arc = 0
local stop_arc = 0
local i = 1
while i <= val do
start_arc = (graph_unit_angle * i) - graph_unit_thickness
stop_arc = (graph_unit_angle * i)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = start_arc
-- hand
start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
stop_arc = (graph_unit_angle * val)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
cairo_stroke(display)
-- graduations marks
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = graph_end_angle / graduation_unit_angle
local i = 0
while i < nb_graduation do
cairo_set_line_width(display, graduation_thickness)
start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
-- text
local txt_radius = data['txt_radius']
local txt_weight, txt_size = data['txt_weight'], data['txt_size']
local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
cairo_set_font_size (display, txt_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
cairo_show_text (display, value)
cairo_stroke (display)
-- caption
local caption = data['caption']
local caption_weight, caption_size = data['caption_weight'], data['caption_size']
local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
cairo_set_font_size (display, caption_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
cairo_move_to (display, x + tox + 5, y + toy + 1)
-- bad hack but not enough time !
if graph_start_angle < 105 then
cairo_move_to (display, x + tox - 30, y + toy + 1)
end
cairo_show_text (display, caption)
cairo_stroke (display)
end
-------------------------------------------------------------------------------
-- go_clock_rings
-- loads data and displays clock
--
function go_clock_rings(display)
local function load_clock_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_clock_ring(display, data, value)
end
for i in pairs(clock_h) do
load_clock_rings(display, clock_h[i])
end
for i in pairs(clock_m) do
load_clock_rings(display, clock_m[i])
end
for i in pairs(clock_s) do
load_clock_rings(display, clock_s[i])
end
end
-------------------------------------------------------------------------------
-- go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
local function load_gauge_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_gauge_ring(display, data, value)
end
for i in pairs(gauge) do
load_gauge_rings(display, gauge[i])
end
end
-------------------------------------------------------------------------------
-- MAIN
function conky_main()
if conky_window == nil then
return
end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local display = cairo_create(cs)
local updates = conky_parse('${updates}')
update_num = tonumber(updates)
if update_num > 5 then
go_clock_rings(display)
go_gauge_rings(display)
end
cairo_surface_destroy(cs)
cairo_destroy(display)
end
A modifier en fonction de votre configuration.
.gif)
Linuxmint 24.02 Xia - Mageia 9 xfce et plasma sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX

Adrien.D Membre non connecté
-
- Voir le profil du membre Adrien.D
- Inscrit le : 30/05/2011
- Site internet
- Groupes :
question idiote : Hier ton calendrier n'affichait pas "septembre 2013" avec le 20 de 2013 en rouge ?

Config : PC Fixe : X470 GAMING PRO- AMD Ryzen 5 2600X - 16Go RAM - Radeon RX 560 (Pilote libre) - Gentoo Linux - GNOME Desktop - Kernel 5.10 LTS
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !


loutch Membre non connecté
-
- Voir le profil du membre loutch
- Inscrit le : 07/07/2010
- Groupes :
non pourquoi ????
@+
Linuxmint 24.02 Xia - Mageia 9 xfce et plasma sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX

Adrien.D Membre non connecté
-
- Voir le profil du membre Adrien.D
- Inscrit le : 30/05/2011
- Site internet
- Groupes :
Je vais enquêter

Config : PC Fixe : X470 GAMING PRO- AMD Ryzen 5 2600X - 16Go RAM - Radeon RX 560 (Pilote libre) - Gentoo Linux - GNOME Desktop - Kernel 5.10 LTS
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !

Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie