Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#351 Le 09/01/2011, à 23:29

lifala

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Salut tout le monde !

J'ai pu modifier mon conky pour qu'il y est des infos qui change toute les 20 sec. Le script de Wlouf à très bien fais l'affaire. Vous pouvez récupérer une vidéo d'un peu plus de 30sec ici

==EDIT==

J'ai testé ta signature Levi59, elle fonctionne.

Dernière modification par lifala (Le 09/01/2011, à 23:38)


conky 1 --- conky 2 --- conkyForecast 2.09 --- Tuto Finch
Lucid minimal + openbox

Hors ligne

#352 Le 09/01/2011, à 23:34

Levi59

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

chepioq a écrit :

Les liens de ta signature renvoient vers une page blanche...

Heu non... ça marche là.

Peut être une maintenance de over-blog...

Hors ligne

#353 Le 09/01/2011, à 23:59

Fenouille84

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Voici mon conky.

Il est sous Gnome, les effets de compiz (cube de bureau, fenêtre élastique, etc.) me manquaient !!
Mais honnêtement, rien ne vaut un bon petit OpenBox ^^ J'y retourne illico !!

Screen :
ethereal.th.png

conkyrc0 :

#Fonctionnement de conky 
  total_run_times 0                     #Temps en secondes ; 0 = toujours actif
  background yes                        #Pour que conky tourne en arrière plan ; no = pour les tests

#Réglages système
  cpu_avg_samples 1                     #Nb d'échantillons pour calculer la moyenne d'utilisation CPU
  net_avg_samples 2                     #Nb d'échantillons pour calculer la moyenne d'utilisation CPU

#Mémoire
  double_buffer yes                     #Éviter le clignotement
  no_buffers yes                        #Soustraire les mémoires tampons de la mémoire utilisée
  text_buffer_size 1024                 #Taille du cache pour le texte

#Affichage
  out_to_console no                     #Affiche le texte sur la sortie standard
  update_interval 1                     #Taux de rafraîchissement de la fenêtre (s)

#Fenêtre conky
  alignment top_right                   #Alignement
 #---
  minimum_size 350 10                   #Taille minimum (px) ; largeur / hauteur
  maximum_width 350                     #Largeur maximum (px)
 #---
  gap_x 5                               #Écart avec le bord gauche / droit
  gap_y 30                              #Écart avec le bord haut / bas
 #---
  draw_shades no                        #Afficher les ombres
  draw_outline no                       #Afficher les contours de fenêtre
  draw_borders no                       #Afficher des contours autour des blocs de texte
  border_width 1                        #Largeur du contour
  border_inner_margin 1                 #Largeur des marges
 #---
  own_window yes                        #Utiliser sa propre fenêtre
  own_window_type override              #Type de fenêtre ; normal / override / desktop
  own_window_transparent yes            #Pseudo transparence

#Mise en forme
  use_xft yes                           #Utiliser Xft (polices lissées etc)
  xftalpha .1                           #Utiliser Xft
  override_utf8_locale yes              #Force l'UTF8
  uppercase no                          #Tout le texte en majuscule
  use_spacer right                      #Ajoute des espaces après certains objets (qu'avec des polices fixes)
 #---
  xftfont saxMono:size=9                #Police par défaut
 #---
  default_bar_size 82 3                 #Barre par défaut (longeur hauteur)
  stippled_borders 3                    #Taille des pointillés

#Couleurs
  default_color FFFFFF                  #Couleur par défaut
  default_shade_color 333333            #Couleur des ombres
  default_outline_color black           #Couleur des contours
 #---
  color1 D6D6D6                         #Argenté
  color2 40CEFF                         #Bleu clair
  color3 A3ADB0                         #Gris

 #---
  short_units yes                       #Unités courtes
  pad_percents 2                        #Unité à 2 décimales

#Prise en charge du LUA
  lua_load $HOME/conky/Script/clock.lua
  lua_draw_hook_pre clock_rings


TEXT
${color3}${offset 56}${voffset 5}${cpugraph cpu6 17,1}${voffset -1}${cpugraph cpu6 0,50}
${voffset -27}${offset 110}${font Digital\-7:size=20}${time %H:%M:%S}${font}${alignr}${uptime}
${voffset -5}${offset 110}${hr}${voffset 2}${color1}
${font Nimbus Mono L:size=8}${execp cal | sed '1!d ; s/  //g ; s/^/\${goto 120} /g'}
${execp cal | sed '1d ; s/^/ /g ; s/$/ /g ; s/'" $(date +%e)"'/\${color2}'" $(date +%e)"'\${color1}/1 ; s/^/\${goto 120}/g'} ${voffset -84} #
${goto 270}\#1:${color2}${cpu cpu1}%${color1}${offset 11}\#2:${color2}${cpu cpu2}%${color1}
${goto 270}\#R:${memperc}%${offset 11}\#S:${swapperc}% ${swapbar 3,40}

${if_existing /proc/net/route wlan0}${goto 270}${offset 11} - WiFi -${else}${if_existing /proc/net/route eth0}${goto 270}${offset 11} - Link -${else}${goto 270}${offset 11} -  \#\#  -${endif}${endif}

${goto 270}/r:${fs_used_perc /}%${alignr}${color2}${fs_free /}${color1}
${goto 270}/h:${fs_used_perc /home}%${alignr}${color2}${fs_free /home}${color3}

${offset 56}${stippled_hr}${voffset -26}
${offset 56}${cpugraph cpu6 17,1}${color1}
${offset 56}ToDo List :::..${voffset -3}
${offset 56}${cpugraph cpu6 0,90}
${execp sed '/^#/d ; s/^/\${offset 56} - /g ; s/ - $/ ------/g' $HOME/Ubuntu/ToDo/ToDo}
${if_match ${exec ls /media | wc -l} > 0}${offset 56}${hr}
${execp grep -E ^\/dev /etc/mtab | cut -d " " -f2 | sed '1,2d ; s&^.*/&&g' | while read line ; do name=$(echo $line | cut -c '1-5' | sed 's/.*/\L&/g ; s/^./\U&/g ; s/^/\${goto 270}/g') ; echo $name'${alignr}${color2}${fs_free /media/'$line'}\n${goto 270}${color3}${fs_bar 3,82 /media/'$line'}${color1}' ; done}${else}${endif}${voffset -5}

Le script LUA qui va bien :

-- Tuto pris ici: http://conky-pitstop.wikidot.com/background-colour-with-lua-cairo
-- Un exemple: http://conky-pitstop.wdfiles.com/local--files/background-colour-with-lua-cairo/conky-lua-background.png

--[[
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

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=15

-- Set the colour and transparency (alpha) of your background.
bg_colour=0xffffff
bg_alpha=0.1

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

Et voilà smile

Pour le wall : par ici.

Dernière modification par Fenouille84 (Le 15/01/2011, à 14:08)


Ma page Deviant Art : conky inside ;-)
.
-- DropBox (online backup) : 2Go + 250 Mo pour vous et moi par parrainage --

Hors ligne

#354 Le 10/01/2011, à 12:01

sunkart

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Levi59 a écrit :

@sunkart
L'affichage se modifie comme le reste du code conkyrc... Si tu veux un retour à la ligne après $name (petite subtilité), tu le fait entre les guillemets simples qui entourent le contenu de echo:

echo $name 'codeentout genre'$var'autrecode...'

peut aussi s'ecrire avec des retours à la ligne:

echo $name '
codeentout
genre'$var'autrecode
...'

À noter que l'on a trouvé comment ajouter la déclaration de variable directement dans le conkyrc, ce qui rend inutile de passer par un script annexe... (cf la page ou tu as trouvé le script sur mon blog, en fin de post)

J'ai copié celui que tu avais fait et mis sur le forum à l'époque. J'irai jeter un oeil sur ton blog pour voir cette histoire de variable.
Par contre, est-ce qu'il n'y a pas un risque que conky devienne trop lourd avec la gestion des variables ?

Concernant l'affichage des infos des espaces disques, je vais essayer d'utiliser df -h à la place de mtab.

Je vais essayer de faire un script inspiré du tien pour m'essayer au script. Si jamais j'ai des questions, je reviendrai vers toi.


Cyril

Hors ligne

#355 Le 10/01/2011, à 12:17

Rolinh

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Histoire de m'abonner au topic, je post le mien.
Il n'est sûrement pas dans sa version définitive mais il me plait déjà pas mal smile

own_window no
own_window_argb_visual yes
own_window_argb_value 150
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_type normal
background no
font ubuntu:size=7.5
xftfont ubuntu:size=7.5
use_xft yes
xftalpha 0.5
update_interval 1.0
total_run_times 0
double_buffer yes
draw_shades yes
draw_outline yes
draw_borders no
draw_graph_borders no
minimum_size 224 5
maximum_width 224
border_width 2
default_color d7d7d7
default_shade_color black
default_outline_color black
alignment top_right
gap_x 0
gap_y 20
no_buffers yes
cpu_avg_samples 2
override_utf8_locale yes
uppercase no # set to yes if you want all text to be in uppercase
use_spacer right

TEXT
${image /usr/share/fbpanel/images/logo.png -s 18x18 -p 205,3}
SYSTEM ${hr 1}

Hostname: $alignr${color #0069ff}$nodename${color}
Kernel: $alignr${color #0069ff}$kernel${color}
Uptime: ${alignr}${color #0069ff}$uptime${color}
Processes: ${alignr}${color #0069ff}$processes ($running_processes running)${color}
Load: ${alignr}${color #0069ff}$loadavg${color}

Nvidia GPU Temp:${alignr}${color #ff0006}${execi 20 nvidia-settings -q gpucoretemp |grep Attribute |awk '{print $4}' |cut -c1-2}°C${color}

CPU 0${alignc} ${freq}MHz${color} / ${color #ff0006}${acpitemp}°C${color} ${alignr}(${cpu cpu0}%)${color}
${cpubar cpu0 7}
CPU 1${alignc} ${freq}MHz${color} / ${color #ff0006}${acpitemp}°C${color} ${alignr}(${cpu cpu1}%)${color}
${cpubar cpu1 7}
${color #0069ff}${cpugraph}${color}
Highest CPU $alignr CPU     MEM

${top name 1}$alignr${color #0069ff}${top cpu 1}%${top mem 1}%${color}
${top name 2}$alignr${color #0069ff}${top cpu 2}%${top mem 2}%${color}
${top name 3}$alignr${color #0069ff}${top cpu 3}%${top mem 3}%${color}

RAM ${alignr}$mem / $memmax ($memperc%)
${membar 10}

Highest MEM $alignr CPU     MEM

${top_mem name 1}$alignr${color #0069ff}${top_mem cpu 1}%${top_mem mem 1}%${color}
${top_mem name 2}$alignr${color #0069ff}${top_mem cpu 2}%${top_mem mem 2}%${color}
${top_mem name 3}$alignr${color #0069ff}${top_mem cpu 3}%${top_mem mem 3}%${color}

BATTERY ${hr 1}

${color3}Pow:${color}\
  ${if_existing /proc/acpi/battery/BAT0/state no} AC only\
  ${else}${if_match ${battery_percent BAT0}<10}${color red}\
${endif}\
${battery_percent BAT0}$color%
${if_existing /proc/acpi/ac_adapter/AC/state off-line}\
      ${battery_time BAT0}${else}\
${if_match ${battery_percent BAT0}==100}      Charged\
${else}      Charging\
 ${endif}${endif}${endif}

FILESYSTEM ${hr 1}${color}

${color #0069ff}/       ${color}${alignr}${fs_used /}/${fs_size /}${alignr}${color}${fs_bar 7,80 /}
${color #0069ff}/home   ${color}${alignr}${fs_used /home}/${fs_size /home}${alignr}${color}${fs_bar 7,80 /home}

${color}NETWORK ${hr 1}

#PUBLIC IP:${alignr}${color #0069ff}${execi 1~/.scripts/ip.sh}${color}

Wireless IP:${alignr}${color #0069ff}${addr wlan0}${color}
ESSID:$alignr${color #0069ff}${wireless_essid wlan0}${color}

Down ${downspeed wlan0} k/s ${alignr}Up ${upspeed wlan0} k/s
${color #0069ff}${downspeedgraph wlan0 15,107} ${alignr}${color #0069ff}${upspeedgraph wlan0 15,107}
${color}Total ${totaldown wlan0} ${alignr}Total ${totalup wlan0}


Wired IP:${alignr}${color #0069ff}${addr eth0}${color}

Down ${downspeed eth0} k/s ${alignr}Up ${upspeed eth0} k/s
${color #0069ff}${downspeedgraph eth0 15,107} ${alignr}${color #0069ff}${upspeedgraph eth0 15,107}
${color}Total ${totaldown eth0} ${alignr}Total ${totalup eth0}

Hors ligne

#356 Le 10/01/2011, à 17:59

wlourf

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Levi59 a écrit :

À noter que l'on a trouvé comment ajouter la déclaration de variable directement dans le conkyrc, ce qui rend inutile de passer par un script annexe... (cf la page ou tu as trouvé le script sur mon blog, en fin de post)

Interessant ça ! mais je n'ai pas trouvé sur quelle page tu as posté ça ! tu peux m'aiguiller ? merci

Hors ligne

#357 Le 10/01/2011, à 18:41

Levi59

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

C'est sur cette page :
Confere le second point en fin de l'article.

Mais ça avait été cité un peu plus tôt dans le forum et c'est également dans la section "Mon conky! PC" de mon blog. En fait on fait la déclaration comme dans un script (var=...) directement dans la ligne de code. Au début, je sais plus pourquoi, ça ne marchait jamais mais ça devait être une erreur d'écriture...
Edit: par contre je ne pense pas que l'on puisse reprendre des variables de conky.

Pour ce qui est de la sollicitation, je pense pas que ce soit plus lourd qu'un script externe.

@ sunkart
Si tu veux commencer à te plonger dans le bash, tu peux aller voir mes scripts mais sache que les plus anciens sont aussi les plus grossiers du fait qu'ils ont été fait lorsque je me suis lancé (mis à part celui pour rhythmbox que j'ai actualisé récemment...), donc tu peux t'en inspirer puisqu'ils marchent mais n'hésite pas à en pointer les défauts. wink

Dernière modification par Levi59 (Le 10/01/2011, à 18:49)

Hors ligne

#358 Le 10/01/2011, à 21:05

sunkart

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Je vais regarder ça.
Comment faire pour tester un script sans le mettre dans conky ? Je le lance via le terminal ?


Cyril

Hors ligne

#359 Le 11/01/2011, à 03:22

maestroom

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Fenouille84 a écrit :

Voici mon conky.

Il est sous Gnome, les effets de compiz (cube de bureau, fenêtre élastique, etc.) me manquait !!
Mais honnêtement, rien ne vaut un bon petit OpenBox ^^ J'y retourne illico !!

Hey! Ta le chic de faire des œuvres d'arts toi avec tes jolies backgrounds! Ta pensé de t'ouvrire un site pour artiste XD


P.S. Bonne et heureuse années a tous les linuxiens et Conkiens!

Dernière modification par maestroom (Le 11/01/2011, à 03:23)


CM: Asus Maximus extreme VI/ cpu: intel Core I7-4770 /carte graphique: nvidia GTX 760 /os: Ubuntu gnome-shell 14.04 "" 64 bits avec dual boot windows 8.1 64bit

Hors ligne

#360 Le 11/01/2011, à 10:53

Fenouille84

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

maestroom a écrit :

Hey! Ta le chic de faire des œuvres d'arts toi avec tes jolies backgrounds! Ta pensé de t'ouvrire un site pour artiste XD

Merci du compliment !! Sa fait plaisir big_smile

sunkart a écrit :

Je vais regarder ça.
Comment faire pour tester un script sans le mettre dans conky ? Je le lance via le terminal ?

Oui !


Ma page Deviant Art : conky inside ;-)
.
-- DropBox (online backup) : 2Go + 250 Mo pour vous et moi par parrainage --

Hors ligne

#361 Le 12/01/2011, à 19:14

maestroom

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Voilà mon nouveau conky pour commencer l'année 2011
baser sur Sysmetrix ( sur gnomelook, chercher bionic)
conky011211.th.png

voila le script  Start_conky.sh

#!/bin/bash

sleep 30
conky -c ~/.Conky/bionic/config/conkyrc &
exit 0

conkyrc

# — Conky settings — #

background yes

update_interval 1
total_run_times 0
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
imlib_cache_size 0

temperature_unit celcius

# — Window specifications — #

own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,sticky,skip_taskbar,skip_pager

border_inner_margin 0
border_outer_margin 0

minimum_size 270 930
maximum_width 270

alignment bottom_right

gap_x 0
gap_y 75


# — Graphics settings — #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# — Text settings — #
use_xft yes
xftfont hooge 05_54:size=6
xftalpha 0.1

default_color FFFFFF
default_gauge_size 47 25

uppercase no
use_spacer right

color0 white
color1 orange
color2 green

# — Lua Load — #

lua_load ~/.Conky/bionic/scripts/rings.lua
lua_draw_hook_pre main_rings

TEXT
${image ~/.Conky/bionic/pix/bg.png -p 0,0 -s 270x930}
${voffset 32}${font Astron Boy Video:size=8}${goto 40}Cpu1:${cpu cpu1}%
${voffset 12}${goto 40}Cpu3:${cpu cpu3}%
${voffset 12}${goto 180}Cpu2:${cpu cpu2}%
${voffset 12}${goto 180}Cpu4:${cpu cpu4}%
${voffset 160}${goto 160}${font Horst Roman Gothic:size=14}${memperc}%
${voffset 40}${goto 170}IN:
${goto 170}${downspeed eth1}
${voffset 1}${goto 170}OUT:
${goto 170}${upspeed eth1}
${voffset 298}${goto 90}${time %D :%H:%M:%S}

rings.lua

--[[ RINGS with SECTORS widget
    v1.0 by wlourf (08.08.2010)
    this widget draws a ring with differents effects 
    http://u-scripts.blogspot.com/2010/08/rings-sectors-widgets.html
    
To call the script in a conky, use, before TEXT
    lua_load /path/to/the/script/rings.lua
    lua_draw_hook_pre main_rings
and add one line (blank or not) after TEXT


Parameters are :
3 parameters are mandatory
name        - the name of the conky variable to display,
              for example for {$cpu cpu0}, just write name="cpu"
arg            - the argument of the above variable,
              for example for {$cpu cpu0}, just write arg="cpu0"
                arg can be a numerical value if name=""
max            - the maximum value the above variable can reach,
              for example for {$cpu cpu0}, just write max=100
    
Optional parameters:
xc,yc        - coordinates of the center of the ring,
              default = middle of the conky window
radius        - external radius of the ring, in pixels,
              default = quarter of the width of the conky window
thickness    - thickness of the ring, in pixels, default = 10 pixels
start_angle    - starting angle of the ring, in degrees, value can be negative,
              default = 0 degree
end_angle    - ending angle of the ring, in degrees,
              value must be greater than start_angle, default = 360 degrees
sectors        - number of sectors in the ring, default = 10
gap_sectors - gap between two sectors, in pixels, default = 1 pixel
cap            - the way to close a sector, available values are
                "p" for parallel , default value 
                "r" for radial (follow the radius)
inverse_arc    - if set to true, arc will be anticlockwise, default=false
border_size    - size of the border, in pixels, default = 0 pixel i.e. no border
fill_sector    - if set to true, each sector will be completely filled,
              default=false, this parameter is inoperate if sectors=1
background    - if set to false, background will not be drawn, default=true
foreground    - if set to false, foreground will not be drawn, default=true

Colours tables below are defined into braces :
{position in the gradient (0 to 1), colour in hexadecimal, alpha (0 to 1)}
example for a single colour table : 
{{0,0xFFAA00,1}} position parameter doesn't matter
example for a two-colours table : 
{{0,0xFFAA00,1},{1,0x00AA00,1}} or {{0.5,0xFFAA00,1},{1,0x00AA00,1}}
example for a three-colours table : 
{{0,0xFFAA00,1},{0.5,0xFF0000,1},{1,0x00AA00,1}}

bg_colour1    - colour table for background,
              default = {{0,0x00ffff,0.1},{0.5,0x00FFFF,0.5},{1,0x00FFFF,0.1}}
fg_colour1    - colour table for foreground,
              default = {{0,0x00FF00,0.1},{0.5,0x00FF00,1},{1,0x00FF00,0.1}}
bd_colour1    - colour table for border,
              default = {{0,0xFFFF00,0.5},{0.5,0xFFFF00,1},{1,0xFFFF00,0.5}}              

Seconds tables for radials gradients :
bg_colour2    - second colour table for background, default = no second colour
fg_colour2    - second colour table for foreground, default = no second colour
bd_colour2    - second colour table for border, default = no second colour

v1.0 (08 Aug. 2010) original release

]]


require 'cairo'
function conky_main_rings()
-- START PARAMETERS HERE
rings_settings={
    {
    name="time",
    arg="%S",
    max=60,
    xc=118,
    yc=676,
    start_angle=0,
    end_angle=360,
    thickness=5,
    radius=30,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0x00FF00,0.6}},
    },
    {
    name="time",
    arg="%M.%S",
    max=60,
    xc=118,
    yc=676,
    start_angle=0,
    end_angle=360,
    thickness=5,
    radius=24,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0xFFFF00,0.6}},
    },
    {
    name="time",
    arg="%I.%M",
    max=12,
    xc=118,
    yc=676,
    start_angle=0,
    end_angle=360,
    thickness=5,
    radius=18,
    sectors=6,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0xFF0000,0.6}},
    },
    {
    --ring 1-1 :cpu
    name="cpu",
    arg="cpu1",
    max=100,
    xc=82,
    yc=145,
    start_angle=180,
    end_angle=-180,
    thickness=5,
    radius=30,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0xD7DB3,0.6}},
    fg_colour2={{0.5,0xFF0000,0.6}},
    },
    {
    --ring 1-2 :cpu
    name="cpu",
    arg="cpu2",
    max=100,
    xc=82,
    yc=145,
    start_angle=180,
    end_angle=-180,
    thickness=5,
    radius=25,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0x49A835,0.6}},
    fg_colour2={{0.5,0xFF0000,0.6}},
    },
    {
    --ring 1-3 :cpu
    name="cpu",
    arg="cpu3",
    max=100,
    xc=82,
    yc=145,
    start_angle=180,
    end_angle=-180,
    thickness=5,
    radius=20,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0xCB0C29,0.6}},
    fg_colour2={{0.5,0xFF0000,0.6}},
    },
    {
    --ring 1-4 :cpu
    name="cpu",
    arg="cpu4",
    max=100,
    xc=82,
    yc=145,
    start_angle=180,
    end_angle=-180,
    thickness=5,
    radius=15,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0xFF6E00,0.6}},
    fg_colour2={{0.5,0xFF0000,0.6}},
    },
    {
    name="memperc",
    arg="",
    max=100,
    xc=175,
    yc=297,
    start_angle=180,
    end_angle=-180,
    thickness=7,
    radius=30,
    sectors=10,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0x00FF00,0.6}},
    fg_colour2={{0.5,0xFF0000,0.6}},
    },
    {
    --ring 4-1 : download speed
    name="downspeedf",
    arg="eth1",
    max=700,
    xc=187,
    yc=548,
    start_angle=180,
    end_angle=-180,
    thickness=17,
    radius=30,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0x0000ff,0.6}},
    fg_colour2={{0.5,0xFFFF00,0.6}},
    --ring 4-2 : upload speed
    },
    {
    name="upspeedf",
    arg="eth1",
    max=150,
    xc=95,
    yc=433,
    start_angle=180,
    end_angle=-180,
    thickness=17,
    radius=30,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0xFFFF00,0.6}},
    fg_colour2={{0.5,0x0000FF,0.6}},
    },
}
--END OF PARAMETERS HERE

--main function

    if conky_window==nil then return end
le code pour les
    local cs=cairo_xlib_surface_create(conky_window.display,
        conky_window.drawable, 
        conky_window.visual, conky_window.width, conky_window.height)
    cr=cairo_create(cs)

    if tonumber(conky_parse('${updates}'))>3 then
        for i in pairs(rings_settings) do
            draw_ring(rings_settings[i])
        end
    end

    cairo_destroy(cr)

end




function draw_ring(t)

    local function rgba_to_r_g_b_a(tcolour)
        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
    
    --initialize table
    setup(t)
    --[[grid
    h=conky_window.height
    w=conky_window.width
    cairo_set_source_rgba(cr,1,1,1,1)
    cairo_set_line_width(cr,0.5)
    cairo_move_to(cr,0,t.yc)
    cairo_line_to(cr,w,t.yc)
    cairo_stroke(cr)
    cairo_move_to(cr,t.xc,0)
    cairo_line_to(cr,t.xc,h)
    cairo_stroke(cr)
    cairo_move_to(cr,t.xc,t.yc)
    cairo_line_to(cr,t.xc+200*math.sin(math.pi/4),t.yc-200*math.cos(math.pi/4))
    cairo_stroke(cr)
    cairo_move_to(cr,0,t.yc-t.radius)
    cairo_line_to(cr,w,t.yc-t.radius)
    cairo_stroke(cr)
    cairo_move_to(cr,0,t.yc-t.int_radius)
    cairo_line_to(cr,w,t.yc-t.int_radius)
    cairo_stroke(cr)
    cairo_move_to(cr,0,t.yc-t.gap_sectors)
    cairo_line_to(cr,w,t.yc-t.gap_sectors)
    cairo_stroke(cr)
    cairo_set_source_rgba(cr,1,0,0,0.5)
    cairo_arc(cr,t.xc,t.yc,t.radius,0,2*math.pi)
    cairo_stroke(cr)
    cairo_arc(cr,t.xc,t.yc,t.int_radius,0,2*math.pi)    
    cairo_stroke(cr)    
    cairo_set_source_rgba(cr,0,1,0,1)    
    cairo_move_to(cr,t.xc+t.gap_sectors,t.yc-t.gap_sectors)
    cairo_line_to(cr,t.xc+400*math.sin(math.pi/4),t.yc-400*math.cos(math.pi/4))
    cairo_stroke(cr)
    --END GRID
    ]]
    
    --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 :
    angleA = ((t.end_angle-t.start_angle)/t.sectors)*math.pi/180
    --value of a sector : 
    valueA = t.max/t.sectors
    --first angle of a sector : 
    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 #
         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
        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 
        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
        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]]


function axis(ctx,alpha)
    cairo_set_line_width(ctx,1)
    cairo_set_source_rgba(ctx,1,0,0,alpha)
    cairo_move_to(ctx,0,0)
    cairo_line_to(ctx,150,0)
    cairo_stroke(ctx)
    cairo_set_source_rgba(ctx,0,1,0,alpha)
    cairo_move_to(ctx,0,0)
    cairo_line_to(ctx,0,150)
    cairo_stroke(ctx)
end    

pour les fonts.ttf j'utilise HOOG0550.ttf,HOOG0553.ttf,HOOG0554.ttf,HOOG0555_cyr2.ttf

et pour ceux qui veule le pix voici l'image

40600845.th.png

Uploaded with ImageShack.us


P.S. Voila Levi59 j'ai tout mis car ce matin je n'avais pas eu le temps de tout mettre sur le site.. ^^

Dernière modification par maestroom (Le 13/01/2011, à 17:32)


CM: Asus Maximus extreme VI/ cpu: intel Core I7-4770 /carte graphique: nvidia GTX 760 /os: Ubuntu gnome-shell 14.04 "" 64 bits avec dual boot windows 8.1 64bit

Hors ligne

#362 Le 12/01/2011, à 19:56

Levi59

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

J'adore!
Le code peut-être...

Hors ligne

#363 Le 12/01/2011, à 20:54

sunkart

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Question script, je voudrais utiliser grep comme toi sur /etc/mtab mais sur le résultat de "df -h", mais je n'arrive pas à utiliser grep avec la fonction df. Comment faire ?

Edit : j'ai trouvé smile

Dernière modification par sunkart (Le 12/01/2011, à 21:17)


Cyril

Hors ligne

#364 Le 13/01/2011, à 01:43

Pacifick_FR42

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

avec un pipe ? non ? df <options> | grep <ce_que_tu_veux_> ou alors, j'ai mal compris ta question...

Hors ligne

#365 Le 13/01/2011, à 21:00

maestroom

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

bon voila je m'ennuyais se matin et je trouvais qu'il manquait un p'tit quelques choses dans mon conky donc j'ai créé un conky a par pour complété ce qui manquait

et voici la mise a jour de mes script car je me retrouve ainsi avec deux conkyrc ^^
modifdemonnewconky.th.png

voici les images utiliser pour le conky
40600845.th.png

hddpix.th.png

usbkey.th.png

conkyrc:

# Use Xft?
use_xft yes
xftfont DejaVu Sans:size=8
xftalpha 0.8
text_buffer_size 2048

# Update interval in seconds
update_interval 1

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0
background yes

# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_transparent yes
own_window_type override
#own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 325 250
#maximum_width 325

# 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 5

# border width
border_width 1

# Default colors and also border colors
default_color white
#default_shade_color black
#default_outline_color white
own_window_colour white

# 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
# same thing as passing -x at command line
gap_x 1700
gap_y 39

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 1

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer none

text
${image ~/.Conky/bionic/pix/hdd_pix.png -p 0,10 -s 127x74}
${voffset 0}${goto 150}${color white}${font Astron Boy Gothic:size=10}Home: ${fs_bar 7,100 /media/}
${voffset 0}${goto 150}used: ${fs_used /media/}
${voffset 0}${goto 150}FREE: ${fs_free /media/}
${voffset 0}${goto 150}SIZE: ${fs_size /media/}
${image ~/.Conky/bionic/pix/hdd_pix.png -p 0,110 -s 127x74}
${voffset 15}${goto 150}${color white}${font Astron Boy Gothic:size=10}Dead Space: ${fs_bar 7,100 /media/Dead_Space}
${voffset 0}${goto 150}used: ${fs_used /media/Dead_Space}
${voffset 0}${goto 150}FREE: ${fs_free /media/Dead_Space}
${voffset 0}${goto 150}SIZE: ${fs_size /media/Dead_Space}
${image ~/.Conky/bionic/pix/hdd_pix.png -p 0,210 -s 127x74}
${voffset 15}${goto 150}${color white}${font Astron Boy Gothic:size=10}Windows 7: ${fs_bar 7,100 /media/Windows_7}
${voffset 0}${goto 150}used: ${fs_used /media/Windows_7}
${voffset 0}${goto 150}FREE: ${fs_free /media/Windows_7}
${voffset 0}${goto 150}SIZE: ${fs_size /media/Windows_7}
${image ~/.Conky/bionic/pix/hdd_pix.png -p 0,310 -s 127x74}
${voffset 15}${goto 150}${color white}${font Astron Boy Gothic:size=10}serenity: ${fs_bar 7,100 /media/serenity}
${voffset 0}${goto 150}used: ${fs_used /media/serenity}
${voffset 0}${goto 150}FREE: ${fs_free /media/serenity}
${voffset 0}${goto 150}SIZE: ${fs_size /media/serenity}
${image ~/.Conky/bionic/pix/usb_key.png -p 15,410 -s 102x59}
${voffset 15}${goto 150}${color white}${font Astron Boy Gothic:size=10}Exodus: ${fs_bar 7,100 /media/EXODUS}
${voffset 0}${goto 150}FREE: ${fs_free /media/EXODUS}
${voffset 0}${goto 150}SIZE: ${fs_size /media/EXODUS}

conkyrc 2

# — Conky settings — #

background yes

update_interval 1
total_run_times 0
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
imlib_cache_size 0

temperature_unit celcius

# — Window specifications — #

own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,sticky,skip_taskbar,skip_pager

border_inner_margin 0
border_outer_margin 0

minimum_size 270 930
maximum_width 270

alignment bottom_right

gap_x 0
gap_y 75


# — Graphics settings — #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# — Text settings — #
use_xft yes
xftfont hooge 05_54:size=6
xftalpha 0.1

default_color FFFFFF
default_gauge_size 47 25

uppercase no
use_spacer right

color0 white
color1 orange
color2 green

# — Lua Load — #

lua_load ~/.Conky/bionic/scripts/rings.lua
lua_draw_hook_pre main_rings

TEXT
${image ~/.Conky/bionic/pix/bg.png -p 0,0 -s 270x930}
${voffset 32}${font Astron Boy Video:size=8}${goto 40}Cpu1:${cpu cpu1}%
${voffset 12}${goto 40}Cpu3:${cpu cpu3}%
${voffset 12}${goto 180}Cpu2:${cpu cpu2}%
${voffset 12}${goto 180}Cpu4:${cpu cpu4}%
${voffset 160}${goto 160}${font Horst Roman Gothic:size=14}${memperc}%
${voffset 40}${goto 170}IN:
${goto 170}${downspeed eth1}
${voffset 1}${goto 170}OUT:
${goto 170}${upspeed eth1}
${voffset 298}${goto 90}${time %D :%H:%M:%S}

rings.lua

--[[ RINGS with SECTORS widget
    v1.0 by wlourf (08.08.2010)
    this widget draws a ring with differents effects 
    http://u-scripts.blogspot.com/2010/08/rings-sectors-widgets.html
    
To call the script in a conky, use, before TEXT
    lua_load /path/to/the/script/rings.lua
    lua_draw_hook_pre main_rings
and add one line (blank or not) after TEXT


Parameters are :
3 parameters are mandatory
name        - the name of the conky variable to display,
              for example for {$cpu cpu0}, just write name="cpu"
arg            - the argument of the above variable,
              for example for {$cpu cpu0}, just write arg="cpu0"
                arg can be a numerical value if name=""
max            - the maximum value the above variable can reach,
              for example for {$cpu cpu0}, just write max=100
    
Optional parameters:
xc,yc        - coordinates of the center of the ring,
              default = middle of the conky window
radius        - external radius of the ring, in pixels,
              default = quarter of the width of the conky window
thickness    - thickness of the ring, in pixels, default = 10 pixels
start_angle    - starting angle of the ring, in degrees, value can be negative,
              default = 0 degree
end_angle    - ending angle of the ring, in degrees,
              value must be greater than start_angle, default = 360 degrees
sectors        - number of sectors in the ring, default = 10
gap_sectors - gap between two sectors, in pixels, default = 1 pixel
cap            - the way to close a sector, available values are
                "p" for parallel , default value 
                "r" for radial (follow the radius)
inverse_arc    - if set to true, arc will be anticlockwise, default=false
border_size    - size of the border, in pixels, default = 0 pixel i.e. no border
fill_sector    - if set to true, each sector will be completely filled,
              default=false, this parameter is inoperate if sectors=1
background    - if set to false, background will not be drawn, default=true
foreground    - if set to false, foreground will not be drawn, default=true

Colours tables below are defined into braces :
{position in the gradient (0 to 1), colour in hexadecimal, alpha (0 to 1)}
example for a single colour table : 
{{0,0xFFAA00,1}} position parameter doesn't matter
example for a two-colours table : 
{{0,0xFFAA00,1},{1,0x00AA00,1}} or {{0.5,0xFFAA00,1},{1,0x00AA00,1}}
example for a three-colours table : 
{{0,0xFFAA00,1},{0.5,0xFF0000,1},{1,0x00AA00,1}}

bg_colour1    - colour table for background,
              default = {{0,0x00ffff,0.1},{0.5,0x00FFFF,0.5},{1,0x00FFFF,0.1}}
fg_colour1    - colour table for foreground,
              default = {{0,0x00FF00,0.1},{0.5,0x00FF00,1},{1,0x00FF00,0.1}}
bd_colour1    - colour table for border,
              default = {{0,0xFFFF00,0.5},{0.5,0xFFFF00,1},{1,0xFFFF00,0.5}}              

Seconds tables for radials gradients :
bg_colour2    - second colour table for background, default = no second colour
fg_colour2    - second colour table for foreground, default = no second colour
bd_colour2    - second colour table for border, default = no second colour

v1.0 (08 Aug. 2010) original release

]]


require 'cairo'
function conky_main_rings()
-- START PARAMETERS HERE
rings_settings={
    {
    name="time",
    arg="%S",
    max=60,
    xc=118,
    yc=676,
    start_angle=0,
    end_angle=360,
    thickness=5,
    radius=30,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0x00FF00,0.6}},
    },
    {
    name="time",
    arg="%M.%S",
    max=60,
    xc=118,
    yc=676,
    start_angle=0,
    end_angle=360,
    thickness=5,
    radius=24,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0xFFFF00,0.6}},
    },
    {
    name="time",
    arg="%I.%M",
    max=12,
    xc=118,
    yc=676,
    start_angle=0,
    end_angle=360,
    thickness=5,
    radius=18,
    sectors=6,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0xFF0000,0.6}},
    },
    {

    --ring 1-1 :cpu
    name="cpu",
    arg="cpu1",
    max=100,
    xc=82,
    yc=145,
    start_angle=180,
    end_angle=-180,
    thickness=5,
    radius=30,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0xD7DB3,0.6}},
    fg_colour2={{0.5,0xFF0000,0.6}},
    },
    {
    --ring 1-2 :cpu
    name="cpu",
    arg="cpu2",
    max=100,
    xc=82,
    yc=145,
    start_angle=180,
    end_angle=-180,
    thickness=5,
    radius=25,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0x49A835,0.6}},
    fg_colour2={{0.5,0xFF0000,0.6}},
    },
    {
    --ring 1-3 :cpu
    name="cpu",
    arg="cpu3",
    max=100,
    xc=82,
    yc=145,
    start_angle=180,
    end_angle=-180,
    thickness=5,
    radius=20,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0xCB0C29,0.6}},
    fg_colour2={{0.5,0xFF0000,0.6}},
    },
    {
    --ring 1-4 :cpu
    name="cpu",
    arg="cpu4",
    max=100,
    xc=82,
    yc=145,
    start_angle=180,
    end_angle=-180,
    thickness=5,
    radius=15,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0xFF6E00,0.6}},
    fg_colour2={{0.5,0xFF0000,0.6}},
    },
    {
    name="memperc",
    arg="",
    max=100,
    xc=175,
    yc=297,
    start_angle=180,
    end_angle=-180,
    thickness=7,
    radius=30,
    sectors=10,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0x00FF00,0.6}},
    fg_colour2={{0.5,0xFF0000,0.6}},
    },
    {
    --ring 4-1 : download speed
    name="downspeedf",
    arg="eth1",
    max=700,
    xc=187,
    yc=548,
    start_angle=180,
    end_angle=-180,
    thickness=17,
    radius=30,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0x0000ff,0.6}},
    fg_colour2={{0.5,0xFFFF00,0.6}},
    --ring 4-2 : upload speed
    },
    {
    name="upspeedf",
    arg="eth1",
    max=150,
    xc=95,
    yc=433,
    start_angle=180,
    end_angle=-180,
    thickness=17,
    radius=30,
    sectors=30,
    gap_sectors=1,
    bg_colour1={{0.5,0xFFFFFF,0.2}},
    fg_colour1={{0.5,0xFFFF00,0.6}},
    fg_colour2={{0.5,0x0000FF,0.6}},
    },
}



--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)
    cr=cairo_create(cs)

    if tonumber(conky_parse('${updates}'))>3 then
        for i in pairs(rings_settings) do
            draw_ring(rings_settings[i])
        end
    end

    cairo_destroy(cr)

end




function draw_ring(t)

    local function rgba_to_r_g_b_a(tcolour)
        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
    
    --initialize table
    setup(t)
    --[[grid
    h=conky_window.height
    w=conky_window.width
    cairo_set_source_rgba(cr,1,1,1,1)
    cairo_set_line_width(cr,0.5)
    cairo_move_to(cr,0,t.yc)
    cairo_line_to(cr,w,t.yc)
    cairo_stroke(cr)
    cairo_move_to(cr,t.xc,0)
    cairo_line_to(cr,t.xc,h)
    cairo_stroke(cr)
    cairo_move_to(cr,t.xc,t.yc)
    cairo_line_to(cr,t.xc+200*math.sin(math.pi/4),t.yc-200*math.cos(math.pi/4))
    cairo_stroke(cr)
    cairo_move_to(cr,0,t.yc-t.radius)
    cairo_line_to(cr,w,t.yc-t.radius)
    cairo_stroke(cr)
    cairo_move_to(cr,0,t.yc-t.int_radius)
    cairo_line_to(cr,w,t.yc-t.int_radius)
    cairo_stroke(cr)
    cairo_move_to(cr,0,t.yc-t.gap_sectors)
    cairo_line_to(cr,w,t.yc-t.gap_sectors)
    cairo_stroke(cr)
    cairo_set_source_rgba(cr,1,0,0,0.5)
    cairo_arc(cr,t.xc,t.yc,t.radius,0,2*math.pi)
    cairo_stroke(cr)
    cairo_arc(cr,t.xc,t.yc,t.int_radius,0,2*math.pi)    
    cairo_stroke(cr)    
    cairo_set_source_rgba(cr,0,1,0,1)    
    cairo_move_to(cr,t.xc+t.gap_sectors,t.yc-t.gap_sectors)
    cairo_line_to(cr,t.xc+400*math.sin(math.pi/4),t.yc-400*math.cos(math.pi/4))
    cairo_stroke(cr)
    --END GRID
    ]]
    
    --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 :
    angleA = ((t.end_angle-t.start_angle)/t.sectors)*math.pi/180
    --value of a sector : 
    valueA = t.max/t.sectors
    --first angle of a sector : 
    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 #
         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
        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 
        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
        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]]


function axis(ctx,alpha)
    cairo_set_line_width(ctx,1)
    cairo_set_source_rgba(ctx,1,0,0,alpha)
    cairo_move_to(ctx,0,0)
    cairo_line_to(ctx,150,0)
    cairo_stroke(ctx)
    cairo_set_source_rgba(ctx,0,1,0,alpha)
    cairo_move_to(ctx,0,0)
    cairo_line_to(ctx,0,150)
    cairo_stroke(ctx)
end    

Start_conky.sh

#!/bin/bash

sleep 30
conky -c &
conky -c ~/.Conky/bionic/config/conkyrc &
exit 0

Dernière modification par maestroom (Le 13/01/2011, à 21:10)


CM: Asus Maximus extreme VI/ cpu: intel Core I7-4770 /carte graphique: nvidia GTX 760 /os: Ubuntu gnome-shell 14.04 "" 64 bits avec dual boot windows 8.1 64bit

Hors ligne

#366 Le 13/01/2011, à 22:13

sunkart

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

J'ai réussit à faire ce que je voulais faire big_smile
Voici le code :

#!/bin/bash
#12/01/2011 - Cyril
rm -f /tmp/pointsmontage
df -h > /tmp/resultat_dfh

for i in `grep ^\/dev /tmp/resultat_dfh | grep -v \ /\$ | sed 's/ /a/g' | cut -c41-`
    do
        # récupérer le nom de dossier
        name=`echo $i | cut -c12-`
    montage=`echo $i | cut -c5-`
    valeur=`echo $i | cut -c1-1`
    echo '${alignr}'$name'
${alignr}${if_match ${fs_used_perc '$montage'} >= 80}${color CC2929}${fs_free '$montage'}${else}${if_match ${fs_used_perc '$montage'} >= 50}${color CC6D29}${fs_used '$montage'}${else}${if_match ${fs_used_perc '$montage'} >= 20}${color 008000}${fs_used '$montage'}${else}${color 616161}${fs_used '$montage'}${endif}${endif}${endif}
${voffset -28}${font Pie charts for maps:size=12}${if_match ${fs_used_perc '$montage'} >= 80}${color CC2929}${else}${if_match ${fs_used_perc '$montage'} >= 50}${color CC6D29}${else}${if_match ${fs_used_perc '$montage'} >= 20}${color 008000}${else}${color 616161}${endif}${endif}${endif}'$valeur'${color}${font}
${voffset -6}${font Nimbus Sans L:size=7}${if_match ${fs_used_perc '$montage'} >= 80}${color CC2929}${else}${if_match ${fs_used_perc '$montage'} >= 50}${color CC6D29}${else}${if_match ${fs_used_perc '$montage'} >= 20}${color 008000}${else}${color 616161}${endif}${endif}${endif}${fs_used_perc '$montage'}%${color}${font}' >> /tmp/pointsmontage
    done

Il permet, comme le script de Levi59, d'afficher les informations des disques montés sur votre machine (clé usb ou disque dur externe). A la différence de Levi59, j'utilise la commande "df -h". Elle permet de récupérer les % d'utilisation. Je récupère le premier chiffre du % d'occupation et j'utilise la police "Pie charts for maps" pour tracer le cercle représentant l'utilisation avec cette valeur récupérée. Dans le cas d'un % d'occupation inférieur à 10%, la commande affiche la valeur sur un seul chiffre. J'ai donc remplacé cet espace vide par un "a" qui se transforme en cercle vide avec la police.

La mise en forme est la suivante : rouge si > 80% - orange si > 50% - vert si > 20% - gris si < 20%
La valeur affichée est l'espace restant quand c'est si > 80% et l'espace occupé si < 80%.

Bon, c'est mon premier script (il m'a pris 3h), y'a surement de quoi faire pour l'améliorer, mais le principal c'est qu'il fait ce que je veux big_smile

Capture avec seulement la partition avec Ubuntu (qui n'est pas affiché avec le script mais directement via conky) :
capture1fh.png
Uploaded with ImageShack.us

Capture avec une carte SD connectée :
capture2eg.png
Uploaded with ImageShack.us


Cyril

Hors ligne

#367 Le 14/01/2011, à 13:05

Barkit

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Boujour à tous

Voici un update de mon conky :

ici

maestroom a écrit :

Hey! Ta le chic de faire des œuvres d'arts toi avec tes jolies backgrounds! Ta pensé de t'ouvrire un site pour artiste XD

Entièrement d'accord! smile

@ Fenouille84 merci au passage de m'avoir faire découvrir Openbox et Tilda (via ta signature!) grâce à ça j'ai pu obtenir une interface hyper épurée et hyper réactive !

Dernière modification par Barkit (Le 14/01/2011, à 13:08)

Hors ligne

#368 Le 14/01/2011, à 15:12

Levi59

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

@ sunkart
Un code plus léger sans sed ni cut (pas très pratique comme tu l'utilises) ni fichier temporaire (selon l'exemple de Totor, Merci! ^^)

#!/bin/bash
# By Rodolphe Rombeaut sur le modèle de Cyril (Alias Sunkart)
# Affichage avancé des périphériques

OLDIFS=$IFS
IFS="
"
liste=()
alpha=(a b c d e f g h i j k l m n o p q r s t u)
for i in `df -h | grep ^\/dev`
do
    # récupérer le nom de dossier
    name=${i#*\%}
    [ -z "${name##*/}" ] && name="root" || name=${name##*/}
    
    montage=${i#*\%}
    [ -z "${montage#*/}" ] && montage="/" || montage="/${montage#*/}"
    
    valeur=${i%\%*}
    valeur=${valeur##* }
    [ "$valeur" -gt 80 ] && color="CC2929" || {
        [ "$valeur" -gt 50 ] && color="CC6D29" || {
            [ "$valeur" -gt 20 ] && color="008000" || color="616161"
        }
    }
    
    graph=$(( ($valeur*21) / 100 ))
    graph=${alpha[$graph]}
    
    liste+=(`echo '${alignr}'$name'
${alignr}${color '$color'}${fs_used '$montage'}${color}
${voffset -28}${font Pie charts for maps:size=12}${color '$color'}'$graph'${color}${font}
${voffset -6}${font Nimbus Sans L:size=7}${color '$color'}'$valeur'%${color}${font}'`)
done
printf '%s\n' ${liste[@]}
IFS=$OLDIFS
exit

Normalement il te suffit de mettre ce code dans conky pour avoir l'affichage:

${execpi XX /CHEMIN/VERS/SCRIPT.SH}

XX, c'est le rythme d'actualisation en secondes

EDIT : J'ai un peu simplifié et corrigé...

Dernière modification par Levi59 (Le 14/01/2011, à 18:05)

Hors ligne

#369 Le 14/01/2011, à 16:47

sunkart

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Je me disais bien que j'aurais droit à une correction de ta part smile
Je teste ta modif ce soir.

Je me suis rendu compte que ce n'était plus pour moi ce genre de codage, dans le sens où je n'ai plus trop le temps à y consacrer pour apprendre. En tout cas, c'est très instructif.


Cyril

Hors ligne

#370 Le 14/01/2011, à 17:49

Levi59

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Bah il est plutôt simple celui là...
J'ai juste maché le travail de conky pour les couleurs (autant faire le test dans le script, ça économise le nombre de vérification), j'ai utilisé les lettres plutôt que les chiffres pour le petit graph (plus de nuance: 21 lettres pour 10 chiffres) et j'ai éliminé les étapes inutiles (fichier temporaire, appelle à des commandes superflue...)

Edit: Petite erreur de ma part

Il faut remplacer la ligne

    graph=$(( ( ($valeur*21) / 100 ) - 1 ))

par

    graph=$(( ($valeur*21) / 100 ))

Sinon ca plante et il ne trouve pas la lettre équivalente.

Dernière modification par Levi59 (Le 14/01/2011, à 18:01)

Hors ligne

#371 Le 14/01/2011, à 18:38

maestroom

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Barkit a écrit :

Boujour à tous

Voici un update de mon conky :

ici

maestroom a écrit :

Hey! Ta le chic de faire des œuvres d'arts toi avec tes jolies backgrounds! Ta pensé de t'ouvrire un site pour artiste XD

Entièrement d'accord! smile

@ Fenouille84 merci au passage de m'avoir faire découvrir Openbox et Tilda (via ta signature!) grâce à ça j'ai pu obtenir une interface hyper épurée et hyper réactive !


bon d'accord ont passe au vote sur une échelle de 1 a 10
....
.....

...........
................


............10 sur 10  @ Fenouille84 pour ces goût et ces concept Artistique et du fait je suis pas tout seul a y pensé  ^^


CM: Asus Maximus extreme VI/ cpu: intel Core I7-4770 /carte graphique: nvidia GTX 760 /os: Ubuntu gnome-shell 14.04 "" 64 bits avec dual boot windows 8.1 64bit

Hors ligne

#372 Le 14/01/2011, à 22:28

Fenouille84

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Barkit a écrit :

@ Fenouille84 merci au passage de m'avoir faire découvrir Openbox et Tilda (via ta signature!) grâce à ça j'ai pu obtenir une interface hyper épurée et hyper réactive !

De rien ! wink
On est là pour partager nos conky, mais aussi nos astuces, bons plans...

@maestroom
Encore merci pour les compliments !!
Merci également à tout ceux qui aime, ou qui ne déteste pas, mes conky tongue Ils n'ont rien d'extraordinaires, j'apporte rarement de nouvelles fonctionnalités... Mais s'ils vous plaisent, c'est l'essentiel alors smile

Dernière modification par Fenouille84 (Le 14/01/2011, à 22:30)


Ma page Deviant Art : conky inside ;-)
.
-- DropBox (online backup) : 2Go + 250 Mo pour vous et moi par parrainage --

Hors ligne

#373 Le 14/01/2011, à 22:55

sunkart

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Levi59 a écrit :

Bah il est plutôt simple celui là...
J'ai juste maché le travail de conky pour les couleurs (autant faire le test dans le script, ça économise le nombre de vérification), j'ai utilisé les lettres plutôt que les chiffres pour le petit graph (plus de nuance: 21 lettres pour 10 chiffres) et j'ai éliminé les étapes inutiles (fichier temporaire, appelle à des commandes superflue...)

Edit: Petite erreur de ma part

Il faut remplacer la ligne

    graph=$(( ( ($valeur*21) / 100 ) - 1 ))

par

    graph=$(( ($valeur*21) / 100 ))

Sinon ca plante et il ne trouve pas la lettre équivalente.

Testé et approuvé smile
Par contre, est-ce qu'on peut afficher l'espace restant quand c'est > 80% à la place de l'espace occupé ?


Cyril

Hors ligne

#374 Le 15/01/2011, à 14:20

wiltur

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Voici mon conky tout frais, des modification sur certains scripts lua pioché ici
J'ai voulu du discret et pas encombrant smile

1295093387.jpg

Les scripts Lua et les conkys sont ici

Dernière modification par wiltur (Le 15/01/2011, à 14:20)


Microsoft est à l'informatique ce que TF1 est à la culture. :)

Hors ligne

#375 Le 15/01/2011, à 14:47

Levi59

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

6 cœurs? Oo (Moi et mon pôvre P4... :'( )

Sinon très sympa même si je n'aurais pas utilisé les nuances de bleu... Si j'avais un peu plus de puissance, pourquoi pas!

Hors ligne