Ferod a écritMerci d'avoir cherché pour moi cheploq. Je testerai ça dès que je peux !
En cherchant un peu, je viens de voir que ce que je t'ai donné ne fonctionne uniquement que si le script retourne une sortie "string", c'est à dire une chaîne de caractères, si c'est une image tu auras une erreur.
lua function_name (function parameters) Executes a Lua function with given parameters, then prints the returned string. See also 'lua_load' on how to load scripts. Conky puts 'conky_' in front of function_name to prevent accidental calls to the wrong function unless you put you place 'conky_' in front of it yourself.
Par ailleurs j'ai pu obtenir un résultat avec un conky intégrant un script lua en installant par compilation le conky de GitHub :
https://github.com/brndnmtthws/conky
Il a fallu quand même que je le bidouille un peu, cette version ne prenant en charge que lua 5.1 et 5.2, alors que sur ma fedora j'ai lua en 5.3
J'ai donc modifié le fichier /conky/cmake/ConkyPlatformChecks.cmake , ligne 252 ainsi :
pkg_search_module(LUA REQUIRED lua5.3 lua-5.3 lua>=5.1 lua5.1 lua-5.1)
J'ai ensuite suivi ce qu'il y avait indiqué dans le fichier README.cmake, avec l'option ccmake ../
Et après installation, j'ai eu un bon résultat :
http://pix.toile-libre.org/?img=1448460115.jpg
Pour ceux que cela intéresserait, voici mon conkyrc :
conky.config = {
background = false,
use_xft = true,
font = 'MgOpen Modata L:size=9:bold',
update_interval = 3600.0,
total_run_times = 0,
own_window = true,
own_window_type = 'normal',
own_window_transparent = true,
own_window_argb_visual = true,
own_window_hints = 'undecorated,skip_taskbar,skip_pager,below',
double_buffer = true,
draw_shades = false,
draw_outline = false,
draw_borders = false,
draw_graph_borders = true,
stippled_borders = 8,
border_inner_margin = 4,
alignment = 'middle_middle',
minimum_width = 250,
minimum_height = 200,
gap_x = 570,
gap_y = -190,
no_buffers = true,
uppercase = false,
cpu_avg_samples = 2,
net_avg_samples = 2,
override_utf8_locale = true,
use_spacer = right,
text_buffer_size = 1024,
lua_load = '/home/dominique/.conkyrc/conky-soleil1/solar.lua',
lua_draw_hook_pre = 'sun',
}
conky.text = [[
]]
Ainsi que le script lua associé :
solar.lua
require 'cairo'
require 'imlib2'
function rgb_to_r_g_b(colour)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255.
end
function conky_sun()
if conky_window == nil then return end
image = imlib_load_image("/home/dominique/.conkyrc/conky-soleil1/fg6.png")
imlib_context_set_image(image)
imlib_render_image_on_drawable(0,0)
imlib_free_image()
--Vous pouvez changer ces paramètres
--couleur du texte à afficher
local text_color={50,50,0}
--localisation du lieu à afficher
local text_l= conky_parse("${exec sunwait -p 43.2882N 5.5778E | grep rises | awk '{print $3}'}")
local text_c= conky_parse("${exec sunwait -p 43.2882N 5.5778E | grep rises | awk '{print $6}'}")
local text_z= conky_parse("${exec sunwait -p 43.2882N 5.5778E | grep meridian | awk '{print$4}'}")
--Police à utiliser
local font= "URW Chancery L"
local font_size= 18
--fin des paramétres
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable,
conky_window.visual, conky_window.width,conky_window.height)
cr=cairo_create(cs)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL)
cairo_set_font_size (cr, font_size)
cairo_set_source_rgba (cr, text_color[1]/255, text_color[2]/255, text_color[3]/255,1)
cairo_move_to (cr, 20.0, 143.0)
cairo_show_text (cr, "Lever")
cairo_move_to (cr, 20.0, 163.0)
cairo_show_text (cr, text_l)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL)
cairo_set_font_size (cr, font_size)
cairo_set_source_rgba (cr, text_color[1]/255, text_color[2]/255, text_color[3]/255,1)
cairo_move_to (cr, 165.0, 143.0)
cairo_show_text (cr, "Coucher")
cairo_move_to (cr, 173.0, 163.0)
cairo_show_text (cr, text_c)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL)
cairo_set_font_size (cr, font_size)
cairo_set_source_rgba (cr, text_color[1]/255, text_color[2]/255, text_color[3]/255,1)
cairo_move_to (cr, 93.0, 43.0)
cairo_show_text (cr, "Zenith")
cairo_move_to (cr, 95.0, 63.0)
cairo_show_text (cr, text_z)
cairo_destroy(cr)
end