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.

#451 Le 23/02/2014, à 18:44

ljere

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

ouah c'est clair c'est de l'art continu comme ça daniel38100 wink


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

#452 Le 24/02/2014, à 18:00

ragamatrix

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

Salut et BRAVO ! à tous pour vos compos et conky chargés wink
Daniel38100 tiens dis moi ce que tu penses de cette horloge... ça peut donner des idées, c'est le travail de easysid du forum Anglophone... wink
easysid

Hors ligne

#453 Le 25/02/2014, à 19:14

ragamatrix

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

Salut;
J'ai retrouvé un script graph.lua mais j'ai une petite erreur terminal au lancement :

Conky: llua_do_call: function conky_main execution failed: /home/raphix/.conky/monitoring.lua:285: bad argument #2 to 'max' (number expected, got nil)

graph.jpg
monitoring.lua:

 --[[ GRAPH widget v1.1 by wlourf (07.01.2011)
	this widget draws some graphs with some effects 
	http://u-scripts.blogspot.com/2010/10/graph-widget.html
	
To call the script in a conky, use, before TEXT
	lua_load /path/to/the/script/graph.lua
	lua_draw_hook_pre main_graph
and add one line (blank or not) after TEXT


Parameters are :
3 parameters are mandatory
name		- the name of the conky variable to display,
			  for example for {$cpu cpu0}, just write name="cpu"
arg			- the argument of the above variable,
			  for example for {$cpu cpu1}, just write arg="cpu1"
		  	  arg can be a numerical value if name=""
max			- the maximum value the above variable can reach,
			  for example for {$cpu cpu1}, just write max=100 or less or more
	
Optional parameters:
x,y 		- coordinates of the bottom-left corner of the graph,
              relative to the top-left corner of the conky window 
			  default =  bottom-left corner of the conky window
width       - width of the graph, default = 100 pixels
height      - height of the graph, default = 20 pixels
nb_values   - number of values to display in the graph, default=width 
              i.e. 1 pixel for 1 value
autoscale   - if set to true, calculate the max valeu of the y axis and
              doesn't use the max parameter above, default=false
skew_x      - skew graph around x axis, défaut = 0
skew_y      - skew graph around y axis, défaut = 0
angle	    - angle of rotation of the graph in degress, default = 0
              i.e. a horizontal graph)
inverse     - if set to true, graph are draw from right to left, default=false
background  - if set to false, background is not drawn, default=true
foreground  - if set to false, foreground is not drawn, default=true
              foreground = plain graph
bg_bd_size  - size of the border of the background, default=0=no border
fg_bd_size  - size of the border of the foreground, default=0=no border


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

bg_colour	- colour table for background,
			  default = {{0,0x000000,.5},{1,0xFFFFFF,.5}}
fg_colour	- colour table for foreground,
			  default = {{0,0x00FFFF,1},{1,0x0000FF,1}}
bg_bd_colour- colour table for background border,
			  default = {{1,0xFFFFFF,1}}			  
fg_bd_colour- colour table for foreground border,
			  default = {{1,0xFFFF00,1}}			  

bg_orientation, bg_bd_orientation, fg_orientation, fg_bd_orientation,
        	- "orientation" defines the starting point of the gradient,
        	  default="nn"
			  there are 8 available starting points : 
			  "nw","nn","ne","ee","se","ss","sw","ww"
			  (n for north, w for west ...)
			  theses 8 points are the 4 corners + the 4 middles of graph
			  so a gradient "nn" will go from "nn" to "ss"
			  a gradient "nw" will go from "nw" to "se"

draw_me     - if set to false, graph is not drawn (default = true)
              it can be used with a conky string, if the string returns 1, the graph is drawn :
              example : "${if_empty ${wireless_essid wlan0}}${else}1$endif",
              
v1.0 (31/10/2010) original release
v1.1 (07/01/2011) Add draw_me parameter and correct memory leaks, thanks to "Creamy Goodness"
                  text is parsed inside the function, not in the array of settings

--      This program is free software; you can redistribute it and/or modify
--      it under the terms of the GNU General Public License as published by
--      the Free Software Foundation version 3 (GPLv3)
--     
--      This program is distributed in the hope that it will be useful,
--      but WITHOUT ANY WARRANTY; without even the implied warranty of
--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--      GNU General Public License for more details.
--     
--      You should have received a copy of the GNU General Public License
--      along with this program; if not, write to the Free Software
--      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
--      MA 02110-1301, USA.		

]]


require 'cairo'


function set_settings()
	graph_settings={
	    
	   --[[background {
	    name="",
	    arg=0,
	    max=1,
	    x=0,
        y=38,
        width=1920,
        height=40,
        foreground=false,
        bg_colour=col_bg,
	    },]]----test

{
	    name="cpu",
	    arg="cpu1",
	    max=100,
        y=190,
        x=0,
        autoscale=true,
        width=1900,
        height=140,
        nb_values=500,
        background=false,
        fg_bd_size=1.5,
        foreground=false,
        --fg_colour={{0.5,0xFFAA00,1},{1,0x00AA00,1}},
        fg_bd_colour = { {0.5,0xBF3EFF,1},
                     {.75,0x00BFFF,1},
                     },
	    },
{
	    name="cpu",
	    arg="cpu2",
	    max=100,
        y=190,
        x=0,
        autoscale=true,
        width=1900,
        height=140,
        nb_values=500,
        --angle=180,
        --inverse=true,
        background=false,
        fg_bd_size=1.5,
        foreground=false,
        --fg_colour={{0.5,0xFF1A00,1},{1,0x01AA00,1}},
        fg_bd_colour = { {0.5,0xF0FFF0,1},
                     {.75,0xFFD700,1},
                     },
	    },
	    
    	--[[{
	    name="downspeedf",
	    arg="eth0",
	    max=100,
        y=190,
        x=0,
        autoscale=true,
        width=1900,
        height=140,
        nb_values=500,
        --angle=180,
        --inverse=true,
        background=false,
        fg_bd_size=1.5,
        foreground=false,
        --fg_colour={{0.5,0xFF1A00,1},{1,0x01AA00,1}},
        fg_bd_colour = { {0.5,0x008B00,1},
                     {.75,0x00EE00,1},
                     },
	    },
	    {
	    name="upspeedf",
	    arg="eth0",
	    max=100,
        y=190,
        x=0,
        autoscale=true,
        width=1900,
        height=140,
        nb_values=500,
        --angle=180,
        --inverse=true,
        background=false,
        fg_bd_size=1.5,
        foreground=false,
        --fg_colour={{0.5,0xFF1A00,1},{1,0x01AA00,1}},
        fg_bd_colour = { {0.5,0xA8A8A8,1},
                     {.75,0xCDC8B1,1},
                     },
	    },--]]     
    	   
    	    		    	    	          	        
       }
end

---END OF PARAMETERS ---

function check_settings(t)
    --tables are check only when conky start
	if t.name==nil and t.arg==nil then 
		print ("No input values ... use parameters 'name'" .. 
			" with 'arg' or only parameter 'arg' ") 
		return 1
	end

	if t.max==nil then
		print ("No maximum value defined, use 'max'")
		print ("for name=" .. t.name .. " with arg=" .. t.arg)
		return 1
	end
	if t.name==nil then t.name="" end
	if t.arg==nil then t.arg="" end
	return 0
end

function conky_main_graph()

    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)

    updates=tonumber(conky_parse('${updates}'))
    --start drawing after "updates_gap" updates
    --prevent segmentation error for cpu
    updates_gap=5
    if updates==1 then    
        set_settings()
	    
	    flagOK=0
		for i in pairs(graph_settings) do
			if graph_settings[i].width==nil then graph_settings[i].width=100 end
        	if graph_settings[i].nb_values==nil then  
        	    graph_settings[i].nb_values= graph_settings[i].width
        	end
			--create an empty table to store values
			graph_settings[i]["values"]={}
			--beginning point
			graph_settings[i].beg = graph_settings[i].nb_values
			--graph_settings[i].beg = 0
			for j =1, graph_settings[i].nb_values do
			    graph_settings[i].values[j]=0
			end
		    graph_settings[i].flag_init=true
		    flagOK=flagOK + check_settings(graph_settings[i])

		end
    end

    if flagOK>0 then 
        --abort script if error in one of the tables
        print ("ERROR : Check the graph_setting table")
        return
    end

    --drawing process
    if updates > updates_gap then
		for i in pairs(graph_settings) do
		    if graph_settings[i].draw_me==true then graph_settings[i].draw_me = nil end
			if (graph_settings[i].draw_me==nil or conky_parse(tostring(graph_settings[i].draw_me)) == "1") then 
			    local nb_values=graph_settings[i].nb_values
			    graph_settings[i].automax=0
			    for j =1, nb_values do
				    if graph_settings[i].values[j+1]==nil then 
				        graph_settings[i].values[j+1]=0 
				    end
				
				    graph_settings[i].values[j]=graph_settings[i].values[j+1]
				    if j==nb_values then
					    --store value
					    if graph_settings[i].name=="" then
					        value=graph_settings[i].arg
					    else
        					value=tonumber(conky_parse('${' .. 
        					    graph_settings[i].name .. " " ..
        					    graph_settings[i].arg ..'}'))
        			    end
					    graph_settings[i].values[nb_values]=value
				    end
				    graph_settings[i].automax=math.max(graph_settings[i].automax,
				                                       graph_settings[i].values[j])
			        --should stop weird glitches at beginning when no values reported yet for upspeed or diskio
                    if graph_settings[i].automax == 0 then graph_settings[i].automax = 1 end 
                end
   			    draw_graph(graph_settings[i])
		    end
		end
    end

    cairo_destroy(cr)
    cairo_surface_destroy(cs)
	updates=nil
	updates_gap=nil
end


function draw_graph(t)
    --drawing function

    local function rgb_to_r_g_b(colour)
        return ((colour[2] / 0x10000) % 0x100) / 255., ((colour[2] / 0x100) % 0x100) / 255., (colour[2] % 0x100) / 255., colour[3]
    end
 
	local function linear_orientation(o,w,h)
	    --set gradient for bg and bg border
	    local p
		if o=="nn" then
			p={w/2,h,w/2,0}
		elseif o=="ne" then
			p={w,h,0,0}
		elseif o=="ww" then
			p={0,h/2,w,h/2}
		elseif o=="se" then
			p={w,0,0,h}
		elseif o=="ss" then
			p={w/2,0,w/2,h}
		elseif o=="ee" then
			p={w,h/2,0,h/2}		
		elseif o=="sw" then
			p={0,0,w,h}
		elseif o=="nw" then
			p={0,h,w,0}
		end
		return p
	end

	local function linear_orientation_inv(o,w,h)
	    --set gradient for fg and fg border
	    local p
		if o=="ss" then
			p={w/2,h,w/2,0}
		elseif o=="sw" then
			p={w,h,0,0}
		elseif o=="ee" then
			p={0,h/2,w,h/2}
		elseif o=="nw" then
			p={w,0,0,h}
		elseif o=="nn" then
			p={w/2,0,w/2,h}
		elseif o=="ww" then
			p={w,h/2,0,h/2}		
		elseif o=="ne" then
			p={0,0,w,h}
		elseif o=="se" then
			p={0,h,w,0}
		end
		return p
	end


	--set default values
	
    --cancel drawing if not needed
	if t.draw_me~=nil and conky_parse(tostring(t.draw_me)) ~= "1" then 
		return
	end
	

	
	if t.height==nil	then t.height=20 end
	--checked in previous part : width and nb_values
		
	if t.background==nil    then t.background=true end
	if t.bg_bd_size==nil	then t.bg_bd_size=0 end
	if t.x==nil 		    then t.x=t.bg_bd_size end
	if t.y==nil 		    then t.y=conky_window.height -t.bg_bd_size end
	if t.bg_colour==nil 	then t.bg_colour={{0,0x000000,.5},{1,0xFFFFFF,.5}} end
	if t.bg_bd_colour==nil 	then t.bg_bd_colour={{1,0xFFFFFF,1}} end
	
	if t.foreground==nil    then t.foreground=true end
	if t.fg_colour==nil 	then t.fg_colour={{0,0x00FFFF,1},{1,0x0000FF,1}} end
	
	if t.fg_bd_size==nil	then t.fg_bd_size=0 end	
	if t.fg_bd_colour==nil  then t.fg_bd_colour={{1,0xFFFF00,1}} end
	
	if t.autoscale==nil     then t.autoscale=false end
	if t.inverse==nil       then t.inverse=false end
	if t.angle==nil         then t.angle=0 end
	
	if t.bg_bd_orientation==nil then t.bg_bd_orientation="nn" end
	if t.bg_orientation==nil then t.bg_orientation="nn" end
	if t.fg_bd_orientation==nil then t.fg_bd_orientation="nn" end
	if t.fg_orientation==nil then t.fg_orientation="nn" end

    --check colours tables
	for i=1, #t.fg_colour do    
        if #t.fg_colour[i]~=3 then 
        	print ("error in fg_colour table")
        	t.fg_colour[i]={1,0x0000FF,1} 
        end
    end
	
	for i=1, #t.fg_bd_colour do    
        if #t.fg_bd_colour[i]~=3 then 
        	print ("error in fg_bd_colour table")
        	t.fg_bd_colour[i]={1,0x00FF00,1} 
        end
    end
    
	for i=1, #t.bg_colour do    
        if #t.bg_colour[i]~=3 then 
        	print ("error in background color table")
        	t.bg_colour[i]={1,0xFFFFFF,0.5} 
        end
    end    

	for i=1, #t.bg_bd_colour do    
        if #t.bg_bd_colour[i]~=3 then 
        	print ("error in background border color table")
        	t.bg_bd_colour[i]={1,0xFFFFFF,1} 
        end
    end    

    --calculate skew parameters if needed
    if t.flag_init then
	    if t.skew_x == nil then 
		    t.skew_x=0 
	    else
		    t.skew_x = math.pi*t.skew_x/180	
	    end
	    if t.skew_y == nil then 
		    t.skew_y=0
	    else
		    t.skew_y = math.pi*t.skew_y/180	
	    end
	    t.flag_init=false
	end

    cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
    cairo_set_line_join(cr,CAIRO_LINE_JOIN_ROUND)

    local matrix0 = cairo_matrix_t:create()
    tolua.takeownership(matrix0)
    cairo_save(cr)
    cairo_matrix_init (matrix0, 1,t.skew_y,t.skew_x,1,0,0)
    cairo_transform(cr,matrix0)
    
   	local ratio=t.width/t.nb_values

	cairo_translate(cr,t.x,t.y)
	cairo_rotate(cr,t.angle*math.pi/180)
	cairo_scale(cr,1,-1)

	--background
	if t.background then
	    local pts=linear_orientation(t.bg_orientation,t.width,t.height)
		local pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
		for i=1, #t.bg_colour do
			--print ("i",i,t.colour[i][1], rgb_to_r_g_b(t.colour[i]))
		    cairo_pattern_add_color_stop_rgba (pat, t.bg_colour[i][1], rgb_to_r_g_b(t.bg_colour[i]))
		end
		cairo_set_source (cr, pat)
		cairo_rectangle(cr,0,0,t.width,t.height)	
		cairo_fill(cr)	
		cairo_pattern_destroy(pat)
	end
	
    --autoscale
    cairo_save(cr)
	if t.autoscale then
		t.max= t.automax*1.1
	end
	
    local scale_x = t.width/(t.nb_values-1)
	local scale_y = t.height/t.max
	
    --define first point of the graph
	if updates-updates_gap <t.nb_values then 
		t.beg = t.beg - 1
    	--next line prevent segmentation error when conky window is redraw 
		--quicly when another window "fly" over it
		if t.beg<0 then t.beg=0 end
	else
		t.beg=0
	end
    if t.inverse then cairo_scale(cr,-1,1)
    cairo_translate(cr,-t.width,0) end

	--graph foreground
	if t.foreground then
	    local pts_fg=linear_orientation_inv(t.fg_orientation,t.width,t.height)
	    local pat = cairo_pattern_create_linear (pts_fg[1],pts_fg[2],pts_fg[3],pts_fg[4])
		for i=1,#t.fg_colour,1 do
			cairo_pattern_add_color_stop_rgba (pat, 1-t.fg_colour[i][1], rgb_to_r_g_b(t.fg_colour[i]))
		end
		cairo_set_source (cr, pat)

		cairo_move_to(cr,t.beg*scale_x,0)
		cairo_line_to(cr,t.beg*scale_x,t.values[t.beg+1]*scale_y)
		for i=t.beg, t.nb_values-1 do
			cairo_line_to(cr,i*scale_x,t.values[i+1]*scale_y)		
		end
		cairo_line_to(cr,(t.nb_values-1)*scale_x,0)
		cairo_close_path(cr)
		cairo_fill(cr)
		cairo_pattern_destroy(pat)
	end

	--graph_border
	if t.fg_bd_size>0 then
    	local pts=linear_orientation_inv(t.fg_bd_orientation,t.width,t.height)
		local pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
		for i=1,#t.fg_bd_colour,1 do
			cairo_pattern_add_color_stop_rgba (pat, 1-t.fg_bd_colour[i][1], rgb_to_r_g_b(t.fg_bd_colour[i]))
		end
		cairo_set_source (cr, pat)
		cairo_move_to(cr,t.beg*scale_x,t.values[t.beg+1]*scale_y)
		for i=t.beg, t.nb_values-1 do
			cairo_line_to(cr,i*scale_x,t.values[i+1]*scale_y)		
		end
		cairo_set_line_width(cr,t.fg_bd_size)
		cairo_stroke(cr)
		cairo_pattern_destroy(pat)
	end
	cairo_restore(cr)

	--background border
	if t.bg_bd_size>0 then
    	local pts=linear_orientation(t.bg_bd_orientation,t.width,t.height)
		local pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
		for i=1, #t.bg_bd_colour do
			--print ("i",i,t.colour[i][1], rgb_to_r_g_b(t.colour[i]))
		    cairo_pattern_add_color_stop_rgba (pat, t.bg_bd_colour[i][1], rgb_to_r_g_b(t.bg_bd_colour[i]))
		end
		cairo_set_source (cr, pat)
		cairo_rectangle(cr,0,0,t.width,t.height)	
		cairo_set_line_width(cr,t.bg_bd_size)
		cairo_stroke(cr)
		cairo_pattern_destroy(pat)	
	end	

	cairo_restore(cr)

end

Dernière modification par ragamatrix (Le 25/02/2014, à 19:16)

Hors ligne

#454 Le 25/02/2014, à 21:28

Didier-T

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

Bonsoir ragamatrix,
sur le premier cycle d'interrogation conky ne renvoie pas de données, d'où ce message d'erreur.

j'ai effectué une petite modification qui doit régler le problème

 --[[ GRAPH widget v1.1 by wlourf (07.01.2011)
        this widget draws some graphs with some effects
        http://u-scripts.blogspot.com/2010/10/graph-widget.html

To call the script in a conky, use, before TEXT
        lua_load /path/to/the/script/graph.lua
        lua_draw_hook_pre main_graph
and add one line (blank or not) after TEXT


Parameters are :
3 parameters are mandatory
name            - the name of the conky variable to display,
                          for example for {$cpu cpu0}, just write name="cpu"
arg                     - the argument of the above variable,
                          for example for {$cpu cpu1}, just write arg="cpu1"
                          arg can be a numerical value if name=""
max                     - the maximum value the above variable can reach,
                          for example for {$cpu cpu1}, just write max=100 or less or more

Optional parameters:
x,y             - coordinates of the bottom-left corner of the graph,
              relative to the top-left corner of the conky window
                          default =  bottom-left corner of the conky window
width       - width of the graph, default = 100 pixels
height      - height of the graph, default = 20 pixels
nb_values   - number of values to display in the graph, default=width
              i.e. 1 pixel for 1 value
autoscale   - if set to true, calculate the max valeu of the y axis and
              doesn't use the max parameter above, default=false
skew_x      - skew graph around x axis, défaut = 0
skew_y      - skew graph around y axis, défaut = 0
angle       - angle of rotation of the graph in degress, default = 0
              i.e. a horizontal graph)
inverse     - if set to true, graph are draw from right to left, default=false
background  - if set to false, background is not drawn, default=true
foreground  - if set to false, foreground is not drawn, default=true
              foreground = plain graph
bg_bd_size  - size of the border of the background, default=0=no border
fg_bd_size  - size of the border of the foreground, default=0=no border


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

bg_colour       - colour table for background,
                          default = {{0,0x000000,.5},{1,0xFFFFFF,.5}}
fg_colour       - colour table for foreground,
                          default = {{0,0x00FFFF,1},{1,0x0000FF,1}}
bg_bd_colour- colour table for background border,
                          default = {{1,0xFFFFFF,1}}
fg_bd_colour- colour table for foreground border,
                          default = {{1,0xFFFF00,1}}

bg_orientation, bg_bd_orientation, fg_orientation, fg_bd_orientation,
                - "orientation" defines the starting point of the gradient,
                  default="nn"
                          there are 8 available starting points :
                          "nw","nn","ne","ee","se","ss","sw","ww"
                          (n for north, w for west ...)
                          theses 8 points are the 4 corners + the 4 middles of graph
                          so a gradient "nn" will go from "nn" to "ss"
                          a gradient "nw" will go from "nw" to "se"

draw_me     - if set to false, graph is not drawn (default = true)
              it can be used with a conky string, if the string returns 1, the graph is drawn :
              example : "${if_empty ${wireless_essid wlan0}}${else}1$endif",

v1.0 (31/10/2010) original release
v1.1 (07/01/2011) Add draw_me parameter and correct memory leaks, thanks to "Creamy Goodness"
                  text is parsed inside the function, not in the array of settings

--      This program is free software; you can redistribute it and/or modify
--      it under the terms of the GNU General Public License as published by
--      the Free Software Foundation version 3 (GPLv3)
--
--      This program is distributed in the hope that it will be useful,
--      but WITHOUT ANY WARRANTY; without even the implied warranty of
--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--      GNU General Public License for more details.
--
--      You should have received a copy of the GNU General Public License
--      along with this program; if not, write to the Free Software
--      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
--      MA 02110-1301, USA.

]]


require 'cairo'


function set_settings()
        graph_settings={

           --[[background {
            name="",
            arg=0,
            max=1,
            x=0,
        y=38,
        width=1920,
        height=40,
        foreground=false,
        bg_colour=col_bg,
            },]]----test

{
            name="cpu",
            arg="cpu1",
            max=100,
        y=190,
        x=0,
        autoscale=true,
        width=1900,
        height=140,
        nb_values=500,
        background=false,
        fg_bd_size=1.5,
        foreground=false,
        --fg_colour={{0.5,0xFFAA00,1},{1,0x00AA00,1}},
        fg_bd_colour = { {0.5,0xBF3EFF,1},
                     {.75,0x00BFFF,1},
                     },
            },
{
            name="cpu",
            arg="cpu2",
            max=100,
        y=190,
        x=0,
        autoscale=true,
        width=1900,
        height=140,
        nb_values=500,
        --angle=180,
        --inverse=true,
        background=false,
        fg_bd_size=1.5,
        foreground=false,
        --fg_colour={{0.5,0xFF1A00,1},{1,0x01AA00,1}},
        fg_bd_colour = { {0.5,0xF0FFF0,1},
                     {.75,0xFFD700,1},
                     },
            },

        --[[{
            name="downspeedf",
            arg="eth0",
            max=100,
        y=190,
        x=0,
        autoscale=true,
        width=1900,
        height=140,
        nb_values=500,
        --angle=180,
        --inverse=true,
        background=false,
        fg_bd_size=1.5,
        foreground=false,
        --fg_colour={{0.5,0xFF1A00,1},{1,0x01AA00,1}},
        fg_bd_colour = { {0.5,0x008B00,1},
                     {.75,0x00EE00,1},
                     },
            },
            {
            name="upspeedf",
            arg="eth0",
            max=100,
        y=190,
        x=0,
        autoscale=true,
        width=1900,
        height=140,
        nb_values=500,
        --angle=180,
        --inverse=true,
        background=false,
        fg_bd_size=1.5,
        foreground=false,
        --fg_colour={{0.5,0xFF1A00,1},{1,0x01AA00,1}},
        fg_bd_colour = { {0.5,0xA8A8A8,1},
                     {.75,0xCDC8B1,1},
                     },
            },--]]


       }
end

---END OF PARAMETERS ---

function check_settings(t)
    --tables are check only when conky start
        if t.name==nil and t.arg==nil then
                print ("No input values ... use parameters 'name'" ..
                        " with 'arg' or only parameter 'arg' ")
                return 1
        end

        if t.max==nil then
                print ("No maximum value defined, use 'max'")
                print ("for name=" .. t.name .. " with arg=" .. t.arg)
                return 1
        end
        if t.name==nil then t.name="" end
        if t.arg==nil then t.arg="" end
        return 0
end

function conky_main_graph()

    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)

    updates=tonumber(conky_parse('${updates}'))
    --start drawing after "updates_gap" updates
    --prevent segmentation error for cpu
    updates_gap=5
    if updates==1 then
        set_settings()

            flagOK=0
                for i in pairs(graph_settings) do
                        if graph_settings[i].width==nil then graph_settings[i].width=100 end
                if graph_settings[i].nb_values==nil then
                    graph_settings[i].nb_values= graph_settings[i].width
                end
                        --create an empty table to store values
                        graph_settings[i]["values"]={}
                        --beginning point
                        graph_settings[i].beg = graph_settings[i].nb_values
                        --graph_settings[i].beg = 0
                        for j =1, graph_settings[i].nb_values do
                            graph_settings[i].values[j]=0
                        end
                    graph_settings[i].flag_init=true
                    flagOK=flagOK + check_settings(graph_settings[i])

                end
    end

    if flagOK>0 then
        --abort script if error in one of the tables
        print ("ERROR : Check the graph_setting table")
        return
    end

    --drawing process
    if updates > updates_gap then
                for i in pairs(graph_settings) do
                    if graph_settings[i].draw_me==true then graph_settings[i].draw_me = nil end
                        if (graph_settings[i].draw_me==nil or conky_parse(tostring(graph_settings[i].draw_me)) == "1") then
                            local nb_values=graph_settings[i].nb_values
                            graph_settings[i].automax=0
                            for j =1, nb_values do
                                    if graph_settings[i].values[j+1]==nil then
                                        graph_settings[i].values[j+1]=0
                                    end

                                    graph_settings[i].values[j]=graph_settings[i].values[j+1]
                                    if j==nb_values then
                                            --store value
                                            if graph_settings[i].name=="" then
                                                value=graph_settings[i].arg
                                            else
                                                value=tonumber(conky_parse('${' ..
                                                    graph_settings[i].name .. " " ..
                                                    graph_settings[i].arg ..'}'))
                                    end
                                        if value==nil then
                                            graph_settings[i].values[nb_values]=0
                                        else
                                            graph_settings[i].values[nb_values]=value
                                        end
                                    end
                                    graph_settings[i].automax=math.max(graph_settings[i].automax,
                                                                       graph_settings[i].values[j])
                                --should stop weird glitches at beginning when no values reported yet for upspeed or diskio
                    if graph_settings[i].automax == 0 then graph_settings[i].automax = 1 end
                end
                            draw_graph(graph_settings[i])
                    end
                end
    end

    cairo_destroy(cr)
    cairo_surface_destroy(cs)
        updates=nil
        updates_gap=nil
end


function draw_graph(t)
    --drawing function

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

        local function linear_orientation(o,w,h)
            --set gradient for bg and bg border
            local p
                if o=="nn" then
                        p={w/2,h,w/2,0}
                elseif o=="ne" then
                        p={w,h,0,0}
                elseif o=="ww" then
                        p={0,h/2,w,h/2}
                elseif o=="se" then
                        p={w,0,0,h}
                elseif o=="ss" then
                        p={w/2,0,w/2,h}
                elseif o=="ee" then
                        p={w,h/2,0,h/2}
                elseif o=="sw" then
                        p={0,0,w,h}
                elseif o=="nw" then
                        p={0,h,w,0}
                end
                return p
        end

        local function linear_orientation_inv(o,w,h)
            --set gradient for fg and fg border
            local p
                if o=="ss" then
                        p={w/2,h,w/2,0}
                elseif o=="sw" then
                        p={w,h,0,0}
                elseif o=="ee" then
                        p={0,h/2,w,h/2}
                elseif o=="nw" then
                        p={w,0,0,h}
                elseif o=="nn" then
                        p={w/2,0,w/2,h}
                elseif o=="ww" then
                        p={w,h/2,0,h/2}
                elseif o=="ne" then
                        p={0,0,w,h}
                elseif o=="se" then
                        p={0,h,w,0}
                end
                return p
        end


        --set default values

    --cancel drawing if not needed
        if t.draw_me~=nil and conky_parse(tostring(t.draw_me)) ~= "1" then
                return
        end



        if t.height==nil        then t.height=20 end
        --checked in previous part : width and nb_values

        if t.background==nil    then t.background=true end
        if t.bg_bd_size==nil    then t.bg_bd_size=0 end
        if t.x==nil                 then t.x=t.bg_bd_size end
        if t.y==nil                 then t.y=conky_window.height -t.bg_bd_size end
        if t.bg_colour==nil     then t.bg_colour={{0,0x000000,.5},{1,0xFFFFFF,.5}} end
        if t.bg_bd_colour==nil  then t.bg_bd_colour={{1,0xFFFFFF,1}} end

        if t.foreground==nil    then t.foreground=true end
        if t.fg_colour==nil     then t.fg_colour={{0,0x00FFFF,1},{1,0x0000FF,1}} end

        if t.fg_bd_size==nil    then t.fg_bd_size=0 end
        if t.fg_bd_colour==nil  then t.fg_bd_colour={{1,0xFFFF00,1}} end

        if t.autoscale==nil     then t.autoscale=false end
        if t.inverse==nil       then t.inverse=false end
        if t.angle==nil         then t.angle=0 end

        if t.bg_bd_orientation==nil then t.bg_bd_orientation="nn" end
        if t.bg_orientation==nil then t.bg_orientation="nn" end
        if t.fg_bd_orientation==nil then t.fg_bd_orientation="nn" end
        if t.fg_orientation==nil then t.fg_orientation="nn" end

    --check colours tables
        for i=1, #t.fg_colour do
        if #t.fg_colour[i]~=3 then
                print ("error in fg_colour table")
                t.fg_colour[i]={1,0x0000FF,1}
        end
    end

        for i=1, #t.fg_bd_colour do
        if #t.fg_bd_colour[i]~=3 then
                print ("error in fg_bd_colour table")
                t.fg_bd_colour[i]={1,0x00FF00,1}
        end
    end

        for i=1, #t.bg_colour do
        if #t.bg_colour[i]~=3 then
                print ("error in background color table")
                t.bg_colour[i]={1,0xFFFFFF,0.5}
        end
    end

        for i=1, #t.bg_bd_colour do
        if #t.bg_bd_colour[i]~=3 then
                print ("error in background border color table")
                t.bg_bd_colour[i]={1,0xFFFFFF,1}
        end
    end

    --calculate skew parameters if needed
    if t.flag_init then
            if t.skew_x == nil then
                    t.skew_x=0
            else
                    t.skew_x = math.pi*t.skew_x/180
            end
            if t.skew_y == nil then
                    t.skew_y=0
            else
                    t.skew_y = math.pi*t.skew_y/180
            end
            t.flag_init=false
        end

    cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
    cairo_set_line_join(cr,CAIRO_LINE_JOIN_ROUND)

    local matrix0 = cairo_matrix_t:create()
    tolua.takeownership(matrix0)
    cairo_save(cr)
    cairo_matrix_init (matrix0, 1,t.skew_y,t.skew_x,1,0,0)
    cairo_transform(cr,matrix0)

        local ratio=t.width/t.nb_values

        cairo_translate(cr,t.x,t.y)
        cairo_rotate(cr,t.angle*math.pi/180)
        cairo_scale(cr,1,-1)

        --background
        if t.background then
            local pts=linear_orientation(t.bg_orientation,t.width,t.height)
                local pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
                for i=1, #t.bg_colour do
                        --print ("i",i,t.colour[i][1], rgb_to_r_g_b(t.colour[i]))
                    cairo_pattern_add_color_stop_rgba (pat, t.bg_colour[i][1], rgb_to_r_g_b(t.bg_colour[i]))
                end
                cairo_set_source (cr, pat)
                cairo_rectangle(cr,0,0,t.width,t.height)
                cairo_fill(cr)
                cairo_pattern_destroy(pat)
        end

    --autoscale
    cairo_save(cr)
        if t.autoscale then
                t.max= t.automax*1.1
        end

    local scale_x = t.width/(t.nb_values-1)
        local scale_y = t.height/t.max

    --define first point of the graph
        if updates-updates_gap <t.nb_values then
                t.beg = t.beg - 1
        --next line prevent segmentation error when conky window is redraw
                --quicly when another window "fly" over it
                if t.beg<0 then t.beg=0 end
        else
                t.beg=0
        end
    if t.inverse then cairo_scale(cr,-1,1)
    cairo_translate(cr,-t.width,0) end

        --graph foreground
        if t.foreground then
            local pts_fg=linear_orientation_inv(t.fg_orientation,t.width,t.height)
            local pat = cairo_pattern_create_linear (pts_fg[1],pts_fg[2],pts_fg[3],pts_fg[4])
                for i=1,#t.fg_colour,1 do
                        cairo_pattern_add_color_stop_rgba (pat, 1-t.fg_colour[i][1], rgb_to_r_g_b(t.fg_colour[i]))
                end
                cairo_set_source (cr, pat)

                cairo_move_to(cr,t.beg*scale_x,0)
                cairo_line_to(cr,t.beg*scale_x,t.values[t.beg+1]*scale_y)
                for i=t.beg, t.nb_values-1 do
                        cairo_line_to(cr,i*scale_x,t.values[i+1]*scale_y)
                end
                cairo_line_to(cr,(t.nb_values-1)*scale_x,0)
                cairo_close_path(cr)
                cairo_fill(cr)
                cairo_pattern_destroy(pat)
        end

        --graph_border
        if t.fg_bd_size>0 then
        local pts=linear_orientation_inv(t.fg_bd_orientation,t.width,t.height)
                local pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
                for i=1,#t.fg_bd_colour,1 do
                        cairo_pattern_add_color_stop_rgba (pat, 1-t.fg_bd_colour[i][1], rgb_to_r_g_b(t.fg_bd_colour[i]))
                end
                cairo_set_source (cr, pat)
                cairo_move_to(cr,t.beg*scale_x,t.values[t.beg+1]*scale_y)
                for i=t.beg, t.nb_values-1 do
                        cairo_line_to(cr,i*scale_x,t.values[i+1]*scale_y)
                end
                cairo_set_line_width(cr,t.fg_bd_size)
                cairo_stroke(cr)
                cairo_pattern_destroy(pat)
        end
        cairo_restore(cr)

        --background border
        if t.bg_bd_size>0 then
        local pts=linear_orientation(t.bg_bd_orientation,t.width,t.height)
                local pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
                for i=1, #t.bg_bd_colour do
                        --print ("i",i,t.colour[i][1], rgb_to_r_g_b(t.colour[i]))
                    cairo_pattern_add_color_stop_rgba (pat, t.bg_bd_colour[i][1], rgb_to_r_g_b(t.bg_bd_colour[i]))
                end
                cairo_set_source (cr, pat)
                cairo_rectangle(cr,0,0,t.width,t.height)
                cairo_set_line_width(cr,t.bg_bd_size)
                cairo_stroke(cr)
                cairo_pattern_destroy(pat)
        end

        cairo_restore(cr)

end

Hors ligne

#455 Le 26/02/2014, à 09:16

ragamatrix

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

Merci Didier-T plus d'erreur wink

Hors ligne

#456 Le 26/02/2014, à 16:03

daniel38100

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

ragamatrix a écrit :

Salut et BRAVO ! à tous pour vos compos et conky chargés wink
Daniel38100 tiens dis moi ce que tu penses de cette horloge... ça peut donner des idées, c'est le travail de easysid du forum Anglophone... wink
easysid

bien vu ragamatrix j'aime bien celui en timbre l'horloge n'est pas mal non plus je vais peut-être m'en inspire

@Didier-T
sur mon horloge j'ai un point pour les seconde mais j'aimerai qu'il reste allumer tant que la minute n'est pas passer pourrai tu m'aider STP

voici ton chronographe quelque peut modifier

--[[ multiple analogue clocks by Didier-T (forum Ubuntu.fr) - 25 Nov 2012
 Basé sur le travail de mrpeachy et Sector11
26 Nov 2012 - ajout hand_gap et hand_larg Didier-T
01 Dec 2012 - correction bug nb_jour Décembre Didier-T
02 Dec 2012 - ajout mode 24 heures Didier-T


use in conkyrc

lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT

]]

require 'cairo'
--Position et taille horloge
local init={

  {text={"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""},
  nb=3600,
  formule='minute',
  police="monofur",
  taille=20,
  text_color=0xFFFFFF,
  text_alpha=1,
  text_color_current=0xF00000,
  text_alpha_current=1,
  point_color=0xFFFFFF,
  point_alpha=1,
  point_color_current=0xff0000,
  point_alpha_current=1,
  hand_color=0x189e26,
  hand_alpha=0.7,
  center_x=540,
  center_y=525,
  text_radius=170,
  point_radius=510,
  point_ray=15,
  hand_gap=1000,
  hand_larg=8,
  hand_length=1000
  },
  {text={"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"},
  nb=60,
  formule='secondes',
  police="cmr10",
  taille=15,
  text_color=0xFFFFFF,
  text_alpha=1,
  text_color_current=0xFFFFFF,
  text_alpha_current=1,
  point_color=0xFFFFFF,
  point_alpha=1,
  point_color_current=0xFF0000,
  point_alpha_current=1,
  hand_color=0xFF0000,
  hand_alpha=0.4,
  center_x=540,
  center_y=525,
  text_radius=512,
  point_radius=500,
  point_ray=0.5,
  hand_gap=0,
  hand_larg=0,
  hand_length=0
  },
}

function conky_main()
  
  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 extents=cairo_text_extents_t:create()
  tolua.takeownership(extents)
  local h, min, sec=time()
  local jour, jour_num, mois, nb_jour=date()

  if tonumber(conky_parse('${updates}'))>3 then
    for i in pairs(init) do
      draw(cr, extents, init[i], h, min, sec, jour, jour_num, mois, nb_jour)
    end
  end

  cairo_destroy(cr)
  cairo_surface_destroy(cs)
  cr=nil
  collectgarbage()
end

function draw(cr, extents, value, h, min, sec, jour, jour_num, mois, nb_jour)
  local pos
  local nb=tonumber(table.getn(value.text))
  cairo_select_font_face (cr, value.police, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
  cairo_set_font_size (cr, value.taille)
-- Section Horloge
  if value.formule=="heure" then
    local text
    nb=value.nb/3600
    if nb==24 then h=tonumber(os.date("%H")) end
    pos=heure(h, min, sec)
    for i=1, nb do
      local j=i-1
      if value.hour_24==true then
        if tonumber(os.date("%H"))<nb then
          text=value.text[i]
        else
          text=value.text[i+12]
        end
      else
        text=value.text[i]
      end
      if j==h then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="minute" then 
    pos=minute(min, sec)
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if j==min then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="secondes" then
    pos=sec
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if j==sec then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
-- Section date
  elseif value.formule=="mois" then
    value.nb, pos=month()
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if i==mois then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="jour_num" then
    value.nb=nb_jour*24
    nb=nb_jour
    pos=day(jour-1)
    for i=1, nb_jour do
      if math.mod(i, 2) == 0 then
        text=string.format("%02d",i)
      else
        text=""
      end
      local j=i-1
      if i==jour then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="jour" then
    pos=(jour_num*24)+tonumber(os.date("%H"))
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if i==jour_num+1 then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
    
-- Horloge avec personnalisée (non utilisé pour le moment)  
  else
    pos=tonumber(conky_parse(value.formule))
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if tonumber(text)==pos then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, i, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, i, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, i, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, i, cr, value.point_ray)
      end
    end
  end

  hand(pos, value.nb, value.text_radius, value.hand_length, value.hand_gap, value.hand_larg, value.center_x, value.center_y, value.hand_color, value.hand_alpha, cr)
end

function date()
  local nb_jour
  local jour=tonumber(os.date("%d"))
  local jour_num=tonumber(os.date("%w"))
  local mois=tonumber(os.date("%m"))
  if mois==12 then
    nb_jour=31
  else
    nb_jour=tonumber(conky_parse("${exec date --date '1 month' +%j}"))-tonumber(conky_parse("${exec date +%j}"))
  end
  return jour, jour_num, mois, nb_jour
end

function day(jour)
  local hjour=(jour*24)+tonumber(os.date("%H"))
  return hjour
end

function month()
  local nb_jours_annee=tonumber(conky_parse("${exec echo $(date --date '31 Dec' +%j)}"))
  local jour_annee=tonumber(conky_parse("${exec echo $(date +%j)}"))
  return nb_jours_annee, jour_annee
end

function time()
  local h=tonumber(os.date("%I"))
  local min=tonumber(os.date("%M"))
  local sec=tonumber(os.date("%S"))
  return h, min, sec
end

function heure(h, min, sec)
  local hs=(h*3600)+(min*60)+sec
  return hs
end

function minute(min, sec)
  local m=(min*60)+sec
  return m
end

function rgb_to_r_g_b(col,alp)
  return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end

function texte(police, taille, text, nb, radius, center_x, center_y, color, alpha, i, extents, cr)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(i))
  local x=0+radius*(math.sin(point))
  local y=0-radius*(math.cos(point))
  cairo_text_extents(cr,text,extents)
  local width=extents.width
  local height=extents.height
  cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
  cairo_show_text (cr, text)
  cairo_stroke (cr)
end

function point(nb, radius, center_x, center_y, color, alpha, i, cr, ray)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(i))
  local x=0+radius*(math.sin(point))
  local y=0-radius*(math.cos(point))
  cairo_arc (cr,center_x+x,center_y+y,ray,0,2*math.pi)
  cairo_stroke (cr)
end

function hand(pos, nb, radius, hand_length, hand_gap, largeur, center_x, center_y, color, alpha, cr)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(pos))
  local x_gap=0+hand_gap*(math.sin(point))
  local y_gap=0-hand_gap*(math.cos(point))
  local x=0+hand_length*(math.sin(point))
  local y=0-hand_length*(math.cos(point))
  cairo_move_to (cr,center_x+x_gap,center_y+y_gap)
  cairo_line_to (cr,center_x+x,center_y+y)
  cairo_set_line_width (cr,largeur)
  cairo_set_line_cap  (cr, CAIRO_LINE_CAP_ROUND)
  cairo_stroke (cr)
end

Dernière modification par daniel38100 (Le 26/02/2014, à 16:26)

Hors ligne

#457 Le 27/02/2014, à 18:13

loutch

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

smilies%20(204).gif

Voila j'ai besoin d'un peu d'aide pour modifier un calendrier en lua .C'est ce  calendrier lua et j'ai réussi à rajouter un cercle pour les mois mais à la place de mettre le nom des mois il me met les chiffres de 1 à 12. Une image vaut mieux qu'un long discourt

1393520798.png

voici la partie du lua que j'ai modifié (c'est celui  la partie Mois ) :

function draw_function(cr)
  local w,h=conky_window.width,conky_window.height	
  --cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND)
  cairo_set_line_width(cr, 3)
  cairo_set_font_size(cr,12)
  cairo_select_font_face (cr, "URW Chancery L", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
  
-- Number of weeks per year --- 
  create_circle(cr,w,h, 52.0, 2, 3.5, 165, 3, CAIRO_OPERATOR_OVER, 6, tonumber(conky_parse('${exec date +%V}')), '')
  
-- Number of days in a month ---
  create_circle(cr,w,h, conky_parse('${exec cal |egrep -v [a-z] |wc -w}'), 2, 3.5, 120, 13,CAIRO_OPERATOR_CLEAR, -3.5,tonumber(conky_parse('${exec date +%d}')), '')
  
--- Days ---
-- function create_circle(cr,w,h, elements, distance_between_blocks, two_number_degree, radius, line_width, operator, radius_shift_for_text, current, days, shift_days_distance)
 
  local days = {"Lun", "Mar", "Mer","Jeu", "Ven", "Sam", "Dim"}
  create_circle(cr,w,h, 7, 2, 3.5, 100, 14, CAIRO_OPERATOR_CLEAR, -4, tonumber(conky_parse('${exec date +%u}')), days, 8.5)
  
--- Mois ---
  local months = {"Jan", "Fév", "Mar","Avr", "Mai", "Jui", "Juil","Aou","Sept","Oct","Nov","déc",}
  create_circle(cr,w,h, 12, 2, 3.5, 140, 14, CAIRO_OPERATOR_CLEAR, -4, tonumber(conky_parse('${exec date +%m}')), '')
  
--- Clock ---
  cairo_set_font_size(cr,42)
  cairo_move_to(cr, w/2-45,h/2)
  cairo_show_text(cr,conky_parse('${exec date +%H}') .. ":" .. conky_parse('${exec date +%M}'))
  cairo_set_font_size(cr,20)
  cairo_move_to(cr, w/2-24,h/2+30)
  cairo_show_text(cr, conky_parse('${exec date +%B}'))
  

Merci d'avance et

smilies%20(1).gif

Dernière modification par loutch (Le 27/02/2014, à 18:14)

Hors ligne

#458 Le 27/02/2014, à 19:09

Didier-T

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

Bonjour loutch,
ça aurait été plus simple avec le script entier, mais j'ai l'impression qu'il faut faire appel au tableau quand on ne veut pas utiliser les chiffres (un peu comme pour le jour).
donc cette ligne

create_circle(cr,w,h, 12, 2, 3.5, 140, 14, CAIRO_OPERATOR_CLEAR, -4, tonumber(conky_parse('${exec date +%m}')), '')

devrait ressembler à ceci

create_circle(cr,w,h, 12, 2, 3.5, 140, 14, CAIRO_OPERATOR_CLEAR, -4, tonumber(conky_parse('${exec date +%m}')), months, x.x)

le x.x étant à remplacer par une distance ??? (enfin tu verras en faisant les essais)

Hors ligne

#459 Le 27/02/2014, à 19:50

loutch

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

RE

Voici le lua en entier et désolé mais le rajout ne fonctionne pas  le lua ne se lance pas .



-- 2014-02-24 by eXpander


---------------- USER CONFIGURATION ----------------
-- Set your number of physical cores to show temperatures of each.
number_of_physical_CPU_cores = 0      

-- Do you want to show your graphic card temperature? (Yes/No). If you set Yes, you should know how to
-- output your temperature. For example;
-- nvidia-smi | grep 'NVS' -A 1 | tail -n 1 | awk '{print $3}' | cut -b1,2
-- Change line 266 to yours to output graphic card temperature.
enable_graphic_card_temperature_sensor= "no" 

-- You GPU model.			    

-- Colors
HTML_colors = "#000000"
HTML_colors_current = "FFFFFF"
transparency = 0.65 -- From 0 to 1
























































require 'cairo'

function hex2rgb(hex)
  hex = hex:gsub("#","")
  return tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6))
end

r,g,b = hex2rgb(HTML_colors)
r_c,g_c,b_c = hex2rgb(HTML_colors_current)

r = r/255
g = g/255
b = b/255

r_c = r_c/255
g_c = g_c/255
b_c = b_c/255

if enable_graphic_card_temperature_sensor == "Yes" then
  number_of_physical_CPU_cores = number_of_physical_CPU_cores + 1
end


function create_circle_hdd(cr,w,h,elements,distance_between_blocks, radius, line_width, current)
  cairo_set_line_width(cr, line_width)
  cairo_set_source_rgba(cr, r,g,b,transparency)
  cairo_new_path(cr)
  local number_of_arcs = (360 - (elements*distance_between_blocks)) / elements
  local start_angel = 270
  local percent_per_element = 100.0 / elements
  local charged_elements = current / percent_per_element
  
  for i=1, elements do
    if charged_elements >= i then
      cairo_set_source_rgba(cr, r_c,g_c,b_c,transparency)
    end
    cairo_arc(cr, w,h,radius,start_angel*math.pi/180,(start_angel+number_of_arcs)*math.pi/180)
    cairo_stroke(cr)
    start_angel = start_angel+number_of_arcs+distance_between_blocks
    cairo_set_source_rgba(cr, r,g,b,transparency)
  end   
end
function create_circle(cr,w,h, elements, distance_between_blocks, two_number_degree, radius, line_width, operator, radius_shift_for_text, current, days, shift_days_distance)
  cairo_set_line_width(cr, line_width)
  cairo_set_source_rgba(cr, r,g,b,transparency)
  cairo_new_path(cr)
  local number_of_arcs = (360 - (elements*distance_between_blocks)) / elements
  local start_angel = 271
  
  for i=1, elements do
    if i == current then
      cairo_set_source_rgba(cr, r_c,g_c,b_c,transparency)
    end
    cairo_arc(cr, w/2, h/2, radius, start_angel*math.pi/180, (start_angel+number_of_arcs)*math.pi/180)
    cairo_stroke(cr)
    start_angel = start_angel+number_of_arcs+distance_between_blocks
    cairo_set_source_rgba(cr, r,g,b,transparency)
  end 
  
  start_angel = 271
  cairo_set_operator(cr, operator)
  
  for i=1, elements do
    if i == current then
      cairo_set_source_rgba(cr, r_c,g_c,b_c,transparency)
    end
    if string.len(tostring(i)) == 2 and elements ~= 7 then
      cairo_move_to(cr,w/2+((radius+radius_shift_for_text)*math.cos((start_angel+(((number_of_arcs-two_number_degree)/2)))*(math.pi/180.0))),h/2+((radius+radius_shift_for_text)*math.sin((start_angel+(((number_of_arcs-two_number_degree)/2)))*(math.pi/180.0))))
      cairo_rotate(cr, (((number_of_arcs-two_number_degree)/2)+(number_of_arcs+distance_between_blocks)*(i-1))*math.pi/180.0)
      cairo_show_text(cr,tostring(i))
      cairo_rotate(cr,-(((number_of_arcs-two_number_degree)/2)+(number_of_arcs+distance_between_blocks)*(i-1))*math.pi/180.0)
    elseif elements == 7 then
      cairo_move_to(cr,w/2+((radius+radius_shift_for_text)*math.cos((start_angel+((math.abs((number_of_arcs-shift_days_distance))/2)))*(math.pi/180.0))),h/2+((radius+radius_shift_for_text)*math.sin((start_angel+((math.abs((number_of_arcs-shift_days_distance))/2)))*(math.pi/180.0))))
      cairo_rotate(cr, ((math.abs((number_of_arcs-shift_days_distance))/2)+(number_of_arcs+distance_between_blocks)*(i-1)+4)*math.pi/180.0)
      cairo_show_text(cr,days[i])
      cairo_rotate(cr,-((math.abs((number_of_arcs-shift_days_distance))/2)+(number_of_arcs+distance_between_blocks)*(i-1)+4)*math.pi/180.0)      
    elseif string.len(tostring(i)) == 1 and elements ~= 7 then
      cairo_move_to(cr,w/2+((radius+radius_shift_for_text)*math.cos((start_angel+(((number_of_arcs-distance_between_blocks)/2)))*(math.pi/180.0))),h/2+((radius+radius_shift_for_text)*math.sin((start_angel+(((number_of_arcs-distance_between_blocks)/2)))*(math.pi/180.0))))
      cairo_rotate(cr, (((number_of_arcs-distance_between_blocks)/2)+(number_of_arcs+distance_between_blocks)*(i-1))*math.pi/180.0)
      cairo_show_text(cr,tostring(i))
      cairo_rotate(cr,-(((number_of_arcs-distance_between_blocks)/2)+(number_of_arcs+distance_between_blocks)*(i-1))*math.pi/180.0)
    end
    
    start_angel = start_angel+number_of_arcs+distance_between_blocks 
    cairo_set_source_rgba(cr, r,g,b,transparency)
  end
  cairo_close_path(cr)
  cairo_set_operator(cr, CAIRO_OPERATOR_OVER)
end


function vertical_bars(cr,w,h,x,y,conky_value)
    cairo_set_source_rgba(cr, r,g,b,transparency)
    local percent_per_block = 70 / 10
    local number_of_filled_blocks = math.floor((conky_value/percent_per_block)+0.5)
    
    for i=1,10 do
      if number_of_filled_blocks >= i then
	cairo_set_source_rgba(cr, r_c,g_c,b_c,transparency)
      end
      --cairo_rectangle(cr, w/2-x, h/2+y-i*5,15,3)
      cairo_rectangle(cr, w, h/2+y-i*5,15,3)
      cairo_fill(cr)
      cairo_set_source_rgba(cr, r,g,b,transparency)
    end
  
end

function draw_circles(cr, x_start,y_start,radius, angle_1, angle_2, free_perc, angle_step)
	 cairo_select_font_face (cr, "Dejavu Sans Condensed", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
	 local number_of_circles = 360 / angle_step
	 local angle_start = 90
	 cairo_set_line_width(cr, 1)
	 local percent_per_circle = 100.0 / number_of_circles
	 local number_of_nonfree_circles = math.floor(((100.0 - tonumber(free_perc)) / percent_per_circle)+0.5)
	 cairo_set_source_rgba(cr, r,g,b,transparency)
	 
	for i=1,number_of_circles do
	  cairo_arc(cr,x_start+(radius*math.cos(angle_start*(math.pi/180.0))),y_start-(radius+5)+radius-(radius*math.sin(angle_start*(math.pi/180.0))),2,angle1,angle2)
	  if i <= number_of_nonfree_circles then
	    cairo_set_source_rgba(cr, r_c,g_c,b_c,transparency)
	    cairo_fill(cr)
	  else
	    cairo_set_source_rgba(cr, r,g,b,transparency)
	    cairo_fill(cr)
	  end
	  angle_start = angle_start - angle_step
	end
	cairo_set_source_rgba(cr, r,g,b,transparency)
	
end

function draw_function(cr)
  local w,h=conky_window.width,conky_window.height	
  --cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND)
  cairo_set_line_width(cr, 3)
  cairo_set_font_size(cr,12)
  cairo_select_font_face (cr, "URW Chancery L", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
  
-- Number of weeks per year --- 
  create_circle(cr,w,h, 52.0, 2, 3.5, 160, 3, CAIRO_OPERATOR_OVER, 6, tonumber(conky_parse('${exec date +%V}')), '')
  
-- Number of days in a month ---
  create_circle(cr,w,h, conky_parse('${exec cal |egrep -v [a-z] |wc -w}'), 2, 3.5, 135, 10,CAIRO_OPERATOR_CLEAR, -3.5,tonumber(conky_parse('${exec date +%d}')), '')
  
--- Days ---
-- function create_circle(cr,w,h, elements, distance_between_blocks, two_number_degree, radius, line_width, operator, radius_shift_for_text, current, days, shift_days_distance)
 
  local days = {"Lun", "Mar", "Mer","Jeu", "Ven", "Sam", "Dim"}
  create_circle(cr,w,h, 7, 2, 3.5, 120, 10, CAIRO_OPERATOR_CLEAR, -4, tonumber(conky_parse('${exec date +%u}')), days, 8.5)
  
--- Mois ---
  local months = {"Jan", "Fév", "Mar","Avr", "Mai", "Jui", "Juil","Aou","Sept","Oct","Nov","Déc",}
  create_circle(cr,w,h, 12, 2, 3.5, 150, 10, CAIRO_OPERATOR_CLEAR, -4, tonumber(conky_parse('${exec date +%m}')), '')
  
--- Clock ---
   

--- Free space ---
  
  
--- Temperatures ---

  cairo_move_to(cr,w/2-50,h/2+100)
  cairo_set_font_size(cr,12)

  for i=1, number_of_physical_CPU_cores do
    x = w/2-((15*number_of_physical_CPU_cores)+15*(number_of_physical_CPU_cores-1))/2+30*(i-1)
    
    if enable_graphic_card_temperature_sensor == "Yes" and i == number_of_physical_CPU_cores then
      str= tonumber(conky_parse("${exec nvidia-smi | grep 'NVS' -A 1 | tail -n 1 | awk '{print $3}' | cut -b1,2}"))
      vertical_bars(cr,x,h,64,75,str)
      cairo_arc(cr,x+8,h/2+90,7,0,2*math.pi)
      cairo_fill(cr)
      cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR)
      cairo_move_to(cr,x+3,h/2+94)
      cairo_show_text(cr,"G")
      cairo_set_operator(cr, CAIRO_OPERATOR_OVER)
    else
      str = "${exec sensors|grep 'Core " .. tostring(i-1) .. ":'|awk '{print $3}'| cut -b2,3,4,5}"
      vertical_bars(cr,x,h,64,75,tonumber(conky_parse(str)))
      cairo_arc(cr,x+8,h/2+90,7,0,2*math.pi)
      cairo_fill(cr)
      cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR)
      cairo_move_to(cr,x+5,h/2+94)
      cairo_show_text(cr,tostring(i-1))
      cairo_set_operator(cr, CAIRO_OPERATOR_OVER)
    end
    
  end
end

function conky_start_widgets()
	local function draw_conky_function(cr)
		local str=''
		local value=0		
		draw_function(cr)
	end
	
	-- Check that Conky has been running for at least 5s

	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_conky_function(cr)
	end
	cairo_surface_destroy(cs)
	cairo_destroy(cr)
end

@+

Hors ligne

#460 Le 27/02/2014, à 21:45

Didier-T

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

Bonsoir loutch,
j'ai modifié un peu le code, la fonction create_circle, pour être précis, de manière à lui donner plus de souplesse dans son utilisation (ce qui bloquait était le fait qu'il ne traitait les tableaux que s'il y avait 7 entrées)

-- 2014-02-24 by eXpander


---------------- USER CONFIGURATION ----------------
-- Set your number of physical cores to show temperatures of each.
number_of_physical_CPU_cores = 0

-- Do you want to show your graphic card temperature? (Yes/No). If you set Yes, you should know how to
-- output your temperature. For example;
-- nvidia-smi | grep 'NVS' -A 1 | tail -n 1 | awk '{print $3}' | cut -b1,2
-- Change line 266 to yours to output graphic card temperature.
enable_graphic_card_temperature_sensor= "no"

-- You GPU model.

-- Colors
HTML_colors = "#000000"
HTML_colors_current = "FFFFFF"
transparency = 0.65 -- From 0 to 1
























































require 'cairo'

function hex2rgb(hex)
  hex = hex:gsub("#","")
  return tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6))
end

r,g,b = hex2rgb(HTML_colors)
r_c,g_c,b_c = hex2rgb(HTML_colors_current)

r = r/255
g = g/255
b = b/255

r_c = r_c/255
g_c = g_c/255
b_c = b_c/255

if enable_graphic_card_temperature_sensor == "Yes" then
  number_of_physical_CPU_cores = number_of_physical_CPU_cores + 1
end


function create_circle_hdd(cr,w,h,elements,distance_between_blocks, radius, line_width, current)
  cairo_set_line_width(cr, line_width)
  cairo_set_source_rgba(cr, r,g,b,transparency)
  cairo_new_path(cr)
  local number_of_arcs = (360 - (elements*distance_between_blocks)) / elements
  local start_angel = 270
  local percent_per_element = 100.0 / elements
  local charged_elements = current / percent_per_element

  for i=1, elements do
    if charged_elements >= i then
      cairo_set_source_rgba(cr, r_c,g_c,b_c,transparency)
    end
    cairo_arc(cr, w,h,radius,start_angel*math.pi/180,(start_angel+number_of_arcs)*math.pi/180)
    cairo_stroke(cr)
    start_angel = start_angel+number_of_arcs+distance_between_blocks
    cairo_set_source_rgba(cr, r,g,b,transparency)
  end
end
function create_circle(cr,w,h, elements, distance_between_blocks, two_number_degree, radius, line_width, operator, radius_shift_for_text, current, days, shift_days_distance)
  cairo_set_line_width(cr, line_width)
  cairo_set_source_rgba(cr, r,g,b,transparency)
  cairo_new_path(cr)
  local number_of_arcs = (360 - (elements*distance_between_blocks)) / elements
  local start_angel = 271

  for i=1, elements do
    if i == current then
      cairo_set_source_rgba(cr, r_c,g_c,b_c,transparency)
    end
    cairo_arc(cr, w/2, h/2, radius, start_angel*math.pi/180, (start_angel+number_of_arcs)*math.pi/180)
    cairo_stroke(cr)
    start_angel = start_angel+number_of_arcs+distance_between_blocks
    cairo_set_source_rgba(cr, r,g,b,transparency)
  end

  start_angel = 271
  cairo_set_operator(cr, operator)

  for i=1, elements do
    if i == current then
      cairo_set_source_rgba(cr, r_c,g_c,b_c,transparency)
    end
    if days ~= "" then
      cairo_move_to(cr,w/2+((radius+radius_shift_for_text)*math.cos((start_angel+((math.abs((number_of_arcs-shift_days_distance))/2)))*(math.pi/180.0))),h/2+((radius+radius_shift_for_text)*math.sin((start_angel+((math.abs((number_of_arcs-shift_days_distance))/2)))*(math.pi/180.0))))
      cairo_rotate(cr, ((math.abs((number_of_arcs-shift_days_distance))/2)+(number_of_arcs+distance_between_blocks)*(i-1)+4)*math.pi/180.0)
      cairo_show_text(cr,days[i])
      cairo_rotate(cr,-((math.abs((number_of_arcs-shift_days_distance))/2)+(number_of_arcs+distance_between_blocks)*(i-1)+4)*math.pi/180.0)
    elseif string.len(tostring(i)) == 2 then
      cairo_move_to(cr,w/2+((radius+radius_shift_for_text)*math.cos((start_angel+(((number_of_arcs-two_number_degree)/2)))*(math.pi/180.0))),h/2+((radius+radius_shift_for_text)*math.sin((start_angel+(((number_of_arcs-two_number_degree)/2)))*(math.pi/180.0))))
      cairo_rotate(cr, (((number_of_arcs-two_number_degree)/2)+(number_of_arcs+distance_between_blocks)*(i-1))*math.pi/180.0)
      cairo_show_text(cr,tostring(i))
      cairo_rotate(cr,-(((number_of_arcs-two_number_degree)/2)+(number_of_arcs+distance_between_blocks)*(i-1))*math.pi/180.0)
    elseif string.len(tostring(i)) == 1 then
      cairo_move_to(cr,w/2+((radius+radius_shift_for_text)*math.cos((start_angel+(((number_of_arcs-distance_between_blocks)/2)))*(math.pi/180.0))),h/2+((radius+radius_shift_for_text)*math.sin((start_angel+(((number_of_arcs-distance_between_blocks)/2)))*(math.pi/180.0))))
      cairo_rotate(cr, (((number_of_arcs-distance_between_blocks)/2)+(number_of_arcs+distance_between_blocks)*(i-1))*math.pi/180.0)
      cairo_show_text(cr,tostring(i))
      cairo_rotate(cr,-(((number_of_arcs-distance_between_blocks)/2)+(number_of_arcs+distance_between_blocks)*(i-1))*math.pi/180.0)
    end

    start_angel = start_angel+number_of_arcs+distance_between_blocks
    cairo_set_source_rgba(cr, r,g,b,transparency)
  end
  cairo_close_path(cr)
  cairo_set_operator(cr, CAIRO_OPERATOR_OVER)
end


function vertical_bars(cr,w,h,x,y,conky_value)
    cairo_set_source_rgba(cr, r,g,b,transparency)
    local percent_per_block = 70 / 10
    local number_of_filled_blocks = math.floor((conky_value/percent_per_block)+0.5)

    for i=1,10 do
      if number_of_filled_blocks >= i then
        cairo_set_source_rgba(cr, r_c,g_c,b_c,transparency)
      end
      --cairo_rectangle(cr, w/2-x, h/2+y-i*5,15,3)
      cairo_rectangle(cr, w, h/2+y-i*5,15,3)
      cairo_fill(cr)
      cairo_set_source_rgba(cr, r,g,b,transparency)
    end

end

function draw_circles(cr, x_start,y_start,radius, angle_1, angle_2, free_perc, angle_step)
         cairo_select_font_face (cr, "Dejavu Sans Condensed", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
         local number_of_circles = 360 / angle_step
         local angle_start = 90
         cairo_set_line_width(cr, 1)
         local percent_per_circle = 100.0 / number_of_circles
         local number_of_nonfree_circles = math.floor(((100.0 - tonumber(free_perc)) / percent_per_circle)+0.5)
         cairo_set_source_rgba(cr, r,g,b,transparency)

        for i=1,number_of_circles do
          cairo_arc(cr,x_start+(radius*math.cos(angle_start*(math.pi/180.0))),y_start-(radius+5)+radius-(radius*math.sin(angle_start*(math.pi/180.0))),2,angle1,angle2)
          if i <= number_of_nonfree_circles then
            cairo_set_source_rgba(cr, r_c,g_c,b_c,transparency)
            cairo_fill(cr)
          else
            cairo_set_source_rgba(cr, r,g,b,transparency)
            cairo_fill(cr)
          end
          angle_start = angle_start - angle_step
        end
        cairo_set_source_rgba(cr, r,g,b,transparency)

end

function draw_function(cr)
  local w,h=conky_window.width,conky_window.height
  --cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND)
  cairo_set_line_width(cr, 3)
  cairo_set_font_size(cr,12)
  cairo_select_font_face (cr, "URW Chancery L", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);

-- Number of weeks per year ---
  create_circle(cr,w,h, 52.0, 2, 3.5, 160, 3, CAIRO_OPERATOR_OVER, 6, tonumber(conky_parse('${exec date +%V}')), '')

-- Number of days in a month ---
  create_circle(cr,w,h, conky_parse('${exec cal |egrep -v [a-z] |wc -w}'), 2, 3.5, 135, 10,CAIRO_OPERATOR_CLEAR, -3.5,tonumber(conky_parse('${exec date +%d}')), '')

--- Days ---
-- function create_circle(cr,w,h, elements, distance_between_blocks, two_number_degree, radius, line_width, operator, radius_shift_for_text, current, days, shift_days_distance)

  local days = {"Lun", "Mar", "Mer","Jeu", "Ven", "Sam", "Dim"}
  create_circle(cr,w,h, 7, 2, 3.5, 120, 10, CAIRO_OPERATOR_CLEAR, -4, tonumber(conky_parse('${exec date +%u}')), days, 8.5)

--- Mois ---
  local months = {"Jan", "Fév", "Mar","Avr", "Mai", "Jui", "Juil","Aou","Sept","Oct","Nov","Déc",}
  create_circle(cr,w,h, 12, 2, 3.5, 150, 10, CAIRO_OPERATOR_CLEAR, -4, tonumber(conky_parse('${exec date +%m}')), months, 8.5)

--- Clock ---


--- Free space ---


--- Temperatures ---

  cairo_move_to(cr,w/2-50,h/2+100)
  cairo_set_font_size(cr,12)

  for i=1, number_of_physical_CPU_cores do
    x = w/2-((15*number_of_physical_CPU_cores)+15*(number_of_physical_CPU_cores-1))/2+30*(i-1)

    if enable_graphic_card_temperature_sensor == "Yes" and i == number_of_physical_CPU_cores then
      str= tonumber(conky_parse("${exec nvidia-smi | grep 'NVS' -A 1 | tail -n 1 | awk '{print $3}' | cut -b1,2}"))
      vertical_bars(cr,x,h,64,75,str)
      cairo_arc(cr,x+8,h/2+90,7,0,2*math.pi)
      cairo_fill(cr)
      cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR)
      cairo_move_to(cr,x+3,h/2+94)
      cairo_show_text(cr,"G")
      cairo_set_operator(cr, CAIRO_OPERATOR_OVER)
    else
      str = "${exec sensors|grep 'Core " .. tostring(i-1) .. ":'|awk '{print $3}'| cut -b2,3,4,5}"
      vertical_bars(cr,x,h,64,75,tonumber(conky_parse(str)))
      cairo_arc(cr,x+8,h/2+90,7,0,2*math.pi)
      cairo_fill(cr)
      cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR)
      cairo_move_to(cr,x+5,h/2+94)
      cairo_show_text(cr,tostring(i-1))
      cairo_set_operator(cr, CAIRO_OPERATOR_OVER)
    end

  end
end

function conky_start_widgets()
        local function draw_conky_function(cr)
                local str=''
                local value=0
                draw_function(cr)
        end

        -- Check that Conky has been running for at least 5s

        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_conky_function(cr)
        end
        cairo_surface_destroy(cs)
        cairo_destroy(cr)
end

Si la modification te convient, j'aimerais que tu la soumettes à l'auteur de ce script.
Merci,
Didier-T

Hors ligne

#461 Le 28/02/2014, à 10:02

loutch

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

smilies%20(204).gif

Merci Didier ,tu es le meilleur ça fonctionne au poil.

smilies%20(1).gif

Hors ligne

#462 Le 28/02/2014, à 17:15

eXpander

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

Hey all,

loutch messaged me that you made my Conky Calendar Extra -code better. Well, thank you Didier-T and loutch smile for your ideas making this script better.

PS: Really nice conkys here wink. I will bookmark this forum and take a look here from time to time smile

Hors ligne

#463 Le 28/02/2014, à 17:46

loutch

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

smilies%20(204).gif

Voici ce que ça donne ,l'horloge est un deuxième lua  encore merci.


1393606019.png



smilies%20(1).gif

Dernière modification par loutch (Le 28/02/2014, à 17:47)

Hors ligne

#464 Le 01/03/2014, à 23:27

Didier-T

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

@ loutch,
elle est très bien cette horloge.

@ eXpander,
de rien ce fut un plaisir, ce calendrier est très beau.

Hors ligne

#465 Le 06/03/2014, à 18:11

Didier-T

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

Bonjour daniel38100,
je viens de voir ton édit du 26/02/2014, je ne suis pas certain de comprendre ce que tu veux faire avec les points des secondes.
Faire en sorte que les secondes passées restes allumées, jusqu’à atteindre la 59ièmes secondes, où autre chose ?

Hors ligne

#466 Le 07/03/2014, à 12:45

daniel38100

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

Didier-T a écrit :

Bonjour daniel38100,
je viens de voir ton édit du 26/02/2014, je ne suis pas certain de comprendre ce que tu veux faire avec les points des secondes.
Faire en sorte que les secondes passées restes allumées, jusqu’à atteindre la 59ièmes secondes, où autre chose ?

je pense que tu as compris je voudrai que les seconde passer reste rouge jusqu'à la 59ème seconde
je m'en suis pas trop occuper depuis donc j'ai pas résolu mon problème

Dernière modification par daniel38100 (Le 07/03/2014, à 12:46)

Hors ligne

#467 Le 07/03/2014, à 13:08

Didier-T

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

Pas de soucis, il faut juste que je répare mon PC (pb carte graphique).

Hors ligne

#468 Le 07/03/2014, à 14:23

daniel38100

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

c pas presser j'ai pas mal de taf en ce moment
j'ai meme pas le temps de peaufiner le projet meteo fond-d'ecran

Dernière modification par daniel38100 (Le 07/03/2014, à 14:25)

Hors ligne

#469 Le 09/03/2014, à 11:29

Didier-T

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

Bonjour daniel38100,
voici le script chronographe modifié, avec une petite perte de poids wink

--[[ multiple analogue clocks by Didier-T (forum Ubuntu.fr) - 25 Nov 2012
 Basé sur le travail de mrpeachy et Sector11
26 Nov 2012 - ajout hand_gap et hand_larg Didier-T
01 Dec 2012 - correction bug nb_jour Décembre Didier-T
02 Dec 2012 - ajout mode 24 heures Didier-T


use in conkyrc

lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT

]]

require 'cairo'
--Position et taille horloge
local init={
  {text={"Dim","Lun","Mar","Mer","Jeu","Ven","Sam"},
  nb=7*24,
  formule='jour',
  police="monofur",
  taille=12,
  text_color=0xFFFFFF,
  text_alpha=1,
  text_color_current=0xFF0000,
  text_alpha_current=1,
  point_color=0xFFFFFF,
  point_alpha=1,
  point_color_current=0xFF0000,
  point_alpha_current=1,
  hand_color=0xFFFFFF,
  hand_alpha=0.7,
  center_x=175,
  center_y=90,
  text_radius=45,
  point_radius=32,
  hand_gap=0,
  hand_larg=1,
  hand_length=28,
  point_ray=0.5
  },
  {text={""},
  nb="",
  formule='jour_num',
  police="Century Schoolbook",
  taille=10,
  text_color=0xFFFFFF,
  text_alpha=1,
  text_color_current=0xFF0000,
  text_alpha_current=1,
  point_color=0xFFFFFF,
  point_alpha=1,
  point_color_current=0xFF0000,
  point_alpha_current=1,
  hand_color=0xFFFFFF,
  hand_alpha=0.7,
  center_x=90,
  center_y=175,
  text_radius=45,
  point_radius=35,
  hand_gap=0,
  hand_larg=1,
  hand_length=28,
  point_ray=0.5
  },
  {text={"Jan","Fév","Mar","Avr","Mai","Jui","Jul","Aôu","Sep","Oct","Nov","Déc"},
  nb="",
  formule='mois',
  police="monofur",
  taille=12,
  text_color=0xFFFFFF,
  text_alpha=1,
  text_color_current=0xFF0000,
  text_alpha_current=1,
  point_color=0xFFFFFF,
  point_alpha=1,
  point_color_current=0xFF0000,
  point_alpha_current=1,
  hand_color=0xFFFFFF,
  hand_alpha=0.7,
  center_x=260,
  center_y=175,
  text_radius=45,
  point_radius=32,
  point_ray=1,
  hand_gap=0,
  hand_larg=1,
  hand_length=28
  },
  {text={"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"},
  hour_24=true,
  nb=12*3600, --12 or 24 *3600
  formule='heure',
  police="Tibetan Machine Uni",
  taille=13,
  text_color=0xFFFFFF,
  text_alpha=1,
  text_color_current=0xFFFF00,
  text_alpha_current=1,
  point_color=0xFFFFFF,
  point_alpha=1,
  point_color_current=0xFFFF00,
  point_alpha_current=1,
  hand_color=0xFFFFFF,
  hand_alpha=0.7,
  center_x=175,
  center_y=175,
  text_radius=165,
  point_radius=150,
  hand_gap=0,
  hand_length=110,
  hand_larg=3,
  point_ray=1
  },
  {text={"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""},
  nb=3600,
  formule='minute',
  police="monofur",
  taille=9,
  text_color=0xFFFFFF,
  text_alpha=1,
  text_color_current=0xF00000,
  text_alpha_current=1,
  point_color=0xFFFFFF,
  point_alpha=1,
  point_color_current=0xF00000,
  point_alpha_current=1,
  hand_color=0xFFFFFF,
  hand_alpha=0.7,
  center_x=175,
  center_y=175,
  text_radius=170,
  point_radius=150,
  point_ray=0,
  hand_gap=0,
  hand_larg=2,
  hand_length=135
  },
  {text={"","01","02","03","04","","06","07","08","09","","11","12","13","14","","16","17","18","19","","21","22","23","24","","26","27","28","29","","31","32","33","34","","36","37","38","39","","41","42","43","44","","46","47","48","49","","51","52","53","54","","56","57","58","59"},
  nb=60,
  formule='secondes',
  police="cmr10",
  taille=10,
  text_color=0xFFFFFF,
  text_alpha=1,
  text_color_current=0xFFFFFF,
  text_alpha_current=1,
  point_color=0xFFFFFF,
  point_alpha=1,
  point_color_current=0xFF0000,
  point_alpha_current=1,
  hand_color=0xFF0000,
  hand_alpha=0.4,
  center_x=175,
  center_y=175,
  text_radius=160,
  point_radius=150,
  point_ray=0.5,
  hand_gap=150,
  hand_larg=4,
  hand_length=165,
  progressif=true
  },
}

function conky_main()

  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 extents=cairo_text_extents_t:create()
  tolua.takeownership(extents)
  local h, min, sec=time()
  local jour, jour_num, mois, nb_jour=date()

  if tonumber(conky_parse('${updates}'))>3 then
    for i in pairs(init) do
      draw(cr, extents, init[i], h, min, sec, jour, jour_num, mois, nb_jour)
    end
  end

  cairo_destroy(cr)
  cairo_surface_destroy(cs)
  cr=nil
  collectgarbage()
end

function draw(cr, extents, value, h, min, sec, jour, jour_num, mois, nb_jour)
  local function affichage(cr, extents, j, valeur, value, text, nb)
    if value.progressif == nil then
      value.progressif=false
    end
    if value.progressif==true and j<=valeur then
      texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
      point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
    elseif value.progressif==false and j==valeur then
      texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
      point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
    else
      texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
      point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
    end
  end
  local pos
  local nb=tonumber(table.getn(value.text))
  cairo_select_font_face (cr, value.police, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
  cairo_set_font_size (cr, value.taille)
-- Section Horloge
  if value.formule=="heure" then
    local text
    nb=value.nb/3600
    if nb==24 then h=tonumber(os.date("%H")) end
    pos=heure(h, min, sec)
    for i=1, nb do
      local j=i-1
      if value.hour_24==true then
        if tonumber(os.date("%H"))<nb then
          text=value.text[i]
        else
          text=value.text[i+12]
        end
      else
        text=value.text[i]
      end
      affichage(cr, extents, j, h, value, text, nb)
    end
  elseif value.formule=="minute" then
    pos=minute(min, sec)
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      affichage(cr, extents, j, min, value, text, nb)
    end
  elseif value.formule=="secondes" then
    pos=sec
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      affichage(cr, extents, j, sec, value, text, nb)
    end
-- Section date
  elseif value.formule=="mois" then
    value.nb, pos=month()
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      affichage(cr, extents, j, mois-1, value, text, nb)
    end
  elseif value.formule=="jour_num" then
    value.nb=nb_jour*24
    nb=nb_jour
    pos=day(jour-1)
    for i=1, nb_jour do
      if math.mod(i, 2) == 0 then
        text=string.format("%02d",i)
      else
        text=""
      end
      local j=i-1
      affichage(cr, extents, j, jour-1, value, text, nb)
    end
  elseif value.formule=="jour" then
    pos=(jour_num*24)+tonumber(os.date("%H"))
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      affichage(cr, extents, j, jour_num, value, text, nb)
    end

-- Horloge avec personnalisée (non utilisé pour le moment)
  else
    pos=tonumber(conky_parse(value.formule))
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if tonumber(text)==pos then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, i, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, i, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, i, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, i, cr, value.point_ray)
      end
    end
  end

  hand(pos, value.nb, value.text_radius, value.hand_length, value.hand_gap, value.hand_larg, value.center_x, value.center_y, value.hand_color, value.hand_alpha, cr)
end

function date()
  local nb_jour
  local jour=tonumber(os.date("%d"))
  local jour_num=tonumber(os.date("%w"))
  local mois=tonumber(os.date("%m"))
  if mois==12 then
    nb_jour=31
  else
    nb_jour=tonumber(conky_parse("${exec date --date '1 month' +%j}"))-tonumber(conky_parse("${exec date +%j}"))
  end
  return jour, jour_num, mois, nb_jour
end

function day(jour)
  local hjour=(jour*24)+tonumber(os.date("%H"))
  return hjour
end

function month()
  local nb_jours_annee=tonumber(conky_parse("${exec echo $(date --date '31 Dec' +%j)}"))
  local jour_annee=tonumber(conky_parse("${exec echo $(date +%j)}"))
  return nb_jours_annee, jour_annee
end

function time()
  local h=tonumber(os.date("%I"))
  local min=tonumber(os.date("%M"))
  local sec=tonumber(os.date("%S"))
  return h, min, sec
end

function heure(h, min, sec)
  local hs=(h*3600)+(min*60)+sec
  return hs
end

function minute(min, sec)
  local m=(min*60)+sec
  return m
end

function rgb_to_r_g_b(col,alp)
  return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end

function texte(police, taille, text, nb, radius, center_x, center_y, color, alpha, i, extents, cr)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(i))
  local x=0+radius*(math.sin(point))
  local y=0-radius*(math.cos(point))
  cairo_text_extents(cr,text,extents)
  local width=extents.width
  local height=extents.height
  cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
  cairo_show_text (cr, text)
  cairo_stroke (cr)
end

function point(nb, radius, center_x, center_y, color, alpha, i, cr, ray)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(i))
  local x=0+radius*(math.sin(point))
  local y=0-radius*(math.cos(point))
  cairo_arc (cr,center_x+x,center_y+y,ray,0,2*math.pi)
  cairo_stroke (cr)
end

function hand(pos, nb, radius, hand_length, hand_gap, largeur, center_x, center_y, color, alpha, cr)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(pos))
  local x_gap=0+hand_gap*(math.sin(point))
  local y_gap=0-hand_gap*(math.cos(point))
  local x=0+hand_length*(math.sin(point))
  local y=0-hand_length*(math.cos(point))
  cairo_move_to (cr,center_x+x_gap,center_y+y_gap)
  cairo_line_to (cr,center_x+x,center_y+y)
  cairo_set_line_width (cr,largeur)
  cairo_set_line_cap  (cr, CAIRO_LINE_CAP_ROUND)
  cairo_stroke (cr)
end

1394360922.png
j'ai ajouter une variable nommée "progressif", elle a deux valeurs possibles, true ou false. si rien n'est indiqué elle est considérée comme false.

Hors ligne

#470 Le 16/03/2014, à 18:58

Phyllinux

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

golgot200 a écrit :

Bonjour à tous,

Arghhhhhh, si on pouvait sortir ça dans un conky + Alsa au lieu de Pulseaudio, ça serait le panard !!!!

C'est un screenlet Impulse. J'ai vu sur un site ( mais, j'ai perdu le lien, que quelques uns y pensent)

Les différentes tentatives pour lancer quelque chose qui donne le même rendu que le screenlet Impulse n'ont rien donné de bon, car c'est trop gourmand en ressource proceseur.
En revanche, tu peux toujours lancer le script python du screenlet dans ton conky
Perso, c'est ce que je fais avec mon conky pour le lecteur DeadBeef :
conky DeadBeef


The ship is sinking normally...

Hors ligne

#471 Le 16/03/2014, à 19:50

F50

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

Salut,

golgot200 a écrit :

Arghhhhhh, si on pouvait sortir ça dans un conky + Alsa au lieu de Pulseaudio, ça serait le panard !!!!

Je vote deux fois pour! big_smile

@ Phyllinux : J'ai ton conky Deadbeef mais pas cette version avec screenlet, tu peux la partager? Est-il possible de faire ça en horizontal sans le cd en arrière plan? Merci.

#472 Le 17/03/2014, à 18:23

jlfh0816

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

Bonjour,

Pour m'amuser, j'ai tenté d'installer un GIF animé sur mon bureau (Xubuntu 13.10 dans sa version personnalisée Voyager 13.10 de Rodofr). Pour commencer, j'ai téléchargé un cube animé sur le site Bloggif (c'est gratuit, il suffit de fournir les photos) puis j'ai suivi à la lettre les instructions de Pietre Blinkenshell parues en 2010 dans le forum Crunchbang (forum Crunchbang) ainsi que sur le site de cet auteur (site de Pieter Blinkenshell).
A ma grande surprise (je dis ça car je ne suis vraiment pas doué ...), tout a très bien fonctionné sans grandes difficultés et du premier coup. J'ai donc maintenant un cube animé sur mon bureau, sans code lua ou quoi que ce soit d'autre pour le faire fonctionner.
Voici ce que cela donne :
140318102335206491.gif

L'envie qui me vient maintenant à l'esprit est tout aussi futile que mon idée première d'avoir un gif animé sur le bureau... c'est à dire pensez-vous qu'il soit possible de rendre cliquable ce GIF animé de façon à en faire un lanceur animé ?
Je précise que je n'ai pas un PC très puissant (un modeste i3) et pourtant ma consommation CPU lorsque le conky animé tourne est d'à peine 5 à 8 %. D'où ma tentation …
Il me semble qu'il n'y a pas si longtemps, Didier-T avait réussi à rendre cliquable l'un de ses beaux conkys mais impossible de remettre la main sur les posts qui vont bien tant le topic « conky » auquel participe très activement Didier-T est fourni et touffu ...
De plus et pour ma part, je suis bien incapable de modifier mon conky animé pour le rendre cliquable …
Si quelqu'un s'y connaît, peut-il me dire si c'est faisable et comment faire ?
Un grand merci d'avance !

Au cas où cela intéresse quelqu'un, je lance le conky animé avec :

conky -c /home/jlfh0816/essai/.conkyrcessai

et voici le .conkyrcessai que j'ai bidouillé :

update_interval 0.15
# réglage de la mémoire, pour éviter le clignotement
double_buffer yes
# Soustraire les mémoires tampons de la mémoire utilisée
no_buffers yes
text_buffer_size 1024
imlib_cache_size 0
template1 /home/jlfh0816/essai/temp.gif.
template2 -p 100,280 -s 135x135
TEXT
Conky animation with images
${if_updatenr 01}${image ${template1}005 ${template2}}${endif}
${if_updatenr 02}${image ${template1}010 ${template2}}${endif}
${if_updatenr 03}${image ${template1}015 ${template2}}${endif}
${if_updatenr 04}${image ${template1}020 ${template2}}${endif}
${if_updatenr 05}${image ${template1}025 ${template2}}${endif}
${if_updatenr 06}${image ${template1}030 ${template2}}${endif}
${if_updatenr 07}${image ${template1}035 ${template2}}${endif}
${if_updatenr 08}${image ${template1}040 ${template2}}${endif}
${if_updatenr 09}${image ${template1}045 ${template2}}${endif}
${if_updatenr 10}${image ${template1}050 ${template2}}${endif}
${if_updatenr 11}${image ${template1}055 ${template2}}${endif}
${if_updatenr 12}${image ${template1}060 ${template2}}${endif}
${if_updatenr 13}${image ${template1}065 ${template2}}${endif}
${if_updatenr 14}${image ${template1}070 ${template2}}${endif}
${if_updatenr 15}${image ${template1}075 ${template2}}${endif}
${if_updatenr 16}${image ${template1}080 ${template2}}${endif}
${if_updatenr 17}${image ${template1}085 ${template2}}${endif}
${if_updatenr 18}${image ${template1}090 ${template2}}${endif}
${if_updatenr 19}${image ${template1}095 ${template2}}${endif}
${if_updatenr 20}${image ${template1}100 ${template2}}${endif}
${if_updatenr 21}${image ${template1}105 ${template2}}${endif}
${if_updatenr 22}${image ${template1}110 ${template2}}${endif}
${if_updatenr 23}${image ${template1}115 ${template2}}${endif}
${if_updatenr 24}${image ${template1}120 ${template2}}${endif}
${if_updatenr 25}${image ${template1}125 ${template2}}${endif}
${if_updatenr 26}${image ${template1}130 ${template2}}${endif}
${if_updatenr 27}${image ${template1}135 ${template2}}${endif}
${if_updatenr 28}${image ${template1}140 ${template2}}${endif}
${if_updatenr 29}${image ${template1}145 ${template2}}${endif}
${if_updatenr 30}${image ${template1}150 ${template2}}${endif}
${if_updatenr 31}${image ${template1}155 ${template2}}${endif}
${if_updatenr 32}${image ${template1}160 ${template2}}${endif}
${if_updatenr 33}${image ${template1}165 ${template2}}${endif}
${if_updatenr 34}${image ${template1}170 ${template2}}${endif}
${if_updatenr 35}${image ${template1}175 ${template2}}${endif}
${if_updatenr 36}${image ${template1}180 ${template2}}${endif}
${if_updatenr 37}${image ${template1}185 ${template2}}${endif}
${if_updatenr 38}${image ${template1}190 ${template2}}${endif}
${if_updatenr 39}${image ${template1}195 ${template2}}${endif}
${if_updatenr 40}${image ${template1}200 ${template2}}${endif}
${if_updatenr 41}${image ${template1}205 ${template2}}${endif}
${if_updatenr 42}${image ${template1}210 ${template2}}${endif}
${if_updatenr 43}${image ${template1}215 ${template2}}${endif}
${if_updatenr 44}${image ${template1}220 ${template2}}${endif}
${if_updatenr 45}${image ${template1}225 ${template2}}${endif}
${if_updatenr 46}${image ${template1}230 ${template2}}${endif}
${if_updatenr 47}${image ${template1}235 ${template2}}${endif}
${if_updatenr 48}${image ${template1}240 ${template2}}${endif}
${if_updatenr 49}${image ${template1}245 ${template2}}${endif}
${if_updatenr 50}${image ${template1}250 ${template2}}${endif}
${if_updatenr 51}${image ${template1}255 ${template2}}${endif}
${if_updatenr 52}${image ${template1}260 ${template2}}${endif}
${if_updatenr 53}${image ${template1}265 ${template2}}${endif}
${if_updatenr 54}${image ${template1}270 ${template2}}${endif}
${if_updatenr 55}${image ${template1}275 ${template2}}${endif}
${if_updatenr 56}${image ${template1}280 ${template2}}${endif}
${if_updatenr 57}${image ${template1}285 ${template2}}${endif}
${if_updatenr 58}${image ${template1}290 ${template2}}${endif}
${if_updatenr 59}${image ${template1}295 ${template2}}${endif}
${if_updatenr 60}${image ${template1}300 ${template2}}${endif}
${if_updatenr 61}${image ${template1}305 ${template2}}${endif}
${if_updatenr 62}${image ${template1}310 ${template2}}${endif}
${if_updatenr 63}${image ${template1}315 ${template2}}${endif}
${if_updatenr 64}${image ${template1}320 ${template2}}${endif}
${if_updatenr 65}${image ${template1}325 ${template2}}${endif}
${if_updatenr 66}${image ${template1}330 ${template2}}${endif}
${if_updatenr 67}${image ${template1}335 ${template2}}${endif}
${if_updatenr 68}${image ${template1}340 ${template2}}${endif}
${if_updatenr 69}${image ${template1}345 ${template2}}${endif}
${if_updatenr 70}${image ${template1}350 ${template2}}${endif}
${if_updatenr 71}${image ${template1}355 ${template2}}${endif}
${if_updatenr 72}${image ${template1}360 ${template2}}${endif}
${if_updatenr 73}${image ${template1}365 ${template2}}${endif}
${if_updatenr 74}${image ${template1}370 ${template2}}${endif}
${if_updatenr 75}${image ${template1}375 ${template2}}${endif}
${if_updatenr 76}${image ${template1}380 ${template2}}${endif}
${if_updatenr 77}${image ${template1}385 ${template2}}${endif}
${if_updatenr 78}${image ${template1}390 ${template2}}${endif}
${if_updatenr 79}${image ${template1}395 ${template2}}${endif}
${if_updatenr 80}${image ${template1}400 ${template2}}${endif}
${if_updatenr 81}${image ${template1}405 ${template2}}${endif}
${if_updatenr 82}${image ${template1}410 ${template2}}${endif}
${if_updatenr 83}${image ${template1}415 ${template2}}${endif}
${if_updatenr 84}${image ${template1}420 ${template2}}${endif}
${if_updatenr 85}${image ${template1}425 ${template2}}${endif}
${if_updatenr 86}${image ${template1}430 ${template2}}${endif}
${if_updatenr 87}${image ${template1}435 ${template2}}${endif}
${if_updatenr 88}${image ${template1}440 ${template2}}${endif}
${if_updatenr 89}${image ${template1}445 ${template2}}${endif}
${if_updatenr 90}${image ${template1}450 ${template2}}${endif}

Dernière modification par jlfh0816 (Le 18/03/2014, à 22:21)


Xubuntu - Voyager 18.04 et 22.04

Hors ligne

#473 Le 17/03/2014, à 20:40

Didier-T

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

Bonjour jlfh0816,
tu as une bonne mémoire, je n'ai pas retrouvé le second conky, mais en voici déjà un conky météo interactif

Hors ligne

#474 Le 17/03/2014, à 21:08

jlfh0816

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

@Didier-T

Bonsoir Didier-T et merci beaucoup pour ce premier lien de conky cliquable.

Hélas, ma mémoire n'est pas si bonne que cela (dur, dur de vieillir ...) puisque ce n'est pas ce conky que j'avais vaguement en mémoire. Ceci dit, je t'en remercie beaucoup et je vais m'empresser de regarder de près si je peux en tirer quelque chose pour l'adapter à mon cas, du moins dans la mesure de mes faibles capacités en conky (soyons honnête, je ne fais que modifier voire adapter ce qui existe déjà ! ).

Mais bien sûr, si tu arrives à te souvenir du deuxième conky cliquable je suis preneur aussi !  !  !  !  tongue

Puis-je te poser une question accessoire ?  Comment as-tu fait pour afficher ta carte-météo satellite animée dans ton post ? Je suis vraiment épaté qu'on puisse faire cela dans un post ... ça reste un mystère pour moi !
(entre parenthèses, il fonctionne très bien ton conky-animate de carte-météo-satellite animée mais je n'ai toujours pas compris comment l'arrêter autrement qu'en arrêtant la session et en se reconnectant. J'ai cherché de la doc là-dessus sur Google (fonction animate de conky ? ) mais je n'ai rien trouvé de probant ou de pertinent (et toi-même, de ton côté, as-tu pu avancer sur ce point précis ? ).

En te remerciant à l'avance,

Jean-Luc

Dernière modification par jlfh0816 (Le 17/03/2014, à 22:18)


Xubuntu - Voyager 18.04 et 22.04

Hors ligne

#475 Le 18/03/2014, à 16:50

F50

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

Salut,

[Mode annonce HS]

Je viens de remarquer que Deadbeef incorporait désormais ce que les adeptes de foobar2000 (moi entre autre) regrettait, un spectre et les possibilités de foorbar concernant l'agencement compartimenté de la fenêtre et le choix de la fonction dans ces derniers. Pour cela, dans la nouvelle version 6.1 allez dans affichage et cliquez mode design puis dans la fenêtre > clique droit pour choisir son contenu, voici le résultat à la va vite:

1395157213.png

1395160115.png

Il y a aussi le moyen de faire comme le spectre d'audacity, chouettte! tongue

https://github.com/cboxdoerfer/ddb_waveform_seekbar

[Fin du mode annonce HS]

Dernière modification par fcn50 (Le 18/03/2014, à 17:35)