Conky with Lua

I am trying to use Conky, but I want to use lua with it.  Lua is not compiled with conky when I use pacman.  How do I solve this?

There is one in aur that has lau otherwise abs would be the way to go.

Similar Messages

  • Memory Leakage in Conky with Lua

    Hi there, I've been experiencing ongoing memory leakage using my Conky + Lua scripts. It tends to keep accumulating memory until I kill the process and restart it. Highest I've seen it go is 10% of my 4gb of RAM, so it does get to be substantial if unchecked.
    I did google it, and it mentioned something about cairo_destroy(cr), so I inserted it at the end of functions randomly where it made sense (to my limited scripting skills) and where it didn't (just in case), but it didn't seem to make any difference.
    Here is the lua script - it creates rings as % bars, I believe it was taken from somewhere on the arch forums months ago where it was also modified.
    Ring Meters by londonali1010 (2009)
    This script draws percentage meters as rings. It is fully customisable; all options are described in the script.
    To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
    lua_load ~/scripts/rings-v1.2.1.lua
    lua_draw_hook_pre ring_stats
    -- Background settings
    corner_r=20
    main_bg_colour=0x060606
    main_bg_alpha=0.4
    -- Ring color settings
    ring_background_color = 0x000000
    ring_background_alpha = 0.6
    ring_foreground_color = 0x909090
    ring_foreground_alpha = 1
    -- Rings settings
    settings_table = {
    name='cpu',
    arg='cpu2',
    max=100,
    bg_colour=ring_background_color,
    bg_alpha=ring_background_alpha,
    fg_colour=ring_foreground_color,
    fg_alpha=ring_foreground_alpha,
    x=50, y=55,
    radius=31,
    thickness=3,
    start_angle=-180,
    end_angle=0
    name='cpu',
    arg='cpu1',
    max=100,
    bg_colour=ring_background_color,
    bg_alpha=ring_background_alpha,
    fg_colour=ring_foreground_color,
    fg_alpha=ring_foreground_alpha,
    x=50, y=55,
    radius=35,
    thickness=3,
    start_angle=-180,
    end_angle=0
    name='memperc',
    arg='',
    max=100,
    bg_colour=ring_background_color,
    bg_alpha=ring_background_alpha,
    fg_colour=ring_foreground_color,
    fg_alpha=ring_foreground_alpha,
    x=205, y=55,
    radius=32,
    thickness=10,
    start_angle=-180,
    end_angle=-0
    require 'cairo'
    local function rgb_to_r_g_b(colour,alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
    end
    local 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
    local 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>1 then
    for i in pairs(settings_table) do
    setup_rings(cr,settings_table[i])
    end
    end
    cairo_destroy(cr)
    end
    --[[ This is a script made for draw a transaprent background for conky ]]
    local function conky_draw_bg()
    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)
    local cr=cairo_create(cs)
    -- local thick=2
    cairo_move_to(cr,corner_r,0)
    cairo_line_to(cr,w-corner_r,0)
    cairo_curve_to(cr,w,0,w,0,w,corner_r)
    cairo_line_to(cr,w,h-corner_r)
    cairo_curve_to(cr,w,h,w,h,w-corner_r,h)
    cairo_line_to(cr,corner_r,h)
    cairo_curve_to(cr,0,h,0,h,0,h-corner_r)
    cairo_line_to(cr,0,corner_r)
    cairo_curve_to(cr,0,0,0,0,corner_r,0)
    cairo_close_path(cr)
    cairo_set_source_rgba(cr,rgb_to_r_g_b(main_bg_colour,main_bg_alpha))
    --cairo_set_line_width(cr,thick)
    --cairo_stroke(cr)
    cairo_fill(cr)
    cairo_destroy(cr)
    end
    function conky_main()
    conky_draw_bg()
    conky_ring_stats()
    cairo_destroy(cr)
    end
    And this is called into conky via:
    background no
    override_utf8_locale no
    use_xft yes
    xftfont Monospace:size=8
    ## orig font cure
    text_buffer_size 2048
    update_interval 1.0
    total_run_times 0
    own_window yes
    own_window_transparent yes
    own_window_type desktop
    own_window_colour 191919
    own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
    double_buffer yes
    minimum_size 600 90
    maximum_width 320
    draw_shades no
    draw_outline no
    draw_borders no
    draw_graph_borders no
    default_color 909090
    default_shade_color fed053
    default_outline_color 7f8f9f
    alignment br
    gap_x 30
    gap_y 50
    no_buffers yes
    uppercase no
    cpu_avg_samples 2
    override_utf8_locale no
    color1 fff
    border_inner_margin 5
    border_outer_margin 5
    own_window_argb_visual no
    own_window_argb_value 200
    lua_load ~/.conky/rings.lua
    lua_draw_hook_pre main
    Left out the conky TEXT section unless anybody desperately needs to see that too.
    If anybody can point me in the right direction with this silly thing, that would be appreciated. Thanks!
    Last edited by ugugii (2011-11-16 17:42:00)

    No I meant that the destroy functions should not be in conky_main at all. Why? Because you are using cr as an argument when you have no local cr defined. You are passing the undefined value (nil) to these destroy functions and they do nothing.
    Like I said, I don't use conky or cairo but it is generally a good idea to destroy a resource you create. If you don't you will get memory leaks because "creating" is usually vague language that comes down to allocating memory and "destroy" deallocates memory.
    This line from your own post creates a surface and stores it in the cs variable:
    local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)
    Yet you forget to deallocate the surface stored in cs. So add a line like this after each cairo_destroy(cr):
    cairo_surface_destroy(cs)
    I hope that helps.

  • [SOLVED] Error when compiling conky with audacious support

    Edit: See post #8 for solution
    Hello.
    When trying to compile conky with the --enable-audacious option, I get the following error.
    checking for Audacious... configure: error: Package requirements (audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0) were not met:
    No package 'audclient' found
    Consider adjusting the PKG_CONFIG_PATH environment variable if you
    installed software in a non-standard prefix.
    Alternatively, you may set the environment variables Audacious_CFLAGS
    and Audacious_LIBS to avoid the need to call pkg-config.
    See the pkg-config man page for more details.
    ==> ERROR: A failure occurred in build().
    Aborting...
    My PKGBUILD is the one in the repos, with the addition of an --enable-audacious line. See below:
    # $Id: PKGBUILD 205494 2014-02-06 05:24:01Z bisson $
    # Maintainer: Gaetan Bisson <[email protected]>
    # Contributor: Giovanni Scafora <[email protected]>
    # Contributor: James Rayner <[email protected]>
    # Contributor: Partha Chowdhury <[email protected]>
    pkgname=conky
    pkgver=1.9.0
    pkgrel=4
    pkgdesc='Lightweight system monitor for X'
    url='http://conky.sourceforge.net/'
    license=('BSD' 'GPL')
    arch=('i686' 'x86_64')
    makedepends=('docbook2x')
    depends=('glib2' 'curl' 'lua' 'wireless_tools' 'libxml2' 'libxft' 'libxdamage' 'imlib2')
    source=("http://downloads.sourceforge.net/project/${pkgname}/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.gz")
    sha1sums=('a8d26d002370c9b877ae77ad3a3bbd2566b38e5d')
    backup=('etc/conky/'conky{,_no_x11}.conf)
    options=('!emptydirs')
    build() {
    cd "${srcdir}/${pkgname}-${pkgver}"
    CPPFLAGS="${CXXFLAGS}" LIBS="${LDFLAGS}" ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --enable-ibm \
    --enable-curl \
    --enable-rss \
    --enable-weather-xoap \
    --enable-imlib2 \
    --enable-wlan \
    --enable-audacious \
    make
    package() {
    cd "${srcdir}/${pkgname}-${pkgver}"
    make DESTDIR="${pkgdir}" install
    install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    install -Dm644 extras/vim/syntax/conkyrc.vim "${pkgdir}"/usr/share/vim/vimfiles/syntax/conkyrc.vim
    install -Dm644 extras/vim/ftdetect/conkyrc.vim "${pkgdir}"/usr/share/vim/vimfiles/ftdetect/conkyrc.vim
    Note: While similar, I don't think this problem is the same as this one.
    Last edited by Sudowoodo (2014-06-29 10:07:02)

    drcouzelis wrote:Remove the "\" from the end of "--enable-audacious". Does it work now?
    No, it's exactly the same.
    drcouzelis wrote:EDIT: Also, there's already a package for conky-audacious in the AUR.
    I tried it, that doesn't compile either, and its orphan & outdated.
    For the record, its PKGBUILD is
    Edit: Remove unnecessary text. See post #8 for solution.
    and the error is the same:
    Edit: Remove unnecessary text. See post #8 for solution.
    Have you been able to reproduce the problem? I'm using an amd64 processor and trying to build with "makepkg -s". Thank you for replying.
    Last edited by Sudowoodo (2014-06-28 12:13:28)

  • Using Conky with multiple MPD servers

    Hello gang.  I have 3 MPD servers that I connect to from my laptop (one is running on my laptop, 2 are on remote servers), and I'd like to have Conky report "now playing" info from whichever one is active at any given moment.  My issue is with dynamically identifying the host/port within Conky.
    I have a Python script that returns the host and port of the active MPD server, which is called like this:
    $ python MpdInfoHandler.py -host
    this.is.myhost
    $ python MpdInfoHandler.py -port
    6600
    So, I tried putting this in my conkyrc:
    mpd_host ${execi 300 python /pathtoscript/MpdInfoHandler.py -host}
    mpd_port ${execi 300 python /pathtoscript/MpdInfoHandler.py -port}
    This doesn't work - Conky seems to interpret the host and port as the actual strings appearing on each line.  So, my question is: is there a way to assign the output of the script calls to "mpd_host" and "mpd_port"?  Or does this only work when dealing with stuff underneath the "TEXT" section in conkyrc?
    Thanks all

    Hello gang.  I have 3 MPD servers that I connect to from my laptop (one is running on my laptop, 2 are on remote servers), and I'd like to have Conky report "now playing" info from whichever one is active at any given moment.  My issue is with dynamically identifying the host/port within Conky.
    I have a Python script that returns the host and port of the active MPD server, which is called like this:
    $ python MpdInfoHandler.py -host
    this.is.myhost
    $ python MpdInfoHandler.py -port
    6600
    So, I tried putting this in my conkyrc:
    mpd_host ${execi 300 python /pathtoscript/MpdInfoHandler.py -host}
    mpd_port ${execi 300 python /pathtoscript/MpdInfoHandler.py -port}
    This doesn't work - Conky seems to interpret the host and port as the actual strings appearing on each line.  So, my question is: is there a way to assign the output of the script calls to "mpd_host" and "mpd_port"?  Or does this only work when dealing with stuff underneath the "TEXT" section in conkyrc?
    Thanks all

  • Conky with Gnome3 and dock plugin

    Hi,
    This is how my Conky looks like in Gnome3 with Gnome-Shell. I am using following preferences:
    own_window_class Conky
    own_window yes
    own_window_type conky
    own_window_transparent yes
    own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
    While using dock, when application is maximized there is still a part of desktop background visible (the part of desktop above the Firefox icon on my screenshot). What I want to achieve is to use this spare space for conky.
    I tried following configurations:
    # Text alignment, other possible values are commented
    alignment top_left
    # Gap between borders of screen and text
    gap_x 1500
    and:
    # Text alignment, other possible values are commented
    alignment top_right
    # Gap between borders of screen and text
    gap_x -200
    unfortunatelly none of above were working. Conky stays as shown on screenshot (even if I change the "gap_x" value to "2000" or "-500"). Any ideas how to move conky 50 pixels right?

    Try commenting out own_window_hints.
    When I moved to GNOME 3, I experienced the same problem, although my grip was the inability to use ctrl+alt+up/down if I stayed on an empty desktop with conky running.

  • Conky with a bash script

    I am trying to change the color of my CPU temp text in conky to green, yellow or red based on the CPU temp.  I am getting this in my conky:
    Temperature:  color green33
    Here is my conky line:
    ${voffset 1}${goto 40}Temperature: ${font Droid Sans:style=Bold:size=8}${execpi 120 sensors | grep Core0 | paste -s | cut -c15-18 | xargs ~/.conky/colorize.sh}${hwmon 0 temp 1}°C${color}${font}${alignr}
    Here is my bash script:
    #!/bin/bash
    # colorize.sh
    COOL=65
    WARM=80
    if [[ $1 < $COOL ]];
    then
    echo "color green"
    elif [[ $1 > $WARM ]];
    then
    echo "color red"
    else
    echo "color yellow"
    fi
    exit 0
    Any help would be greatly appreciated.
    Thanks

    Using exec(p)(i) makes your conky run heavier, so, why wouldn't you use the built-in conky variables to achieve the same...
    I'm using: (before "TEXT")
    template2 ${color2}${if_match ${hwmon \1 temp \2}>75}${color orange}${if_match ${hwmon \1 temp \2}>90}${color red}${endif}${endif}${hwmon \1 temp \2}${color1}
    and i call them like: (after "TEXT")
    Temp ${template2 0 1}/${template2 1 1}/${template2 2 2}/${template2 2 4}
    Of course you need to find out what numbers you need to pass to hwmon...

  • Help with LUA script

    I need some help regarding the LUA scripting for the authentication of a vpn client. I am currently able to get the CN information from the certificate, but it comes in the form of last.first.middle.id#. what I need to do is write a script that isolates the id# which is a 10 digit number and then add a @mil to it. For instance if the certificate is returning ( smith.joe.chris.1111111111 ) I need to change that to 1111111111@mil. Thank you for your help in advance.

    So all of this is just to set the column widths to the sizes pre-defined in a paragraph style, i.e., always the same?
    I feel like I almost could do that in VB!
    But in Javascript, all it needs is sth in the ilk of
    var myWidths = [ 10, 50, 100, 50, 12 ]; // in whatever units you fancy
    var myTable = app.activeDocument.stories[0].tables[0];  // (just grabbing some table)
    for (i=0; i<myTable.columns.length; i++)
    myTable.columns[i].width = myWidths[i % myWidths.length];
    .. and the most interesting thing here (written from top of my head) is the "myWidths" lookup: it doesn't matter how many columns there are in this table, 'cause the widths array wraps around. (But you won't need this because you know all of your widths in advance.)

  • [Solved] Lua with Conky gives unwanted background color

    Hi,
    I've Googled and ransacked the forum looking for an answer. I have Conky with lua on KDE4 and I cannot run both together without creating an unwanted background. After getting sidetracked with KDE4 transparency considerations, I discovered that if I start Conky without Lua, I can get proper transparency. If I start Conky with Lua enabled I get a background color. The Lua script doesn't seem to have any background settings. I'm not sure what files are relevant to post, the conkyrc and or the Lua script, which is quite large. I'm reasonably au fait with Conky but this is the first Conky I cannot get to function correctly. My basic question is how to use Lua without starting a background color. Here is where I got the original files http://www.linuxandlife.com/2012/06/get … -your.html . Of course, I can post the relevant Lua file if necessary but, as I  mentioned, it is quite large and I'm not clear on forum rules regarding posting large files of this type. Here's how Conky starts Lua:
    lua_load ~/.conky/avi9526_conky.lua
    lua_draw_hook_pre Widgets
    Thanks for your time.
    In case anyone is interested, changing line 1236 of the Lua script to cairo_set_source_rgba(CairoContext, 0.6, 0.61, 0.62, 0.0) did the trick.
    Last edited by Foxblood (2013-04-28 14:07:15)

    If you set your minimum_size and maximum_width variables you can make it any size that you want.
    So, lets say that you are using a 1280x1024 screensize.
    You can set your minimum_size to be 1200.  If you don't provide a second option, you are specifying the width.
    Then, if you set your maximum_width to be 1280,  or, if you want a 1 pixel gap on either side 1278,  then your conky will not go off the sides of the screen, and if you use any align option, then it will stay within that specified width.
    P.S.  The reason that it doesn't go all the way across your screen right now, is because there is not enough information being displayed to warrant anything larger.
    HTH
    Last edited by Knute (2010-08-09 21:22:17)

  • [SOLVED] Conky lua problem (transparency)

    Hi,
    I'm trying to transfer my conky from Ubuntu to Arch: below is a screenshot of the Ubuntu version (what it should look like).  On Arch I have a solid black background.   If it's relevant, I'm running Archbang rather than pure Arch, so with Openbox.
    My main issue at the moment is the semi-transparency (and I'd like to have the rounded corners too).   I understand that conky 1.8.0 can do transparency, but only with a compositor, and I'd rather keep my system as light as possible.  So I've replaced my conky with 1.7.2 conky-lua from AUR and (don't know if this was necessary) installed cairo and lua from the repos.   Unfortunately the lua script I used on Ubuntu isn't working; when I run conky in the terminal I get the message ".conkyrc: 121: config file error".  At lines 120 and 121 I have my
    lua_load ~/scripts/draw_bg.lua
            lua_draw_hook_pre
    My .conkyrc and lua script are below.  Thanks for looking!
    # conky configuration
    # edited by Mark Buck (Kaivalagi) <[email protected]>
    # set to yes if you want Conky to be forked in the background
    background no
    # X font when Xft is disabled, you can pick one with program xfontsel
    #font 5x7
    #font 6x10
    #font 7x13
    #font 8x13
    #font 9x15
    #font *mintsmild.se*
    #font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
    # Use Xft?
    use_xft yes
    # Xft font when Xft is enabled
    xftfont Bitstream Vera Sans Mono:size=9
    # Text alpha when using Xft
    xftalpha 0.8
    # Update interval in seconds
    update_interval 1.0
    # This is the number of times Conky will update before quitting.
    # Set to zero to run forever.
    total_run_times 0
    # Use double buffering (reduces flicker, may not work for everyone)
    double_buffer yes
    # Minimum size of text area
    minimum_size 200 700
    maximum_width 200
    # Draw shades?
    draw_shades yes
    # Draw outlines?
    draw_outline no
    # Draw borders around text
    draw_borders no
    draw_graph_borders yes
    # Stippled borders?
    stippled_borders 8
    # border margins
    border_inner_margin 2
    border_outer_margin 2
    # border width
    border_width 1
    # Default colors and also border colors
    default_color white
    default_shade_color black
    default_outline_color white
    # own window options
    own_window yes
    own_window_type desktop
    #own_window_hints undecorated,skip_taskbar
    # Text alignment, other possible values are commented
    #alignment top_left
    alignment top_right
    #alignment bottom_left
    #alignment bottom_right
    # Gap between borders of screen and text
    # same thing as passing -x at command line
    gap_x 5
    gap_y 35
    # Subtract file system buffers from used memory?
    no_buffers yes
    # set to yes if you want all text to be in uppercase
    uppercase no
    # number of cpu samples to average
    # set to 1 to disable averaging
    cpu_avg_samples 2
    # number of net samples to average
    # set to 1 to disable averaging
    net_avg_samples 2
    # Force UTF8? note that UTF8 support required XFT
    override_utf8_locale yes
    # Add spaces to keep things from moving about? This only affects certain objects.
    use_spacer right
    # colours
    color1 white
    # light blue
    color2 6892C6
    color3 6892C6
    # green
    color4 78BF39
    # red
    color5 CC0000
    color6 88ff88
    text_buffer_size 2048
    # variable is given either in format $variable or in ${variable}. Latter
    # allows characters right after the variable and must be used in network
    # stuff because of an argument
    # stuff after 'TEXT' will be formatted on screen
    lua_load ~/scripts/draw_bg.lua
    lua_draw_hook_pre
    TEXT
    ${offset -5}${font StyleBats:style=CleanCut:size=12}q ${voffset -2}${font Bitstream Vera Sans Mono:style=Bold:size=11}Weather${font} ${hr}${color1}
    ${execpi 1800 conkyForecast --location=MZXX0003 --template=/home/mark/conky/conkyForecast.template}
    ${goto 25}${color1}${font Bitstream Vera Sans Mono:size=14}${execi 1800 conkyForecast --location=MZXX0003 --datatype=CT}${font}
    ${goto 20}${font ConkyWeather:style=Bold:size=30}${execi 1800 conkyForecast --location=MZXX0003 --datatype=WF} ${goto 120}${font ConkyWindNESW:size=30}${execi 1800 conkyForecast --location=MZXX0003 --datatype=BS}${font}
    ${goto 10}${execi 1800 conkyForecast --location=MZXX0003 --datatype=HT --centeredwidth=4}/${execi 1800 conkyForecast --location=MZXX0003 --datatype=LT --centeredwidth=4} ${goto 100}${execi 1800 conkyForecast --location=MZXX0003 --datatype=WS --imperial} - ${execi 1800 conkyForecast --location=MZXX0003 --datatype=WD}
    $if_mpd_playing${offset -5}${font StyleBats:style=CleanCut:size=12}q ${voffset -2}${font Bitstream Vera Sans Mono:style=Bold:size=11}Music${font} ${hr}${color1}
    ${font Bitstream Vera Sans:size=9}${color2}MPD:${color6} $mpd_status
    ${color}${texeci 10 /home/mark/conky/composer.sh}
    ${font Bitstream Vera Sans:size=9}$color$mpd_artist
    ${font Bitstream Vera Sans:size=9}$mpd_album
    ${font Bitstream Vera Sans:size=9}$mpd_title
    ${color #ccddff} ${mpd_bar 5, 100}
    $endif
    ${offset -5}${font StyleBats:style=CleanCut:size=12}q ${voffset -2}${font Bitstream Vera Sans Mono:style=Bold:size=11}${color1}System${font} ${hr}${color1}
    ${color2}CPU Temp: ${color}${acpitemp}${color}°${font Bitstream Vera Sans Mono:size=9}
    $color2}CPU1: $color${cpu cpu1}% ${cpubar cpu1 4,65}${font Bitstream Vera Sans Mono:size=9}
    $color2}CPU2: $color${cpu cpu2}% ${cpubar cpu2 4,65}${font Bitstream Vera Sans Mono:size=9}
    ${color2}RAM:$color $mem/$memmax
    ${color2}Root: $color${fs_used /}/${fs_size /}${font Bitstream Vera Sans Mono:size=9}
    ${color2}Home: $color${fs_used /home/}/${fs_size /home/}${font Bitstream Vera Sans Mono:size=9}
    ${color2}Today:${color6}${execi 10 vnstat -i eth0 | grep "today" | awk '{print $5 $6}'}${goto 120}${color1}${execi 10 vnstat -i eth0 | grep "today" | awk '{print $8 $9}'}
    ${color2}Week: ${color6}${execi 10 vnstat -i eth0 -w | grep "current week" | awk '{print $6 $7}'}${goto 120}${color1}${execi 10 vnstat -i eth0 -w | grep "current week" | awk '{print $9 $10}'}
    ${color2}Month: ${color6}${execi 10 vnstat -i eth0 -m | grep "`date +"%b '%y"`" | awk '{print $6 $7}'}${goto 120}${color1}${execi 10 vnstat -i eth0 -m | grep "`date +"%b '%y"`" | awk '{print $9 $10}'}${font}
    ${color2}Battery:$color ${color red}${battery_bar 4,50 BAT0}
    Background by londonali1010 (2009)
    This script draws a background to the Conky window. It covers the whole of the Conky window, but you can specify rounded corners, if you wish.
    To call this script in Conky, use (assuming you have saved this script to ~/scripts/):
    lua_load ~/scripts/draw_bg.lua
    lua_draw_hook_pre
    Changelog:
    + v1.0 -- Original release (07.10.2009)
    -- Change these settings to affect your background.
    -- "corner_r" is the radius, in pixels, of the rounded corners. If you don't want rounded corners, use 0.
    corner_r=15
    -- Set the colour and transparency (alpha) of your background.
    bg_colour=0x000000
    bg_alpha=0.4
    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 conky_draw_bg()
    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)
    cairo_move_to(cr,corner_r,0)
    cairo_line_to(cr,w-corner_r,0)
    cairo_curve_to(cr,w,0,w,0,w,corner_r)
    cairo_line_to(cr,w,h-corner_r)
    cairo_curve_to(cr,w,h,w,h,w-corner_r,h)
    cairo_line_to(cr,corner_r,h)
    cairo_curve_to(cr,0,h,0,h,0,h-corner_r)
    cairo_line_to(cr,0,corner_r)
    cairo_curve_to(cr,0,0,0,0,corner_r,0)
    cairo_close_path(cr)
    cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))
    cairo_fill(cr)
    end
    Last edited by Henry Flower (2010-04-13 04:54:08)

    The error in line 121 is because of lua_draw_hook_pre command must have a function name. In your file, it would be:
    lua_draw_hook_pre draw_bg
    To get the transparency put the command:
    own_window_transparent yes
    I have tried this in an AwesomeWM, with conky 1.8.0 compiled with lua support, and without compositing.

  • Conky-lua errors

    I am receiving the following error after installing conky-lua from AUR:
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Here is what my conky looks like:
    Conky error
    And here are the text files:
    conkyrc-blue
    background yes
    update_interval 1
    cpu_avg_samples 2
    net_avg_samples 2
    temperature_unit celsius
    double_buffer yes
    no_buffers yes
    text_buffer_size 2048
    gap_x 10
    gap_y 240
    minimum_size 210 450
    maximum_width 210
    own_window yes
    own_window_type normal
    own_window_transparent yes
    own_window_hints undecorate,below,sticky,skip_taskbar,skip_pager
    border_inner_margin 0
    border_outer_margin 0
    alignment tr
    draw_shades no
    draw_outline no
    draw_borders no
    draw_graph_borders no
    override_utf8_locale yes
    use_xft yes
    xftfont Dejavu Sans:size=8
    xftalpha 0.5
    uppercase no
    default_color 1994D1
    color1 DDDDDD
    color2 AAAAAA
    color3 888888
    color4 666666
    lua_load /home/terry/.conky/conky_grey.lua
    lua_draw_hook_post main
    TEXT
    ${voffset 35}
    ${goto 95}${color4}${font Dejavu Sans:size=22}${time %e}${color1}${offset -50}${font Dejavu Sans:size=10}${time %A}
    ${goto 85}${color2}${voffset -2}${font Dejavu Sans:size=9}${time %b}${voffset -2} ${color3}${font Dejavu Sans:size=12}${time %Y}${font}
    ${voffset 80}
    ${goto 90}${font Dejavu Sans:size=7,weight:bold}${color}CPU$
    ${goto 90}${font Dejavu Sans:size=7,weight:normal}${color1}${top name 1}${alignr}${top cpu 1}%
    ${goto 90}${font Dejavu Sans:size=7,weight:normal}${color2}${top name 2}${alignr}${top cpu 2}%
    ${goto 90}${font Dejavu Sans:size=7,weight:normal}${color3}${top name 3}${alignr}${top cpu 3}%
    ${goto 90}${cpugraph 10,100 666666 666666}
    ${goto 90}${voffset -10}${font Dejavu Sans:size=7,weight:normal}${color}${threads} process
    ${voffset 20}
    ${goto 90}${font Dejavu Sans:size=7,weight:bold}${color}MEM - ${mem}
    ${goto 90}${font Dejavu Sans:size=7,weight:normal}${color1}${top_mem name 1}${alignr}${top_mem mem 1}%
    ${goto 90}${font Dejavu Sans:size=7,weight:normal}${color2}${top_mem name 2}${alignr}${top_mem mem 2}%
    ${goto 90}${font Dejavu Sans:size=7,weight:normal}${color3}${top_mem name 3}${alignr}${top_mem mem 3}%
    ${voffset 15}
    ${goto 90}${font Dejavu Sans:size=7,weight:bold}${color}DISKS
    ${goto 90}${diskiograph 30,100 666666 666666}${voffset -30}
    ${goto 90}${font Dejavu Sans:size=7,weight:normal}${color}used: ${fs_used /home/terry} /home/terry
    ${goto 90}${font Dejavu Sans:size=7,weight:normal}${color}used: ${fs_used /} /
    ${voffset 10}
    ${goto 70}${font Dejavu Sans:size=18,weight:bold}${color3}NET${alignr}${color2}${font Dejavu Sans:size=7,weight:bold}${color}${if_up wlan0}wifi ${addr wlan0}${endif}
    ${goto 90}${font Dejavu Sans:size=7,weight:normal}${color1}Up: ${upspeed wlan0}${goto 90}${font}${alignr}${color3}${upspeedgraph wlan0 8,50}
    ${goto 90}${font Dejavu Sans:size=7,weight:normal}${color1}Down: ${downspeed wlan0}${goto 90}${font}${alignr}${color3}${downspeedgraph wlan0 8,40}
    ${goto 90}${font Dejavu Sans:size=7,weight:normal}${color1}Total Up: ${totalup wlan0}
    ${goto 90}${font Dejavu Sans:size=7,weight:normal}${color1}Total Down: ${totaldown wlan0}
    conky_grey.lua
    ==============================================================================
    -- conky_grey.lua
    -- author : SLK
    -- version : v2011011001
    -- license : Distributed under the terms of GNU GPL version 2 or later
    --==============================================================================
    require 'cairo'
    -- clock DATA
    -- HOURS
    clock_h = {
    name='time', arg='%H', max_value=12,
    x=110, y=80,
    graph_radius=53,
    graph_thickness=3,
    graph_unit_angle=30, graph_unit_thickness=30,
    graph_bg_colour=0xffffff, graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
    txt_radius=34,
    txt_weight=1, txt_size=10.0,
    txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.6,
    graduation_radius=53,
    graduation_thickness=6, graduation_mark_thickness=2,
    graduation_unit_angle=30,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
    -- MINUTES
    clock_m = {
    name='time', arg='%M', max_value=60,
    x=110, y=80,
    graph_radius=57,
    graph_thickness=2,
    graph_unit_angle=6, graph_unit_thickness=6,
    graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
    graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
    txt_radius=70,
    txt_weight=0, txt_size=9.0,
    txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.6,
    graduation_radius=57,
    graduation_thickness=0, graduation_mark_thickness=2,
    graduation_unit_angle=30,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
    -- SECONDS
    clock_s = {
    name='time', arg='%S', max_value=60,
    x=110, y=80,
    graph_radius=50,
    graph_thickness=2,
    graph_unit_angle=6, graph_unit_thickness=2,
    graph_bg_colour=0xffffff, graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.2,
    txt_radius=40,
    txt_weight=0, txt_size=12.0,
    txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.3,
    graduation_radius=0,
    graduation_thickness=0, graduation_mark_thickness=0,
    graduation_unit_angle=0,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
    -- gauge DATA
    gauge = {
    name='cpu', arg='cpu0', max_value=100,
    x=85, y=200,
    graph_radius=24,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7, graph_unit_thickness=2.7,
    graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
    graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.5,
    hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
    txt_radius=34,
    txt_weight=0, txt_size=8.0,
    txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.3,
    graduation_radius=28,
    graduation_thickness=0, graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1, caption_size=8.0,
    caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.3,
    name='cpu', arg='cpu1', max_value=100,
    x=85, y=200,
    graph_radius=18,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7, graph_unit_thickness=2.7,
    graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
    graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.5,
    hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
    txt_radius=10,
    txt_weight=0, txt_size=8.0,
    txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.3,
    graduation_radius=28,
    graduation_thickness=0, graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
    caption='',
    caption_weight=1, caption_size=8.0,
    caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.3,
    name='memperc', arg='', max_value=100,
    x=85, y=300,
    graph_radius=24,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7, graph_unit_thickness=2.7,
    graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
    graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.5,
    hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
    txt_radius=10,
    txt_weight=0, txt_size=8.0,
    txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.3,
    graduation_radius=23,
    graduation_thickness=8, graduation_mark_thickness=2,
    graduation_unit_angle=27,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.5,
    caption='',
    caption_weight=1, caption_size=8.0,
    caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.3,
    name='fs_used_perc', arg='/', max_value=100,
    x=85, y=380,
    graph_radius=24,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7, graph_unit_thickness=2.7,
    graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
    graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.5,
    hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
    txt_radius=34,
    txt_weight=0, txt_size=8.0,
    txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.5,
    graduation_radius=28,
    graduation_thickness=0, graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
    caption='/',
    caption_weight=1, caption_size=8.0,
    caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.5,
    name='fs_used_perc', arg='/home/terry', max_value=100,
    x=85, y=380,
    graph_radius=18,
    graph_thickness=5,
    graph_start_angle=180,
    graph_unit_angle=2.7, graph_unit_thickness=2.7,
    graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
    graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.5,
    hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
    txt_radius=10,
    txt_weight=0, txt_size=8.0,
    txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.5,
    graduation_radius=28,
    graduation_thickness=0, graduation_mark_thickness=1,
    graduation_unit_angle=27,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
    caption='/data',
    caption_weight=1, caption_size=8.0,
    caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.5,
    -- rgb_to_r_g_b
    -- converts color in hexa to decimal
    function rgb_to_r_g_b(colour, alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
    end
    -- angle_to_position
    -- convert degree to rad and rotate (0 degree is top/north)
    function angle_to_position(start_angle, current_angle)
    local pos = current_angle + start_angle
    return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
    end
    -- draw_clock_ring
    -- displays clock
    function draw_clock_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
    -- background ring
    cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi)
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)
    -- arc of value
    local val = (value % max_value)
    local i = 1
    while i <= val do
    cairo_arc(display, x, y, graph_radius,( ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360) )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2))
    cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha))
    cairo_stroke(display)
    i = i + 1
    end
    local angle = (graph_unit_angle * i) - graph_unit_thickness
    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
    local nb_graduation = 360 / graduation_unit_angle
    local i = 1
    while i <= nb_graduation do
    cairo_set_line_width(display, graduation_thickness)
    cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2))
    cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
    cairo_stroke(display)
    cairo_set_line_width(display, graph_thickness)
    i = i + 1
    end
    end
    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * (math.cos((angle * 2 * math.pi / 360)-(math.pi/2)))
    local movey = txt_radius * (math.sin((angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight);
    cairo_set_font_size (display, txt_size);
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha));
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3);
    cairo_show_text (display, value);
    cairo_stroke (display);
    end
    -- draw_gauge_ring
    -- displays gauges
    function draw_gauge_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_start_angle = data['graph_start_angle']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
    local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
    local graph_end_angle = (max_value * graph_unit_angle) % 360
    -- background ring
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)
    -- arc of value
    local val = value % (max_value + 1)
    local start_arc = 0
    local stop_arc = 0
    local i = 1
    while i <= val do
    start_arc = (graph_unit_angle * i) - graph_unit_thickness
    stop_arc = (graph_unit_angle * i)
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
    cairo_stroke(display)
    i = i + 1
    end
    local angle = start_arc
    -- hand
    start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
    stop_arc = (graph_unit_angle * val)
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
    cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
    cairo_stroke(display)
    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
    local nb_graduation = graph_end_angle / graduation_unit_angle
    local i = 0
    while i < nb_graduation do
    cairo_set_line_width(display, graduation_thickness)
    start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
    stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
    cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
    cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
    cairo_stroke(display)
    cairo_set_line_width(display, graph_thickness)
    i = i + 1
    end
    end
    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
    local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
    cairo_set_font_size (display, txt_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
    cairo_show_text (display, value)
    cairo_stroke (display)
    -- caption
    local caption = data['caption']
    local caption_weight, caption_size = data['caption_weight'], data['caption_size']
    local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
    local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
    cairo_set_font_size (display, caption_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
    cairo_move_to (display, x + tox + 5, y + toy + 1)
    -- bad hack but not enough time !
    if graph_start_angle < 105 then
    cairo_move_to (display, x + tox - 30, y + toy + 1)
    end
    cairo_show_text (display, caption)
    cairo_stroke (display)
    end
    -- go_clock_rings
    -- loads data and displays clock
    function go_clock_rings(display)
    local function load_clock_rings(display, data)
    local str, value = '', 0
    str = string.format('${%s %s}',data['name'], data['arg'])
    str = conky_parse(str)
    value = tonumber(str)
    draw_clock_ring(display, data, value)
    end
    for i in pairs(clock_h) do
    load_clock_rings(display, clock_h[i])
    end
    for i in pairs(clock_m) do
    load_clock_rings(display, clock_m[i])
    end
    for i in pairs(clock_s) do
    load_clock_rings(display, clock_s[i])
    end
    end
    -- go_gauge_rings
    -- loads data and displays gauges
    function go_gauge_rings(display)
    local function load_gauge_rings(display, data)
    local str, value = '', 0
    str = string.format('${%s %s}',data['name'], data['arg'])
    str = conky_parse(str)
    value = tonumber(str)
    draw_gauge_ring(display, data, value)
    end
    for i in pairs(gauge) do
    load_gauge_rings(display, gauge[i])
    end
    end
    -- MAIN
    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 display = cairo_create(cs)
    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)
    if update_num > 5 then
    go_clock_rings(display)
    go_gauge_rings(display)
    end
    end

    Sorry, I wanted to put code tags, but I was unaware of the command. I am running conky-lua-nv 1.8.0-1 from the AUR. There also seems to be some issue with the drawing of the rings, as it shows percents but not the graphical rings that go with it. I suspect it has something to do with the lua file. Anyone see any issue?

  • [SOLVED] Attempting to build conky-lua

    Trying to get conky-1.9.0 to work with lua, got all the flags set so it does, but anytime I attempt to run make on it, It constantly gives me this error.
    Making all in src
    make[1]: Entering directory `/home/multimoon/Documents/conky-1.9.0/src'
    make  all-am
    make[2]: Entering directory `/home/multimoon/Documents/conky-1.9.0/src'
    make[2]: Leaving directory `/home/multimoon/Documents/conky-1.9.0/src'
    make[1]: Leaving directory `/home/multimoon/Documents/conky-1.9.0/src'
    Making all in doc
    make[1]: Entering directory `/home/multimoon/Documents/conky-1.9.0/doc'
    make[1]: Nothing to be done for `all'.
    make[1]: Leaving directory `/home/multimoon/Documents/conky-1.9.0/doc'
    Making all in lua
    make[1]: Entering directory `/home/multimoon/Documents/conky-1.9.0/lua'
    Makefile:678: *** missing separator.  Stop.
    make[1]: Leaving directory `/home/multimoon/Documents/conky-1.9.0/lua'
    make: *** [all-recursive] Error 1
    I'm decent with linux, rather new to Archlinux, so If anyone can give me a hand, I would appreciate it.
    Last edited by Multimoon (2012-10-13 02:38:51)

    Output for pacman -Ql conky-lua:
       conky-lua /etc/conky/conky.conf
       conky-lua /etc/conky/conky_no_x11.conf
       conky-lua /usr/
       conky-lua /usr/bin/
       conky-lua /usr/bin/conky
       conky-lua /usr/lib/
       conky-lua /usr/lib/conky/
       conky-lua /usr/lib/conky/libcairo.a
       conky-lua /usr/lib/conky/libcairo.la
       conky-lua /usr/lib/conky/libcairo.so
       conky-lua /usr/lib/conky/libcairo.so.0
       conky-lua /usr/lib/conky/libcairo.so.0.0.0
       conky-lua /usr/lib/conky/libimlib2.a
       conky-lua /usr/lib/conky/libimlib2.la
       conky-lua /usr/lib/conky/libimlib2.so
       conky-lua /usr/lib/conky/libimlib2.so.0
       conky-lua /usr/lib/conky/libimlib2.so.0.0.0
       conky-lua /usr/share/
       conky-lua /usr/share/licenses/
       conky-lua /usr/share/licenses/conky/
       conky-lua /usr/share/licenses/conky/LICENSE
       conky-lua /usr/share/man/
       conky-lua /usr/share/man/man1/
       conky-lua /usr/share/man/man1/conky.1.gz
       conky-lua /usr/share/vim/
       conky-lua /usr/share/vim/vimfiles/
       conky-lua /usr/share/vim/vimfiles/ftdetect/
       conky-lua /usr/share/vim/vimfiles/ftdetect/conkyrc.vim
       conky-lua /usr/share/vim/vimfiles/syntax/
       conky-lua /usr/share/vim/vimfiles/syntax/conkyrc.vim
    Then for find:
    /usr/lib/libcairo.so
    /usr/lib/conky/libcairo.so
    Last edited by Multimoon (2012-10-11 20:19:04)

  • Conky-lua problem

    I used this as a lua script guide for conky (semi-relvent)
    error message I can't resolve with my current lua knowledge or though research/script reading.
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    conky config
    # Conky, a system monitor, based on torsmo
    # Any original torsmo code is licensed under the BSD license
    # All code written since the fork of torsmo is licensed under the GPL
    # Please see COPYING for details
    # Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
    # Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
    # All rights reserved.
    # 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, either version 3 of the License, or
    # (at your option) any later version.
    # 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, see <http://www.gnu.org/licenses/>.
    # - Conky settings - #
    update_interval .5
    total_run_times 0
    net_avg_samples 1
    cpu_avg_samples 1
    imlib_cache_size 0
    double_buffer yes
    no_buffers yes
    # - Text settings - #
    use_xft yes
    xftfont Ubuntu:size=9
    override_utf8_locale yes
    text_buffer_size 2048
    # - Window specifications - #
    own_window_class Conky
    own_window yes
    own_window_type override
    own_window_transparent yes
    own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
    #own_window_argb_visual yes
    #own_window_argb_value 100
    alignment bottom_right
    alignment tr
    gap_x -2
    gap_y 180
    minimum_size 350 300
    default_bar_size 100 8
    draw_shades no
    default_color efefef
    default_shade_color 1d1d1d
    background no
    border_width 1
    default_color white
    default_outline_color white
    default_shade_color white
    draw_borders no
    draw_graph_borders yes
    draw_outline no
    out_to_console no
    out_to_stderr no
    extra_newline no
    own_window yes
    own_window_class Conky
    own_window_type desktop
    stippled_borders 0
    update_interval 1.0
    uppercase no
    use_spacer none
    show_graph_scale no
    show_graph_range no
    lua_load ./conky_outline.lua
    lua_draw_hook_post main
    TEXT
    $alignc CPU
    #${scroll 16 $nodename - $sysname $kernel on $machine | }
    #$hr
    #${color grey}Uptime:$color $uptime
    #${color grey}Frequency (in MHz):$color $freq
    #${color grey}Frequency (in GHz):$color $freq_g
    #${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}
    #${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}
    #${color grey}CPU Usage:$color ${cpu cpu0}% ${cpugauge 0}
    #${color grey}Processes:$color $processes ${color grey}Running:$color $running_processes
    #$hr
    #${color grey}File systems:
    # / $color${fs_used /}/${fs_size /} ${fs_bar 6 /}
    #${color grey}Networking:
    #Up:$color ${upspeed eth0} ${color grey} - Down:$color ${downspeed eth0}
    #$hr
    #${color grey}Name PID CPU% MEM%
    #${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
    #${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
    #${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
    #${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
    the lua script giving the errors
    --[[line_width=5
    top_left_x=20
    top_left_y=20
    rec_width=50
    rec_height=50
    red=1
    green=0
    blue=0
    alpha=1 ]]
    --draw it
    require 'cario'
    line_width=5
    top_left_x=20
    top_left_y=20
    rec_width=50
    rec_height=50
    red=1
    green=0
    blue=0
    alpha=1
    function conky_main()
    if value == nil then value = 0 end
    pct = value/pt['max']
    if conky_window == nil then return end
    --local updates = conky_parse('${updates}')
    -- update_num = tonumber(updates)
    --if updates_num>5 then
    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}')
    cairo_set_line_width (cr,line_width)
    cairo_rectangle (cr,top_left_x,top_left_y,rec_width,rec_height)
    cairo_set_source_rgba (cr,red,green,blue,alpha)
    --end-- if updates>5
    cairo_destroy(cr)
    cairo_surface_destroy(cs)
    cr=nil
    end-- end main function
    ra
    backgroud for anybody that cares.
    Ive been trying to learn enough about lua and conky enough to make my own lua script for conky for flexabilty reasons. I want to be able to draw the background with lua which is what im trying to do here as a proof of concept.

    runny6play wrote:
    I tried it. It had no effect. also I changed lua_draw_hook_post main to lua_draw_hook_post conky_main
    and this is what i got. though i think its just annother error for the setting i just changed because its incorrect.
    Conky: llua_load: /home/alec/conky_outline.lua:11: module 'cario' not found:
    no field package.preload['cario']
    no file './cario.lua'
    no file '/usr/share/lua/5.1/cario.lua'
    no file '/usr/share/lua/5.1/cario/init.lua'
    no file '/usr/lib/lua/5.1/cario.lua'
    no file '/usr/lib/lua/5.1/cario/init.lua'
    no file '/usr/lib/conky/libcario.so'
    no file './cario.so'
    no file '/usr/lib/lua/5.1/cario.so'
    no file '/usr/lib/lua/5.1/loadall.so'
    Conky: desktop window (15d) is root window
    Conky: window type - desktop
    Conky: drawing to created window (0x1200001)
    Conky: drawing to double buffer
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
    Shouldn't that be "Cairo" and not "Cario"?

  • [solved] Issue with conky and Kde 4

    I have a small issue with conky and KDE 4.2. I start conky with a script which I stored under ~/.kde/Autostart. The script is simple and looks like this..
    conky -c ~/.conkyrc_kde4
    This works fine. But when I restart the first KDE and check with ps, I have 2 instances of conky running. The instances keep on growing with the number of restarts.
    I think kde tries to restart all the apps which were running when the session was terminated. Is there a way to change this behavior in general or all the programs or for only a specific program like conky ?
    Last edited by rangalo (2009-07-28 19:02:17)

    I did
    Systemsettings > Advanced > Session Manager > Start with an empty session
    and put everything you want in Autostart

  • [SOLVED] Conky 100% transparent bg with Compiz

    Enabling the Compiz Wallpaper (diffrent wallpaper at different desktop) with disabled nautilus/xfdesktop to draw on it..
    How to make conky seems not to lose the transparency?
    Last edited by rhoit (2013-01-18 16:36:04)

    Hmm, I'm not too sure then. Have you tried asking in the compiz IRC channel? #compiz on freenode. Also these might be relevant:
    http://ubuntuforums.org/showthread.php?t=1478252
    http://connermccall.com/20080729/conky-with-compiz/
    Good luck!

  • Problem with Conky + Slim

    Hello everyone!
    I'm having an issue when running Conky with SLiM. Conky's background should be transparent, but on my desktop, instead of being transparent, shows a part of SLiM's background. I don't know how to fix this, could you help me??
    Thanks in advance!

    Hi everybody.  I came across this post because conky was doing the same thing to me as to OP.  I'm running SLiM and Xfce on top of Arch Linux PPC, and conky would show my underlying SLiM background instead of Xfce's when I wanted transparency.  I tried all the solutions offered here without success, but fortunately I found another way.
    What finally worked was enabling compositing in Xfce's Window Manager Tweaks dialog (Applications Menu --> Settings --> Window Manager Tweaks --> Compositor).  I turned it on, fired up conky, and I got a beautiful, see-through conky showing my regular background.  Woo! 
    my .conkyrc:
    # fork to background?
    background yes
    # Use double buffering (reduces flicker, may not work for everyone)
    double_buffer yes
    update_interval 2.0
    # Create own window instead of using desktop (required in nautilus)
    own_window yes
    own_window_class Conky
    own_window_type desktop
    own_window_transparent yes
    own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
    own_window_argb_visual yes
    #own_window_argb_value 100
    #own_window_colour hotpink
    use_xft yes
    xftfont Bitstream Vera Sans Mono:size=08
    cpu_avg_samples 2
    net_avg_samples 2
    out_to_console no
    # mail spool
    mail_spool $MAIL
    # Draw borders around text
    draw_borders no
    # Stippled borders?
    stippled_borders 10
    # border width
    border_width 1
    # Default colors and also border colors
    default_color white
    # Text alignment, other possible values are commented
    alignment top_right
    # Gap between borders of screen and text
    #gap_x 13
    gap_y 30
    # Add spaces to keep things from moving about? This only affects certain objects.
    use_spacer none
    # Subtract file system buffers from used memory?
    no_buffers yes
    # set to yes if you want all text to be in uppercase
    uppercase no
    TEXT
    $nodename - $sysname $kernel on $machine
    $stippled_hr
    ${color lightgrey}Uptime:$color $uptime ${color lightgrey}- Load:$color $loadavg
    ${color lightgrey}CPU Usage:${color #5000a0} ${cpu cpu1}% ${cpubar cpu1}
    ${color black}${cpugraph 000000 5000a0}
    ${color lightgrey}RAM Usage:$color $mem/$memmax - $memperc% $membar
    ${color lightgrey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar}
    ${color lightgrey}Processes:$color $processes ${color grey}Running:$color $running_processes
    $color$stippled_hr
    ${color lightgrey}Networking:
    Down:${color #8844ee} ${downspeed wlan0} ${color lightgrey} ${offset 70}Up:${color #22ccff} ${upspeed wlan0}
    ${color black}${downspeedgraph wlan0 32,150 ff0000 0000ff} $alignr${color black}${upspeedgraph wlan0 32,150 0000ff ff0000}
    $color$stippled_hr
    ${color lightgrey}File systems:
    / $color${fs_used /}/${fs_size /} ${fs_bar /}
    $color$stippled_hr
    ${color}Proc usage: PID CPU% MEM%
    ${color #ddaa00} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
    ${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
    ${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
    ${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
    ${color lightgrey} ${top name 5} ${top pid 5} ${top cpu 5} ${top mem 5}
    ${color}Mem usage:
    ${color #ddaa00} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
    ${color lightgrey} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
    ${color lightgrey} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
    ${color lightgrey} ${top_mem name 4} ${top_mem pid 4} ${top_mem cpu 4} ${top_mem mem 4}
    ${color lightgrey} ${top_mem name 5} ${top_mem pid 5} ${top_mem cpu 5} ${top_mem mem 5}
    I'd like to note that I needed own_window_type to be desktop.  Setting to override shows the SLiM background again.  Or maybe just a black background, I don't know.  Anyway, choose desktop.
    Just thought I'd share what worked for me, after hours of frustration.
    Last edited by eap (2012-02-28 23:06:18)

Maybe you are looking for

  • How to Configure Location based Accounts system for a company

    Hi Experts, My client using SAP B1 2007B PL13. I am configuring the Accounts part. here My client is involved in manufacturing business. so there are 3 locations like Location 1: Head Office Location 2: Factory1 and Warehouse1. Location 3: Factory2 a

  • Preloader not working !!!

    Hi All, I used 2 preloaders code, but both are not working !!!, what problem with this code ? script 1 stop(); this.addEventListener(Event.ENTER_FRAME, loading); function loading(e:Event):void           var total:Number = this.stage.loaderInfo.bytesT

  • Computer as video source

    Thanks for all the help on the auto-stop function, it worked! Now for my next question:  Is there any way to pull the video from the computer as the video source.  What I am looking to do is to capture a PowerPoint presentation with audio (speaker ta

  • Windows7 and Quicktime error -43

    I've downloaded QuickTime and installed it. If I click on the desktop shortcut, nothing appears to happen although the program is listed as running in the task manager processes tab. If I go to the directory where the software was installed and doubl

  • How do i remove Handango Icon

    i have removed it from the desktop manager and when i run the "Application Manager" it doesn't list Handango any longer but the icon lingers on my blackberry?....