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.

#626 Le 29/08/2014, à 00:34

Didier-T

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonsoir loutch,
je viens de voir ta solution, personnelement, je n'aime pas forcer l'actualisation de l'image a chaque interval de mise a jour (dans ton cas toutes les secondes).
l'option -f de ${image} est bien plus souple, pour deux raisons, la première le refraichissement ne concerne que l'image affiché par la commande, le seconde tu peut mettre l'interval qui te convient (en fonction de la puissance de ton processeur, par exemple).
tu as aussi l'option -n qui precise que l'image en question ne bénéficie pas du cache.
pour un mise a jour toutes les secondes tu as donc deux solutions :
  - ${image ~/.conky/audacious/audacious.jpg -p 30,230 -s 200x200 -f 1}
  - ${image ~/.conky/audacious/audacious.jpg -p 30,230 -s 200x200 -n}

A+,
Didier.

Hors ligne

#627 Le 30/08/2014, à 13:26

loutch

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

smilies%20(204).gif

Merci j'ai mis l'option -n

smilies%20(1).gif

Hors ligne

#628 Le 12/09/2014, à 09:04

enebre

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonjour, j'aimerais remettre l'info de la dernière ligne de syslog.
j'avais cette commande , mais il doit y avoir une erreur que je n'arrive pas à trouver.

${exec cat tail -n1 -f /var/log/syslog | grep note | cut -d "=" -f2}

edit: je ne trouve pas le syslog !!! ou serait-il ?
Pourtant "locate syslog" me donne cette adresse, mais en fait il n'y est pas !

Dernière modification par enebre (Le 12/09/2014, à 09:17)

Hors ligne

#629 Le 12/09/2014, à 11:16

ljere

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

bonjour,
ça ne serait pas plutôt

${exec cat tail -n1 -f /var/log/syslog | cut -d "=" -f2}

sinon je suis sceptique sur le cat tail à la suite


ancien PC Toshiba satellite_c670d-11 / Linux Mint 21 Vanessa
Nouveau PC ASUS TUF GAMING A17 GPU RTX 4070 CPU AMD Ryzen 9 7940HS w/ Radeon 780M Graphics / Linux Mint 21.2 Victoria / Kernel: 6.4.8-1-liquorix / Desktop: Cinnamon

Hors ligne

#630 Le 12/09/2014, à 12:30

enebre

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonjour ljere, ça fait un moment que je n'ai pas eu le plaisir de te saluer.
Pour le retour de ta suggestion c'est peut être ça mais je n'ai pas plus de résultat, et comment se fait-il que je ne trouve pas le fichier syslog dans /var/log/ ?

Hors ligne

#631 Le 12/09/2014, à 22:02

loutch

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

smilies%20(204).gif

Voila j'ai un problème avec un conky marée de Didier-t  ,il ne change pas le port que j'ai choisi (125 )et met met toujours le port par défaut du conky à savoir le 66 et les dates ne sont pas bonnes, j'ai même changé le temps des update à 20 .Il change pourtant l'heure des mises à jours.

le 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
 
background yes
use_xft yes
xftfont URW Chancery L:style=Bold: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
double_buffer yes
minimum_size 350 
maximum_width 350
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color ffffff
default_outline_color white
alignment tl
gap_x 370
gap_y 0
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes

# Taille des pointillés
stippled_borders 5

    template1 ${lua Maree_\1 \2} # -- gestion météo --#
    lua_load ~/conky/script/Marée/marée.lua                   # éventuellement changer la référence à votre répertoire 


TEXT
${template1 Maj ~/conky/script/Marée/marée.cfg}
Marées pour le port de ${template1 port} longitude ${template1 longitude} latitude ${template1 latitude}

Horaire des marées pour le ${template1 date 1}
${template1 Position1 1} à ${template1 Heure1 1} Niveau ${template1 Hauteur1 1}${if_match "${template1 Position1 1}"=="Marée Haute"} indice de Marée à ${template1 maree1 1}${endif}
${template1 Position2 1} à ${template1 Heure2 1} Niveau ${template1 Hauteur2 1}${if_match "${template1 Position2 1}"=="Marée Haute"} indice de Marée à ${template1 maree1 1}${endif}
${template1 Position3 1} à ${template1 Heure3 1} Niveau ${template1 Hauteur3 1}${if_match "${template1 Position3 1}"=="Marée Haute"} indice de Marée à ${template1 maree2 1}${endif}
${if_match "${template1 Position4 1}"=="N/A"}${else}${template1 Position4 1} à ${template1 Heure4 1} Niveau ${template1 Hauteur4 1}${if_match "${template1 Position4 1}"=="Marée Haute"} indice de Marée à ${template1 maree2 1}${endif}${endif}

Information mise à jour à ${template1 Heure}H${template1 Minute}

le maree.cfg

#Répertoire de sauvegarde
repsauv=~/conky/maree

#Répertoire temporaire
TempShell=/tmp

#Copier votre adresse maree.info ici
web=http://maree.info/125

#Temps entre les mises à jour (secondes)
update=20

Comme dit dans le post 786 du 29-04-2012 j'ai bien relancé le conky mais ça ne fonctionne pas et je n'ai pas d'erreur en konsole.

[romuald@localhost ~]$ conky -c ~/conky/marée
Conky: forked to background, pid is 15621
[romuald@localhost ~]$ 
Conky: desktop window (1e00230) is subwindow of root window (90)
Conky: window type - normal
Conky: drawing to created window (0x6200002)
Conky: drawing to double buffer
[romuald@localhost ~]$ 

1410551297.png

Merci d'avance et

smilies%20(1).gif

Dernière modification par loutch (Le 12/09/2014, à 22:12)

Hors ligne

#632 Le 12/09/2014, à 22:14

Didier-T

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonsoir enebre,
cat et tail dans la même commande sa peut pas le faire, il faut choisir.
cat te lit tout le fichier.
tail le nombre de ligne demandée en partant de la fin.

tail semble le plus adapté, essaye ceci

tail -1 /var/log/syslog

Hors ligne

#633 Le 12/09/2014, à 22:19

Didier-T

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonsoir loutch,
eh bien ça c'est du déterrage big_smile je ne me souvenais même plus avoir écris ce script tongue

tu pourrais me donner le retour de ceci

ls ~/conky/script/Marée/

et de ceci

ls ~/conky/maree

Merci

Hors ligne

#634 Le 12/09/2014, à 22:22

loutch

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Re Didier-T

oui 2012 ça fait loin

[romuald@localhost ~]$ ls ~/conky/script/Marée/
marée.cfg  marée.lua
[romuald@localhost ~]$ 
[romuald@localhost ~]$ ls ~/conky/maree
maree.txt

 

le maree.txt ne change pas
@+

Dernière modification par loutch (Le 12/09/2014, à 22:24)

Hors ligne

#635 Le 12/09/2014, à 22:56

Didier-T

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Re loutch,
ils ont mis une protection contre les robots.
C'est pas bien grave, voici le script corrigé.
marée.lua

-- Créé par Didier-T (forum.ubuntu-fr.org)



require "io"
require "os"
local Version = "v1"
local maree = {}
local info = {}
local Rep, repsauv, time, up

--Vérifier l'existence d'un fichier
function existe(file)
  local a = io.open(file, "r")
  local present
  if a then
    present = true
    io.close(a)
  else
    present = false
  end
  return present
end


function string.balise(self, arg1, arg2)
    local a, b, c

    a,b = self:find(arg1)
    if a ~= nil then
        if b == nil then
            b = a+1
        else
            b = b+1
        end

        c = self:find(arg2, b)
        if c == nil then
            c = b
        else
            c = c-1
        end
    end

    return b, c
end


function recup_maree(fichier)
    local pos1, pos2, pos3, pos4, pos5, pos6, longitude, latitude, port, date, Heure1_Pos, Heure2_Pos, Heure3_Pos, Heure4_Pos, Heure1, Heure2, Heure3, Heure4, Hauteur1, Hauteur2, Hauteur3, Hauteur4, maree1, maree2
    local file = assert(io.open(fichier, "rb") )
    local line = file:read()

    for line in file:lines() do
        if string.find(line, 'GeoCoordinates') ~= nil then
            pos1, pos2 = line:balise('<small>', '<br>')
            latitude = string.sub(line, pos1, pos2):gsub("&deg;", "°")
            pos1, pos2 = line:balise('<br>', '</small>')
            longitude = string.sub(line, pos1, pos2):gsub("&deg;", "°")
        elseif string.find(line, "'PortNom'") ~= nil then
            pos1, pos2 = line:balise(' "', '",')
            port = string.sub(line, pos1, pos2)
        elseif string.find(line, 'MareeJours_Content') ~= nil then
            for i = 1, 7 do
                pos1, pos2 = line:balise('<tr class="MJ ', '</tr>')
                local line1 = string.sub(line, pos1, pos2)
                line = line:sub(pos2)
                pos3, pos4 = line1:balise(';">', "</b>")
                date = string.gsub(string.sub(line1, pos3, pos4), "<br><b>", " ")
                pos3, pos4 = line1:balise('<td>', '</td>')
                local line2 = string.sub(line1, pos3, pos4)
                if line2:sub(1,1) == "<" then
                    Heure1_Pos = "Marée Haute"
                    Heure1 = string.sub(line2, 4, 8)
                    Heure2_Pos = "Marée Basse"
                    Heure2 = string.sub(line2, 17, 21)
                    Heure3_Pos = "Marée Haute"
                    Heure3 = string.sub(line2, 29, 33)
                    if line2:sub(33):len() > 5 then
                        Heure4_Pos = "Marée Basse"
                        Heure4 = string.sub(line2, 42, 46)
                    else
                        Heure4_Pos = "N/A"
                        Heure4 = "N/A"
                    end
                else
                    Heure1_Pos = "Marée Basse"
                    Heure1 = string.sub(line2, 1, 5)
                    Heure2_Pos = "Marée Haute"
                    Heure2 = string.sub(line2, 13, 17)
                    Heure3_Pos = "Marée Basse"
                    Heure3 = string.sub(line2, 26, 30)
                    if line2:sub(31):len() ~= 0 then
                        Heure4_Pos = "Marée Haute"
                        Heure4 = string.sub(line2, 38, 42)
                    else
                        Heure4_Pos = "N/A"
                        Heure4 = "N/A"
                    end
                end
                line1 = line1:sub(pos4)
                pos3, pos4 = line1:balise('<td>', '</td>')
                line2 = string.sub(line1, pos3, pos4)
                if line2:sub(1,1) == "<" then
                    m = 2
                    Hauteur1 = string.sub(line2, 4, 8)
                    Hauteur2 = string.sub(line2, 17, 21)
                    Hauteur3 = string.sub(line2, 29, 33)
                    if line2:sub(33):len() > 5 then
                        Hauteur4 = string.sub(line2, 42, 46)
                    else
                        Hauteur4 = "N/A"
                    end
                else
                    Hauteur1 = string.sub(line2, 1, 5)
                    Hauteur2 = string.sub(line2, 13, 17)
                    Hauteur3 = string.sub(line2, 26, 30)
                    m = 1
                    if line2:sub(30):len() > 4 then
                        m = 2
                        Hauteur4 = string.sub(line2, 38, 42)
                    else
                        Hauteur4 = "N/A"
                    end
                end
                line1 = line1:sub(pos4)
                pos3, pos4 = line1:balise('<td>', '</td>')
                line2 = string.sub(line1, pos3, pos4)
                if m == 2 then
                    pos5, pos6 = line2:balise('<b>', '</b>')
                    maree1 = string.sub(line2, pos5, pos6)
                    line2 = line2:sub(pos6)
                    pos5, pos6 = line2:balise('<b>', '</b>')
                    maree2 = string.sub(line2, pos5, pos6)
                else
                    pos5, pos6 = line2:balise('<b>', '</b>')
                    maree1 = string.sub(line2, pos5, pos6)
                    maree2 = "N/A"
                end
            maree[i]={}
            maree[i]={date=date, Heure1_Pos=Heure1_Pos, Heure2_Pos=Heure2_Pos, Heure3_Pos=Heure3_Pos, Heure4_Pos=Heure4_Pos, Heure1=Heure1, Heure2=Heure2, Heure3=Heure3, Heure4=Heure4, Hauteur1=Hauteur1, Hauteur2=Hauteur2, Hauteur3=Hauteur3, Hauteur4=Hauteur4, maree1=maree1, maree2=maree2}
            end -- fin boucle 6 jours
        info={longitude=longitude, latitude=latitude, port=port}
        end
    end -- fin lecture fichier
end


--Sauvegarde des données
function sauvegarde()
    local t = {}
    local file = assert(io.open(repsauv.."maree.txt", "w+"))
    file:write ("\n")
    t = {"longitude", "latitude", "port"}
    for i = 1, 3 do
        file:write (info[t[i]], "\n")
    end
    for j = 1,7 do
        t = {"date", "Heure1_Pos", "Heure2_Pos", "Heure3_Pos", "Heure4_Pos", "Heure1", "Heure2", "Heure3", "Heure4", "Hauteur1", "Hauteur2", "Hauteur3", "Hauteur4", "maree1", "maree2"}
        for i = 1, 15 do
            file:write (maree[j][t[i]], "\n")
        end
    end
    file:write (time, "\n")
    io.close(file)
end


function conky_Maree_Maj(cfg)

    local s = '${if_gw}${lua conky_Maree_enligne}${else}${lua conky_Maree_horsligne '..cfg..'}${endif}'
    conky_parse( s )
    return " "
end


--hors ligne récupération de données
function conky_Maree_horsligne(cfg)

    if maj1 == nil then
        init(cfg)
        maj1 = "ok"

--Récupération dernières infos marée
        local file = assert(io.open(repsauv.."maree.txt", "r") )
        local line = file:read()
        local i = 0
        local donee = {}
        for line in file:lines() do
            i = i+1
            donee[i] = line
        end
        io.close(file)
        t = {"longitude", "latitude", "port"}
        for i = 1, 3 do
            info[t[i]] = donee[i]
        end
        for j = 1,7 do
            t = {"date", "Heure1_Pos", "Heure2_Pos", "Heure3_Pos", "Heure4_Pos", "Heure1", "Heure2", "Heure3", "Heure4", "Hauteur1", "Hauteur2", "Hauteur3", "Hauteur4", "maree1", "maree2"}
            maree[j]={}
            for i = 1, 15 do
                maree[j][t[i]] = donee[(i+3)+((j-1)*15)]
            end
        end
        time = donee[109]
    end

    return ""

end


--Récupération de données
function conky_Maree_enligne()



    if tonumber(delais) <= os.difftime(os.time(), up) then
        up = os.time()
        time = up
        local s = '${exec wget --user-agent="firfox" --tries=3 -q -O '..Rep..'/maree '..cmd..'}'
        conky_parse( s )
        recup_maree(Rep..'/maree')
        sauvegarde()

        collectgarbage()
    end

    return ""
end



--initialisation paramètres
function init(cfg)
    local r, l, t
    local home = os.getenv("HOME")
    cfg = string.gsub(cfg, "~", home)
    cfg = string.gsub(cfg, "$HOME", home)

    local file = assert(io.open(cfg, "rb") )
    local line = file:read()
    for line in file:lines() do
        local pos1 = string.find(line, '#')
        if pos1 ~= nil then
            line = string.sub(line, 1, pos1-1)
        end
        pos1 = string.find(line, '=')
        if string.find(line, 'repsauv=') ~= nil then
            repsauv = string.sub(line, pos1+1)
        elseif string.find(line, 'TempShell=') ~= nil then
            r = string.sub(line, pos1+1)
        elseif string.find(line, 'web=') ~= nil then
            cmd = string.sub(line, pos1+1)
        elseif string.find(line, 'update=') ~= nil then
            delais = string.sub(line, pos1+1)
        end
    end
    io.close(file)
    print("Répertoire de sauvegarde = "..repsauv)
    print("adresse Web = "..cmd)
    print("Délais entre deux mise a jour = "..delais)

    r = string.gsub(r, "~", home)
    r = string.gsub(r, "$HOME", home)
    repsauv = string.gsub(repsauv, "~", home)
    repsauv = string.gsub(repsauv, "$HOME", home)
    repsauv = repsauv.."/"

--Création répertoire de travail
    l = cmd:match("/(%d+)")
    Rep = r.."/maree/"..l
    if os.execute("cd "..Rep) ~= 0 then
        os.execute("mkdir -p "..Rep)
    end

--init compteur mise à jours
    up = os.time()-delais

    local repsauv1 = string.sub(repsauv, 1, -2)
    if os.execute("cd "..repsauv1) ~= 0 then
--création de repsauv si inexistant
        local pos1 = 1
        local chemin = nil
        local cheminsup = nil
        while pos1 ~= nil do
            pos1 = string.find(repsauv1, '/', pos1+1)
            if pos1 ~= nil then
                cheminsup = string.sub(repsauv1, pos1)
                chemin = string.gsub(repsauv1, cheminsup, "")
            else
                cheminsup = ""
                chemin = repsauv1
            end
            if os.execute("cd "..chemin) ~= 0 then
                os.execute("mkdir "..chemin)
            end
        end
    end

    if not existe(repsauv.."maree.txt") then
        conky_Maree_enligne()
    end

    return ""
end

--Retour d'information Marée
--information site
function conky_Maree_longitude()
    return info.longitude
end

function conky_Maree_latitude()
    return info.latitude
end

function conky_Maree_port()
    return info.port
end

--donées Marée

function conky_Maree_date(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].date
end

function conky_Maree_Position1(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].Heure1_Pos
end

function conky_Maree_Position2(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].Heure2_Pos
end

function conky_Maree_Position3(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].Heure3_Pos
end

function conky_Maree_Position4(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].Heure4_Pos
end

function conky_Maree_Heure1(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].Heure1
end

function conky_Maree_Heure2(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].Heure2
end

function conky_Maree_Heure3(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].Heure3
end

function conky_Maree_Heure4(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].Heure4
end

function conky_Maree_Hauteur1(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].Hauteur1
end

function conky_Maree_Hauteur2(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].Hauteur2
end

function conky_Maree_Hauteur3(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].Hauteur3
end

function conky_Maree_Hauteur4(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].Hauteur4
end

function conky_Maree_maree1(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].maree1
end

function conky_Maree_maree2(j)
    if j == nil then j = 1 end
    return maree[tonumber(j)].maree2
end

--Heure dernier mise à jour

function conky_Maree_Heure()
    return os.date("%H", time)
end

function conky_Maree_Minute()
    return os.date("%M", time)
end

--[[function conky_Maree_

end]]--

Hors ligne

#636 Le 13/09/2014, à 07:33

loutch

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

smilies%20(204).gif

smilies%20(224).gif ça fonctionne au poil, encore

smilies%20(242).gif merci et

smilies%20(1).gif

Hors ligne

#637 Le 30/09/2014, à 09:48

ragamatrix

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Une pendule système :
ConkySystemClock:

 # pkill -xf "conky -c /media/5/Conky/S11_Rem_Cal.conky" &
# conky -c /media/5/Conky/S11_Rem_Cal.conky &
# To use #! in a conky use: ${exec echo '#!'}
# Reminder fix compliments: Reid Thompson
###  Begin Window Settings  ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
#own_window_type normal
#own_window_transparent yes
#own_window_hints undecorated,below,skip_taskbar,skip_pager,sticky
own_window_title systemclock
own_window_class Conky
own_window_colour grey50
### ARGB can be used for real transparency
#own_window_argb_visual yes
#own_window_argb_value 0

# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes

############
minimum_size 350 400
maximum_width 350 ##largeur
############

gap_x 15 # left-right
gap_y 35 # up-down

alignment mr
###################################################  End Window Settings  ###
###  Font Settings  #########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
#xftfont Monofur:bold:size=11
xftfont	mono:bold:size=8
# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes

uppercase no
######################################################  End Font Settings  ###
###  Color Settings  #########################################################
draw_shades yes #no # amplifies text if yes
default_shade_color 000000

draw_outline no # amplifies text if yes
default_outline_color 000000

#default_color DCDCDC #220 220 220    Gainsboro
#default_color C0C0C0 #192 192 192 Silver
default_color B0E0E6 #176 224 230 PowderBlue
color0 8FBC8F #143 188 143    DarkSeaGreen
color1 778899 #119 136 153    LightSlateGray
color2 D8BFD8 #216 191 216    Thistle
color3 9ACD32 #154 205  50    YellowGreen
color4 FFA07A #255 160 122    LightSalmon
color5 FFDEAD #255 222 173    NavajoWhite
color6 00BFFF #  0 191 255    DeepSkyBlue
color7 5F9EA0 # 95 158 160    CadetBlue
color8 BDB76B #189 183 107    DarkKhaki
color9 CD5C5C #205  92  92    IndianRed  #FF0000 #255   0   0    Red
#####################################################  End Color Settings  ###
###  Borders Section  ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders no #yes
#default_graph_size 15 40
#####################################################  End Borders Secton  ###
###  Miscellaneous Section  ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background yes

# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none

# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 1024

# Subtract (file system) buffers from used memory?
no_buffers yes

# change GiB to G and MiB to M
short_units yes

# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2

#   Maximum size of user text buffer, i.e. layout below TEXT line in config file
#  (default is 16384 bytes)
# max_user_text 16384
# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
# temperature_unit Fahrenheit
update_interval 1
##############################################  End Miscellaneous Section  ###
###  LUA Settings  ###########################################################
## Above and After TEXT - After - requires a composite manager or blinks.
##############################################################################
#lua scripts
lua_load ~/.conky/system_clock.lua
lua_draw_hook_pre main
TEXT

system_clock.lua:

--this lua script for use in conky
require 'cairo'

function conky_main(center_x,center_y)
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)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
--#################################################################
--#################################################################
--#################################################################
-- hours on the clock 12 or 24
hours=12
--the second interval displayed 5, 10, or 15
seconds=5
second_hand_size=1
minute_hand_size=5
hour_hand_size=5
-- Colors
d_font_red=.8
d_font_green=.8
d_font_blue=.8
d_font_alpha=1
--#################################################################
--#################################################################
--#################################################################
d_math=math.pi/180
max_width=175
if center_x == nil then center_x=max_width+5 end
if center_y == nil then center_y=max_width+5 end
hour_radius=141
second_radius=120
--#################################################################
--########## time calculation #####################################
--#################################################################
date_mm_dd_yy=conky_parse("${time %D}")
second=tonumber(conky_parse("${time %S}"))
minute=tonumber(conky_parse("${time %M}"))
if hours ~= 12 then hours=24 end
if hours == 12 then
hour=tonumber(conky_parse("${time %I}"))
time_hms=conky_parse("${time %r}")
i_start=1
i_end=12
else
hour=tonumber(conky_parse("${time %H}"))
time_hms=conky_parse("${time %T}")
i_start=0
i_end=hours-1
end
second_position=(-90+(360/60)*second)*d_math
minute_position=(-90+(360/60)*minute)*d_math
hour_position=(-90+(360/hours)*hour)*d_math+(((360/hours/60)*minute)*d_math)
--#################################################################
--########## string values ########################################
--#################################################################
cpu_avg=tonumber(conky_parse("${cpu cpu0}"))
if cpu_avg == nil then cpu_avg=0 end
cpu_core1=tonumber(conky_parse("${cpu cpu1}"))
if cpu_core1 == nil then cpu_core1=0 end
cpu_core2=tonumber(conky_parse("${cpu cpu2}"))
if cpu_core2 == nil then cpu_core2=0 end
ram=tonumber(conky_parse("${memperc}"))
if ram == nil then ram=0 end
mem=conky_parse("${mem}")
mem_size=conky_parse("${memmax}")
swap_perc=tonumber(conky_parse("${swapperc}"))
if swap_perc == nil then swap_perc=0 end
swap=conky_parse("${swap}")
swap_size=conky_parse("${swapmax}")
--#################################################################
--########## Info Panel ###########################################
--#################################################################
cairo_set_line_width(cr,2)
cairo_arc(cr,55,360,30,(90*d_math),(270*d_math))
cairo_arc(cr,295,360,30,(270*d_math),(90*d_math))
cairo_close_path(cr)
cairo_set_source_rgba(cr,.2,.2,1,.75)
cairo_fill(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,55,360,28,(90*d_math),(270*d_math))
cairo_arc(cr,295,360,28,(270*d_math),(90*d_math))
cairo_close_path(cr)
cairo_set_source_rgba(cr,0,0,0,1)
cairo_fill(cr)
x={52,52,52,
161,153,153,
225,225,225,225
}
y={348,363,378,
355,370,383,
343,355,370,382
}
t={"Cpu Avg:     "..cpu_avg.."%","Cpu Core 1: "..cpu_core1.."%","Cpu Core 2: "..cpu_core2.."%",
"Time: ",time_hms,date_mm_dd_yy,
"Ram:",""..mem.." / "..mem_size.."","Swap:",""..swap.." / "..swap_size..""
}
for i = 1,#t do
cairo_set_source_rgba(cr,.8,.8,.8,1)
cairo_move_to(cr,x[i],y[i])
cairo_show_text(cr,t[i])
end
cairo_stroke(cr)
--#################################################################
--#################################################################
--#################################################################
--minute hand bottom
cairo_set_line_width(cr,6)
cairo_arc(cr,center_x,center_y,170,(minute_position-((minute_hand_size/2)*d_math)),(minute_position+((minute_hand_size/2)*d_math)))
cairo_arc(cr,center_x,center_y,10,(minute_position+(40*d_math)),(minute_position-(40*d_math)))
cairo_set_source_rgba(cr,1,1,1,1)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,0,0,0,1)
cairo_close_path(cr)
cairo_fill(cr)
--hour hand bottom
cairo_arc(cr,center_x,center_y,160,(hour_position-((hour_hand_size/2)*d_math)),(hour_position+((hour_hand_size/2)*d_math)))
cairo_arc(cr,center_x,center_y,10,(hour_position+(40*d_math)),(hour_position-(40*d_math)))
cairo_set_source_rgba(cr,1,1,1,1)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,0,0,0,1)
cairo_close_path(cr)
cairo_fill(cr)
--hands center
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,center_y,10,0,(360*d_math))
cairo_set_source_rgba(cr,0,0,0,1)
cairo_fill(cr)
--main background
cairo_arc(cr,center_x,center_y,150,0,(360*d_math))
cairo_set_source_rgba(cr,.5,.5,.5,.25)
cairo_fill(cr)
--clock background
cairo_arc(cr,center_x,center_y,150,0,(360*d_math))
cairo_arc_negative(cr,center_x,center_y,110,(360*d_math),0)
cairo_close_path(cr)
cairo_set_source_rgba(cr,0,0,0,1)
cairo_fill(cr)
cairo_arc(cr,center_x,center_y,150,0,(360*d_math))
cairo_set_source_rgba(cr,.2,.2,1,.75)
cairo_stroke(cr)
cairo_arc(cr,center_x,center_y,130,0,(360*d_math))
cairo_set_source_rgba(cr,.25,.25,.25,1)
cairo_stroke(cr)
cairo_arc(cr,center_x,center_y,110,0,(360*d_math))
cairo_set_source_rgba(cr,.2,.2,1,.75)
cairo_stroke(cr)
--#################################################################
--########## System Info ##########################################
--#################################################################
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
--cpu avg
cairo_set_line_width(cr,10)
cairo_arc(cr,center_x,center_y,102,(135*d_math),(45*d_math))
cairo_set_source_rgba(cr,0,0,0,1)
cairo_stroke(cr)
cairo_set_line_width(cr,8)
cairo_arc(cr,center_x,center_y,102,(135*d_math),((135*d_math)+(((270/100)*cpu_avg)*d_math)))
cairo_set_source_rgba(cr,.2,.2,1,.75)
cairo_stroke(cr)
--cpu core 1
cairo_set_line_width(cr,10)
cairo_arc(cr,center_x,center_y,89,(135*d_math),(45*d_math))
cairo_set_source_rgba(cr,0,0,0,1)
cairo_stroke(cr)
cairo_set_line_width(cr,8)
cairo_arc(cr,center_x,center_y,89,(135*d_math),((135*d_math)+(((270/100)*cpu_core1)*d_math)))
cairo_set_source_rgba(cr,.2,.2,1,.75)
cairo_stroke(cr)
--cpu core 2
cairo_set_line_width(cr,10)
cairo_arc(cr,center_x,center_y,76,(135*d_math),(45*d_math))
cairo_set_source_rgba(cr,0,0,0,1)
cairo_stroke(cr)
cairo_set_line_width(cr,8)
cairo_arc(cr,center_x,center_y,76,(135*d_math),((135*d_math)+(((270/100)*cpu_core2)*d_math)))
cairo_set_source_rgba(cr,.2,.2,1,.75)
cairo_stroke(cr)
--ram
cairo_set_line_width(cr,10)
cairo_arc(cr,center_x,center_y,62,(100*d_math),(260*d_math))
cairo_set_source_rgba(cr,0,0,0,1)
cairo_stroke(cr)
cairo_set_line_width(cr,8)
cairo_arc(cr,center_x,center_y,62,(100*d_math),((100*d_math)+(((160/100)*ram)*d_math)))
cairo_set_source_rgba(cr,.2,.2,1,.75)
cairo_stroke(cr)
--swap
cairo_set_line_width(cr,10)
cairo_arc(cr,center_x,center_y,62,(-80*d_math),(80*d_math))
cairo_set_source_rgba(cr,0,0,0,1)
cairo_stroke(cr)
cairo_set_line_width(cr,8)
cairo_arc_negative(cr,center_x,center_y,62,(80*d_math),((80*d_math)-(((160/100)*swap_perc)*d_math)))
cairo_set_source_rgba(cr,.2,.2,1,.75)
cairo_stroke(cr)
--#################################################################
--########## Text Backgrounds #####################################
--#################################################################
--cpu_avg
cairo_set_line_width(cr,14)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_arc(cr,center_x,center_y,102,(50*d_math),(130*d_math))
cairo_set_source_rgba(cr,1,1,1,1)
cairo_stroke(cr)
cairo_set_line_width(cr,12)
cairo_arc(cr,center_x,center_y,102,(50*d_math),(130*d_math))
cairo_set_source_rgba(cr,.1,.1,.1,1)
cairo_stroke(cr)
--cpu_core1
cairo_set_line_width(cr,14)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_arc(cr,center_x,center_y,89,(50*d_math),(130*d_math))
cairo_set_source_rgba(cr,1,1,1,1)
cairo_stroke(cr)
cairo_set_line_width(cr,12)
cairo_arc(cr,center_x,center_y,89,(50*d_math),(130*d_math))
cairo_set_source_rgba(cr,.1,.1,.1,1)
cairo_stroke(cr)
--cpu_core2
cairo_set_line_width(cr,14)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_arc(cr,center_x,center_y,76,(50*d_math),(130*d_math))
cairo_set_source_rgba(cr,1,1,1,1)
cairo_stroke(cr)
cairo_set_line_width(cr,12)
cairo_arc(cr,center_x,center_y,76,(50*d_math),(130*d_math))
cairo_set_source_rgba(cr,.1,.1,.1,1)
cairo_stroke(cr)
--ram
cairo_set_line_width(cr,14)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_arc(cr,center_x,center_y,47,(157*d_math),(202*d_math))
cairo_set_source_rgba(cr,1,1,1,1)
cairo_stroke(cr)
cairo_set_line_width(cr,12)
cairo_arc(cr,center_x,center_y,47,(157*d_math),(202*d_math))
cairo_set_source_rgba(cr,.1,.1,.1,1)
cairo_stroke(cr)
--swap
cairo_set_line_width(cr,14)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_arc(cr,center_x,center_y,47,(-30*d_math),(30*d_math))
cairo_set_source_rgba(cr,1,1,1,1)
cairo_stroke(cr)
cairo_set_line_width(cr,12)
cairo_arc(cr,center_x,center_y,47,(-30*d_math),(30*d_math))
cairo_set_source_rgba(cr,.1,.1,.1,1)
cairo_stroke(cr)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_BUTT)
--#################################################################
--######### Text ##################################################
--#################################################################
cairo_set_source_rgba(cr,.8,.8,.8,1)
t={"C","P","U"," ","A","V","E","R","A","G","E"}
for i=1,#t do
	x,y=pt((center_x-3),(center_y+4),102,((223-(79/#t)*i)))
	cairo_move_to (cr,x,y)
	cairo_show_text (cr,t[i])
end--for
cairo_stroke(cr)
t={"C","P","U"," ","C","O","R","E"," ","1"}
for i=1,#t do
	x,y=pt((center_x-3),(center_y+4),89,((223-(79/#t)*i)))
	cairo_move_to (cr,x,y)
	cairo_show_text (cr,t[i])
end--for
cairo_stroke(cr)
t={"C","P","U"," ","C","O","R","E"," ","2"}
for i=1,#t do
	x,y=pt((center_x-3),(center_y+4),76,((223-(79/#t)*i)))
	cairo_move_to (cr,x,y)
	cairo_show_text (cr,t[i])
end--for
cairo_stroke(cr)
t={"R","A","M"}
for i=1,#t do
	x,y=pt((center_x-3),(center_y+4),48,(((90+220)-(60/#t)*i)))
	cairo_move_to (cr,x,y)
	cairo_show_text (cr,t[i])
end--for
cairo_stroke(cr)
t={"P","A","W","S"}
for i=1,#t do
	x,y=pt((center_x-3),(center_y+4),46,((134-(70/#t)*i)))
	cairo_move_to (cr,x,y)
	cairo_show_text (cr,t[i])
end--for
cairo_stroke(cr)
--######################################################################
-- time markers ########################################################
--######################################################################
for i=1,60 do
second_markers_position=(-90*d_math)+((i*(360/60))*d_math)
cairo_set_line_width(cr,2)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_BUTT)
cairo_arc(cr,center_x,center_y,115,second_markers_position,second_markers_position)
cairo_arc(cr,center_x,center_y,110,second_markers_position,second_markers_position)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
cairo_arc(cr,center_x,center_y,130,second_markers_position,second_markers_position)
cairo_arc(cr,center_x,center_y,125,second_markers_position,second_markers_position)
cairo_stroke(cr)
end
for i=i_start,i_end do
hour_markers_position=(-90*d_math)+(i*(360/hours))*d_math
cairo_set_line_width(cr,3)
cairo_arc(cr,center_x,center_y,150,hour_markers_position,hour_markers_position)
cairo_arc(cr,center_x,center_y,145,hour_markers_position,hour_markers_position)
cairo_set_source_rgba(cr,.5,.5,.5,1)
cairo_stroke(cr)
cairo_arc(cr,center_x,center_y,135,hour_markers_position,hour_markers_position)
cairo_arc(cr,center_x,center_y,130,hour_markers_position,hour_markers_position)
cairo_stroke(cr)
end
--######################################################################
-- time text ###########################################################
--######################################################################
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
cairo_set_source_rgba(cr,.8,.8,.8,1)
if hours==24 then
for i=0,23 do
	if i==0 or i==2 or i==4 or i==6 or i==8 or i==10 or i==12 or i==14 or i==16 or i==18 or i==20 or i==22 then
	x,y=pt((center_x-4),(center_y+4),(hour_radius),((360/24)*i))
	cairo_move_to (cr,x,y)
	cairo_show_text (cr,i)
	end
end--for
elseif hours==12 then
for i=1,12 do
	x,y=pt((center_x-4),(center_y+4),(hour_radius),((360/12)*i))
	cairo_move_to (cr,x,y)
	cairo_show_text (cr,i)
end--for
end--hours
if seconds==5 then
for i=0,59 do
	if i==0 or i==5 or i==10 or i==15 or i==20 or i==25 or i==30 or i==35 or i==40 or i==45 or i==50 or i==55 then
	x,y=pt((center_x-5),(center_y+4),(second_radius),((360/60)*i))
	cairo_move_to (cr,x,y)
	cairo_show_text (cr,i)
	end
end--for
elseif seconds==10 then
for i=0,59 do
	if i==0 or i==10 or i==20 or i==30 or i==40 or i==50 then
	x,y=pt((center_x-5),(center_y+4),(second_radius),((360/60)*i))
	cairo_move_to (cr,x,y)
	cairo_show_text (cr,i)
	end
end--for
elseif seconds==15 then
for i=0,59 do
	if i==0 or i==15 or i==30 or i==45 then
	x,y=pt((center_x-5),(center_y+4),(second_radius),((360/60)*i))
	cairo_move_to (cr,x,y)
	cairo_show_text (cr,i)
	end
end--for
end--second
cairo_stroke(cr)
--######################################################################
-- mrpeacy code end ####################################################
--######################################################################
--hour hand top
cairo_set_line_width(cr,6)
cairo_arc(cr,center_x,center_y,160,(hour_position-((hour_hand_size/2)*d_math)),(hour_position+((hour_hand_size/2)*d_math)))
cairo_arc_negative(cr,center_x,center_y,140,hour_position,hour_position)
cairo_set_source_rgba(cr,1,1,1,1)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,0,0,0,1)
cairo_close_path(cr)
cairo_fill(cr)
--minute hand top
cairo_arc(cr,center_x,center_y,170,(minute_position-((minute_hand_size/2)*d_math)),(minute_position+((minute_hand_size/2)*d_math)))
cairo_arc_negative(cr,center_x,center_y,120,minute_position,minute_position)
cairo_set_source_rgba(cr,1,1,1,1)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,0,0,0,1)
cairo_close_path(cr)
cairo_fill(cr)
--second hand
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,center_y,10,0,(360*d_math))
cairo_set_source_rgba(cr,1,1,1,1)
cairo_fill(cr)
cairo_arc(cr,center_x,center_y,9,0,(360*d_math))
cairo_set_source_rgba(cr,0,0,0,1)
cairo_fill(cr)
cairo_set_line_width(cr,4)
cairo_arc(cr,center_x,center_y,10,second_position,second_position)
cairo_arc(cr,center_x,center_y,120,second_position,second_position)
cairo_set_source_rgba(cr,1,1,1,1)
cairo_stroke(cr)
cairo_set_line_width(cr,3)
cairo_arc(cr,center_x,center_y,9,second_position,second_position)
cairo_arc(cr,center_x,center_y,119,second_position,second_position)
cairo_set_source_rgba(cr,0,0,0,1)
cairo_stroke(cr)
cairo_set_line_width(cr,4)
cairo_arc(cr,center_x,center_y,10,(second_position-(180*d_math)),(second_position-(180*d_math)))
cairo_arc(cr,center_x,center_y,30,(second_position-(180*d_math)),(second_position-(180*d_math)))
cairo_set_source_rgba(cr,1,1,1,1)
cairo_stroke(cr)
cairo_set_line_width(cr,3)
cairo_arc(cr,center_x,center_y,9,(second_position-(180*d_math)),(second_position-(180*d_math)))
cairo_arc(cr,center_x,center_y,29,(second_position-(180*d_math)),(second_position-(180*d_math)))
cairo_set_source_rgba(cr,0,0,0,1)
cairo_stroke(cr)
--#################################################################
--#################################################################
--#################################################################
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return""
end-- end main function
--#################################################################
--#################################################################
--#################################################################
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
function pt(px,py,prad,pdeg)
local ppo=(math.pi/180)*pdeg
local px1=px+prad*(math.sin(ppo))
local py1=py-prad*(math.cos(ppo))
return px1,py1
end
function font(fontt)
local name=fontt.f	or default_font_name	or "mono"
local size=fontt.fs	or default_font_size	or 12
local face=fontt.ff	or default_font_face	or "n"
if face=="n" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="b" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD)
elseif face=="i" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="bi" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_BOLD)
end
cairo_set_font_size(cr,size)
end
function hexcolor(hexcolort)
local col=hexcolort.c	or default_hex_color	or 0xffffff
local a=hexcolort.a	or default_alpha	or 1
local r,g,b=((col/0x10000) % 0x100)/255,((col/0x100) % 0x100)/255,(col % 0x100)/255
cairo_set_source_rgba(cr,r,g,b,a)
end
function text(textt)
local x=textt.x 		or 100
local y=textt.y 		or 100
local t=textt.t 		or "set txt"
local hj=textt.hj 		or default_horizontal_justify		or "l"
local vj=textt.vj 		or default_vertical_justify		or "n"
local r=textt.r			or default_rotation			or 0
cairo_text_extents(cr,t,extents)
local wx=extents.x_advance
local wd=extents.width
local hy=extents.height
local bx=extents.x_bearing
local by=extents.y_bearing+hy
--hl-- l=left, c=center, r=right
if hj=="l" then
xa=x-bx
rad=0
elseif hj=="c" then
xa=x-((wx-bx)/2)-bx
rad=(wx-bx)/2
elseif hj=="r" then
xa=x-wx
rad=wx-bx
else
print ('hj not set correctly for text: '..t..' - "l", "c" or "r"')
xa=0
rad=0
end
--vj-- n=normal, nb=normal-ybearing, m=middle, mb=middle-ybearing, t=top
if vj=="n" then
ya=y
rad2=0
ry=by
elseif vj=="nb" then
ya=y-by
rad2=-by
ry=by
elseif vj=="m" then
ya=y+((hy-by)/2)
rad2=((hy-by)/2)
ry=((hy-by)/2)-by
elseif vj=="mb" then
ya=y+(hy/2)-by
rad2=(hy/2)-by
ry=((hy-by)/2)-by
elseif vj=="t" then
ya=y+hy-by
rad2=hy-by
ry=0+by
else
print ('vj not set correctly for text: '..t..' - "n", "nb", "m", "mb" or "t"')
ya=0
rad2=0
ry=0
end
--rotation
if r~=0 then
local x2,y2=pt(x,y,rad2,r-180)
local x1,y1=pt(x2,y2,rad,r-90)
cairo_save (cr)
cairo_translate (cr,x1,y1)
cairo_rotate(cr,(math.pi/180)*r)
cairo_show_text (cr,t)
cairo_stroke (cr)
cairo_restore (cr)
else
cairo_move_to (cr,xa,ya)
cairo_show_text (cr,t)
cairo_stroke (cr)
end--if ro
--set non local variables to nil
xa=nil;ya=nil;rad=nil;rad2=nil;ry=nil
end--function text #####################################################

1412063238.png
wink

Hors ligne

#638 Le 02/10/2014, à 10:39

loutch

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

smilies%20(204).gif


@ ragamatrix :

Etant incapable de faire du lua ,je me suis permis de modifier ton pendule (beau boulot ) pour qu'il aille mieux avec mon bureau et ça donne ceci :

1412238525.png


smilies%20(1).gif

Hors ligne

#639 Le 07/10/2014, à 09:28

ragamatrix

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Merci loutch !
Je ne suis malheureusement pas l'auteur de ce script, à part faire du copier coller et changer les couleurs je ne sais pas faire grand chose en lua...
L' honneur et les remerciements reviendraient plutôt à ansem_of_nexus du forum crunchbang anglophone. smile
Sinon c'est très joli en gris et beaucoup plus lisible (l'heure) ce que tu as fait.

Hors ligne

#640 Le 29/10/2014, à 10:16

Gaara

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Salut à tous,
Je me suis fait un petit conky pour un serveur (je sais, il ne devrait pas tourner sous X, mais bon.. c'est pas la question tongue)
Le conky m'indique juste l'envoi des données:
mini_610340201410291440x900scrot.png

Je fais un rafraichissement toutes les 60s, donc je peux avoir un historique d'environ 20h. Mais c'est là que j'aimerais avoir plus de précision:
Est-ce que c'est possible de graduer la barre, avec des indications d'heures par exemple ? Et pourquoi pas, que l'heure (midi, minuit) bouge en même temps que la barre ?

Voici mon code, très simple:

TEXT

$color1
${alignc}HISTORIQUE D'ENVOI : $color2 eth0 $color1
${upspeedgraph eth0 50,1000 99c8e8 618094 100}

Merci smile


Kubuntu 18.04 x64
Un terminal tactile Raspberry Pi et Odroid

                                        <code>zenity  --question --title "Alert"  --text "Microsoft Windows has been found! Would you like to remove it?"</code>

Hors ligne

#641 Le 29/10/2014, à 12:34

Didier-T

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonjour Gaara,
ce n'est pas réalisable directement avec les commande de conky.
Par contre c'est faisable avec un script LUA ou en utilisant imagemagick.
Ou encore, tu peux superposer une image contenant les graduations et le graphique généré par la commande de conky, c'est a mon avis la solution la plus simple et la plus fiable (sauf si conky change c'est échelles de débit au fur et a mesure).

Amuse toi bien,
Didier.

Hors ligne

#642 Le 29/10/2014, à 13:25

Gaara

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Salut Didier-T, merci pour ta réponse
Pour l'image, c'est possible de la faire bouger en même temps que le graphique avance (pour connaitre le débit à une heure fixe) ou il faut obligatoirement passer par un script LUA ?
Je pense que l'échelle du temps est toujours la même, vu que le rafraîchissement est fixe.
Pour l'échelle du débit, c'est fixe aussi, le maxi est de 100 ko/s.


Kubuntu 18.04 x64
Un terminal tactile Raspberry Pi et Odroid

                                        <code>zenity  --question --title "Alert"  --text "Microsoft Windows has been found! Would you like to remove it?"</code>

Hors ligne

#643 Le 02/11/2014, à 18:10

ragamatrix

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Salut Gaara
Sur le forum Anglophone, j'ai cru voir conky fonctionner avec vnstat pour avoir les données du traffic "week;days;and month"
par ici
Il faut que tu installes vnstat et ce ne sera que du texte... Je viens de me relire et je vois que j'ai répondu à coté de la plaque... hmm
dsl...

Hors ligne

#644 Le 02/11/2014, à 18:47

Didier-T

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonjour Gaara,
je n'avais pas eut la notification pour ton dernier message.
A part l'utilisation de LUA je ne vois pas de solution pour avoir la barre de temps qui progresse avec le graphique.
Ce genre d'utilisation sort de mon domaine de compétence, un script lua déjà existant qui ferait sensiblement ce que tu recherche pourrait fortement m'aider.
A moins que ragamatrix ne demande un peut d'aide sur le forum Anglais, ils sont quelques uns a pouvoir le faire du moins il me semble.

Hors ligne

#645 Le 02/11/2014, à 19:02

Gaara

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Salut a vous,
Merci pour ta réponse ragamatrix, et en effet tu as raison, vnstat renvoie des données du trafic, mais ne m'aidera pas pour avoir une échelle de mon graphe! big_smile
Mais je viens d'avoir une idée de bricolage (j'étais passé a autre chose, je n'ai pas trop réfléchi sur le sujet depuis la sem dernière)

-> Le texte bougeant avec l'option offset, je me dis que d'écrire un script python qui remplace cette valeur toutes les 60 secondes (dans un autre conkyrc, pour garder le graphe) pourrait être une solution.
Bon ok ça ferait un effet de rafraichissement, mais toutes les minutes c'est pas très gênant, surtout que ce ne serait que du texte.

En LUA il faudra que je prenne tout de zéro car je ne connais pas du tout ce langage. Je vais quand même essayer de trouver un truc qui ressemble


Kubuntu 18.04 x64
Un terminal tactile Raspberry Pi et Odroid

                                        <code>zenity  --question --title "Alert"  --text "Microsoft Windows has been found! Would you like to remove it?"</code>

Hors ligne

#646 Le 03/11/2014, à 18:45

ragamatrix

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

@Gaara : j'ai posté la question ici mais je ne sais pas si j'ai bien traduit ta demande...

Hors ligne

#647 Le 03/11/2014, à 20:17

Gaara

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

@ragamatrix
Merci pour ton aide ! C'est vrai que ce n'est déjà pas facile d'expliquer en français, alors en anglais... tongue
J'ai eu le temps d'avancer un peu, ça fonctionne pas trop mal:
mini_9416581999550scrot.png
Avec un script python, je rafraîchi le .conkyrc toutes les 1/2 heures, avec une réécriture de la ligne des heures (si elle change), pour mettre la plus récente en dernier.
Mais bon c'est un peu moche et pas très précis, mais c'est à peu près ça.


Kubuntu 18.04 x64
Un terminal tactile Raspberry Pi et Odroid

                                        <code>zenity  --question --title "Alert"  --text "Microsoft Windows has been found! Would you like to remove it?"</code>

Hors ligne

#648 Le 04/11/2014, à 16:04

Gaara

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Je mets le code python, au cas ou ça intéresserait quelqu'un. C'est la version 0.20.3, ça s'actualise à chaque changement d'heure.
Ce code est à démarrer avant le conky concerné, pour que le conkyrc soit actualisé au démarrage.

#!/usr/bin/env python
# -*- coding: utf-8 -*-

########### GRADUATION CONKY V 0.3 ############

import time
import shutil


class Grad:

       
   def verif_time(self, Grad, donnees=None):
      h2 = time.localtime()
      self.heure_ver = h2.tm_hour
      if self.heure_actuel == self.heure_ver:
         time.sleep(60)
      else:
         print "Actualisation"
         print "Il est " + str(self.heure_ver) + "h"
         print "---------------------"
         self.auto(self, Grad)
      self.verif_time(self, Grad)
     
   def auto(self, Grad, donnees=None):  
      
      self.h = time.localtime()
      self.heure_actuel = self.h.tm_hour
      
      fleches = """$color3${offset 10}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|${offset 31}|"""
      heures = []
      spaces = []
      for h in range(0,30):
         new = self.heure_actuel - h
         if new < 0:
            new = 24 + new
         if new >= 10:
            space = str(11)
         else:
            space = str(19)
         spaces.append(space)
         heures.append(new)

      grad = """$color3""" + " " + str(heures[28]) + """h${offset """ + spaces[27] + """}""" + str(heures[27]) + """h${offset """ + spaces[26] + """}""" + str(heures[26]) + """h${offset """ + spaces[25] + """}""" + str(heures[25]) + """h${offset """ + spaces[24] + """}""" + str(heures[24]) + """h${offset """ + spaces[23] + """}""" + str(heures[23]) + """h${offset """ + spaces[22] + """}""" + str(heures[22]) + """h${offset """ + spaces[21] + """}""" + str(heures[21]) + """h${offset """ + spaces[20] + """}""" + str(heures[20]) + """h${offset """ + spaces[19] + """}""" + str(heures[19]) + """h${offset """ + spaces[18] + """}""" + str(heures[18]) + """h${offset """ + spaces[17] + """}""" + str(heures[17]) + """h${offset """ + spaces[16] + """}""" + str(heures[16]) + """h${offset """ + spaces[15] + """}""" + str(heures[15]) + """h${offset """ + spaces[14] + """}""" + str(heures[14]) + """h${offset """ + spaces[13] + """}""" + str(heures[13]) + """h${offset """ + spaces[12] + """}""" + str(heures[12]) + """h${offset """ + spaces[11] + """}""" + str(heures[11]) + """h${offset """ + spaces[10] + """}""" + str(heures[10]) + """h${offset """ + spaces[9] + """}""" + str(heures[9]) + """h${offset """ + spaces[8] + """}""" + str(heures[8]) + """h${offset """ + spaces[7] + """}""" + str(heures[7]) + """h${offset """ + spaces[6] + """}""" + str(heures[6]) + """h${offset """ + spaces[5] + """}""" + str(heures[5]) + """h${offset """ + spaces[4] + """}""" + str(heures[4]) + """h${offset """ + spaces[3] + """}""" + str(heures[3]) + """h${offset """ + spaces[2] + """}""" + str(heures[2]) + """h${offset """ + spaces[1] + """}""" + str(heures[1]) + """h${offset """ + spaces[0] + """}""" + str(heures[0]) + """h """

      with open("/home/pi/.conkyrc.tmp", "w") as tmp:
         with open("/home/pi/.conkyrc3") as ini:
            for num, line in enumerate(ini, 1):
               if "TEXT" in line:
                  tmp.write("TEXT" + "\n")
                  tmp.write(fleches + "\n")
                  tmp.write(grad)
                  print "OK"
                  break
               if not "TEXT" in line:
                  tmp.write(line)
                  time.sleep(0.007)
            ini.close()
            tmp.close
      
      shutil.copy2("/home/pi/.conkyrc.tmp", "/home/pi/.conkyrc3")
      self.verif_time(self, Grad)

   def __init__(self):
      self.auto(self, Grad)
      
if __name__ == "__main__":
    Grad()      

Bien sûr, c'est à adapter/améliorer ! Mais pour mon serveur, et vu mon courage, je laisse comme ça.

Dernière modification par Gaara (Le 05/11/2014, à 13:18)


Kubuntu 18.04 x64
Un terminal tactile Raspberry Pi et Odroid

                                        <code>zenity  --question --title "Alert"  --text "Microsoft Windows has been found! Would you like to remove it?"</code>

Hors ligne

#649 Le 08/11/2014, à 16:29

enebre

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonjour Didier-T, ljere,
Il y a un temps vous m'aviez préparé un petit script pour afficher mes messages des boîtes gmail.com, actuellement le script ne fonctionne plus.
Me feriez vous le correctif s'ils vous plait ?
Il y a ce texte qui s'inscrit à la place du résultat nbr de mail :

<?xml version="1.0" encoding="UTF-8"?><feed version="0.3" xmlns="http://purl.org/atom/ns#">42014-11-08T14:49:30ZLettre d&#39;informations du 02 novembre 2014 au 08 novembre 2014Cliquez ici si vous ne parvenez pas à lire ce message Lettre d&#39;informations du 02 novembre 2014<link rel="alternate" href="http://mail.google.com/a/gmail.com?account_id=******@gmail.com&amp;message_id=1498f0c9d0e9af76&amp;view=conv&amp;extsrc=atom" type="text/html" />2014-11-08T10:56:48Z2014-11-08T10:56:48Ztag:gmail.google.com,2004:1484200826802646902A la Une : A Sivens, l&#39;exaspération des agriculteurs - Mexique : des suspects avouent le meurtre d&#39;au moins 40 étudiants disparusSi vous avez des difficultés à visualiser cette lettre d&#39;information, cliquez ici. samedi 8<link rel="alternate" href="http://mail.google.com/a/gmail.com?account_id=*******@gmail.com&amp;message_id=1498e6672aea7f27&amp;view=conv&amp;extsrc=atom" type="text/html" />2014-11-08T07:55:19Z2014-11-08T07:55:19Ztag:gmail.google.com,2004:1484189407994609447<link rel="alternate" href="http://mail.google.com/a/gmail.com?account_id=******@gmail.com&amp;message_id=1498cde194fdb947&amp;view=conv&amp;extsrc=atom" type="text/html" />2014-11-08T00:46:46Z2014-11-08T00:46:46Ztag:gmail.google.com,2004:1484162445969570119La newsletter des professionnels en informatique du 07/11/2014<link rel="alternate" href="http://mail.google.com/a/gmail.com?account_id=********@gmail.com&amp;message_id=1498c60a1aba9ba3&amp;view=conv&amp;extsrc=atom" type="text/html" />2014-11-07T22:29:43Z2014-11-07T22:29:43Ztag:gmail.google.com,2004:1484153823918988195

le script:

#!/bin/bash
wget -q -O - https://mail.google.com/a/gmail.com/feed/atom --http-user=******* --http-password="******" --no-check-certificate | grep fullcount | sed 's/<[^0-9]*>//g'

le conky:

# Use Xft?
use_xft yes
#xftfont Trebuchet MS:size=9
#xftalpha 0.8
text_buffer_size 508
#background yes
# Update interval in seconds
update_interval 10
#xftalpha 0.8
own_window_argb_visual yes
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_transparent yes
#own_window_type desktop
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 200 0
maximum_width 300 
# Draw shades?
#draw_shades yes

# Draw outlines?
#draw_outline yes

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border margins
# border_margin 1

# border width
border_width 1

# Default colors and also border colors
# default_color white
# own_window_colour white
color1        lightgrey
color2        F7332C

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

# 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

#borders
draw_borders no
# border_margin 4

#position
gap_x 8
gap_y 20
alignment tr

TEXT
${voffset -8}${font Ubuntu:pixelsize=14}${color2}Mails :
${font LCD:size=7}${color1}${offset 55}${voffset -17}user1 
${voffset -12}${offset 100}${execpi 100 /home/marc/.conky/conky-perso/gmail_generic.sh ********@gmail.com '********'}
${offset 115}${voffset -12}user2 
${voffset -12}${offset 155}${execpi 100 /home/marc/.conky/conky-perso/gmail_generic1.sh ******@gmail.com '********'}

Dernière modification par enebre (Le 08/11/2014, à 17:11)

Hors ligne

#650 Le 08/11/2014, à 17:15

Didier-T

Re : [5] Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonjour enebre,
ils ont retiré les retour a la ligne, du coup ça fonctionne plus.

Avec sa ça devrait aller.

wget -q -O - https://mail.google.com/a/gmail.com/feed/atom --http-user=******** --http-password="**********" --no-check-certificate | sed -e 's/^.*fullcount>\(.*\)<\/fullcount.*$/\1/'

Dernière modification par Didier-T (Le 08/11/2014, à 17:16)

Hors ligne