Conky, des variables système sur le bureau !



Introduction



Cet article illustre juste les 2 conky que j'ai sur mon bureau, avec leurs fichiers de configuration.


En image






La configuration



Tout se passe dans le fichier .conkyrc situé dans [b]/home/$USER[/b

Voici mon fichier de config en date du 30/11/2016.

Code TEXT :
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 800 500
maximum_width 500
text_buffer_size 2000
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
${font Sans:size=8}${color3}SYSTEM : 
¨¨¨¨¨¨¨¨${color2}
${color3}OS : ${color2}${exec lsb_release -d | cut -f2 }
${color3}Kernel: ${color2}${exec uname -r} ${goto 160}${color3}Arch: ${color2}$machine 
${color3}Uptime:${color2} $uptime ${goto 160}${color3}Load:${color2} $loadavg
${color3}Processes: ${color2} $processes${color3}${goto 160}Running Processes: ${color2} $running_processes
${color3}Battery:  ${color2} ${exec acpi -b | awk '{ print "State : " $3 "  Capacity : "$4 "  (" $5 ")"}'}
${color3}CPU : 
¨¨¨¨¨${color2}
${color3}Clock frequency :${color2} ${freq_g} GHz
${color3}Core 0 and 4:${color2} ${cpu cpu0}%${goto 110}${color4}${cpubar cpu0 6,60}${color2}${goto 190}${exec expr `sensors | grep 'Core 0' | cut -d+ -f2 | cut -d\( -f1 | cut -d. -f1`}°C 
${color3}Core 1 and 5:${color2} ${cpu cpu1}%${goto 110}${color4}${cpubar cpu1 6,60}${color2}${goto 190}${exec expr `sensors | grep 'Core 1' | cut -d+ -f2 | cut -d\( -f1 | cut -d. -f1`}°C
${color3}Core 2 and 6:${color2} ${cpu cpu2}%${goto 110}${color4}${cpubar cpu2 6,60}${color2}${goto 190}${exec expr `sensors | grep 'Core 2' | cut -d+ -f2 | cut -d\( -f1 | cut -d. -f1`}°C
${color3}Core 3 and 7:${color2} ${cpu cpu3}%${goto 110}${color4}${cpubar cpu3 6,60}${color2}${goto 190}${exec expr `sensors | grep 'Core 3' | cut -d+ -f2 | cut -d\( -f1 | cut -d. -f1`}°C
${color3}CPU Fan Speed: ${color2} ${exec sensors | grep cpu_fan | awk '{ print $2 " tr/mn"; }'}
${color3}MEMORY : 
¨¨¨¨¨¨¨¨${color2}
${color3}RAM:${goto 40}${color2} $mem / $memmax ${goto 170}$memperc%
${color3}SWAP:${goto 40}${color2} ${swap} / ${swapmax} ${goto 170} ${swapperc}%
${color3}STORAGE :
¨¨¨¨¨¨¨¨¨${color2}
${color3}Root ${color2}${goto 50}${fs_used /} / ${fs_size /} ${goto 170}${fs_used_perc /}%
${color3}Home ${color2}${goto 50}${fs_used /home} / ${fs_size /home} ${goto 170}${fs_used_perc /home}%
${color3}Var-cl ${color2}${goto 50}${fs_used /var/calculate} / ${fs_size /var/calculate} ${goto 170}${fs_used_perc /var/calculate}% 
${color3}DATA ${color2}${goto 50}${fs_used /media/DATA} / ${fs_size /media/DATA} ${goto 170}${fs_used_perc /media/DATA}% 
#
#${color3}Temp HDD : ${color2}${texeci 60 /usr/sbin/hddtemp /dev/sdb 2>/dev/null | grep sdb | awk  '{ print $5 }' }
${color3}NETWORK : 
¨¨¨¨¨¨¨¨¨${color2}
${color3}eth : ${color2}${addr eth0} ${goto 120}${color3}DL :${color2} ${downspeedf eth0}k/s ${goto 210} ${color3}UP :${color2} ${upspeedf eth0}k/s
${color3}wlan : ${color2}${addr wlan0} ${goto 120}${color3}DL :${color2} ${downspeedf wlan0}k/s ${goto 210} ${color3}UP :${color2} ${upspeedf wlan0}k/s
${color3}Public IP : ${color2}${texeci 1000 wget http://checkip.dyndns.org -O - -o /dev/null | cut -d : -f 2 | cut -d \< -f 1} ${goto 175} ${color3}Latence : ${color2}${texeci 1 ping 8.8.8.8 -c 1 | grep time= | cut -d"=" -f4}
${color3}EPHEMERIDE : 
¨¨¨¨¨¨¨¨¨¨¨¨${color2}
${color3}Date : ${color2}${texeci 1000 date "+%A %d %B %Y"}
${color3}Heure : ${color2}${exec date "+%H:%M"}
${color3}Fête du jour : ${color2}${texeci 1000 wget -O - -q  http://fetedujour.fr/  --user-agent="Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0" | grep "<span>Fête du jour" | head -1 | cut -d">" -f4 | cut -d"<" -f1 }
${color3}Mot du jour : ${color2}${texeci 1000 wget -O - -q http://www.wikebec.org/ | grep accueil-mdj-title | cut -d">" -f10 | cut -d"<" -f1} ${color3}: ${color2}${texeci 1000 wget -O - -q http://www.wikebec.org/ | grep accueil-mdj-title | cut -d">" -f13 | cut -d"<" -f1}
${color3}MUSIQUE :
¨¨¨¨¨¨¨¨¨¨${color2}
${color3}Dernièrement sur FUN : ${color2}${texeci 20 wget -O - -q http://www.funradio.fr/quel-est-ce-titre | grep -E '(class="song-artist"|class="song-title")' | head -2 | sed -e 'N;s/\n/ /' -e 's/>/\|/g' -e 's/</\|/g' | awk -F'|' '{ print $3 " - " $7}'}
 



Nouveautés depuis la version 1.10, le fichier conkyrc est écrit en LUA.

Donc

Code BASH :
conky.config = {
 
  background = true,
 
    own_window = true,
    own_window_class = 'Conky',
    own_window_transparent = false,
    own_window_type = 'desktop',
    own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
    own_window_argb_visual = true,
    own_window_argb_value = 15,
    double_buffer = true,
    no_buffers = true,
 
    use_spacer = 'none',
    use_xft = true,
    xftalpha = 1,
    font = 'Sans:size=10',
    update_interval = 1,
    uppercase = false,
    override_utf8_locale = true,
    stippled_borders = 1,
    border_width = 5,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    show_graph_scale = true,
    show_graph_range = true,
 
    alignment = 'top_left',
    gap_x = 10,
    gap_y = 10,
 
    net_avg_samples = 1,
    cpu_avg_samples = 6,
    short_units = true,
    pad_percents = 2,
    text_buffer_size = 2048,
    out_to_console = false,
    out_to_stderr = false,
    extra_newline = false,
}
 
conky.text = [[
 
 
${color white}SYSTEM:
¨¨¨¨¨¨¨${color orange}
${color white}Uptime:${color orange} $uptime 
${color white}Load:${color orange} $loadavg
${color white}RAM: ${color orange} $mem / $memmax ($memperc%)
${color white}SWAP: ${color orange} ${swap} / ${swapmax} (${swapperc}%)
 
${color white}EPHEMERIDE : 
¨¨¨¨¨¨¨¨¨¨¨¨${color orange}
${color white}Nous sommes le ${color orange}${texeci 1000 date "+%A %d %B %Y" }
${color white}Fête du jour : ${color orange}${texeci 1000 wget -O - -q  http://fetedujour.fr/  --user-agent="Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0" | grep "<span>Fête du jour" | head -1 | cut -d">" -f4 | cut -d"<" -f1 }
${color white}Mot du jour : ${color orange}${texeci 1000 wget -O - -q http://www.wikebec.org/ | grep accueil-mdj-title | cut -d">" -f10 | cut -d"<" -f1} ${color white}: ${color orange}${texeci 1000 wget -O - -q http://www.wikebec.org/ | grep accueil-mdj-title | cut -d">" -f13 | cut -d"<" -f1}
 
${color white}DIFFUSION FM MAISON (87.5 FM) :
¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨${color orange}
${color white}En ce moment : ${color orange}${texeci 15 wget -O - -q http://cluster.linuxtricks.fr/radio | grep 'now_playing' | cut -d'|' -f3}
${color white}Précédemment : ${color orange}${texeci 15 wget -O - -q http://cluster.linuxtricks.fr/radio | grep 'last_1' | head -1 | cut -d'|' -f3 }
${color white}A suivre : ${color orange}${texeci 15 wget -O - -q http://cluster.linuxtricks.fr/radio | grep 'next_song' | cut -d'>' -f2 | cut -d'<' -f1 }
 
${color white}DIVIA TOTEM :
¨¨¨¨¨¨¨¨¨¨¨¨${color orange}
${color white}BUS : ${color orange}${texeci 20 /home/adrien/.adrien/divia-totem-parser/divia-totem-parser.pl -l=90 -a=688 }
${color white}BUS : ${color orange}${texeci 20 /home/adrien/.adrien/divia-totem-parser/divia-totem-parser.pl -l=134 -a=25 }
${color white}TRAM : ${color orange}${texeci 20 /home/adrien/.adrien/divia-totem-parser/divia-totem-parser.pl -l=96 -a=1477 }
${color white}TRAM : ${color orange}${texeci 20 /home/adrien/.adrien/divia-totem-parser/divia-totem-parser.pl -l=185 -a=1510 }
${color white}TRAM : ${color orange}${texeci 20 /home/adrien/.adrien/divia-totem-parser/divia-totem-parser.pl -l=81 -a=1576 }
${color white}TRAM : ${color orange}${texeci 20 /home/adrien/.adrien/divia-totem-parser/divia-totem-parser.pl -l=82 -a=1542 }
]]
 
Cette page a été vue 14859 fois