You are not logged in.

#1 2010-05-22 21:59:23

hume's doona
Member
Registered: 2009-12-11
Posts: 206

[SOLVED]conky-lua-nv help?

Hi,

I just installed conky-lua-nv from the aur, trying to get lua rings working, but I get this error when I attempt to run it:

Conky: /home/dan/.conky_rings: 2: no such configuration: 'lua_load'
Conky: /home/dan/.conky_rings: 3: no such configuration: 'lua_draw_hook_pre'

Output of conky -v is:

 conky -v
Conky 1.8.0 compiled Tue Mar 30 22:49:25 UTC 2010 for Linux 2.6.32-ARCH (x86_64)

Compiled in features:

System config file: /etc/conky/conky.conf
Package library path: /usr/lib/conky

 X11:
  * Xdamage extension
  * XDBE (double buffer extension)
  * Xft
  * ARGB visual

 Music detection:
  * MPD
  * MOC

 General:
  * math
  * hddtemp
  * portmon
  * Curl
  * RSS
  * wireless
  * support for IBM/Lenovo notebooks
  * config-output
  * Imlib2
  * ALSA mixer support
  * apcupsd
  * iostats
  * ncurses

my test conkyrc, I'll fix it up once I work out how to get it to start hmm

# — Lua Load — #
lua_load ~/conky/lua/rings.lua
lua_draw_hook_pre ring_stats

TEXT
${voffset 25}${font Zekton:size=50}${goto 500}${time %H:%M:%S}${voffset -4}
${voffset -58}${goto 173}${color 1E90FF}${hr 2}${font Zekton:size=10}${color}
${voffset -50}${goto 240}${time %A}${voffset -6}${font Zekton:size=14} ${time %d %B %Y}${font Zekton:size=10}
${voffset 10}${goto 240}Conky ${conky_version}   ${goto 500}Kernel: ${kernel} 
${goto 240}${exec whoami} @ $nodename $machine   ${goto 500}Uptime: ${uptime}
${goto 240}${desktop_name}  /  Gesamt: ${desktop_number} - ${desktop}
${font}
${voffset -135}
${goto 90}${color 1E90FF}RAM: ${memperc}%
${goto 90}${color FF0000}CPU-1: ${cpu cpu0}%
${goto 90}${color FF0000}CPU-2: ${cpu cpu1}%
${goto 90}${color FFFF00}BAT: ${battery_percent BAT0}%
${goto 90}${color 00FF00}Disk: ${fs_used_perc /}%${color}

and rings.lua:

--[[
Ring Meters by londonali1010 (2009)

This script draws percentage meters as rings. It is fully customisable; all options are described in the script.

IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 129 uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num>5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num>3; conversely if you update Conky every 0.5s, you should use update_num>10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.

To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
    lua_load ~/scripts/rings.lua
    lua_draw_hook_pre ring_stats
]]

settings_table = {
    {
        -- Edit this table to customise your rings.
        -- You can create more rings simply by adding more elements to settings_table.
        -- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
        name='cpu',
        -- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
        arg='cpu0',
        -- "bg_colour" is the colour of the base ring.
        bg_colour=0xCDCDC1,
        -- "bg_alpha" is the alpha value of the base ring.
        bg_alpha=0.5,
        -- "fg_colour" is the colour of the indicator part of the ring.
        fg_colour=0xFF0000,
        -- "fg_alpha" is the alpha value of the indicator part of the ring.
        fg_alpha=0.8,
        -- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
        x=120, y=120,
        -- "radius" is the radius of the ring.
        radius=81,
        -- "thickness" is the thickness of the ring, centred around the radius.
        thickness=10
    },
    {
        name='cpu',
        arg='cpu1',
        bg_colour=0xCDCDC1,
        bg_alpha=0.5,
        fg_colour=0xFF0000,
        fg_alpha=0.8,
        x=120, y=120,
        radius=93,
        thickness=10
    },
    {
        name='memperc',
        arg='',
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x1E90FF,
        fg_alpha=0.5,
        x=120, y=120,
        radius=102.5,
        thickness=5
    },
    {
        name='fs_used_perc',
        arg='/',
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0x00FF00,
        fg_alpha=0.5,
        x=120, y=120,
        radius=58,
        thickness=10
    },
    {
        name='battery_percent',
        arg='BAT0',
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0xFFFF00,
        fg_alpha=1,
        x=120, y=120,
        radius=70,
        thickness=10
    },
}
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(t, pt)
    if conky_window == nil then return end
    local w, h = conky_window.width, conky_window.height
    local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual,w,h)
    
    cr=cairo_create(cs)
    
    local xc, yc, ring_r, ring_w = pt['x'], pt['y'], pt['radius'], pt['thickness']
    local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']

    local t_arc=2*t*math.pi/100

    -- Draw background ring

    cairo_arc(cr,xc,yc,ring_r,0,2*math.pi)
    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,0,t_arc)
    cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
    cairo_stroke(cr)        
    
    cairo_destroy(cr)
    cr = nil
end

function conky_cairo_cleanup()
    cairo_surface_destroy(cs)
    cs = nil
end

function conky_ring_stats()
    local function parse_options(pt)
        local str=''
        local value=0
        
        str=string.format('${%s %s}',pt['name'],pt['arg'])
        if pcall(conky_parse,str) then
            str = conky_parse(str)
        else str='0'
        end
        
        value=tonumber(str)
        draw_ring(value, pt)
    end
    
    -- Check that Conky has been running for at least 5s
    
    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
    
    if update_num>5 then
        for i in pairs(settings_table) do
            parse_options(settings_table[i])
        end
    end
end

Last edited by hume's doona (2010-05-23 14:59:46)

Offline

#2 2010-05-22 23:33:43

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: [SOLVED]conky-lua-nv help?

Are you sure there were no errors while compiling and installing the package?

Because for me conky -v prints:

Conky 1.8.0 compiled Sun Apr 11 11:55:18 UTC 2010 for Linux 2.6.33-ARCH (x86_64)

Compiled in features:

System config file: /etc/conky/conky.conf
Package library path: /usr/lib/conky

 X11:
  * Xdamage extension
  * XDBE (double buffer extension)
  * Xft
  * ARGB visual

 Music detection:
  * MPD
  * MOC

 General:
  * math
  * hddtemp
  * portmon
  * Curl
  * RSS
  * wireless
  * support for IBM/Lenovo notebooks
  * nvidia
  * config-output
  * Imlib2
  * ALSA mixer support
  * apcupsd
  * iostats
  * ncurses
  * Lua

  Lua bindings:
   * Cairo
   * Imlib2

If you want to, you could try the package of my repository: http://andrwe.dyndns.org/repo/

Last edited by Andrwe (2010-05-22 23:34:10)

Offline

#3 2010-05-23 14:59:17

hume's doona
Member
Registered: 2009-12-11
Posts: 206

Re: [SOLVED]conky-lua-nv help?

@Andrwe- Thanks, I had to remove conky and reinstall. Now I just have to tweak it.

Offline

Board footer

Powered by FluxBB