You are not logged in.

#1 2012-06-28 12:33:15

darnir
Member
Registered: 2011-12-21
Posts: 47

Need help configuring conky

I started using conky only very recently and am still very new to configuring it.
I was trying to get this particular conky config running on my system, but I am having a lot of problems with it. I would be glad if someone could help me out with it.

The conky config is called NightDrive, and is made by an Arch user, who goes by the name "sen" on the forums.

The conkyrc file is:

##################################################
##################################################
##												##
##					Settings					##
##												##
##################################################
##################################################
background no
update_interval 1.0
double_buffer yes
no_buffers yes
cpu_avg_samples 2
net_avg_samples 2
text_buffer_size 2048
imlib_cache_size 0
override_utf8_locale yes


# +++++ Window +++++
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

border_inner_margin 0
border_outer_margin 0

minimum_size 1060 120
maximum_width 1060

alignment bottom_middle
gap_x 0
gap_y -162 


# +++++ Styles +++++
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders yes


# +++++ Colors +++++
default_shade_color 101010
default_color 8F8F8F

# Blue
#color1 71A1DF
#color2 2C3949
#color3 6F99B4
#lua_load ~/.conky/NightDrive/scripts/rings_blue.lua

# Green
color1 AAB364
color2 2F312E
color3 628747
lua_load ~/.conky/NightDrive/scripts/rings_green.lua

# Orange
#color1 DAB152
#color2 2E2B22
#color3 B28435
#lua_load ~/.conky/NightDrive/scripts/rings_orange.lua

# Red
#color1 EE6363
#color2 3B2A2A
#color3 AE4747
#lua_load ~/.conky/NightDrive/scripts/rings_red.lua

# Mono
#color1 8F8F8F
#color2 303030
#color3 555555
#lua_load ~/.conky/NightDrive/scripts/rings_mono.lua


# +++++ LUA +++++
lua_draw_hook_pre ring_stats


# +++++ Font +++++
use_xft yes
xftfont DejaVu Sans:size=5
xftalpha 0.1
uppercase no



##################################################
##################################################
##												##
##					Components					##
##												##
##################################################
##################################################

# +++++ Clock +++++
template1 ${goto 28}${voffset 35}${color2}${font Digital Readout Thick Upright:size=40}00${voffset -9}:${voffset 9}00${goto 28}${color1}${time %k}${voffset -9}:${voffset 9}${time %M}\n${goto 130}${voffset -68}${color2}${font Digital Readout Thick Upright:size=24}00${goto 130}${color1}${time %d}\n${font Digital Readout Thick Upright:size=12}${goto 130}${voffset -18}${color2}00${goto 130}${color1}${time %m}${goto 146}${color2}00${goto 146}${color1}${time %y}${font}\n


# +++++ Weather +++++
template2 ${execpi 1800 conkyForecast --location=GMXX0270 --template=~/.conky/NightDrive/conkyForecast.template}


# +++++ CPU +++++
template3 ${image ~/.conky/NightDrive/images/icons/cpu.png -p 278,47 -s 24x24 -f 86400}${voffset -62}${alignc 240}${font}${color}${execi 10 sensors k8temp-pci-00c3 |grep Core0 |cut -c 15-16}°C\n${voffset 40}${alignc 240}${font}${freq_g 1}GHz\n


# +++++ Memory +++++
template4 ${image ~/.conky/NightDrive/images/icons/mem.png -p 358,48 -s 24x24 -f 86400}${voffset -58}${alignc 160}${mem}\n${voffset 40}${alignc 160}${swap}\n


# +++++ Nvidia +++++
template5 ${image ~/.conky/NightDrive/images/icons/nvidia.png -p 437,49 -s 24x24 -f 86400}${voffset -58}${alignc 80}${nvidia temp}°C\n${voffset 40}${alignc 80}${nvidia gpufreq}MHz\n


# +++++ Sys & Network +++++
template6 ${image ~/.conky/NightDrive/images/icons/arch.png -p 515,33 -s 32x32 -f 86400}${voffset -22}${alignc}${color3}${font}${execi 600 pacman -Qu | wc -l}${color} updates\n${voffset -1}${alignc}${execi 60 uname -r}\n${image ~/.conky/NightDrive/images/icons/net.png -p 598,48 -s 24x24 -f 86400}${voffset -53}${alignc -80}${downspeed}\n${voffset 40}${alignc -80}${upspeed}\n


# +++++ Storage +++++
template7 ${image ~/.conky/NightDrive/images/icons/hdd.png -p 678,48 -s 24x24 -f 86400}${voffset -58}${alignc -160}${fs_free /}\n${voffset 40}${alignc -160}${fs_free /mnt/music}\n

# +++++ Vol +++++
template8 ${voffset -9}${alignc -240}${mpd_vol}%\n

# +++++ MPD +++++
template9 ${voffset -85}${alignc -240}${mpd_elapsed}/${mpd_length}\n${goto 901}${voffset -1}${font DejaVu Sans Mono:size=6}${scroll 26 3 ${mpd_smart}}\n${font}${goto 901}${color 414141}--------------------------------------------\n${goto 901}${voffset 1}${color3}${font}Album: ${color}${mpd_album 29}\n${goto 901}${voffset 3}${color3}Bit: ${color}${mpd_bitrate}kbps${goto 968}${color3}Rand: ${color}${mpd_random}   ${color3}Rep: ${color}${mpd_repeat}

TEXT
${image ~/.conky/NightDrive/images/bg.png -s 1060x120 -f 86400}${template1}${template2}${template3}${template4}${template5}${template6}${template7}${template8}

${if_mpd_playing}
${if_match "${mpd_status}"=="Playing"}${image ~/.conky/NightDrive/images/icons/play.png -p 758,48 -s 24x24 -f 86400}${if_existing /tmp/cover}${image /tmp/cover -p 828,36 -s 48x48}${else}${image ~/.conky/NightDrive/images/cover/cover_bg.png -p 821,35 -s 58x52}${endif}${template9}${endif}
${if_match "${mpd_status}"=="Paused"}${image ~/.conky/NightDrive/images/icons/pause.png -p 758,48 -s 24x24 -f 86400}${if_existing /tmp/cover}${image /tmp/cover -p 828,36 -s 48x48}${else}${image ~/.conky/NightDrive/images/cover/cover_bg.png -p 821,35 -s 58x52}${endif}${voffset -9}${template9}${voffset 9}${endif}
${if_match "${mpd_status}"=="Stopped"}${image ~/.conky/NightDrive/images/icons/stop.png -p 758,48 -s 24x24 -f 86400}${image ~/.conky/NightDrive/images/cover/cover_bg.png -p 821,35 -s 58x52 -f 86400}${voffset -106}${color 414141}${font DejaVu Sans Mono:size=5}
${goto 901}${scroll 32 1 M   M U   U  SSS  III  CCC     PPPP  L     AA  Y   Y EEEE RRRR      DDD   AA  EEEE M   M  OOO  N   N}
${goto 901}${scroll 32 1 MM MM U   U S      I  C        P   P L    A  A  Y Y  E    R   R     D  D A  A E    MM MM O   O NN  N}
${goto 901}${scroll 32 1 M M M U   U  SSS   I  C        PPPP  L    AAAA   Y   EEE  RRRR      D  D AAAA EEE  M M M O   O N N N}
${goto 901}${scroll 32 1 M   M U   U     S  I  C        P     L    A  A   Y   E    R R       D  D A  A E    M   M O   O N  NN}
${goto 901}${scroll 32 1 M   M  UUU  SSSS  III  CCC     P     LLLL A  A   Y   EEEE R  RR     DDD  A  A EEEE M   M  OOO  N   N}${voffset -88}${endif}
${else}${image ~/.conky/NightDrive/images/cover/cover_bg.png -p 821,35 -s 58x52 -f 86400}${voffset -7}${endif}
${image ~/.conky/NightDrive/images/cover/cover_overlay.png -p 821,35 -s 58x52 -f 86400}

And the lua rings config is:

--[[
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-v1.2.1.lua
    lua_draw_hook_pre ring_stats
 
Changelog:
+ v1.2.1 -- Fixed minor bug that caused script to crash if conky_parse() returns a nil value (20.10.2009)
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ 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)

    {
        -- 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='time',
        -- "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='%I.%M',
        -- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
        max=12,
        -- "bg_colour" is the colour of the base ring.
        bg_colour=0x2F312E,
        -- "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=0xAAB364,
        -- "fg_alpha" is the alpha value of the indicator part of the ring.
        fg_alpha=0.5,
        -- "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=191, y=145,
        -- "radius" is the radius of the ring.
        radius=32,
        -- "thickness" is the thickness of the ring, centred around the radius.
        thickness=4,
        -- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
        start_angle=0,
        -- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger (e.g. more clockwise) than start_angle.
        end_angle=360
    },
]]
settings_table = {    
    {
        name='cpu',
        arg='cpu0',
        max=100,
        bg_colour=0x2F312E,
        bg_alpha=0.5,
        fg_colour=0xAAB364,
        fg_alpha=0.5,
        x=291, y=61,
        radius=28.5,
        thickness=5,
        start_angle=-90,
        end_angle=270
    },
    {
        name='cpu',
        arg='cpu1',
        max=100,
        bg_colour=0x2F312E,
        bg_alpha=0.5,
        fg_colour=0xAAB364,
        fg_alpha=0.5,
        x=291, y=61,
        radius=22.5,
        thickness=5,
        start_angle=-90,
        end_angle=270
    },
    {
        name='memperc',
        arg='',
        max=100,
        bg_colour=0x2F312E,
        bg_alpha=0.5,
        fg_colour=0xAAB364,
        fg_alpha=0.5,
        x=371, y=61,
        radius=28.5,
        thickness=5,
        start_angle=-90,
        end_angle=270
    },
    {
        name='swapperc',
        arg='',
        max=100,
        bg_colour=0x2F312E,
        bg_alpha=0.5,
        fg_colour=0xAAB364,
        fg_alpha=0.5,
        x=371, y=61,
        radius=22.5,
        thickness=5,
        start_angle=-90,
        end_angle=270
    },
    {
        name='nvidia',
        arg='temp',
        max=100,
        bg_colour=0x2F312E,
        bg_alpha=0.5,
        fg_colour=0xAAB364,
        fg_alpha=0.5,
        x=451, y=61,
        radius=28.5,
        thickness=5,
        start_angle=-90,
        end_angle=270
    },
    {
        name='nvidia',
        arg='gpufreq',
        max=650,
        bg_colour=0x2F312E,
        bg_alpha=0.5,
        fg_colour=0xAAB364,
        fg_alpha=0.5,
        x=451, y=61,
        radius=22.5,
        thickness=5,
        start_angle=-90,
        end_angle=270
    },
    {
        name='downspeedf',
        arg='eth0',
        max=2500,
        bg_colour=0x2F312E,
        bg_alpha=0.5,
        fg_colour=0xAAB364,
        fg_alpha=0.5,
        x=611, y=61,
        radius=28.5,
        thickness=5,
        start_angle=-90,
        end_angle=270
    },
    {
        name='upspeedf',
        arg='eth0',
        max=145,
        bg_colour=0x2F312E,
        bg_alpha=0.5,
        fg_colour=0xAAB364,
        fg_alpha=0.5,
        x=611, y=61,
        radius=22.5,
        thickness=5,
        start_angle=-90,
        end_angle=270
    },
    {
        name='fs_used_perc',
        arg='/',
        max=100,
        bg_colour=0x2F312E,
        bg_alpha=0.5,
        fg_colour=0xAAB364,
        fg_alpha=0.5,
        x=691, y=61,
        radius=28.5,
        thickness=5,
        start_angle=-90,
        end_angle=270
    },
    {
        name='fs_used_perc',
        arg='/mnt/music',
        max=100,
        bg_colour=0x2F312E,
        bg_alpha=0.5,
        fg_colour=0xAAB364,
        fg_alpha=0.5,
        x=691, y=61,
        radius=22.5,
        thickness=5,
        start_angle=-90,
        end_angle=270
    },
    {
        name='if_match "${mpd_status}"=="Playing"}${mpd_percent}${else}${if_match "${mpd_status}"=="Paused"}${mpd_percent}${else}0${endif}${endif',
        --name='mpd_percent',
        arg='',
        max=100,
        bg_colour=0x2F312E,
        bg_alpha=0.5,
        fg_colour=0xAAB364,
        fg_alpha=0.5,
        x=771, y=61,
        radius=28.5,
        thickness=5,
        start_angle=-90,
        end_angle=270
    },
    {
        name='mpd_vol',
        arg='',
        max=100,
        bg_colour=0x2F312E,
        bg_alpha=0.5,
        fg_colour=0xAAB364,
        fg_alpha=0.5,
        x=771, y=61,
        radius=22.5,
        thickness=5,
        start_angle=-90,
        end_angle=270
    },
}
 
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
end

I wanted help on making a few changes:
1. The weather module uses kaivalagi's conkyForecast script. However, I am having problems with weather.com. Can anyone suggest another script for the same?
2. The conky shows details for the NVIDIA GPU. But I have a AMD card with the open source drivers. So could anyone please help me on how to pull that data into the conky? I tried searching the forums, but couldn't find much about the open source drivers and I do not wish to use the catalyst driver.
3. The rings.lua mentions a few valid names for the rings. However when I used the "battery_used_perc" name for one of the rings, I got an error message on the console saying that it is not a valid parameter. What else should I be changing?

Offline

Board footer

Powered by FluxBB