You are not logged in.
Pages: 1
I was following this tutorial.
I created a simple file called conky.conf with the following content:
--this is a lua script for use in conky
require 'cairo'
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)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
print ("hello world")
end
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
endWhen I run conky I get the following:
» ~ conky
conky: /home/michael/.config/conky/conky.conf:2: module 'cairo' not found:
no field package.preload['cairo']
no file './cairo.lua'
no file '/usr/share/lua/5.1/cairo.lua'
no file '/usr/share/lua/5.1/cairo/init.lua'
no file '/usr/lib/lua/5.1/cairo.lua'
no file '/usr/lib/lua/5.1/cairo/init.lua'
no file './cairo.so'
no file '/usr/lib/lua/5.1/cairo.so'
no file '/usr/lib/lua/5.1/loadall.so'
» ~ Note that I have conky-lua-archers.
Lua version is:
» ~ lua -v
Lua 5.3.3 Copyright (C) 1994-2016 Lua.org, PUC-RioConky information:
» ~ conky -v
conky 1.10.6_pre compiled Sun 5 Feb 22:05:21 CET 2017 for Linux 4.9.6-1-ARCH x86_64
Compiled in features:
System config file: /etc/conky/conky.conf
Package library path: /usr/lib/conky
General:
* math
* hddtemp
* portmon
* IPv6
* Curl
* wireless
* nvidia
* builtin default configuration
* old configuration syntax
* Imlib2
* apcupsd
* iostats
* ncurses
* Internationalization support
* PulseAudio
Lua bindings:
* Cairo
* Imlib2
* RSVG
X11:
* Xdamage extension
* Xinerama extension (virtual display)
* XDBE (double buffer extension)
* Xft
* ARGB visual
* Own window
Default values:
* Netdevice: enp7s4
* Local configfile: $HOME/.conkyrc
* Localedir: /usr/share/locale
* Maximum netdevices: 64
* Maximum text size: 16384
* Size text buffer: 256Last edited by alogim (2017-02-05 21:09:14)
Offline
is it case sensitive? does changing it to require 'Cairo' fix it?
Offline
No, it does not fix it.
Is there a guide out there to properly install conky and properly install lua for ArchLinux? I really can not figure out what is wrong.
Offline
a) The conky package does not support drawing with cairo. Since your conky shows that it supports cairo, I assume you are using conky-cairo from the AUR.
b) Your conky.conf should contain the config for conky, not the lua script. An example conky.conf is here:
conky.config = {
lua_load = '/full/path/to/script.lua',
lua_draw_hook_pre = 'conky_main',
update_interval = 1.0,
out_to_x = true,
};
conky.text = ""c) Your lua script should be in an external file, the full path of which is given to lua_load in conky.conf.
As an example, the following lua script should show whether everything works:
--this is a lua script for use in conky
require 'cairo'
function conky_main()
io.stderr:write('here')
if conky_window == nil then
return
end
local cs = cairo_xlib_surface_create(conky_window.display,
conky_window.drawable,
conky_window.visual,
conky_window.width,
conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
font="Mono"
font_size=16
text="hello world " .. tostring(updates)
xpos,ypos=100+updates*17,100+updates*17
red,green,blue,alpha=1,1,1,1
font_slant=CAIRO_FONT_SLANT_NORMAL
font_face=CAIRO_FONT_WEIGHT_NORMAL
cairo_select_font_face (cr, font, font_slant, font_face);
cairo_set_font_size (cr, font_size)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,xpos,ypos)
cairo_show_text (cr,text)
cairo_stroke (cr)
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
endIt simply draws a changing text to the screen, moving a bit to the right and down every time.
Running with conky -c conky.conf from the dir where conky.conf and script.lua are located draws the text to the root window on my system.
Offline
Pages: 1