Conky Weather and Circles Don't Work [Solved]

If you are new to Linux or new to Sabayon Linux and just not sure where to post, here ya go. Post without fear of being told to RTFM :-)

Moderator: Moderators

Conky Weather and Circles Don't Work [Solved]

Postby LaneLester » Tue Dec 15, 2009 14:52

As part of my trial migration from Ubuntu Karmic to Sabayon, I trying to get Conky working right. The standard text and graphics work fine, but not the weather and circles (see attached Ubuntu screenshot for circles).

I have all the Conky files in ~/Conky, and the permissions are the same on both the Ubuntu and Sabayon partitions: rw-r--r--

Do you have a suggestion for getting full Conky performance?

Lane
LaneLester
Baby Hen
 
Posts: 16
Joined: Sun Dec 13, 2009 17:48

Re: Conky Weather and Circles Don't Work

Postby Thev00d00 » Tue Dec 15, 2009 14:59

post your conkyrc please
Image
Please report Bugs on the Bugzilla, not forum
Please Adopt an Unanswered thread
Website / Blog : v00d00.net
twitter: Follow Me
G+: Circle Me
Thev00d00
Generally Awesome (tm)
 
Posts: 1472
Joined: Wed Feb 21, 2007 15:52
Location: United Kingdom

Re: Conky Weather and Circles Don't Work

Postby LaneLester » Tue Dec 15, 2009 18:12

Here 'tis!

Code: Select all
# conky configuration

# set to yes if you want Conky to be forked in the background
background no

# Create own window instead of using desktop (required in nautilus)
own_window no

# Use Xft?
use_xft yes

# Xft font when Xft is enabled
xftfont Bitstream Vera Sans Mono:size=10

# Text alpha when using Xft
xftalpha 0.8

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# GiB -> G
short_units yes
pad_percents 2

# Update interval in seconds
update_interval 2.0

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

text_buffer_size 6144 # 256 is the minimum

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
#minimum_size 1000 5  # I comment this out it was creating problems

# Draw shades?
draw_shades yes

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
# stippled_borders 8

# Conky: border_margin is deprecated, please use window.border_inner_margin instead
# border_inner_margin 4

# border width
# border_width 1

# Default colors and also border colors
default_color white
default_shade_color black
default_outline_color white

# 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

# Add spaces to keep things from moving about?  This only affects certain objects.
# use_spacer right

temperature_unit fahrenheit

# -- Lua Load -- #
lua_load ~/Conky/ConkyCirclesBruce.lua
lua_draw_hook_pre ring_stats

# Text alignment
alignment tl  # <<------- use this

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 20  # <<--------- also the gaps, it positions the weather away from the edge
gap_y 43  # <<--------- from the top.

# stuff after 'TEXT' will be formatted on screen


# I renamed the template you'll have to do the same
# I also changed the day name to three characters (Wed) as Wednesday (the longest day name) doesn't fit.
# I also moved: CPU: 5% a little closer to the circle, so when it becomes CPU: 22% there will be room

TEXT
${voffset 26}${goto 1173}${font Bitstream Vera Sans Mono:size=10}${time %a}
${goto 1153}${time %m/%d/%y}
${goto 1153}${time %I:%M:%S}
${voffset 55}${goto 1163}${color medium sea green}Kernel
${goto 1120}${color }$kernel
${voffset 53}${goto 1153}${color medium sea green}CPU: ${color }$cpu%
${goto 1153}${color medium sea green}MEM: ${color }$memperc%
${goto 1153}${color medium sea green}SWP: ${color }$swapperc%



${goto 1100}${color medium sea green}Highest CPU:
${goto 1100}${color #ddaa00} ${top name 1}${top_mem cpu 1}
${goto 1100}${color white} ${top name 2}${top cpu 2}
${goto 1100}${color white} ${top name 3}${top cpu 3}
${goto 1100}${color white} ${top name 4}${top cpu 4}

${goto 1100}${color medium sea green}Highest MEM:
${goto 1100}${color #ddaa00} ${top_mem name 1}${top_mem mem 1}
${goto 1100}${color white} ${top_mem name 2}${top_mem mem 2}
${goto 1100}${color white} ${top_mem name 3}${top_mem mem 3}
${goto 1100}${color white} ${top_mem name 4}${top_mem mem 4}

${goto 1100}${color medium sea green}NET:
${goto 1100}${color white}Up: ${color }${upspeed eth0} k/s
${goto 1100}${upspeedgraph eth0 20,130 000000 ffffff}
${goto 1100}${color white}Down: ${color }${downspeed eth0}k/s${color}
${goto 1100}${downspeedgraph eth0 20,130 000000 ffffff}

${goto 1100}${color medium sea green}PARTITIONS:
${goto 1100}${color medium sea green}ROOT:    ${color }${fs_used /}/${fs_size /}
${goto 1100}${fs_bar 3,100 /}
${goto 1100}${color medium sea green}DOCS:    ${color }${fs_used /mnt/docs}/${fs_size /mnt/docs}
${goto 1100}${fs_bar 3,100 /mnt/docs}
${goto 1100}${color medium sea green}PICS:    ${color }${fs_used /mnt/pics}/${fs_size /mnt/pics}
${goto 1100}${fs_bar 3,100 /mnt/pics}
${goto 1100}${color medium sea green}MUSIC:    ${color }${fs_used /mnt/music}/${fs_size /mnt/music}
${goto 1100}${fs_bar 3,100 /mnt/music}
${goto 1100}${color medium sea green}ARC:    ${color }${fs_used /mnt/arc}/${fs_size /mnt/arc}
${goto 1100}${fs_bar 3,100 /mnt/arc}
${goto 1100}${color medium sea green}INT:    ${color }${fs_used /mnt/int}/${fs_size /mnt/int}
${goto 1100}${fs_bar 3,100 /mnt/int}
${goto 1100}${color medium sea green}OPT:    ${color }${fs_used /opt}/${fs_size /opt}
${goto 1100}${fs_bar 3,100 /opt}
${execpi 1800 conkyForecast --location=USGA0115 --imperial --template=~/Conky/conkyforecast/conkyForecastClarkesville.template}
${execpi 1800 conkyForecast --location=USGA0160 --imperial --template=~/Conky/conkyforecast/conkyForecastComer.template}

and here's ConkyCirclesBruce.lua which calls the circles:
Code: Select all
--[[
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 145 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

Changelog:
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)
]]

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',
        -- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
        max=100,
        -- "bg_colour" is the colour of the base ring.
        bg_colour=0xFFFFFF,
        -- "bg_alpha" is the alpha value of the base ring.
        bg_alpha=0.1,  -- can be between 0 and 1 (0 is blank 1 colour is full)
        -- "fg_colour" is the colour of the indicator part of the ring.
        fg_colour=0xFF8C00,
        -- "fg_alpha" is the alpha value of the indicator part of the ring.
        fg_alpha=0.9,  -- can be between 0 and 1 (0 is blank 1 colour is full)
        -- "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=1190, y=290, --        x=80, y=400,
        -- "radius" is the radius of the ring.
        radius=52,
        -- "thickness" is the thickness of the ring, centred around the radius.
        thickness=12,
        -- "angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
        angle=0
    },
    {
        name='memperc',
        arg='',
        max=100,
        bg_colour=0xE3E3E3,
        bg_alpha=0.1,
        fg_colour=0x00BFFF,
        fg_alpha=0.9,
        x=1190, y=290, --        x=80, y=400,
        radius=64,
        thickness=5,
        angle=0
    },
    {
        name='swapperc',
        arg='',
        max=100,
        bg_colour=0xCDCDC1, -- bg_colour=0xFFFFFF,
        bg_alpha=0.1,
        fg_colour=0xFF0000, -- fg_colour=0x00FF00,
        fg_alpha=0.9,
        x=1190, y=290, --        x=80, y=400,
        radius=70,
        thickness=4,
        angle=0
    },
--[[
    {
        name='upspeed',
        arg='eth0',
        max=200000,
        bg_colour=0xFFFFFF,
        bg_alpha=0.1,
        fg_colour=0xFF8C00,
        fg_alpha=0.9,
        x=1190, y=470, --        x=80, y=400,
        radius=42,
        thickness=7,
        angle=90
    },
    {
        name='downspeed',
        arg='eth0',
        max=200000,
        bg_colour=0xE3E3E3,
        bg_alpha=0.1,
        fg_colour=0x00BFFF,
        fg_alpha=0.9,
        x=1190, y=470, --        x=80, y=400,
        radius=50,
        thickness=7,
        angle=90
    },   
]]
    {
        name='time',
        arg='+%S',
        max=60,
        bg_colour=0xCDCDC1,
        bg_alpha=0.1,
        fg_colour=0x7FFF00,
        fg_alpha=1.0,
        x=1190, y=100, --       x=1190, y=100,
        radius=70,
        thickness=4,
        angle=0
    },
    {
        name='time',
        arg='+%M',
        max=60,
        bg_colour=0xE3E3E3,
        bg_alpha=0.1,
        fg_colour=0x00BFFF,
        fg_alpha=1.0,
        x=1190, y=100, --       x=1190, y=100,
        radius=64,
        thickness=5,
        angle=0
    },
    {
        name='time',
        arg='+%I',
        max=12,
        bg_colour=0xFFFFFF,
        bg_alpha=0.1,
        fg_colour=0xFF8C00,
        fg_alpha=1.0,
        x=1190, y=100, --       x=1190, y=100,
        radius=52,
        thickness=12,
        angle=0
    },
}

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,angle=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['angle']
    local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']

    local angle_0=angle*(2*math.pi/360)-math.pi/2
    local t_arc=t*2*math.pi

    -- 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,angle_0,angle_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 setup_rings(pt)
        local str=''
        local value=0

        str=string.format('${%s %s}',pt['name'],pt['arg'])
        str=conky_parse(str)

        value=tonumber(str)
        pct=value/pt['max']

        draw_ring(pct,pt)
    end

    -- Check that Conky has been running for at least 1s

    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)

    if update_num>1 then
        for i in pairs(settings_table) do
            setup_rings(settings_table[i])
        end
    end
end

Lane
LaneLester
Baby Hen
 
Posts: 16
Joined: Sun Dec 13, 2009 17:48

Re: Conky Weather and Circles Don't Work

Postby neofax » Sun Jan 03, 2010 18:00

First post after hiatus to the dark side! BTW, could you post your conky -v? My assumption is lua is not compiled in the sabayon conky build. If not, how do I go about adding lua, Imlib2 and other support to conky?
neofax
Young Hen
 
Posts: 20
Joined: Tue Sep 04, 2007 19:21

Re: Conky Weather and Circles Don't Work

Postby LaneLester » Sun Jan 03, 2010 23:23

Not getting a solution to the above, I went back to Ubuntu Karmic. Now I've just had a fling at Elive Linux, and basically the same problem existed there. I think you're right about lua not included in the distro.

When I tried to compile conky in Elive, it said it wanted a new lua .deb than is not available in that version of Debian (Elive is a Debian offshoot). I don't like to compile stuff anyway, and that was enough for me to throw in the towel.

Lane
LaneLester
Baby Hen
 
Posts: 16
Joined: Sun Dec 13, 2009 17:48

Re: Conky Weather and Circles Don't Work

Postby neofax » Mon Jan 04, 2010 5:51

Success! I changed the USE flags on conky to add lua, imlib and cairo and re-emerged it. It works great. If someone can change this thread to solved.
neofax
Young Hen
 
Posts: 20
Joined: Tue Sep 04, 2007 19:21

Re: Conky Weather and Circles Don't Work

Postby Thev00d00 » Mon Jan 04, 2010 12:24

Neofax, can you file a bug against the conky entropy package to get those flags added? Thanks!
Image
Please report Bugs on the Bugzilla, not forum
Please Adopt an Unanswered thread
Website / Blog : v00d00.net
twitter: Follow Me
G+: Circle Me
Thev00d00
Generally Awesome (tm)
 
Posts: 1472
Joined: Wed Feb 21, 2007 15:52
Location: United Kingdom

Re: Conky Weather and Circles Don't Work [Solved]

Postby neofax » Tue Jan 05, 2010 4:47

Done, but I am not quite sure if it is correct as it never allowed me to select conky as the package. Here is the bug report and the instructions to get it working: Bug 1139
neofax
Young Hen
 
Posts: 20
Joined: Tue Sep 04, 2007 19:21


Return to Beginners|Newbies Area

Who is online

Users browsing this forum: No registered users and 1 guest