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.

#2251 Le 06/06/2010, à 17:33

wlourf

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

Leyna a écrit :
Fenouille84 a écrit :
Leyna a écrit :

Bouhouhou, j'ai essayé d'éviter lua le plus possible, mais là pas moyen, je suis obligée de m'y mettre! Bon, c'est l'occasion de commencer.

+1 !! Moi aussi je ne voulais pas de LUA.
Mais au final, c'est bien utile et pas si compliqué que sa !! roll

Je patauge complet... Ça fait 1h30 que je cherche une documentation claire, un truc fait pour les noobs, qui réexplique tout depuis le début! Parce qu'il m'a fallu une demi-heure pour comprendre qu'il fallait installer le paquet lua déjà... Tu vois à quel point j'y comprends rien? hmm

Actuellement je n'arrive à rien afficher du tout. Je copie bêtement ton conkyrc et ton script lua (ceux-là http://forum.ubuntu-fr.org/viewtopic.php?pid=3449292#p3449292) mais aucun anneau n'apparaît sur mon écran, juste le texte normal d'un conky sans lua.

J'aimerais bien commencer, afficher ne serait-ce qu'un pitit quelque chose, que je pourrais bidouiller pour apprendre comment ça marche! Quelqu'un aurait un lien vers une doc simple s'il vous plaît?

1-Commence par vérifier que ton conky est bien compilé avec Lua, conky -v doit te retourner au moins ça :

  Lua bindings:
   * Cairo
   * Imlib2

Si tu l'as pas, installe conky -all

2-adapte le chemin vers le script Lua dans ton conkyrc et laisse au moins une ligne (vide ou non après TEXT) comme l'a dit Fenouille

3-si tu as des problèmes, envoie nous ce qu'affiche le terminal quand tu lances ton conky avec cette commande :

conky -c tonconkyrc

PS : a propos d'anneaux, j'ai fait des modifs à mon script camembert/anneaux pour qu'il affiche des anneaux avec des portions comme ceux-ci :

1275841894.png

Le code est ici

Hors ligne

#2252 Le 06/06/2010, à 17:42

Leyna

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

Fenouille84 a écrit :

Dans le conkyrc, indique le chemin de ton script LUA dans la partie avant TEXT
Modifie cette ligne, avec le bon chemin :

lua_load ~/conky/Script/ano.lua

Oui c'est ce que j'ai fait! Je n'obtiens pas d'anneaux:
5095ece4b3f3bcd70b4030d325efat.jpg

Et d'ailleurs ça disparaît au bout de quelques secondes! Est-ce qu'il y a une histoire de paquets à installer? Sur mon pc fixe c'est exactement la même chose.

Hors ligne

#2253 Le 06/06/2010, à 18:21

chepioq

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

@Leyna
C'est vrai que lua au départ c'est pas très évident, faut faire des essais pour bien comprendre comment ça fonctionne...Voila un script lua qui affiche "Hello word" (c'est juste pour te donner une idée de comment ça fonctionne):

--[[Script lua pour afficher Hello word
]]

require 'cairo'
function rgb_to_r_g_b(colour)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255.
end



function conky_hello()
    if conky_window == nil then return end
--Vous pouvez changer ces paramètres
--couleur du texte à afficher
    local text_color={255,0,0}
--Police à utiliser
     local font= "URW Chancery L"
     local font_size= 30
--fin des paramétres

    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)


    cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL,
                               CAIRO_FONT_WEIGHT_NORMAL)
    cairo_set_font_size (cr, font_size)
    cairo_set_source_rgba (cr, text_color[1]/255, text_color[2]/255, text_color[3]/255,1)


    cairo_move_to (cr, 40, 40)
    cairo_show_text (cr, "Hello Word")


    cairo_destroy(cr)
end

Et dans conkyrc juste avant TEXT tu dois avoir:

lua_load chemin_vers_ton_le_script_hello.lua
lua_draw_hook_pre hello

Une autre remarque, ce n'est pas vraiment un tuto sur lua qu'il faut chercher, mais plutôt sur cairo:
http://cairographics.org/samples/
http://cairographics.org/manual/index.html

Dernière modification par chepioq (Le 06/06/2010, à 18:21)


Tout est dans tout et réciproquement....

Hors ligne

#2254 Le 06/06/2010, à 19:16

Brunod

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

Salut,
J'ai aussi un problème avec les anneaux.
Je lance un conky que j'ai recopié de Londonali1010; j'ai bien qq chose qui s'affiche de suite; puis qq secondes après apparaîssent les anneaux mais il ne restent qu'une seconde et conky "s'éteind" : la tâche disparaît, terminée ou tuée... J'ai testé qq petites choses, mais rien qui résolve le problème. J'ai tâché de comparer avec un autre conky qui lui fonctionne bien, mais je n'ai rien vu qui m'explique cette différence de comportement.
Voici mon appel de conky :

# -- Conky settings -- #
background no
update_interval 1
 
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

cpu_avg_samples 2
net_avg_samples 2
 
override_utf8_locale yes

# Use Xft?
use_xft yes
 
double_buffer yes
no_buffers yes
 
text_buffer_size 2048
imlib_cache_size 0
 
# -- Window specifications -- #
 
own_window yes
#own_window_type desktop
own_window_type override  # type de fenêtre BD pour que Conky ne disparaisse plus...
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
 
border_inner_margin 0
border_outer_margin 0
 
minimum_size 1020 600
maximum_width 1000
 
alignment tm
gap_x 10
gap_y 0
 
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
 
# -- Text settings -- #
use_xft yes
xftfont Santana:size=12
xftalpha 0.8
 
uppercase no
 
default_color FFFFFF
 
# -- Lua Load -- #
#lua_load ~/scripts/rings-v1.2.1.lua
lua_load /home/bruno/clock_rings-v1.1.lua
lua_draw_hook_pre ring_stats
 
TEXT
${voffset 35}${font Santana:size=50}${alignr}${time %H.%M}${font}
${goto 160}${hr 2}
${goto 250}${time %A, %d %B %Y}

et voici le module .lua :

--[[
Ring Meters by londonali1010 (2009)
 
This script draws percentage meters as rings. It is fully customisable; all options are described in the script.
 
IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 145 uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num > 5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num > 3; conversely if you update Conky every 0.5s, you should use update_num > 10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.
 
To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
	lua_load ~/scripts/rings-v1.2.1.lua
	lua_draw_hook_pre ring_stats
 
Changelog:
+ v1.2.1 -- Fixed minor bug that caused script to crash if conky_parse() returns a nil value (20.10.2009)
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)
]]
 
settings_table = {
	{
		-- Edit this table to customise your rings.
		-- You can create more rings simply by adding more elements to settings_table.
		-- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
		name='time',
		-- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
		arg='%I.%M',
		-- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
		max=12,
		-- "bg_colour" is the colour of the base ring.
		bg_colour=0xffffff,
		-- "bg_alpha" is the alpha value of the base ring.
		bg_alpha=0.1,
		-- "fg_colour" is the colour of the indicator part of the ring.
		fg_colour=0xffffff,
		-- "fg_alpha" is the alpha value of the indicator part of the ring.
		fg_alpha=0.2,
		-- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
		x=165, y=170,
		-- "radius" is the radius of the ring.
		radius=50,
		-- "thickness" is the thickness of the ring, centred around the radius.
		thickness=5,
		-- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
		start_angle=0,
		-- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger (e.g. more clockwise) than start_angle.
		end_angle=360
	},
	{
		name='time',
		arg='%M.%S',
		max=60,
		bg_colour=0xffffff,
		bg_alpha=0.1,
		fg_colour=0xffffff,
		fg_alpha=0.4,
		x=165, y=170,
		radius=56,
		thickness=5,
		start_angle=0,
		end_angle=360
	},
	{
		name='time',
		arg='%S',
		max=60,
		bg_colour=0xffffff,
		bg_alpha=0.1,
		fg_colour=0xffffff,
		fg_alpha=0.6,
		x=165, y=170,
		radius=62,
		thickness=5,
		start_angle=0,
		end_angle=360
	},
	{
		name='cpu',
		arg='cpu1',
		max=100,
		bg_colour=0xffffff,
		bg_alpha=0,
		fg_colour=0xffffff,
		fg_alpha=0.1,
		x=165, y=170,
		radius=70,
		thickness=5,
		start_angle=60,
		end_angle=120
	},
	{
		name='cpu',
		arg='cpu2',
		max=100,
		bg_colour=0xffffff,
		bg_alpha=0,
		fg_colour=0xffffff,
		fg_alpha=0.1,
		x=165, y=170,
		radius=76,
		thickness=5,
		start_angle=60,
		end_angle=120
	},
	{
		name='cpu',
		arg='cpu0',
		max=100,
		bg_colour=0xffffff,
		bg_alpha=0.1,
		fg_colour=0xffffff,
		fg_alpha=0.4,
		x=165, y=170,
		radius=84.5,
		thickness=8,
		start_angle=60,
		end_angle=120
	},
	{
		name='battery_percent',
		arg='BAT1',
		max=100,
		bg_colour=0xffffff,
		bg_alpha=0.1,
		fg_colour=0xffffff,
		fg_alpha=0.6,
		x=165, y=170,
		radius=72,
		thickness=11,
		start_angle=122,
		end_angle=210
	},
	{
		name='memperc',
		arg='',
		max=100,
		bg_colour=0xffffff,
		bg_alpha=0.1,
		fg_colour=0xffffff,
		fg_alpha=0.8,
		x=165, y=170,
		radius=83.5,
		thickness=8,
		start_angle=122,
		end_angle=210
	},
	{
		name='time',
		arg='%d',
		max=31,
		bg_colour=0xffffff,
		bg_alpha=0.1,
		fg_colour=0xffffff,
		fg_alpha=0.8,
		x=165, y=170,
		radius=70,
		thickness=5,
		start_angle=212,
		end_angle=360
	},
	{
		name='time',
		arg='%m',
		max=12,
		bg_colour=0xffffff,
		bg_alpha=0.1,
		fg_colour=0xffffff,
		fg_alpha=0.8,
		x=165, y=170,
		radius=76,
		thickness=5,
		start_angle=212,
		end_angle=360
	},
	{
		name='fs_used_perc',
		arg='/',
		max=150,
		bg_colour=0xffffff,
		bg_alpha=0.2,
		fg_colour=0xffffff,
		fg_alpha=0.3,
		x=165, y=170,
		radius=108.5,
		thickness=3,
		start_angle=-120,
		end_angle=240
	},
	{
		name='fs_used_perc',
		arg='/',
		max=100,
		bg_colour=0xffffff,
		bg_alpha=0.2,
		fg_colour=0xffffff,
		fg_alpha=0.3,
		x=165, y=170,
		radius=135,
		thickness=50,
		start_angle=-120,
		end_angle=120
	},
}
 
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 draw_ring(cr,t,pt)
	local w,h=conky_window.width,conky_window.height
 
	local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
	local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']
 
	local angle_0=sa*(2*math.pi/360)-math.pi/2
	local angle_f=ea*(2*math.pi/360)-math.pi/2
	local t_arc=t*(angle_f-angle_0)
 
	-- Draw background ring
 
	cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
	cairo_set_line_width(cr,ring_w)
	cairo_stroke(cr)
 
	-- Draw indicator ring
 
	cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
	cairo_stroke(cr)		
end
 
function conky_ring_stats()
	local function setup_rings(cr,pt)
		local str=''
		local value=0
 
		str=string.format('${%s %s}',pt['name'],pt['arg'])
		str=conky_parse(str)
 
		value=tonumber(str)
		if value == nil then value = 0 end
		pct=value/pt['max']
 
		draw_ring(cr,pct,pt)
	end
 
	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)
 
	local cr=cairo_create(cs)	
 
	local updates=conky_parse('${updates}')
	update_num=tonumber(updates)
 
	if update_num>5 then
		for i in pairs(settings_table) do
			setup_rings(cr,settings_table[i])
		end
	end
end

Je ne suis pas un spécialiste, mais je suis conquis aussi si vous avez une piste pour moi...


Windows est un système d'exploitation de l'homme par l'ordinateur. Linux, c'est le contraire...
39 pc linux convertis

Hors ligne

#2255 Le 06/06/2010, à 19:42

wlourf

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

@Brunod
Tu devrais lancer ton conky dans une console avec

conky -c /path/tonconkyrc

et nous envoyer les messages d'erreur que tu vas avoir

Hors ligne

#2256 Le 06/06/2010, à 19:51

Brunod

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

Très bonne idée la console :

bruno@UBlaptop:~$ conky -c conky1.conf
Conky: desktop window (22000a9) is subwindow of root window (ff)
Conky: window type - override
Conky: drawing to created window (0x5000001)
Conky: drawing to double buffer
Conky: can't open /sys/class/power_supply/BAT1/uevent: No such file or directory
Conky: can't open /proc/acpi/battery/BAT1/state: No such file or directory
Conky: obj->data.i 2 info.cpu_count 1
Conky: attempting to use more CPUs than you have!
bruno@UBlaptop:~$

C'est vrai que je travaille sur un portable sans batterie pour l'instant.
Je vais essayer de neutraliser les appels au second proc, mais la batterie, je préfèrerais laisser pour quand je la remettrai. Je vous tiens au courant. Merci ! smile
EDIT : Ça yest, ça marche !!! Merci ! big_smile

Dernière modification par Brunod (Le 06/06/2010, à 19:57)


Windows est un système d'exploitation de l'homme par l'ordinateur. Linux, c'est le contraire...
39 pc linux convertis

Hors ligne

#2257 Le 06/06/2010, à 19:53

Leyna

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

@wlourf
Le chemin vers le fichier lua est correct, et j'ai bien Imlib2 et Cairo.
Retour du terminal:

moon@LeoBox:~$ conky -c /home/moon/conky/conkyrc
Conky: statfs '/media/LEXAR': No such file or directory
Conky: statfs '/media/Linux': No such file or directory
Conky: statfs '/media/LaCie_PC': No such file or directory
Conky: forked to background, pid is 8671
moon@LeoBox:~$ 
Conky: desktop window (e000a7) is subwindow of root window (106)
Conky: window type - override
Conky: drawing to created window (0x2c00001)
Conky: drawing to double buffer
Conky: statfs '/media/LaCie_PC': No such file or directory
Conky: statfs '/media/Linux': No such file or directory
Conky: statfs '/media/LEXAR': No such file or directory
Conky: could not connect to hddtemp host
Conky: could not connect to hddtemp host
Conky: can't open '/sys/bus/platform/devices/coretemp.0/temp1_input': No such file or directory
please check your device or remove this var from Conky

Il râle pour les disques durs ou clés USB inexistants, mais je ne vois rien de louche.
Pas d'anneaux + conky qui disparaît au bout de quelques secondes.

@chepioq
Ton script marche! Et conky ne disparaît pas! C'est bizarre ça, pourquoi ça me fait des problèmes avec les autres scripts?
Je vais voir les liens que tu m'as donnés tout à l'heure.

Merci à vous deux de vous pencher sur mon problème!

Hors ligne

#2258 Le 06/06/2010, à 20:04

wlourf

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

@bruno,
Conky: attempting to use more CPUs than you have!
supprime donc la partie :

    {
        name='cpu',
        arg='cpu1',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0,
        fg_colour=0xffffff,
        fg_alpha=0.1,
        x=165, y=170,
        radius=70,
        thickness=5,
        start_angle=60,
        end_angle=120
    },
    {
        name='cpu',
        arg='cpu2',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0,
        fg_colour=0xffffff,
        fg_alpha=0.1,
        x=165, y=170,
        radius=76,
        thickness=5,
        start_angle=60,
        end_angle=120
    },
    {
        name='cpu',
        arg='cpu0',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0xffffff,
        fg_alpha=0.4,
        x=165, y=170,
        radius=84.5,
        thickness=8,
        start_angle=60,
        end_angle=120
    },

et remplace la par celle là:

    {
        name='cpu',
        arg='',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0,
        fg_colour=0xffffff,
        fg_alpha=0.1,
        x=165, y=170,
        radius=70,
        thickness=5,
        start_angle=60,
        end_angle=120
    },

@lena, chez toi, je pense que c'est cette partie qu'il faut supprimer :

    {
        name='hddtemp',
        arg='/dev/sda',
        max=100,
        bg_colour=0x606060,
        bg_alpha=0.6,
        fg_colour=0x000000,
        fg_alpha=0.8,
        x=36, y=272,
        radius=30,
        thickness=5,
        start_angle=270,
        end_angle=570
    },

Quand vous recopiez des scripts Lua, généralement la configuration est au début du fichier, et le terminal indique où sont les erreurs, il suffit donc de faire une recherche dans le script sur les mots-clés qui posent problème : hddtemp ou cpu.

Hors ligne

#2259 Le 06/06/2010, à 22:11

ferreol

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

leyna,
J aime aussi ton conky posté sur la page 90 pourrais tu poster ton code je vais essayer de faire un mix et de coller des anneaux à mon conky oblique.

Hors ligne

#2260 Le 06/06/2010, à 22:22

wido

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

Conky minimalist big_smile
201006062321371280x1024.th.png

#Barre horizontal
# Le clignotement, ça pique les yeux 
double_buffer yes 

#texte tronqué
text_buffer_size 2048

# Ajoute des espaces après certains objets pour éviter de les faire bouger.
# Fonctionne uniquement avec les polices Fixes
use_spacer right

#caractère bizarre
#override_utf8_locale no
#uppercase no

# Si jamais on voulait plusieurs Conkys simultanément 
own_window  yes 
own_window_transparent no #no # Donne la transparence
own_window_type normal #normal 
own_window_hints undecorate,sticky,skip_taskbar,skip_pager 

#======================
# Comme une fenêtre:
#======================
#own_window_type normal
#own_window_hints skip_taskbar,skip_pager
#own_window_title Conky
#======================
# Default colors and also border colors
default_color FFFFDD
#medium blue 083146
#dark blue 041e2c
#good blue 1994d1
color1 1994d1
# Gris-Blanc
color2 cccccc
# Rouge
color3 a90100
#gris:
color4 202020
# Vert
color5 88f121
#Jaune
color6 ecef00
#Bleu pour le download
color7 00c6ff
# Rouge pour le upload
color8 9f0000
#Gris
color9 777777
#default_shade_color 888888
#default_outline_color 888888
own_window_colour 000000

# Bordures 
draw_borders no 
border_margin 1 

# Ombres 
draw_shades no

# Position 
gap_x 6 # Valeur 6
gap_y 6 # Valeur 6
# alignment top-right
alignment top_right # alignment bottom_left 

# Comportement 
update_interval 1 

#==========  COULEUR
# FFFFFF Blanc

# Polices 
use_xft yes 
xftfont Bauhaus Md BT:size=8
xftalpha 1.0
#xftfont bauhaus:pixelsize=10 

# Pas bouger ! 
use_spacer no 
minimum_size 1268 0
# Longueur du conky
#maximum_width 1280

# ${goto 200}${color2}Archlinux: ${goto 250}${color1}${rss http://www.archlinux.org/feeds/packages/ 1 item_titles 1}

TEXT 
${voffset -1}${color6}(|[°_°]|) ${color2}${time %A %d %B %Y} ${color2}- ${color1}${time %H:%M:%S} ${color2}@ ${color2}RAM ${color1}${font}${mem} ${color2}@ ${color7}DS${downspeed eth0} ${color2}| ${color8}US ${upspeed eth0} ${color7}TD ${totaldown eth0} ${color2}| ${color8}TU${totalup eth0} ${color2}@ ${color2}Ports Ouverts ${color1}${tcp_portmon 1 65535 count} ${color2}@ ${color1}${addr eth0} ${color2}@ ${color2}CPU ${color1}${font}${cpu cpu1}%  ${color1}${font}${cpu cpu2}%  ${color1}${font}${cpu cpu3}%  ${color1}${font}${cpu cpu4}% ${color2}@ ${color5}${kernel} ${color2}@ ${color2}Uptime ${color5}${font}${uptime_short}
${if_mpd_playing}${color1}(|[°_°]|) ${color2}${mpd_status} ${mpd_track} - ${color1}${font}${mpd_smart}${color2} ${mpd_bar 5,100} ${color1}${mpd_elapsed}/${mpd_length} ${color2}@${color1}${mpd_bitrate}Kbps${endif}

Hors ligne

#2261 Le 06/06/2010, à 22:42

Leyna

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

ferreol a écrit :

leyna,
J aime aussi ton conky posté sur la page 90 pourrais tu poster ton code je vais essayer de faire un mix et de coller des anneaux à mon conky oblique.

Malheureusement ce n'est pas mon bureau, et ce n'est pas conky non plus! C'est rainmeter, sous W$. Moi j'essaie justement de recréer cet effet avec conky, cairo, luaaaarghhh smile

wlourf a écrit :

Quand vous recopiez des scripts Lua, généralement la configuration est au début du fichier, et le terminal indique où sont les erreurs, il suffit donc de faire une recherche dans le script sur les mots-clés qui posent problème : hddtemp ou cpu.

Bingo c'était ça qui coinçait! J'ai du supprimer hddtemp et coretemp. Ça tombe bien ça ne m'intéresse pas. Maintenant j'ai enfin des z'ano! C'est un bon début, je m'attaque à la suite! Merci!

Hors ligne

#2262 Le 06/06/2010, à 23:02

Fenouille84

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

wlourf a écrit :

PS : a propos d'anneaux, j'ai fait des modifs à mon script camembert/anneaux pour qu'il affiche des anneaux avec des portions.

Sympa tes modifs wlourf !! cool

Courage à tous ceux qui tentent de configurer leur conky/LUA... wink


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

Hors ligne

#2263 Le 06/06/2010, à 23:17

Leyna

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

Purée, j'ai essayé le script de ferreol, rien ne s'affiche malgré la suppression des paramètres qui créent des erreurs, j'en peux plus... Je ne veux dessiner ni d'anneaux ni de graphes ni rien du tout, je voudrais juste incliner mon texte...

Par exemple, je pars du code suivant, tout simple

--[[Script lua pour afficher Hello world
]]

require 'cairo'
function rgb_to_r_g_b(colour)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255.
end



function conky_hello()
    if conky_window == nil then return end
--Vous pouvez changer ces paramètres
--couleur du texte à afficher
    local text_color={5,10,30}
--Police à utiliser
     local font= "Oasis"
     local font_size= 30
--fin des paramétres

    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)


    cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL,
                               CAIRO_FONT_WEIGHT_NORMAL)
    cairo_set_font_size (cr, font_size)
    cairo_set_source_rgba (cr, text_color[1]/255, text_color[2]/255, text_color[3]/255,1)


    cairo_move_to (cr, 440, 40)
    cairo_show_text (cr, "Hello World")


    cairo_destroy(cr)
end

J'essaie d'ajouter un paramètre cairo_rotate(cr,-0.52); comme dans le script de ferreol, évidemment ça change rien, je crois que je suis bien trop naïve c'est pas aussi simple!

Dites, vous avez tous une formation de programmeurs? Parce que moi je programme rien du tout, mais je me suis lancée dans les fichiers de config avec conky y a un an (que j'ai mis des heures à décrypter) et je me suis prise au jeu. Après j'ai osé attaquer ceux d'openbox. Aussi bien les uns que les autres m'ont paru logiques et abordables. Mais là je dois reconnaître que les voies des scripts lua sont impénétrables pour mon esprit...

Bon, je sais que ce n'est pas l'esprit linux, mais s'il vous plaît, donnez-moi la réponse, ou achevez-moi!

(Ou j'affiche mon texte droit, comme avant, sans chichis, et pis c'est tout)

EDIT
Au fait, je me suis penchée sur les deux liens de chepioq sur cairo... et euh... c'est même pas la peine >_<

Dernière modification par Leyna (Le 06/06/2010, à 23:20)

Hors ligne

#2264 Le 06/06/2010, à 23:21

wido

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

@Leyna, essaye de lancer ton conky via le terminal et colle le résultat sur le forum.

Hors ligne

#2265 Le 06/06/2010, à 23:57

Leyna

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

J'arrive enfin à quelque chose!
C'est toujours pareil, c'est quand je pique ma crise et que je panique que je trouve un semblant de solution smile

Par contre je ne comprends pas le code couleur de cette ligne

cairo_set_source_rgba (cr, 0.325490196, 0.258823529, 0.035294118, 0.8);

J'ai collé un bête RGB mais non, apparemment ce sont des rapports à 1. On les trouve comment? Google m'a pas beaucoup aidée sur ce coup-là.

Hors ligne

#2266 Le 07/06/2010, à 04:59

chepioq

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

@Leyna

Je te donne le lua que j'ai fait pour afficher l'heure comme sur le poste de la page 90:

--[[Script lua pour afficher Hello word
]]

require 'cairo'

function conky_hello()
    if conky_window == nil then return end
--Vous pouvez changer ces paramètres
--couleur du texte à afficher
    local text_color={255,0,0}
--Police à utiliser
     local font= "URW Chancery L"
     local font_size= 30
--Récupérer l'heure
     local text_l= conky_parse("${exec date +%X ")
--fin des paramétres


    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)


    cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL,
                               CAIRO_FONT_WEIGHT_NORMAL)
    cairo_set_font_size (cr, font_size)
    cairo_set_source_rgba (cr, text_color[1]/255, text_color[2]/255, text_color[3]/255,1)


    cairo_move_to (cr, 40, 40)
--Rotation du texte
    cairo_rotate(cr,1.57);

    cairo_show_text (cr, text_l)



    cairo_destroy(cr)
end

Si cela peut t'aider

Dernière modification par chepioq (Le 07/06/2010, à 05:31)


Tout est dans tout et réciproquement....

Hors ligne

#2267 Le 07/06/2010, à 05:18

chepioq

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

Leyna a écrit :

J'arrive enfin à quelque chose!
C'est toujours pareil, c'est quand je pique ma crise et que je panique que je trouve un semblant de solution smile

Par contre je ne comprends pas le code couleur de cette ligne

cairo_set_source_rgba (cr, 0.325490196, 0.258823529, 0.035294118, 0.8);

J'ai collé un bête RGB mais non, apparemment ce sont des rapports à 1. On les trouve comment? Google m'a pas beaucoup aidée sur ce coup-là.

C'est spécial à lua, ce sont des RGB divisé par 255
R:  0.325490196 * 255 = 82.99999 (soit 83)
G:  0.258823529 * 255 = 65.9999 (soit 66)
B:  0.035294118 * 255 = 9.0000009 (soit 9)

Le dernier chiffre 0.8 est pour l'alpha (transparence)de 0 à 1, 0 totalement transparent, 1 totalement opaque

Dernière modification par chepioq (Le 07/06/2010, à 07:04)


Tout est dans tout et réciproquement....

Hors ligne

#2268 Le 07/06/2010, à 10:57

JB-home

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

j'ai modifier mon conky pour cause d'un nouveau wallpaper

1275905168.png

j'en avais marre d'un écran tout noir xD

Dernière modification par z0rg> (Le 07/06/2010, à 11:07)

Hors ligne

#2269 Le 07/06/2010, à 14:10

Leyna

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

Voilà où j'en suis
451ecb2036f3006359eb9f6279fc3t.jpg
Merci pour votre aide!!

Pour l'heure

 --[[
Conky Widgets by londonali1010 (2009)

Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/conky_widgets.lua):
    lua_load ~/Scripts/conky_widgets.lua
    lua_draw_hook_pre load_text ]]

require 'cairo'
function draw_text()
    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)

    
        
-- Font
cairo_select_font_face (cr, "Denmark", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);

-- font size
cairo_set_font_size (cr, 30.0);

-- angle
cairo_rotate(cr, 0);



-- shown text
cairo_move_to (cr, 1370.0, 180.0);
cairo_set_source_rgba (cr, 0,0,0, 1);
cairo_set_font_size (cr, 140.0);
cairo_show_text (cr, conky_parse('${time %H}'));

cairo_move_to (cr, 1500.0, 180.0);
cairo_set_source_rgba (cr, 0.803921569, 0.803921569, 0, 1);
cairo_set_font_size (cr, 100.0);
cairo_show_text (cr, conky_parse('${time %M}'));

cairo_move_to (cr, 1600.0, 180.0);
cairo_set_source_rgba (cr, 0,0,0, 1);
cairo_set_font_size (cr, 30.0);
cairo_show_text (cr, conky_parse('${time %S}'));

cairo_move_to (cr, 250.0, 150.0);
cairo_set_source_rgba (cr, 0,0,0, 1);
cairo_set_font_size (cr, 60.0);
cairo_show_text (cr, conky_parse('${time  %A}'));

cairo_move_to (cr, 350.0, 180.0);
cairo_set_source_rgba (cr, 0.803921569, 0.803921569, 0, 1);
cairo_set_font_size (cr, 60.0);
cairo_show_text (cr, conky_parse('${time  %d %B,}'));

cairo_move_to (cr, 580.0, 170.0);
cairo_set_source_rgba (cr, 0,0,0, 1);
cairo_set_font_size (cr, 30.0);
cairo_show_text (cr, conky_parse('${time  %Y}'));

cairo_stroke (cr);




end



function conky_load_text()
 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)
    
    local cr=cairo_create(cs)    
    
    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
    
    if update_num>5 then
       draw_text()
    end
end

Pour les partitions

 --[[
Conky Widgets by londonali1010 (2009)

Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/conky_widgets.lua):
    lua_load ~/Scripts/conky_widgets.lua
    lua_draw_hook_pre load_text ]]

require 'cairo'
function draw_text()
    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)

    
        
-- Font
cairo_select_font_face (cr, "Denmark", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);

-- font size
cairo_set_font_size (cr, 30.0);

-- angle
cairo_rotate(cr, 1.57);

-- text position
cairo_move_to (cr, 250.0, 0.0);

-- shown text
cairo_move_to (cr, 320.0, 0.0);
cairo_set_source_rgba (cr, 0.803921569, 0.803921569, 0, 1);
cairo_set_font_size (cr, 50.0);
cairo_show_text (cr, conky_parse('${fs_used_perc /}'));

cairo_move_to (cr, 250.0, 0.0);
cairo_set_source_rgba (cr, 0,0,0, 1);
cairo_set_font_size (cr, 35.0);
cairo_show_text (cr, 'Root');

cairo_move_to (cr, 520.0, 0.0);
cairo_set_source_rgba (cr, 0.803921569, 0.803921569, 0, 1);
cairo_set_font_size (cr, 50.0);
cairo_show_text (cr, conky_parse('${fs_used_perc /home}'));

cairo_move_to (cr, 450.0, 0.0);
cairo_set_source_rgba (cr, 0,0,0, 1);
cairo_set_font_size (cr, 35.0);
cairo_show_text (cr, 'Home');

cairo_move_to (cr, 680.0, 0.0);
cairo_set_source_rgba (cr, 0.803921569, 0.803921569, 0, 1);
cairo_set_font_size (cr, 50.0);
cairo_show_text (cr, conky_parse('${fs_used_perc /media/Air}'));

cairo_move_to (cr, 650.0, 0.0);
cairo_set_source_rgba (cr, 0,0,0, 1);
cairo_set_font_size (cr, 35.0);
cairo_show_text (cr, 'Air');

cairo_stroke (cr);




end



function conky_load_text()
 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)
    
    local cr=cairo_create(cs)    
    
    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
    
    if update_num>5 then
       draw_text()
    end
end

Je passe un temps fou à modifier les coordonnées de chaque élément, sans trop en comprendre la logique. Par exemple sur la gauche j'ai l'impression que c'est pas bien droit!



La prochaine étape, c'est intégrer le nombre de mails non lus (sur gmail). Étant donné que je me servais du script ci-dessous, comment l'intégrer à LUA?

#!/usr/bin/perl

use Switch;
use Text::Wrap;

my $what=$ARGV[0];

$user="login"; #username for gmail account
$pass="password"; #password for gmail account
$file="/tmp/gmail.html"; #temporary file to store gmail

#wrap format for subject
$Text::Wrap::columns=40; #Number of columns to wrap subject at
$initial_tab=""; #Tab for first line of subject
$subsequent_tab="\t"; #tab for wrapped lines
$quote="\""; #put quotes around subject

#limit the number of emails to be displayed
$emails=4; #if -1 display all emails

&passwd; #give password the proper url character encoding

switch($what){ #determine what the user wants
    case "n" {&gmail; print "$new\n";} #print number of new emails
    case "s" { #print $from and $subj for new email
        &gmail;
        if ($new>0){
            my $size=@from;
            if ($emails!=-1 && $size>$emails){$size=$emails;} #limit number of emails displayed
            for(my $i=0; $i<$size; ++$i){
                print "From : $from[$i]\n"; #print from line
                $text=$quote.$subj[$i].$quote."\n\n";
                print wrap($initial_tab, $subsequent_tab, $text."\n\n"); #print subject with word wrap
            }
            $size=@from;
            if ($emails!=-1 && $size >$emails){print "$emails out of $size new emails displayed\n";}
        }
    }     
    case "e" { #print number of new emails, $from, and $subj
        &gmail;
        if($new==0){print "0\n";}
        else{
            print "$new non lu(s)\n\n";
            my $size=@from;
            if ($emails!=-1 && $size>$emails){$size=$emails;} #limit number of emails displayed
            for(my $i=0; $i<$size; ++$i){
                print "From : $from[$i]\n"; #print from line
                $text=$quote.$subj[$i].$quote."\n";
                print wrap($initial_tab, $subsequent_tab, $text."\n\n"); #print subject with word wrap
                print"\n"
            }
            $size=@from;
            if ($emails!=-1 && $size >$emails){print "$emails out of $size new emails displayed\n";}
        }
    }
    else {
        print "Usage Error: gmail.pl <option>\n";
        print "\tn displays number of new emails\n";
        print "\ts displays from line and subject line for each new email.\n";
        print "\te displays the number of new emails and from line plus \n";
        print "\t\tsubject line for each new email.\n";
    } #didn't give proper option
}

sub gmail{
    if(!(-e $file)){ #create file if it does not exists
        `touch $file`;
    } 

    #get new emails
    `wget -O - https://$user:$pass\@mail.google.com/mail/feed/atom --no-check-certificate> $file`;

    open(IN, $file); #open $file

    my $i=0; #initialize count
    $new=0; #initialize new emails to 0

    my $flag=0;

    while(<IN>){ #cycle through $file
        if(/<entry>/){$flag=1;}
        elsif(/<fullcount>(\d+)<\/fullcount>/){$new=$1;} #grab number of new emails
        elsif($flag==1){ 
            if(/<title>.+<\/title>/){push(@subj, &msg);} #grab new email titles
            elsif(/<name>(.+)<\/name>/){push(@from, $1); $flag=0;} #grab new email from lines
        }
    }

    close(IN); #close $file
}

sub passwd{ #change to url escape codes in password
    #URL ESCAPE CODES
    $_=$pass;
    s/\%/\%25/g;
    s/\#/\%23/g;
    s/\$/\%24/g;
    s/\&/\%26/g;
    s/\//\%2F/g;
    s/\:/\%3A/g;
    s/\;/\%3B/g;
    s/\</\%3C/g;
    s/\=/\%3D/g;
    s/\>/\%3E/g;
    s/\?/\%3F/g;
    s/\@/\%40/g;
    s/\[/\%5B/g;
    s/\\/\%5C/g;
    s/\]/\%5D/g;
    s/\^/\%5E/g;
    s/\`/\%60/g;
    s/\{/\%7B/g;
    s/\|/\%7C/g;
    s/\}/\%7D/g;
    s/\~/\%7E/g;
    $pass=$_;
}

sub msg{
    #THE HTML CODED CHARACTER SET [ISO-8859-1]
    chomp; s/<title>(.+)<\/title>/$1/; #get just the subject
    #now replace any special characters
    s/\&\#33\;/!/g;        #Exclamation mark
    s/\&\#34\;/"/g; s/\&quot\;/"/g;      #Quotation mark
    s/\&\#35\;/#/g;        #Number sign
    s/\&\#36\;/\$/g;        #Dollar sign
    s/\&\#37\;/%/g;        #Percent sign
    s/\&\#38\;/&/g; s/\&amp\;/&/g;        #Ampersand
    s/\&\#39\;/'/g;        #Apostrophe
    s/\&\#40\;/(/g;        #Left parenthesis
    s/\&\#41\;/)/g;        #Right parenthesis
    s/\&\#42\;/*/g;        #Asterisk
    s/\&\#43\;/+/g;        #Plus sign
    s/\&\#44\;/,/g;        #Comma
    s/\&\#45\;/-/g;        #Hyphen
    s/\&\#46\;/./g;        #Period (fullstop)
    s/\&\#47\;/\//g;        #Solidus (slash)
    s/\&\#58\;/:/g;        #Colon
    s/\&\#59\;/\;/g;        #Semi-colon
    s/\&\#60\;/</g; s/\&lt\;/</g;        #Less than
    s/\&\#61\;/=/g;        #Equals sign
    s/\&\#62\;/>/g; s/\&gt\;/>/g;        #Greater than
    s/\&\#63\;/\?/g;        #Question mark
    s/\&\#64\;/\@/g;        #Commercial at
    s/\&\#91\;/\[/g;        #Left square bracket
    s/\&\#92\;/\\/g;        #Reverse solidus (backslash)
    s/\&\#93\;/\]/g;        #Right square bracket
    s/\&\#94\;/\^/g;        #Caret
    s/\&\#95\;/_/g;        #Horizontal bar (underscore)
    s/\&\#96\;/\`/g;        #Acute accent
    s/\&\#123\;/\{/g;        #Left curly brace
    s/\&\#124\;/|/g;        #Vertical bar
    s/\&\#125\;/\}/g;        #Right curly brace
    s/\&\#126\;/~/g;        #Tilde
    s/\&\#161\;/¡/g;        #Inverted exclamation
    s/\&\#162\;/¢/g;        #Cent sign
    s/\&\#163\;/£/g;        #Pound sterling
    s/\&\#164\;/¤/g;        #General currency sign
    s/\&\#165\;/¥/g;        #Yen sign
    s/\&\#166\;/¦/g;        #Broken vertical bar
    s/\&\#167\;/§/g;        #Section sign
    s/\&\#168\;/¨/g;        #Umlaut (dieresis)
    s/\&\#169\;/©/g; s/\&copy\;/©/g;        #Copyright
    s/\&\#170\;/ª/g;        #Feminine ordinal
    s/\&\#171\;/«/g;        #Left angle quote, guillemotleft
    s/\&\#172\;/¬/g;        #Not sign
    s/\&\#174\;/®/g;        #Registered trademark
    s/\&\#175\;/¯/g;        #Macron accent
    s/\&\#176\;/°/g;        #Degree sign
    s/\&\#177\;/±/g;        #Plus or minus
    s/\&\#178\;/²/g;        #Superscript two
    s/\&\#179\;/³/g;        #Superscript three
    s/\&\#180\;/´/g;        #Acute accent
    s/\&\#181\;/µ/g;        #Micro sign
    s/\&\#182\;/¶/g;        #Paragraph sign
    s/\&\#183\;/·/g;        #Middle dot
    s/\&\#184\;/¸/g;        #Cedilla
    s/\&\#185\;/¹/g;        #Superscript one
    s/\&\#186\;/º/g;        #Masculine ordinal
    s/\&\#187\;/»/g;        #Right angle quote, guillemotright
    s/\&\#188\;/¼/g; s/\&frac14\;/¼/g;       # Fraction one-fourth
    s/\&\#189\;/½/g; s/\&frac12\;/½/g;       # Fraction one-half
    s/\&\#190\;/¾/g; s/\&frac34\;/¾/g;       # Fraction three-fourths
    s/\&\#191\;/¿/g;        #Inverted question mark
    s/\&\#192\;/À/g;        #Capital A, grave accent
    s/\&\#193\;/Á/g;        #Capital A, acute accent
    s/\&\#194\;/Â/g;        #Capital A, circumflex accent
    s/\&\#195\;/Ã/g;        #Capital A, tilde
    s/\&\#196\;/Ä/g;        #Capital A, dieresis or umlaut mark
    s/\&\#197\;/Å/g;        #Capital A, ring
    s/\&\#198\;/Æ/g;        #Capital AE dipthong (ligature)
    s/\&\#199\;/Ç/g;        #Capital C, cedilla
    s/\&\#200\;/È/g;        #Capital E, grave accent
    s/\&\#201\;/É/g;        #Capital E, acute accent
    s/\&\#202\;/Ê/g;        #Capital E, circumflex accent
    s/\&\#203\;/Ë/g;        #Capital E, dieresis or umlaut mark
    s/\&\#204\;/Ì/g;        #Capital I, grave accent
    s/\&\#205\;/Í/g;        #Capital I, acute accent
    s/\&\#206\;/Î/g;        #Capital I, circumflex accent
    s/\&\#207\;/Ï/g;        #Capital I, dieresis or umlaut mark   
    s/\&\#208\;/Ð/g;        #Capital Eth, Icelandic
    s/\&\#209\;/Ñ/g;        #Capital N, tilde
    s/\&\#210\;/Ò/g;        #Capital O, grave accent
    s/\&\#211\;/Ó/g;        #Capital O, acute accent
    s/\&\#212\;/Ô/g;        #Capital O, circumflex accent
    s/\&\#213\;/Õ/g;        #Capital O, tilde
    s/\&\#214\;/Ö/g;        #Capital O, dieresis or umlaut mark
    s/\&\#215\;/×/g;        #Multiply sign
    s/\&\#216\;/Ø/g;        #Capital O, slash
    s/\&\#217\;/Ù/g;        #Capital U, grave accent
    s/\&\#218\;/Ú/g;        #Capital U, acute accent
    s/\&\#219\;/Û/g;        #Capital U, circumflex accent
    s/\&\#220\;/Ü/g;        #Capital U, dieresis or umlaut mark
    s/\&\#221\;/Ý/g;        #Capital Y, acute accent
    s/\&\#222\;/Þ/g;        #Capital THORN, Icelandic
    s/\&\#223\;/ß/g;        #Small sharp s, German (sz ligature)
    s/\&\#224\;/à/g;        #Small a, grave accent
    s/\&\#225\;/á/g;        #Small a, acute accent
    s/\&\#226\;/â/g;        #Small a, circumflex accent
    s/\&\#227\;/ã/g;        #Small a, tilde
    s/\&\#228\;/ä/g;        #Small a, dieresis or umlaut mark
    s/\&\#229\;/å/g;        #Small a, ring
    s/\&\#230\;/æ/g;        #Small ae dipthong (ligature)
    s/\&\#231\;/ç/g;        #Small c, cedilla
    s/\&\#232\;/è/g;        #Small e, grave accent
    s/\&\#233\;/é/g;        #Small e, acute accent
    s/\&\#234\;/ê/g;        #Small e, circumflex accent
    s/\&\#235\;/ë/g;        #Small e, dieresis or umlaut mark
    s/\&\#236\;/ì/g;        #Small i, grave accent
    s/\&\#237\;/í/g;        #Small i, acute accent
    s/\&\#238\;/î/g;        #Small i, circumflex accent
    s/\&\#239\;/ï/g;        #Small i, dieresis or umlaut mark
    s/\&\#240\;/ð/g;        #Small eth, Icelandic
    s/\&\#241\;/ñ/g;        #Small n, tilde
    s/\&\#242\;/ò/g;        #Small o, grave accent
    s/\&\#243\;/ó/g;        #Small o, acute accent
    s/\&\#244\;/ô/g;        #Small o, circumflex accent
    s/\&\#245\;/õ/g;        #Small o, tilde
    s/\&\#246\;/ö/g;        #Small o, dieresis or umlaut mark
    s/\&\#247\;/÷/g;        #Division sign
    s/\&\#248\;/ø/g;        #Small o, slash
    s/\&\#249\;/ù/g;        #Small u, grave accent
    s/\&\#250\;/ú/g;        #Small u, acute accent
    s/\&\#251\;/û/g;        #Small u, circumflex accent
    s/\&\#252\;/ü/g;        #Small u, dieresis or umlaut mark
    s/\&\#253\;/ý/g;        #Small y, acute accent
    s/\&\#254\;/þ/g;        #Small thorn, Icelandic
    s/\&\#255\;/ÿ/g;        #Small y, dieresis or umlaut mark
    s/^\s+//;
    return $_;
}

Script que j'appelais avec cette ligne

${execpi 60 perl /chemin/du/script.pl n}

Une idée?


EDIT
J'ai trouvé ce script, mais rien ne s'affiche à l'écran. Voilà le retour du terminal:

moon@LeoBox:~$ conky -c /home/moon/conky/conkyrc_gmail
Conky: /home/moon/conky/conkyrc_gmail: 1: no such configuration: '--'
Conky: llua_load: /home/moon/conky/gmail.lua:3: unexpected symbol near '#'
Conky: desktop window (12000a7) is subwindow of root window (106)
Conky: window type - desktop
Conky: drawing to created window (0x4000001)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_mail execution failed: attempt to call a nil value

Dernière modification par Leyna (Le 07/06/2010, à 14:44)

Hors ligne

#2270 Le 07/06/2010, à 18:04

JB-home

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

Leyna, j'utilise le même script perl pour gmail, que j'appel de la même façon dans conky. par contre je ne sait pas si c'est possible de l'intégré dans LUA, j'ai vu sur le web que le contraire est possible. ( LUA dans script Perl )

ce qui ne t'avance pas plus lol

EDIT : je n'avais pas vu ton edit...

Conky: /home/moon/conky/conkyrc_gmail: 1: no such configuration: '--'

tu a bien mit "Your Login Gmail" dans le fichier de conf conky ?

Dernière modification par z0rg> (Le 07/06/2010, à 18:11)

Hors ligne

#2271 Le 07/06/2010, à 20:15

Leyna

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

z0rg> a écrit :
Conky: /home/moon/conky/conkyrc_gmail: 1: no such configuration: '--'

tu a bien mit "Your Login Gmail" dans le fichier de conf conky ?

Oui oui, mais rien... J'ai laissé tomber, j'ai repris le conky que j'avais.

Voilà où j'en suis:
3ed508d7d8b4511802ec39b856f5ct.jpg

Date, heure et partitions avec lua, le reste en conky tout simple tout gentil smile
J'ai encore des choses à ajouter. Pis quand ça sera plein j'en aurai ras-le-bol et je changerai tout! Vive la customisation \o/

Hors ligne

#2272 Le 07/06/2010, à 22:06

wlourf

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

Hello!

Pour ceux qui veulent afficher du texte dans tous les sens, j'avais un petit script que je n'avais jamais posté car je le trouvais trop simple, mais en suivant ce topic, je vois qu'il pourrait quand même servir big_smile Je l'ai remanié pour qu'il soit super simple à utiliser (enfin je trouve) : tout se configure au début du script, aucun paramètre n'est obligatoire et voici le genre de résultat qu'on peut obtenir:
562513cf85a5f5f6d36c94b5cf725t.jpg

Edit : La version mise à jour est sur ce topic finalement : http://forum.ubuntu-fr.org/viewtopic.php?pid=3540506#p3540506


Déjà, le conky qui va bien :

# -- Conky settings -- #
background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
imlib_cache_size 0

own_window_type desktop
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
own_window yes
own_window_transparent yes
own_window_argb_visual yes

border_inner_margin 0
border_outer_margin 0

minimum_size 300 500
alignment tl

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

# -- Text settings -- #
#to have calendar in local language, use $time after TEXT
#use xftalpha 0 to hide this text and default_color 000000
use_xft yes
xftfont Santana:size=12
xftalpha 1
default_color 000000

# -- Lua load -- #
lua_load ~/wlourf/scripts/text.lua
lua_draw_hook_post draw_text

#au moins une ligne, même vide, après TEXT
TEXT

et le script text.lua pour l'image ci-dessus :

--[[TEXT WIDGET by Wlourf 07/06/2010
Ce widget permet d'afficher différents textes définis dans la table 
text_settings{} avec différentes options

Les paramètres (tous facultatifs) sont :
text		- texte à afficher, défaut = "Conky is good for you"
			- coordonées relatives au coin supérieur gauche de la fenêtre conky
x			- coordonnée x de la première lettre, en bas à droite, défaut = milieu de la fenêtre conky
y			- coordonnée y de la première lettre, en bas à droite, défaut = milieu de la fenêtre conky
font_name	- nom de la police à utiliser, défaut = Free Sans
font_size	- taille de la police à utiliser, défaut = 14
italic		- afficher le texte en italic si true, défaut=false
oblique		- afficher le texte en oblique si true, défaut=false (je vois pas bien la différence avec italique!)
bold		- afficher le texte en gras si true, défaut=false
angle		- angle de rotation du texte, défaut = 0 (horizontal)
colour		- table de couleur du texte, défaut = texte blanc uni {{1,0xFFFFFF,1}}
			  cette table contient une ou plusieurs table au format {P,C,A}
			  P=position pour un dégradé (0 = début du texte, 1= fin du texte)
			  C=couleur au format Hexadécimal (il y a plein de tables sur le net)
			  A=alpha (opacité) de la couleur (0=invisible,1=opacité 100%)
			  pour une couleur unie {{1,0x00FF00,0.5}}
			  pour un dégradé 2 couleurs {{0,0x00FF00,0.5},{1,0x000033,1}}
			  ou {{0.5,0x00FF00,1},{1,0x000033,1}} -avec celui ci le dégradé ne commensera qu'au milieu du texte
			  pour un dégradé 3 couleurs {{0,0x00FF00,0.5},{0.5,0x000033,1},{1,0x440033,1}}
			  et ainsi de suite


Necessite conky 1.8.0 
Pour appeler ce script dans Conky, dans la section avant-TEXT:
	lua_load /path/to/the/lua/script/text.lua
	lua_draw_hook_pre draw_text

]]
require 'cairo'

function conky_draw_text()
	text_settings={
		--DEBUT DES PARAMETRES
		{--afficher un texte aux coordonées 20,20
		text="texte normal",
		x=20,
		y=20,
		},

		{--afficher un texte aux coordonées 20,40, en définissant une police, 
		--une taille de police avec affichage en italique et en gras (bold)
		text="texte italique et gras",
		x=20,
		y=40,
		font_name="Verdana",
		font_size=18,
		italic=true,
		bold=true,
		},
		
		{--afficher un texte aux coordonées 20,60, en Verdana 18, en vert opacité 0,8
		--et en oblique
		text="texte en vert",
		x=20,
		y=60,
		font_name="Verdana",
		font_size=18,
		oblique=true,
		--la table couleur contient une ou plusieurs tables contenant 3 éléments, ici
		--1=position pour les dégradés (0= début de texte, 1=  fin de texte)
		--0x00FF00=couleur en hexadecimal 
		--0.8 = opacité (0=invisible, 1=opacité à 100%)
		colour={{1,0x00FF00,0.8}}
		},

		{--afficher un texte aux coordonées 20,80, avec un dégradé rouge, vert, bleu
		text="texte dégradé",
		x=20,
		y=80,
		colour={{0,0xFF0000,0.9},{0.5,0x00FF00,1},{1,0x0000FF,0.9}},
		},

		{--afficher un texte aux coordonées 20,150, avec un dégradé jaune, bleu, rouge
		--avec un angle de 30 degrés
		text="texte oblique",
		x=20,
		y=150,
		colour={{0,0xFFFF00,1},{0.5,0x0000FF,1},{1,0xFFFF00,1}},
		angle=-30,
		font_name="Ubuntu Titling",
		font_size=32
		},

		{--afficher un texte aux coordonées 20,60, avec un dégradé 5 couleurs vertical
		text="texte vertical",
		x=30,
		y=450,
		colour={{0	 ,0xFF0000,1},
				{0.25,0xFFFF00,1},
				{0.50,0x00FF00,1},
				{0.75,0x00FFFF,1},
				{1	 ,0x0000FF,1}
				},
		angle=-90,
		font_name="Ubuntu Titling",
		font_size=40
		},

		{--afficher un texte aux coordonées 20,60, avec un dégradé rouge, vert, bleu
		--avec des valeurs de conky :
		--utiliser 2 points à la suite pour la concaténation
		--utiliser conky_parse() pour récupérer une variable de conky
		text="texte avec du conky, cpu=" .. conky_parse("${cpu}") .. " %",
		x=10,
		y=200,
		colour={{0,0xFFFF00,0.8},{0.5,0xFF0000,1},{1,0xFFFF00,1}},
		font_name="Clarendon",
		font_size=16
		},
		
		{--table avec aucun paramètre, affichera "Conky is good for you !"
		},
		
	}
	
	
--------------FIN DES PARAMETERES----------------
	if conky_window == nil then return end
	if tonumber(conky_parse("$updates"))<3 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)
	
    for i,v in pairs(text_settings) do
        display_text(v)
	end
	
	cairo_destroy(cr)
	cairo_surface_destroy(cs)
end

function rgb_to_r_g_b(tcolour)
	colour,alpha=tcolour[2],tcolour[3]
	return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function display_text(t)
	if t.text==nil then t.text="Conky is good for you !" end
	if t.x==nil then t.x = conky_window.width/2 end
	if t.y==nil then t.y = conky_window.height/2 end
	if t.colour==nil then t.colour={{1,0xFFFFFF,1}} end
	if t.font_name==nil then t.font_name="Free Sans" end
	if t.font_size==nil then t.font_size=14 end
	if t.angle==nil then t.angle=0 end
	if t.italic==nil then t.italic=false end
	if t.oblique==nil then t.oblique=false end
	if t.bold==nil then t.bold=false end
	
	cairo_save(cr)
	cairo_translate(cr,t.x,t.y)
	cairo_rotate(cr,t.angle*math.pi/180)
	local slant = CAIRO_FONT_SLANT_NORMAL
	local weight =CAIRO_FONT_WEIGHT_NORMAL
	if t.italic then slant = CAIRO_FONT_SLANT_ITALIC end
	if t.oblique then slant = CAIRO_FONT_SLANT_OBLIQUE end
	if t.bold then weight = CAIRO_FONT_WEIGHT_BOLD end
	cairo_select_font_face(cr, t.font_name, slant,weight)
	cairo_set_font_size(cr,t.font_size)
	
	for i=1, #t.colour do	
		if #t.colour[i]~=3 then t.colour[i]={1,0xFFFFFF,1} end
	end
	if #t.colour==1 then 
		cairo_set_source_rgba(cr,rgb_to_r_g_b(t.colour[1]))
	else
		local te=cairo_text_extents_t:create()
		cairo_text_extents (cr,t.text,te)
		local pat = cairo_pattern_create_linear (0,0,te.width+te.x_bearing,0)
		for i=1, #t.colour do
			cairo_pattern_add_color_stop_rgba (pat, t.colour[i][1], rgb_to_r_g_b(t.colour[i]))
		end
		cairo_set_source (cr, pat)
		cairo_pattern_destroy(pat)
	end
	cairo_move_to(cr,0,0)
	cairo_show_text(cr,t.text)
	cairo_stroke(cr)
	cairo_restore(cr)
end

Le seul truc où il faut faire attention, c'est bien mettre les virgules après chaque élément et bien fermer les accolades (gedit met en surbrillance les accolades), voilà Happy Conkying

Dernière modification par wlourf (Le 10/06/2010, à 22:33)

Hors ligne

#2273 Le 07/06/2010, à 23:34

Leyna

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

Mais c'est parfait pour apprendre ça!
C'est peut-être simple, mais il y a des noobs qui sont preneurs.. suivez mon regard big_smile
MERCI wlourf smile

Hors ligne

#2274 Le 08/06/2010, à 06:08

chepioq

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

Merci wlourf, c'est un script très utile...
Je me posai une question, est ce qu'il ne serai pas possible de faire un sujet entièrement dédié au script lua, cela regrouperai tout les lua qui traine sur le sujet "Conky : Postez vos conkyrc ou certaines parties intéressantes", (et il commence à en avoir pas mal...)
Cela aurai l'avantage de faciliter une recherche...


Tout est dans tout et réciproquement....

Hors ligne

#2275 Le 08/06/2010, à 07:55

Fenouille84

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

En effet, assez utile ton script wlourf pour apprendre !!
Vive la simplicité wink

Je suis assez d'accord pour ouvrir un topic dédié aux scripts LUA.
Chepioq a raison, sa faciliterait grandement les recherches.


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

Hors ligne