====== Conky : comment afficher les infos de lecture ====== Ce tutoriel a été réalisé depuis l'expérience sur Ubuntu Feisty Fawn (7.04) distribution basée sur Debian ainsi que sur Mandriva 2007 par Quentin Sculo. ====== Qu'est-ce que conky ? ====== Conky est un outil de monitoring très léger et extrêmement configurable. Il permet d'afficher sur votre bureau beaucoup d'informations telles la date et l'heure, les températures du CPU et des disques durs, les informations concernant la batterie de votre ordinateur, la charge CPU, RAM, swap, les processus occuppant le plus de ressources CPU et RAM, l'occupation des disques durs, les informations réseau,... Conky permet aussi, et c'est ce qui nous intéresse ici, d'afficher les informations de lecture de plusieus lecteurs tels bmp, audacious, mpd. Quentin Sculo a développé un patch (celui pour conky-1.5.1 est disponible [[http://gmusicbrowser.org/files/conky_gmb.patch5_1.5.1_new.gz|ici]]) afin de pouvoir afficher les informations de lecture de gmusicbrowser dans conky. Une fois le patch téléchargé, créez le répertoire conkypatch dans votre /home : mkdir conkypatch et placez-y le patch mv dossierdetelechargement/conky_gmb.patch5_1.5.1_new.gz conkypatch afin de faciliter les opérations par la suite. ====== Télécharger conky ====== Pour cela, aller sur le site du projet, http://conky.sourceforge.net/ et télécharger les sources de conky au format .tar.bz2 (téléchargeable directement [[http://sourceforge.net/project/showfiles.php?group_id=143975|ici]] par exemple). Une fois le téléchargement terminé, déplacer l'archive dans le répertoire conkypatchmv dossierdetelechargement/conky-1.5.1.tar.bz2 conkypatch Se rendre dans le répertoire conkypatchcd conkypatch et décompresser l'archive conky-1.5.1.tar.bz2 :tar xjfv conky-1.5.1.tar.bz2. Ensuite copier-coller l'archive du patch dans le répertoire nouvellement créé à savoir conky-1.5.1 : cp conky_gmb.patch5_1.5.1_new.gz conky-1.5.1 Se placer dans le répertoire conky-1.5.1 : cd conky-1.5.1 Appliquer le patch : zcat conky_gmb.patch5_1.5.1_new.gz |patch -p1 ======= Compiler conky ====== Tout d'abord veillez à avoir ces paquets installés : gcc, make, automake1.9, autoconf, build-essential, checkinstall : sudo aptitude install gcc automake1.9 autoconf build-essential checkinstall Ensuite faites : ./autogen.sh Le terminal est assez explicite en cas d'erreurs et permet d'installer le(s) paquet(s) manquant si c'est le cas. Personnellement sous Ubuntu 7.04 j'avais un conflit entre plusieurs versions de automake, et j'ai été amené à désinstaller les paquets automake, automake1.4, automake1.7 et automake1.8. Il semblerait en fait que le autogen nécessite automake1.10 ; or sous Ubuntu Feisty Fawn la dernière version disponible est la 1.9. Pour résoudre ce problème, vous pouvez enter cette commande :sudo update-alternatives --config automake et choisir la version 1.9. Le terminal affiche des warnings et le make est ainsi possible. Une fois le autogen réalisé, nous pouvons passer à la compilation à proprement parler. Cette étape peut être profondément personnalisée, je vous renvoie donc au [[http://conky.sourceforge.net/|site du projet]] et plus précisément au [[http://conky.sourceforge.net/docs.html|man]] qui recense les options possibles. Personnellement, je me suis profondément inspiré du configure proposé dans le man si ce n'est que j'ai été amené supprimer les options permettant de bénéficier du support de bmp, audacious et xmms. J'ai donc lancé le configure suivant : ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --enable-xft --enable-own-window --enable-proc-uptime --enable-hddtemp --enable-mpd --enable-imlib2 --enable-portmon --enable-debug --enable-double-buffer --enable-xdamage --enable-x11 --enable-gmb Quel que soit les options que vous souhaitez, n'oubliez surtout pas ceci : --enable-gmb qui permet d'activer le support par conky de gmusicbrowser. Là encore le terminal est bavard et si vous avez des erreurs vous devez pouvoir trouver aisément le(s) paquet(s) à installer (pensez aux paquets -dev). Une fois le configure achevé il faut faire un make puis un sudo checkinstall Le checkinstall est préférable au make install dans la mesure où il est ensuite possible de traiter le paquet conky via APT (cf. la section "Préalable" sur [[http://doc.ubuntu-fr.org/tutoriel/compilation?s=checkinstall|cette page]]). Voilà conky avec le support de gmusicbrowser installé. ====== Configurer conky ====== Pour ceux qui viennent de découvrir l'existence de conky, le fichier de configuration de conky est un fichier caché dans votre home et appelé .conkyrc ; pour éditer ce fichier il suffit de tapper dans un terminal gedit /home/login/.conkyrc en remplaçant login par votre login et en remplaçant gedit par n'importe quel autre éditeur de texte. Le patch permet d'avoir les variables suivantes : $gmb_artist, $gmb_album, $gmb_bar, $gmb_elapsed, $gmb_length, $gmb_percent, $gmb_title, $gmb_track. Voici un exemple de fichier de configuration de conky avec certaines de ces variables accompagnée d'une capture : {{gallery>translations:fr:applications_tierces}} # set to yes if you want Conky to be forked in the background background no cpu_avg_samples 2 net_avg_samples 2 out_to_console no override_utf8_locale yes # X font when Xft is disabled, you can pick one with program xfontsel #font 8x10 #font 7x13 #font 8x13 #font 7x12 #font *mintsmild.se* #font -*-*-*-*-*-*-34-*-*-*-*-*-*-* #font -artwiz-snap-normal-r-normal-*-*-100-*-*-p-*-iso8859-1 #font -*-luxi sans-medium-r-normal-*-13-*-*-*-*-*-iso8859-2 #font -*-helvetica-medium-r-normal-*-12-*-100-100-*-*-iso8859-2 #font -*-lucidatypewriter-medium-r-*-*-14-*-100-100-*-*-iso8895-2 #font -*-courier-medium-r-normal-*-14-*-100-100-*-*-iso8859-2 #font -*-lucida-medium-r-normal-*-13-*-*-*-*-*-iso8859-2 # Use Xft? use_xft yes # Xft font when Xft is enabled #xftfont monospace-8 xftfont Sans -8.5 # Text alpha when using Xft xftalpha 0.8 # mail spool mail_spool $MAIL # Update interval in seconds update_interval 1 # Create own window instead of using desktop (required in nautilus) own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager own_window_transparent yes #own_window_colour black own_window yes own_window_type override # Use double buffering (reduces flicker, may not work for everyone) double_buffer yes # Minimum size of text area minimum_size 5 maximum_width 220 # Draw shades? draw_shades no # Draw outlines? draw_outline no # Draw borders around text draw_borders no # Stippled borders? stippled_borders 0 # border margins border_margin 0 # border width border_width 0 # drawn 1 pixel border around graphs or not draw_graph_borders yes # Default colors and also border colors default_color black default_shade_color black default_outline_color black # Text alignment, other possible values are commented #alignment top_left #alignment top_right #alignment bottom_left alignment bottom_right # Gap between borders of screen and text gap_x 0 gap_y 5 #margines gorny # Add spaces to keep things from moving about? This only affects certain objects. use_spacer yes # Subtract file system buffers from used memory? no_buffers yes # set to yes if you want all text to be in uppercase uppercase no # boinc (seti) dir # seti_dir /opt/seti # Possible variables to be used: # # Variable Arguments Description # acpiacadapter ACPI ac adapter state. # acpifan ACPI fan state # acpitemp ACPI temperature. # adt746xcpu CPU temperature from therm_adt746x # adt746xfan Fan speed from therm_adt746x # battery (num) Remaining capasity in ACPI or APM # battery. ACPI battery number can be # given as argument (default is BAT0). # buffers Amount of memory buffered # cached Amount of memory cached # color (color) Change drawing color to color # cpu CPU usage in percents # cpubar (height) Bar that shows CPU usage, height is # bar's height in pixels # downspeed net Download speed in kilobytes # downspeedf net Download speed in kilobytes with one # decimal # exec shell command Executes a shell command and displays # the output in torsmo. warning: this # takes a lot more resources than other # variables. I'd recommend coding wanted # behaviour in C and posting a patch :-). # execi interval, shell Same as exec but with specific interval. # command Interval can't be less than # update_interval in configuration. # fs_bar (height), (fs) Bar that shows how much space is used on # a file system. height is the height in # pixels. fs is any file on that file # system. # fs_free (fs) Free space on a file system available # for users. # fs_free_perc (fs) Free percentage of space on a file # system available for users. # fs_size (fs) File system size # fs_used (fs) File system used space # hr (height) Horizontal line, height is the height in # pixels # i2c (dev), type, n I2C sensor from sysfs (Linux 2.6). dev # may be omitted if you have only one I2C # device. type is either in (or vol) # meaning voltage, fan meaning fan or temp # meaning temperature. n is number of the # sensor. See /sys/bus/i2c/devices/ on # your local computer. # kernel Kernel version # loadavg (1), (2), (3) System load average, 1 is for past 1 # minute, 2 for past 5 minutes and 3 for # past 15 minutes. # machine Machine, i686 for example # mails Mail count in mail spool. You can use # program like fetchmail to get mails from # some server using your favourite # protocol. See also new_mails. # mem Amount of memory in use # membar (height) Bar that shows amount of memory in use # memmax Total amount of memory # memperc Percentage of memory in use # new_mails Unread mail count in mail spool. # nodename Hostname # outlinecolor (color) Change outline color # pre_exec shell command Executes a shell command one time before # torsmo displays anything and puts output # as text. # processes Total processes (sleeping and running) # running_processes Running processes (not sleeping), # requires Linux 2.6 # shadecolor (color) Change shading color # stippled_hr (space), Stippled (dashed) horizontal line # (height) # swapbar (height) Bar that shows amount of swap in use # swap Amount of swap in use # swapmax Total amount of swap # swapperc Percentage of swap in use # sysname System name, Linux for example # time (format) Local time, see man strftime to get more # information about format # totaldown net Total download, overflows at 4 GB on # Linux with 32-bit arch and there doesn't # seem to be a way to know how many times # it has already done that before torsmo # has started. # totalup net Total upload, this one too, may overflow # updates Number of updates (for debugging) # upspeed net Upload speed in kilobytes # upspeedf net Upload speed in kilobytes with one # decimal # uptime Uptime # uptime_short Uptime in a shorter format # # seti_prog Seti@home current progress # seti_progbar (height) Seti@home current progress bar # seti_credit Seti@hoome total user credit # variable is given either in format $variable or in ${variable}. Latter # allows characters right after the variable and must be used in network # stuff because of an argument #${font Dungeon:style=Bold:pixelsize=10}I can change the font as well #${font Verdana:size=10}as many times as I choose #${font Perry:size=10}Including UTF-8, #${font Luxi Mono:size=10}justo como este texto que o google traduz fĂ?ÂŞz o portuguĂ?ÂŞs # stuff after 'TEXT' will be formatted on screen TEXT ${font Verdana:size=12}$alignc${color #DBAA82}${Time %d %B %Y} - ${color #FFFB00}${time %H:%M:%S}${font Sans:size=8.5} ${color #FF000C}${font Verdana:size=10}Moniteur Système :${font Sans:size=8.5} ${color #DBAA82}$sysname, ${color #565868}$kernel ${color #DBAA82}on ${color #565868}$machine ${color #DBAA82}Fréquence CPU : ${color #FFFB00}$freq_g ${color #DBAA82}GHz ${color #DBAA82}Uptime : ${color #B6A291}$uptime ${color #DBAA82}Temp. : ${color #B6A291}CPU : ${color #FFFB00}${acpitemp}°C ${color #DBAA82}| ${color #B6A291}DD : ${color #FFFB00}${execi 10 hddtemp -n /dev/hda}°C ${color #DBAA82}Adaptateur : ${color #FFFB00}${acpiacadapter} ${color #DBAA82}Autonomie : ${battery BAT1} ${battery_time BAT1} ${color #DBAA82}cpu: ${color #FFFB00}${cpu}% ${color #344299}$cpubar ${color #FFFFFF}${cpugraph DBAA82 344299} ${color #DBAA82}ram : ${color #3652FF}$mem ${color #DBAA82}/ $memmax - ${color #FFFB00}$memperc% ${color #344299}$membar ${color #DBAA82}swap : ${color #3652FF}$swap ${color #DBAA82}/ $swapmax - ${color #FFFB00}$swapperc% ${color #344299}$swapbar ${color #FFFB00}.: ${top name 1} ${color #DBAA82}PID: ${color #FFFB00}${top pid 1} ${color #DBAA82}%cpu : ${color #FFFB00}${top cpu 1} ${color #565868}.: ${top name 2} ${color #DBAA82}PID: ${color #3652FF}${top pid 2} ${color #DBAA82}%cpu : ${color #344299}${top cpu 2} ${color #565868}.: ${top name 3} ${color #DBAA82}PID: ${color #3652FF}${top pid 3} ${color #DBAA82}%cpu : ${color #344299}${top cpu 3} ${color #FF000C}${font Verdana:size=10}Disques :${font Sans:size=8.5} ${color #DBAA82}/ : ${color #3652FF}${fs_used /} ${color #DBAA82}/ ${fs_size /} (${color #FFFB00}${fs_free_perc /}% ${color #DBAA82}free) ${color #344299}${fs_bar /} ${color #DBAA82}/home : ${color #3652FF}${fs_used /home} ${color #DBAA82}/ ${fs_size /home} (${color #FFFB00}${fs_free_perc /home}% ${color #DBAA82}free) ${color #344299}${fs_bar /home} ${color #DBAA82}/Musique : ${color #3652FF}${fs_used /Musique} ${color #DBAA82}/ ${fs_size /Musique} (${color #FFFB00}${fs_free_perc /Musique}% ${color #DBAA82}free) ${color #344299}${fs_bar /Musique} ${color #FF000C}${font Verdana:size=10}Réseau :${font Sans:size=8.5} ${color #DBAA82}down: ${color #FFFB00}${downspeedf eth1} k/s ${color #DBAA82}up: ${color #FFFB00}${upspeedf eth1} k/s ${color #FFFFFF}${downspeedgraph eth1 25,100 DBAA82 344299} ${color #FFFFFF}${upspeedgraph eth1 25,100 344299 DBAA82} ${color #FF000C}${font Verdana:size=10}Musique :${font Sans:size=8.5} ${color #800080}${gmb_title} ${color #4682B4}${gmb_artist} ${color #008B8B}${gmb_album} ${color #FFFB00}${gmb_elapsed}${color #DBAA82}/${gmb_length} ${color #344299}${gmb_bar}${color #DBAA82} Vous pouvez également avoir quelque chose du genre : ${color #FF000C}${font Lexia:size=10}Musique :${font Sans:size=8.5}${color0} ${if_existing /home/bbrice/.config/gmusicbrowser/gmusicbrowser.fifo}${gmb_title} ${gmb_artist} ${gmb_album} ${color #002939}${gmb_bar 18}${color0} $alignc${voffset -21}${gmb_elapsed}/${gmb_length}$endif${if_empty $mpd_smart}$else${mpd_title} ${mpd_artist} ${mpd_album} ${color #002939}${mpd_bar 18}${color0} $alignc${voffset -21}${mpd_elapsed}/${mpd_length}$endif mais dans ce cas, vous devez faire attention à la localisation du fichier gmusicbrowser.fifo. Sous Ubuntu (Feisty, Gutsy) vous trouvez ce fichier ici : ~/.gmusicbrowser/gmusicbrowser.fifo mais sous Debian (Lenny dans mon cas) il se trouve ici : ~/.config/gmusicbrowser/gmusicbrowser.fifo. Pour d'autres exemples et certaines astuces, vous pouvez visiter [[http://forum.ubuntu-fr.org/viewtopic.php?id=99471|cette page]] du forum d'[[http://www.ubuntu-fr.org/|Ubuntu-fr]].