How to install Conky with LUA?

I’d like to install Conky with LUA, which should be conky-all on DEBIAN-based systems. I tried, both AUR-packages with errors (built-process dos not finish):

  • conky 1.12.2-1 which is installed, but does not have LUA support.
  • Following the Wiki and ArchWiki conky-lua (AUR) and conky-caira-no-nvidia (as I don’t have nvidia hardware.

Any chance to get Conky with LUA running?

Install the normal conky package form the repository. This version has LUA support.

Thank you, you’re right, I have actually:

$ pamac list -f conky
/usr/bin/conky
/usr/lib/libconky_core.a
/usr/lib/libtcp-portmon.a
/usr/share/applications/conky.desktop
/usr/share/doc/conky-1.12.2_pre/conky.conf
/usr/share/doc/conky-1.12.2_pre/conky_no_x11.conf
/usr/share/doc/conky-1.12.2_pre/convert.lua
/usr/share/doc/conky-1.12.2_pre/html/config_settings.html
/usr/share/doc/conky-1.12.2_pre/html/docs.html
/usr/share/doc/conky-1.12.2_pre/html/lua.html
/usr/share/doc/conky-1.12.2_pre/html/variables.html
/usr/share/icons/hicolor/scalable/apps/conky-logomark-violet.svg
/usr/share/licenses/conky/COPYING
/usr/share/man/man1/conky.1.gz
/usr/share/vim/vimfiles/ftdetect/conkyrc.vim
/usr/share/vim/vimfiles/syntax/conkyrc.vim

But running my conkyrc produces tis message:

conky -c /home/micha/.conky/conkyrc
conky: llua_load: /home/micha/.conky/rings.lua:64: module 'cairo' not found:
        no field package.preload['cairo']
        no file '/usr/share/lua/5.4/cairo.lua'
        no file '/usr/share/lua/5.4/cairo/init.lua'
        no file '/usr/lib/lua/5.4/cairo.lua'
        no file '/usr/lib/lua/5.4/cairo/init.lua'
        no file './cairo.lua'
        no file './cairo/init.lua'
        no file '/usr/lib/conky/libcairo.so'
        no file '/usr/lib/lua/5.4/cairo.so'
        no file '/usr/lib/lua/5.4/loadall.so'
        no file './cairo.so'

What is missing here?

You LUA Script needs cario. This is a problem, since the normal conky package does not support cario. It is only build with Imlib2.

Thank you @xabbu, guess you mean imlib2, not Imlib2. imlib2 is installed here but you mentioned the build-process. So no chance to get it running on MANJARO?

The library is actually called Imlib2, with a capital i. The package for this library is called imlib2 .

However if you need cairo support, you need to install conky-cairo . It did build on my system. Make sure you edit the PKGBUILD and update the version to 1.12.2 . Maybe don’t use an AUR helper and do it the manual way.

Diff
diff --git a/PKGBUILD b/PKGBUILD
index 5f6be7e..0012c76 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -22,7 +22,7 @@
 # 'perl-xml-libxml' 'perl-xml-sax-expat' in makedepends
 
 pkgname=conky-cairo
-pkgver=1.11.3
+pkgver=1.12.2
 pkgrel=1
 pkgdesc='conky - built for nvidia - Just change one variable to build the git version - defaults to release version.'
 url='https://github.com/brndnmtthws/conky'

You can also use the conky-lua, but you need to change a little bit more.

Thank you @xabbu, sorry for my error about Imlib2; you’re right! As I don’t have nvidia on my hardware, should I use conky-cairo or conky-cairo-no-nvidia 1.11.5-2? If …no-nvidia

pkgname=conky-cairo-no-nvidia
_pkgname=conky
pkgver=1.12.2
pkgrel=2

instead the original (which doesn’t run):
pkgname=conky-cairo-no-nvidia
_pkgname=conky
pkgver=1.11.5
pkgrel=2

Does the no-nvidia package build?

Just keep in mind that the nvidia option doesn’t add any extra dependencies and the nvidia package doesn’t need to be installed. It really doesn’t matter. But if you don’t want it, just turn it off ( BUILD_NVIDIA=OFF ). If you need one of the turned off options, you can turn them on. But you might get an error or you need to add extra dependencies.

No, id did not, but I did not modify the versions.
From what I understood from yoyur explanations, I would try (modifications in ** bold **):

pkgname=conky-cairo
**pkgver=1.12.2**
**pkgrel=1**
pkgdesc='conky - built for nvidia - Just change one variable to build the git version - defaults to release version.'
url='https://github.com/brndnmtthws/conky'
license=('GPL3' 'BSD')
arch=('i686' 'x86_64')

replaces=('torsmo' 'conky')
conflicts=('conky')
provides=('conky')

**SNIP**

	cmake \
		-D CMAKE_BUILD_TYPE=Release \
		-D CMAKE_INSTALL_PREFIX=/usr \
		-D BUILD_WLAN=ON \
		-D BUILD_CURL=ON \
		-D BUILD_RSS=OFF \
		-D BUILD_XDBE=ON \
		-D BUILD_XSHAPE=ON \
		-D BUILD_IMLIB2=ON \
		-D BUILD_ICONV=ON \
		-D BUILD_WEATHER_METAR=OFF \
		-D BUILD_WEATHER_XOAP=OFF \
		-D BUILD_LUA_CAIRO=ON \
		-D BUILD_LUA_IMLIB2=ON \
		-D BUILD_LUA_RSVG=ON \
		-**D BUILD_NVIDIA=OFF** \
		.

	make

}

This looks ok. But you don’t need to change pkgrel=1 . Just leave it at 1.

The Build worked fine, but running my conky.rc thows this error:

$ conky -c /home/micha.conky/conkyrc
conky: desktop window (1e00019) is subwindow of root window (6aa)
conky: window type - normal
conky: drawing to created window (0x4e00002)
conky: drawing to double buffer
cp: Calling stat for 'null.png' not possible: File not found

As null.png is not metioned in my files, I’m lost actually …

Maybe in the LUA script. There is maybe a function that selects different images based on a calculated value. But this has nothing to do with LUA or cairo. It is just a config issue.

You’re right! This is the LUA-script, I don’t see the issue and it’s running on a DEBIAN-based system:

settings_table = {
{
    name='cpu',
    arg='cpu0',
    max=100,
    bg_colour=0xffffff,
    bg_alpha=0.1,
    fg_colour=0xffffff,
    fg_alpha=0.8,
    x=30, y=220,
    radius=20,
    thickness=5,
    start_angle=0,
    end_angle=360
  },
  
  {
    name='memperc',
    arg='',
    max=100,
    bg_colour=0xffffff,
    bg_alpha=0.1,
    fg_colour=0xffffff,
    fg_alpha=0.8,
    x=130, y=220,
    radius=20,
    thickness=5,
    start_angle=0,
    end_angle=360
  },
  
  {
    name='fs_used_perc',
    arg='/home',
    max=100,
    bg_colour=0xffffff,
    bg_alpha=0.1,
    fg_colour=0xffffff,
    fg_alpha=0.8,
    x=230, y=220,
    radius=20,
    thickness=5,
    start_angle=0,
    end_angle=360
  },
   {
    name='fs_used_perc',
    arg='/',
    max=100,
    bg_colour=0xffffff,
    bg_alpha=0.1,
    fg_colour=0xffffff,
    fg_alpha=0.8,
    x=230, y=220,
    radius=12,
    thickness=5,
    start_angle=0,
    end_angle=360
  },

}

require 'cairo'

function rgb_to_r_g_b(colour,alpha)
	return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function draw_ring(cr,t,pt)
	local w,h=conky_window.width,conky_window.height
	
	local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
	local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']

	local angle_0=sa*(2*math.pi/360)-math.pi/2
	local angle_f=ea*(2*math.pi/360)-math.pi/2
	local t_arc=t*(angle_f-angle_0)

	-- Draw background ring

	cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
	cairo_set_line_width(cr,ring_w)
	cairo_stroke(cr)
	
	-- Draw indicator ring

	cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
	cairo_stroke(cr)		
end

function conky_ring_stats()
	local function setup_rings(cr,pt)
		local str=''
		local value=0
		
		str=string.format('${%s %s}',pt['name'],pt['arg'])
		str=conky_parse(str)
		
		value=tonumber(str)
		if value == nil then value = 0 end
		pct=value/pt['max']
		
		draw_ring(cr,pct,pt)
	end

	if conky_window==nil then return end
	local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)
	
	local cr=cairo_create(cs)	
	
	local updates=conky_parse('${updates}')
	update_num=tonumber(updates)
	
	if update_num>5 then
		for i in pairs(settings_table) do
			setup_rings(cr,settings_table[i])
		end
	end
   cairo_surface_destroy(cs)
   cairo_destroy(cr)
end

I also don’t see a pointer to a file called null.png. Maybe it is somewhere else.

The error about the missing null.png has been caused by a delayed activation of an access for weather-data. So, no problem wit MANJARO.
Thanks again for your support!

As described above, I used pkgname=conky-cairo. This worked, but only once after re-booting the machine, e.g.:

  • Boot the machine
  • In terminal: conky -c /~/.conky/conkyrc # Conky is shown
  • In this terminal CTRL-C or an a second one: killall conky
  • The conky disappears, as desired.
  • In the terminal : conky -c /~/.conky/conkyrc # NO Conky is shown

Now I removed pkgname=conky-cairo and installed conky-lua-nv (Repository Version) instead. Now I can stop and start the conky as often I like.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.