Conky, des variables système sur le bureau !

Cet article a été mis à jour, vous consultez ici une archive de cet article!



Introduction





Configurer conky






Exemple de configuration



.conkyrc:
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 enp4s0}
${color3}Download :${color2} ${downspeedf enp4s0}k/s ${goto 175}${color3}Upload :${color2} ${upspeedf enp4s0}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}




.conkyrc2:
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 1000 300
maximum_width 1000
text_buffer_size 300
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_outline_color white
alignment bottom_left
gap_x 30
gap_y 30
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

${color3}${font Sans:size=150}${time %H}${time :%M}${font Sans:size=50}
${color3}${font Sans:size=48}${time %A} ${time %d} ${time %B} ${time %Y}


.conkyinit.sh:
#!/bin/bash

killall conky
sleep 1
conky -c /home/adrien/.conkyrc
sleep 1
conky -c /home/adrien/.conkyrc2



On peut même créer ses propres scripts perl par exemple, et les exécuter direct dans la partie texte.
Voici un exemple avec mon script perl qui va chercher l'API divia.fr et récupérer mes arrêts de bus, pour les afficher dans conky:

Code :
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 400
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_left
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

${color3}Totem Online : ${color2}

${texeci 10 perl /home/adrien/.divia-infos-arret.pl L6-Piscine_Carrousel-Toison_d_Or }

${texeci 10 perl /home/adrien/.divia-infos-arret.pl L6-Alsace-Longvic }


Aperçu