You are not logged in.

#501 2010-04-02 10:04:27

Erus_Iluvatar
Member
Registered: 2010-04-01
Posts: 102

Re: conky configs and screenshots!

I'ts WMFS (Window Manager From Scratch), wmfs-git is in AUR. It is still in development, but really stable. Lacks probably some features of Awesome, but xorg62 (the main dev) works hard on it (he added imlib2 support recently).


I'm french, don't mind my mistakes in english.

Offline

#502 2010-04-07 11:24:54

tawan
Member
Registered: 2010-03-02
Posts: 290
Website

Re: conky configs and screenshots!

I took the main layout from Iman

I've been playing a lot and will probably do more. The basic layout is set, just minor autistic tweaks.

N2eB7l.jpg

conky

c# -- Conky settings -- #
#background no
update_interval 1
 
cpu_avg_samples 2
net_avg_samples 2
 
override_utf8_locale yes
 
double_buffer yes
no_buffers yes
 
text_buffer_size 2048
imlib_cache_size 0
 
# -- Window specifications -- #
 
own_window yes
own_window_transparent yes
own_window_type desktop
#own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_colour 1d1d1d

#colors
#good blue 1994d1
#medium blue 083146
#dark blue 041e2c
#lime 86c113
color1 202020
color2 86c113
color3 1994d1
color4 606060
color5 1d1d1d
color6 cccccc

border_inner_margin 1
border_outer_margin 0
 
minimum_size 42 107
maximum_width 44
 
alignment bottom_left
gap_x 0
gap_y 0
 
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
 
# -- Text settings -- #
use_xft yes
xftfont DejaVu Sans Mono:size=6.5
xftalpha 0.4
 
uppercase no
 
default_color dddddd
border_width 0
 
# -- Lua Load -- #
lua_load ~/.conky/lua.lua
lua_draw_hook_pre ring_stats
 
TEXT
${voffset 88}${goto 3}D${goto 11}U
${voffset 29}${goto 4}MEM
${voffset 29}${goto 3}CPU
${voffset 8}${goto 6}${color6}${font ConkyWeather:size=22}${if_up wlan0}${execi 800 conkyForecast --location=ASXX0112 --datatype=WF}${else}e${endif}${font}${color}
${voffset -5}${goto 12}${if_up wlan0}${execi 600 conkyForecast --location=ASXX0112 --datatype=HT}${else}00${endif}
${voffset -4}${if_match ${battery_percent BAT0} >= 98}${color5}${else}${if_existing /sys/class/power_supply/ACAD/online 0}${color2}${else}${color1}${endif}${endif}${goto 4}${battery_bar 4,36 BAT0}${if_existing /sys/class/power_supply/ACAD/online 0}${if_match ${battery_percent BAT0} <= 8}${execi 200 ~/mybin/tawan-lowpower-shutdown}${endif}${endif}
${voffset -9}${font Digital Readout Thick Upright:size=12}${voffset 4}${alignc}${color6}${execi 240 cat ~/mybin/pacman-status}${color3}-${if_up wlan0}${execpi 245 python ~/.conky/my-gmail.py MAILACCOUNT-1 PASSWORD-1}${else}x${endif}-${color2}${if_up wlan0}${execpi 123 python ~/.conky/my-gmail.py MAILACCOUNT-2 PASSWORD-2}${else}x${endif}${font}${color}

lua

--[[
Ring Meters by londonali1010 (2009)
 
This script draws percentage meters as rings. It is fully customisable; all options are described in the script.
 
IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 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)
]]
conky_background_color = 0x151515
conky_background_alpha = 0

ring_background_color = 0xffffff
ring_background_alpha = 0.2
ring_foreground_color = 0x86c113
ring_foreground_color2 = 0x1994d1
ring_foreground_color3 = 0xaa0000
ring_foreground_alpha = 1
 
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='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=ring_background_color,
        -- "bg_alpha" is the alpha value of the base ring.
--        bg_alpha=ring_background_alpha,
        -- "fg_colour" is the colour of the indicator part of the ring.
--        fg_colour=ring_foreground_color,
        -- "fg_alpha" is the alpha value of the indicator part of the ring.
--        fg_alpha=ring_foreground_alpha,
        -- "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=26, y=25,
        -- "radius" is the radius of the ring.
--        radius=10,
        -- "thickness" is the thickness of the ring, centred around the radius.
--        thickness=6,
        -- "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
--    },
    {
        name='upspeedf',
        arg='wlan0',
        max=512,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color2,
        fg_alpha=ring_foreground_alpha,
        x=23, y=90,
        radius=11,
        thickness=5,
        start_angle=-90,
        end_angle=200
    },
    {
        name='downspeedf',
        arg='wlan0',
        max=1024,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color2,
        fg_alpha=ring_foreground_alpha,
        x=23, y=90,
        radius=17,
        thickness=5,
        start_angle=-90,
        end_angle=200
    },
    {
        name='memperc',
        arg='',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color2,
        fg_alpha=ring_foreground_alpha,
        x=23, y=131,
        radius=17,
        thickness=5,
        start_angle=-90,
        end_angle=200
    },
    {
        name='fs_used_perc',
        arg='/home/tawan/Data',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color,
        fg_alpha=ring_foreground_alpha,
        x=23, y=131,
        radius=11,
        thickness=4,
        start_angle=-90,
        end_angle=180
    },
    {
        name='fs_used_perc',
        arg='/',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color,
        fg_alpha=ring_foreground_alpha,
        x=23, y=131,
        radius=6,
        thickness=3,
        start_angle=-90,
        end_angle=170
    },
    {
        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=23, y=172,
        radius=17,
        thickness=4,
        start_angle=-90,
        end_angle=210
    },
    {
        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=23, y=172,
        radius=9,
        thickness=4,
        start_angle=-90,
        end_angle=200
    },
    {
        name='acpitemp',
        arg='',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color3,
        fg_alpha=ring_foreground_alpha,
        x=23, y=172,
        radius=13,
        thickness=2,
        start_angle=-90,
        end_angle=205
    }
}
 
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_round_rect(cr, x0, y0, w, h, r)
    if (w == 0) or (h == 0) then return end
    local x1 = x0 + w
    local y1 = y0 + h
    if w/2 < r then
        if h/2 < r then
            cairo_move_to  (cr, x0, (y0 + y1)/2)
            cairo_curve_to (cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, (y0 + y1)/2)
            cairo_curve_to (cr, x1, y1, x1, y1, (x1 + x0)/2, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, (y0 + y1)/2)
        else
            cairo_move_to  (cr, x0, y0 + r)
            cairo_curve_to (cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, y0 + r)
            cairo_line_to (cr, x1 , y1 - r)
            cairo_curve_to (cr, x1, y1, x1, y1, (x1 + x0)/2, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, y1- r)
        end
    else
        if h/2 < r then
            cairo_move_to  (cr, x0, (y0 + y1)/2)
            cairo_curve_to (cr, x0 , y0, x0 , y0, x0 + r, y0)
            cairo_line_to (cr, x1 - r, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, (y0 + y1)/2)
            cairo_curve_to (cr, x1, y1, x1, y1, x1 - r, y1)
            cairo_line_to (cr, x0 + r, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, (y0 + y1)/2)
        else
            cairo_move_to  (cr, x0, y0 + r)
            cairo_curve_to (cr, x0 , y0, x0 , y0, x0 + r, y0)
            cairo_line_to (cr, x1 - r, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, y0 + r)
            cairo_line_to (cr, x1 , y1 - r)
            cairo_curve_to (cr, x1, y1, x1, y1, x1 - r, y1)
            cairo_line_to (cr, x0 + r, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, y1- r)
        end
    end
    cairo_close_path (cr)
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
 
cs, cr = nil -- initialize our cairo surface and context to nil
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)

    if cs == nil or cairo_xlib_surface_get_width(cs) ~= conky_window.width or cairo_xlib_surface_get_height(cs) ~= conky_window.height then
        if cs then cairo_surface_destroy(cs) end
        cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    end
    if cr then cairo_destroy(cr) end
    cr = cairo_create(cs)

 
    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
 
    if update_num>5 then
        conky_round_rect(cr, 3, 0, conky_window.width-6, conky_window.height-3, 15)
        cairo_set_source_rgba(cr, rgb_to_r_g_b(conky_background_color, conky_background_alpha))
        cairo_fill(cr)
        for i in pairs(settings_table) do
            setup_rings(cr,settings_table[i])
        end
    end
    cairo_destroy(cr)
    cr = nil
end

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

tint2

#---------------------------------------------
# TINT2 CONFIG FILE
#---------------------------------------------

#---------------------------------------------
# BACKGROUND AND BORDER
#---------------------------------------------
rounded = 0
border_width = 0
background_color = #1d1d1d 0
border_color = #1d1d1d 0

rounded = 22
border_width = 0
background_color = #727272 8
border_color = #ffffff 6

rounded = 22
border_width = 0
background_color = #727272 72
border_color = #ffffff 50

#---------------------------------------------
# PANEL
#---------------------------------------------
panel_monitor = all
panel_position = top left vertical
panel_size = 75% 44
panel_margin = 0 0
panel_padding = 0 0 0
font_shadow = 1
panel_background_id = 1
wm_menu = 1

#---------------------------------------------
# TASKBAR
#---------------------------------------------
taskbar_mode = multi_desktop
#taskbar_mode = single_desktop
taskbar_padding = 0 0 0
taskbar_background_id = 1
taskbar_active_background_id = 2

#---------------------------------------------
# TASKS
#---------------------------------------------
task_icon = 1
task_text = 0
task_maximum_size = 40 40
task_centered = 1
task_padding = 6 3
task_font = sans 7
task_font_color = #ffffff 70
task_active_font_color = #000000 100
task_background_id = 0
task_active_background_id = 3

#---------------------------------------------
# SYSTRAYBAR
#---------------------------------------------
systray = 1
systray_padding = 4 4 5
systray_background_id = 1
systray_sort = left2right
systray_icon_size = 16
systray_icon_asb = 100 0 0

#---------------------------------------------
# CLOCK
#---------------------------------------------
time1_format = %H:%M
time1_font = sans bold 8
time2_format = %h.%e
time2_font = sans 6
clock_font_color = #ffffff 76
clock_padding = 4 2
clock_background_id = 1
#clock_lclick_command = xclock
clock_rclick_command = zenity --calendar

#---------------------------------------------
# BATTERY
#---------------------------------------------
battery = 0
battery_hide = 98
battery_low_status = 10
battery_low_cmd = notify-send "battery low"
bat1_font = sans 8
bat2_font = sans 6
battery_font_color = #ffffff 76
battery_padding = 1 0
battery_background_id = 0

#---------------------------------------------
# TOOLTIP
#---------------------------------------------
tooltip = 1
tooltip_padding = 2 2
tooltip_show_timeout = 0.7
tooltip_hide_timeout = 0.3
tooltip_background_id = 1
tooltip_font_color = #ffffff 80
tooltip_font = sans 10

#---------------------------------------------
# MOUSE ACTION ON TASK
#---------------------------------------------
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
mouse_scroll_down = iconify

Offline

#503 2010-04-07 14:46:34

kittykatt
Member
From: Missouri, USA
Registered: 2009-11-04
Posts: 260
Website

Re: conky configs and screenshots!

tawan wrote:

I took the main layout from Iman

I've been playing a lot and will probably do more. The basic layout is set, just minor autistic tweaks.

http://imgur.com/N2eB7l.jpg

conky

c# -- Conky settings -- #
#background no
update_interval 1
 
cpu_avg_samples 2
net_avg_samples 2
 
override_utf8_locale yes
 
double_buffer yes
no_buffers yes
 
text_buffer_size 2048
imlib_cache_size 0
 
# -- Window specifications -- #
 
own_window yes
own_window_transparent yes
own_window_type desktop
#own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_colour 1d1d1d

#colors
#good blue 1994d1
#medium blue 083146
#dark blue 041e2c
#lime 86c113
color1 202020
color2 86c113
color3 1994d1
color4 606060
color5 1d1d1d
color6 cccccc

border_inner_margin 1
border_outer_margin 0
 
minimum_size 42 107
maximum_width 44
 
alignment bottom_left
gap_x 0
gap_y 0
 
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
 
# -- Text settings -- #
use_xft yes
xftfont DejaVu Sans Mono:size=6.5
xftalpha 0.4
 
uppercase no
 
default_color dddddd
border_width 0
 
# -- Lua Load -- #
lua_load ~/.conky/lua.lua
lua_draw_hook_pre ring_stats
 
TEXT
${voffset 88}${goto 3}D${goto 11}U
${voffset 29}${goto 4}MEM
${voffset 29}${goto 3}CPU
${voffset 8}${goto 6}${color6}${font ConkyWeather:size=22}${if_up wlan0}${execi 800 conkyForecast --location=ASXX0112 --datatype=WF}${else}e${endif}${font}${color}
${voffset -5}${goto 12}${if_up wlan0}${execi 600 conkyForecast --location=ASXX0112 --datatype=HT}${else}00${endif}
${voffset -4}${if_match ${battery_percent BAT0} >= 98}${color5}${else}${if_existing /sys/class/power_supply/ACAD/online 0}${color2}${else}${color1}${endif}${endif}${goto 4}${battery_bar 4,36 BAT0}${if_existing /sys/class/power_supply/ACAD/online 0}${if_match ${battery_percent BAT0} <= 8}${execi 200 ~/mybin/tawan-lowpower-shutdown}${endif}${endif}
${voffset -9}${font Digital Readout Thick Upright:size=12}${voffset 4}${alignc}${color6}${execi 240 cat ~/mybin/pacman-status}${color3}-${if_up wlan0}${execpi 245 python ~/.conky/my-gmail.py MAILACCOUNT-1 PASSWORD-1}${else}x${endif}-${color2}${if_up wlan0}${execpi 123 python ~/.conky/my-gmail.py MAILACCOUNT-2 PASSWORD-2}${else}x${endif}${font}${color}

lua

--[[
Ring Meters by londonali1010 (2009)
 
This script draws percentage meters as rings. It is fully customisable; all options are described in the script.
 
IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 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)
]]
conky_background_color = 0x151515
conky_background_alpha = 0

ring_background_color = 0xffffff
ring_background_alpha = 0.2
ring_foreground_color = 0x86c113
ring_foreground_color2 = 0x1994d1
ring_foreground_color3 = 0xaa0000
ring_foreground_alpha = 1
 
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='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=ring_background_color,
        -- "bg_alpha" is the alpha value of the base ring.
--        bg_alpha=ring_background_alpha,
        -- "fg_colour" is the colour of the indicator part of the ring.
--        fg_colour=ring_foreground_color,
        -- "fg_alpha" is the alpha value of the indicator part of the ring.
--        fg_alpha=ring_foreground_alpha,
        -- "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=26, y=25,
        -- "radius" is the radius of the ring.
--        radius=10,
        -- "thickness" is the thickness of the ring, centred around the radius.
--        thickness=6,
        -- "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
--    },
    {
        name='upspeedf',
        arg='wlan0',
        max=512,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color2,
        fg_alpha=ring_foreground_alpha,
        x=23, y=90,
        radius=11,
        thickness=5,
        start_angle=-90,
        end_angle=200
    },
    {
        name='downspeedf',
        arg='wlan0',
        max=1024,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color2,
        fg_alpha=ring_foreground_alpha,
        x=23, y=90,
        radius=17,
        thickness=5,
        start_angle=-90,
        end_angle=200
    },
    {
        name='memperc',
        arg='',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color2,
        fg_alpha=ring_foreground_alpha,
        x=23, y=131,
        radius=17,
        thickness=5,
        start_angle=-90,
        end_angle=200
    },
    {
        name='fs_used_perc',
        arg='/home/tawan/Data',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color,
        fg_alpha=ring_foreground_alpha,
        x=23, y=131,
        radius=11,
        thickness=4,
        start_angle=-90,
        end_angle=180
    },
    {
        name='fs_used_perc',
        arg='/',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color,
        fg_alpha=ring_foreground_alpha,
        x=23, y=131,
        radius=6,
        thickness=3,
        start_angle=-90,
        end_angle=170
    },
    {
        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=23, y=172,
        radius=17,
        thickness=4,
        start_angle=-90,
        end_angle=210
    },
    {
        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=23, y=172,
        radius=9,
        thickness=4,
        start_angle=-90,
        end_angle=200
    },
    {
        name='acpitemp',
        arg='',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color3,
        fg_alpha=ring_foreground_alpha,
        x=23, y=172,
        radius=13,
        thickness=2,
        start_angle=-90,
        end_angle=205
    }
}
 
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_round_rect(cr, x0, y0, w, h, r)
    if (w == 0) or (h == 0) then return end
    local x1 = x0 + w
    local y1 = y0 + h
    if w/2 < r then
        if h/2 < r then
            cairo_move_to  (cr, x0, (y0 + y1)/2)
            cairo_curve_to (cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, (y0 + y1)/2)
            cairo_curve_to (cr, x1, y1, x1, y1, (x1 + x0)/2, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, (y0 + y1)/2)
        else
            cairo_move_to  (cr, x0, y0 + r)
            cairo_curve_to (cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, y0 + r)
            cairo_line_to (cr, x1 , y1 - r)
            cairo_curve_to (cr, x1, y1, x1, y1, (x1 + x0)/2, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, y1- r)
        end
    else
        if h/2 < r then
            cairo_move_to  (cr, x0, (y0 + y1)/2)
            cairo_curve_to (cr, x0 , y0, x0 , y0, x0 + r, y0)
            cairo_line_to (cr, x1 - r, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, (y0 + y1)/2)
            cairo_curve_to (cr, x1, y1, x1, y1, x1 - r, y1)
            cairo_line_to (cr, x0 + r, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, (y0 + y1)/2)
        else
            cairo_move_to  (cr, x0, y0 + r)
            cairo_curve_to (cr, x0 , y0, x0 , y0, x0 + r, y0)
            cairo_line_to (cr, x1 - r, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, y0 + r)
            cairo_line_to (cr, x1 , y1 - r)
            cairo_curve_to (cr, x1, y1, x1, y1, x1 - r, y1)
            cairo_line_to (cr, x0 + r, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, y1- r)
        end
    end
    cairo_close_path (cr)
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
 
cs, cr = nil -- initialize our cairo surface and context to nil
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)

    if cs == nil or cairo_xlib_surface_get_width(cs) ~= conky_window.width or cairo_xlib_surface_get_height(cs) ~= conky_window.height then
        if cs then cairo_surface_destroy(cs) end
        cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    end
    if cr then cairo_destroy(cr) end
    cr = cairo_create(cs)

 
    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
 
    if update_num>5 then
        conky_round_rect(cr, 3, 0, conky_window.width-6, conky_window.height-3, 15)
        cairo_set_source_rgba(cr, rgb_to_r_g_b(conky_background_color, conky_background_alpha))
        cairo_fill(cr)
        for i in pairs(settings_table) do
            setup_rings(cr,settings_table[i])
        end
    end
    cairo_destroy(cr)
    cr = nil
end

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

tint2

#---------------------------------------------
# TINT2 CONFIG FILE
#---------------------------------------------

#---------------------------------------------
# BACKGROUND AND BORDER
#---------------------------------------------
rounded = 0
border_width = 0
background_color = #1d1d1d 0
border_color = #1d1d1d 0

rounded = 22
border_width = 0
background_color = #727272 8
border_color = #ffffff 6

rounded = 22
border_width = 0
background_color = #727272 72
border_color = #ffffff 50

#---------------------------------------------
# PANEL
#---------------------------------------------
panel_monitor = all
panel_position = top left vertical
panel_size = 75% 44
panel_margin = 0 0
panel_padding = 0 0 0
font_shadow = 1
panel_background_id = 1
wm_menu = 1

#---------------------------------------------
# TASKBAR
#---------------------------------------------
taskbar_mode = multi_desktop
#taskbar_mode = single_desktop
taskbar_padding = 0 0 0
taskbar_background_id = 1
taskbar_active_background_id = 2

#---------------------------------------------
# TASKS
#---------------------------------------------
task_icon = 1
task_text = 0
task_maximum_size = 40 40
task_centered = 1
task_padding = 6 3
task_font = sans 7
task_font_color = #ffffff 70
task_active_font_color = #000000 100
task_background_id = 0
task_active_background_id = 3

#---------------------------------------------
# SYSTRAYBAR
#---------------------------------------------
systray = 1
systray_padding = 4 4 5
systray_background_id = 1
systray_sort = left2right
systray_icon_size = 16
systray_icon_asb = 100 0 0

#---------------------------------------------
# CLOCK
#---------------------------------------------
time1_format = %H:%M
time1_font = sans bold 8
time2_format = %h.%e
time2_font = sans 6
clock_font_color = #ffffff 76
clock_padding = 4 2
clock_background_id = 1
#clock_lclick_command = xclock
clock_rclick_command = zenity --calendar

#---------------------------------------------
# BATTERY
#---------------------------------------------
battery = 0
battery_hide = 98
battery_low_status = 10
battery_low_cmd = notify-send "battery low"
bat1_font = sans 8
bat2_font = sans 6
battery_font_color = #ffffff 76
battery_padding = 1 0
battery_background_id = 0

#---------------------------------------------
# TOOLTIP
#---------------------------------------------
tooltip = 1
tooltip_padding = 2 2
tooltip_show_timeout = 0.7
tooltip_hide_timeout = 0.3
tooltip_background_id = 1
tooltip_font_color = #ffffff 80
tooltip_font = sans 10

#---------------------------------------------
# MOUSE ACTION ON TASK
#---------------------------------------------
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
mouse_scroll_down = iconify

Looks good! I might try this setup in mine soon and post a screenshot. I'll let you know. big_smile


- [ My Blog ] | [ AUR Packages ] | [ My deviantART ] | [ screenFetch ] | [ SilverIRC ] -

Offline

#504 2010-04-12 07:05:13

mezkov
Member
Registered: 2010-01-09
Posts: 11

Re: conky configs and screenshots!

I have some problems with tint2.  When I use tawans config, the panel don't show. It is somehow there, because other windows attracts to it, but it is not visible. When I use Imans config it shows, but on the right side of screen. With default configuration it works fine...

Do you have any idea what's wrong?

I'm using pekwm on x86_64 system...

Offline

#505 2010-04-13 12:37:05

tawan
Member
Registered: 2010-03-02
Posts: 290
Website

Re: conky configs and screenshots!

my tint2 is almost invisible, The main bar is completely transparent and the states are nearly transparent - You'll only see them against a black or very dark background.

Offline

#506 2010-04-13 16:39:37

mezkov
Member
Registered: 2010-01-09
Posts: 11

Re: conky configs and screenshots!

Your tint2 shows date, tray and taskbar, so whan started it should show at least that date, but it shows nothing. But when I change settings to possition bottom center it shows up...

Offline

#507 2010-04-13 17:34:39

Rokixz
Member
From: Šiauliai, Lithuania
Registered: 2007-04-21
Posts: 251
Website

Re: conky configs and screenshots!

Nice configs smile

Last edited by Rokixz (2010-04-13 18:09:16)


http://ispconfig.lt - ISPConfig 3 based hosting. Coming Soon!

Offline

#508 2010-04-13 21:13:08

tawan
Member
Registered: 2010-03-02
Posts: 290
Website

Re: conky configs and screenshots!

mezkov wrote:

Your tint2 shows date, tray and taskbar, so whan started it should show at least that date, but it shows nothing. But when I change settings to possition bottom center it shows up...

hmm, if you still have trouble please post a screenshot of the problem and the code too smile

Offline

#509 2010-04-15 08:45:40

carnero
Member
From: Prague, CZ
Registered: 2010-04-15
Posts: 10
Website

Re: conky configs and screenshots!

simona%202010.04.15.th.png

conky:

use_xft yes
xftfont Coconut:style=normal:size=9

update_interval 1.0
total_run_times 0
double_buffer yes

own_window_colour 000000
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager

minimum_size 0 0

default_color 666666
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no

color0 D8D8D8
color1 777777
color2 AAAAAA

alignment bottom_center
gap_y 0
gap_x 0

net_avg_samples 2

override_utf8_locale yes

TEXT
${voffset -8}${offset 0}${color1}${voffset -6}battery${voffset 6} ${color0}${execi 30 ~/bin/conky/acpi-level.sh}${color1}|${color0}${execi 30 ~/bin/conky/acpi-time.sh} ${color1}${voffset -6}time${voffset 6} ${color0}${time %H:%M}${color1}|${color0}${time %a}${color1}|${color0}${time %d.%m.%Y} ${color1}${voffset -6}volume${voffset 6} ${color0}${exec ~/bin/conky/volume.sh}${color1}${alignr}${color1}${voffset -6}load${voffset 6} ${color0}${cpu cpu1}%${color1}|${color0}${cpu cpu2}% ${color1}${voffset -6}freq${voffset 6} ${color0}${freq_g cup0}GHz${color1}|${color0}${freq_g cpu1}GHz ${color1} ${voffset -6}cpu${voffset 6} ${color0}${acpitemp}°C ${color1}${voffset -6}gpu${voffset 6} ${color0}${execi 60 nvidia-settings -q gpucoretemp |grep '):' | cut -d ' ' -f 6,6 | sed -e 's/.\{1\}$//'}°C ${color1}${voffset -6}eth${voffset 6} ${voffset 2}${downspeedgraph eth0 8,32 444444 88BA88} ${upspeedgraph eth0 8,32 444444 BA8888}${voffset -2}  ${voffset -6}wlan${voffset 6} ${voffset 2}${downspeedgraph wlan0 8,32 444444 88BA88} ${upspeedgraph wlan0 8,32 444444 BA8888}${voffset -2} ${color1}${voffset -6}root${voffset 6} ${color0}${fs_free /} ${color1}${voffset -6}home${voffset 6} ${color0}${fs_free /home}

~/bin/conky/acpi-level.sh
actual state of battery - negative number when discharging, positive when charging

#!/bin/bash

data=`acpi -b`
data=`echo $data | tr "[:upper:]" "[:lower:]"`
values=(`echo $data | tr ',' ' '`)

state=`echo ${values[2]/ /}`
level=`echo ${values[3]/ /}`

if [ "$state" == "discharging" ];
then
    echo "-$level"
else
    if [ "$state" == "full" ];
    then
        echo "$level"
    else
        echo "+$level"
    fi
fi

~/bin/conky/acpi-time.sh
remaining time until battery empty (when discharging) or full (when charging)

#!/bin/bash

data=`acpi -b`
data=`echo $data | tr "[:upper:]" "[:lower:]"`
values=(`echo $data | tr ',' ' '`)
timepre=(`echo ${values[4]} | tr ' ' ' '`)
time=`echo ${timepre/ /}`
if [ "$time" != "" ];
then
    timeparts=(`echo $time | tr ':' ' '`)
    echo "${timeparts[0]}:${timeparts[1]}"
else
    echo "done"
fi

~/bin/conky/volume.sh
volume level

#!/bin/bash

data=`amixer get Master | grep 'Mono:'`
lines=(`echo $data | tr ' ' ' '`)
volume=`echo ${lines[3]/[/}`
volume=`echo ${volume/]/}`

state=`echo ${lines[5]/[/}`
state=`echo ${state/]/}`

if [ "$state" == "on" ];
then
    echo "$volume"
else
    echo "mute"
fi

Last edited by carnero (2010-04-15 08:46:55)

Offline

#510 2010-04-16 21:35:38

initbox
Member
Registered: 2008-09-27
Posts: 168

Re: conky configs and screenshots!

So I implemented that volume script in awk:

#!/bin/sh

data=`amixer get Master | awk 'NR==5 {gsub(/\[|\]/, ""); 1; print $6 " " $4}'`

if [ `echo $data | cut -d \  -f 1` == "on" ];
then
    echo `echo $data | cut -d \  -f 2`
else
    echo "muted"
fi

I can't think of any additional optimizations...

Offline

#511 2010-04-18 18:03:04

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: conky configs and screenshots!

initbox wrote:

So I implemented that volume script in awk:

#!/bin/sh

data=`amixer get Master | awk 'NR==5 {gsub(/\[|\]/, ""); 1; print $6 " " $4}'`

if [ `echo $data | cut -d \  -f 1` == "on" ];
then
    echo `echo $data | cut -d \  -f 2`
else
    echo "muted"
fi

I can't think of any additional optimizations...

Very nice, I'm using it right now.
Any chance to get a version that monitors PCM instead that Master?
Thanks,


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#512 2010-04-18 20:57:44

initbox
Member
Registered: 2008-09-27
Posts: 168

Re: conky configs and screenshots!

rent0n wrote:
initbox wrote:

So I implemented that volume script in awk:

#!/bin/sh

data=`amixer get Master | awk 'NR==5 {gsub(/\[|\]/, ""); 1; print $6 " " $4}'`

if [ `echo $data | cut -d \  -f 1` == "on" ];
then
    echo `echo $data | cut -d \  -f 2`
else
    echo "muted"
fi

I can't think of any additional optimizations...

Very nice, I'm using it right now.
Any chance to get a version that monitors PCM instead that Master?
Thanks,

EDIT: Hrmph, I spoke too soon, apparently it uses a different format. big_smile

PCM doesn't list "muted" though, and the output is like this (atleast for me):
  Front Left: Playback 255 [100%] [0.00dB]
  Front Right: Playback 255 [100%] [0.00dB]

So, do you just want to see the percentage?

Last edited by initbox (2010-04-18 21:05:11)

Offline

#513 2010-04-18 21:22:34

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: conky configs and screenshots!

initbox wrote:
rent0n wrote:
initbox wrote:

So I implemented that volume script in awk:

#!/bin/sh

data=`amixer get Master | awk 'NR==5 {gsub(/\[|\]/, ""); 1; print $6 " " $4}'`

if [ `echo $data | cut -d \  -f 1` == "on" ];
then
    echo `echo $data | cut -d \  -f 2`
else
    echo "muted"
fi

I can't think of any additional optimizations...

Very nice, I'm using it right now.
Any chance to get a version that monitors PCM instead that Master?
Thanks,

EDIT: Hrmph, I spoke too soon, apparently it uses a different format. big_smile

PCM doesn't list "muted" though, and the output is like this (atleast for me):
  Front Left: Playback 255 [100%] [0.00dB]
  Front Right: Playback 255 [100%] [0.00dB]

So, do you just want to see the percentage?

After some trials, I realized that, at least on my setup, the best thing is to use PCM to tune up/down the volume level and Master to mute/unmute.
This is the way I mapped the media keys on my laptop and this is the way I would like conky to display the information. Unfortunately I really can't understand awk...:(

So, basically, I would like to see PCM percentage or 'muted' when I mute Master.
Thank you very much indeed! big_smile


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#514 2010-04-19 13:35:15

initbox
Member
Registered: 2008-09-27
Posts: 168

Re: conky configs and screenshots!

PCM version:

#!/bin/sh

state=`amixer get Master | awk 'NR==5 {gsub(/\[|\]/, ""); 1; print $6}'`
vol=`amixer get PCM | awk 'NR==6 {gsub(/\[|\]/, ""); 1; print $5}'`

if [ $state == "on" ];
then
    echo $vol
else
    echo "muted"
fi

A little less elegant.

If you want data from both channels, replace "NR==6" with "NR==6 || NR==7"

Offline

#515 2010-04-19 14:10:53

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: conky configs and screenshots!

initbox wrote:

PCM version:

#!/bin/sh

state=`amixer get Master | awk 'NR==5 {gsub(/\[|\]/, ""); 1; print $6}'`
vol=`amixer get PCM | awk 'NR==6 {gsub(/\[|\]/, ""); 1; print $5}'`

if [ $state == "on" ];
then
    echo $vol
else
    echo "muted"
fi

A little less elegant.

If you want data from both channels, replace "NR==6" with "NR==6 || NR==7"

Thank you very much, I will test it later!
It's still quite elegant! smile


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#516 2010-04-21 13:53:11

redonkulous
Member
Registered: 2010-04-19
Posts: 3

Re: conky configs and screenshots!

nevermind

Last edited by redonkulous (2010-04-21 13:57:51)

Offline

#517 2010-04-23 16:24:35

bobdob
Member
Registered: 2008-06-13
Posts: 138

Re: conky configs and screenshots!

Does anyone know how to truncate a string based on pixel length rather than character length in conky?
Atm I am using a non fixed width font which means that the string doesn't always fit into the space.

tNDkzdw

Offline

#518 2010-04-24 17:33:53

kittykatt
Member
From: Missouri, USA
Registered: 2009-11-04
Posts: 260
Website

Re: conky configs and screenshots!

bobdob wrote:

Does anyone know how to truncate a string based on pixel length rather than character length in conky?
Atm I am using a non fixed width font which means that the string doesn't always fit into the space.

http://omploader.org/tNDkzdw

I'm not quite sure on that one, though I'll be sure to ask around and do some digging myself. That would be a good thing to have around.


- [ My Blog ] | [ AUR Packages ] | [ My deviantART ] | [ screenFetch ] | [ SilverIRC ] -

Offline

#519 2010-04-25 07:33:11

tawan
Member
Registered: 2010-03-02
Posts: 290
Website

Re: conky configs and screenshots!

Some feature adjustments to my adaptation of the conky a page or so ago...

Nothing much going on
zAc49.jpg

Green dot shows one pacman update available. Numbers at bottom show some mail in 2 mail boxes
e4jE9.jpg

Red dot shows more than 3 pacman updates available, green bar at bottom shows I'm on battery (red if bat is low)
9ZvoJ.jpg

When updates have been run and mail checked then it all looks like this again
zAc49.jpg


DIAibl.jpg
that's how it sits on the screen.

*how it works*

cron hourly runs this and it reports findings to a text file

#!/bin/sh
pacman -Sy > /dev/null
numberof=`pacman -Qu | wc -l`
if [ $numberof -ge 3 ]
then
    echo '${color4}' > /home/tawan/mybin/pacman-status
else
    if [ $numberof -ge 1 ]
    then
        echo '${color3}' > /home/tawan/mybin/pacman-status
    else
        echo '${color1}' > /home/tawan/mybin/pacman-status
    fi
fi

a script is started at boot which runs as a deamon, checks mail and reports findings to text files

#!/bin/bash
#function
function mailbox {
if [ $mymail -ge 3 ]
then
    echo '${color2}'$mymail > /home/tawan/mybin/gmail-$myuser
else
    if [ $mymail -ge 1 ]
    then
        echo '${color3}'$mymail > /home/tawan/mybin/gmail-$myuser
    else
        echo '${color1}'$mymail > /home/tawan/mybin/gmail-$myuser
    fi
fi
}
#main script
while [ 1 ]
do
    mymail=$(python ~/mybin/my-gmail.py TAWANEMAIL)
    myuser=tawan
    mailbox
    sleep 10s
    mymail=$(python ~/mybin/my-gmail.py CHRISEMAIL)
    myuser=chris
    mailbox
    sleep 2m
done

This calls an adapted python script which does the hard leg work with gmail

## needs The urllib and feedparser Python libraries

import sys
import urllib             # For BasicHTTPAuthentication
import feedparser         # For parsing the feed
from textwrap import wrap

_URL = "https://mail.google.com/gmail/feed/atom"

uname = sys.argv[1]
password = PASSWORD
maxlen = 1

urllib.FancyURLopener.prompt_user_passwd = lambda self, host, realm: (uname, password)
    
def auth():
    '''The method to do HTTPBasicAuthentication'''
    opener = urllib.FancyURLopener()
    f = opener.open(_URL)
    feed = f.read()
    return feed

def readmail(feed, maxlen):
    '''Parse the Atom feed and print a summary'''
    atom = feedparser.parse(feed)
    print '%s' % (len(atom.entries))
#    for i in range(min(len(atom.entries), maxlen)):
#        print ' ${color}"%s"' % atom.entries[i].title
#        print '    ${color lightgrey}%s' % atom.entries[i].author
#    if len(atom.entries) > maxlen:
#        print ' ${color}more...'

if __name__ == "__main__":
    f = auth()  # Do auth and then get the feed
    readmail(f, int(maxlen)) # Let the feed be chewed by feedparser

As these scripts report to text files I can 'cat' those files quite often with conky and not have conky call upon arch or gmail too often as to annoy them - but conky can update these values frequently so I can see results as soon as they happen(ish)

conky

# -- Conky settings -- #
#background no
update_interval 1
 
cpu_avg_samples 2
net_avg_samples 2
 
override_utf8_locale yes
 
double_buffer yes
no_buffers yes
 
text_buffer_size 2048
imlib_cache_size 0
 
# -- Window specifications -- #
 
own_window yes
own_window_transparent no
own_window_type desktop
#own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_colour 1d1d1d

#colors
#good blue 1994d1
#medium blue 083146
#dark blue 041e2c
#lime 86c113
color1 202020
color2 86c113
color3 1994d1
color4 aa0000
color5 1d1d1d
color6 cccccc

border_inner_margin 1
border_outer_margin 0
 
minimum_size 42 158
maximum_width 44
maximum_height 149
 
alignment bottom_left
gap_x 0
gap_y 0
 
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
 
# -- Text settings -- #
use_xft yes
xftfont DejaVu Sans Mono:size=6.5
xftalpha 0.4
 
uppercase no
 
default_color dddddd
border_width 0
 
# -- Lua Load -- #
lua_load ~/.conky/lua.lua
lua_draw_hook_pre ring_stats
 
TEXT
${voffset 88}${goto 3}D${goto 10}U ${voffset -7}${goto 16}${font Webdings:size=11}${execpi 30 cat ~/mybin/pacman-status}=${voffset 4}${color}${font}
${voffset 29}${goto 3}MEM
${voffset 29}${goto 2}CPU
${voffset 5}${font Digital Readout Thick Upright:size=12}${voffset 4}${alignc}${execpi 25 cat ~/mybin/gmail-chris} ${execpi 20 cat ~/mybin/gmail-tawan}${font}${color}
${voffset -3}${if_match ${battery_percent BAT0} >= 98}${color5}${else}${if_existing /sys/class/power_supply/ACAD/online 0}${color2}${else}${color1}${endif}${endif}${goto 4}${battery_bar 4,36 BAT0}${if_existing /sys/class/power_supply/ACAD/online 0}${if_match ${battery_percent BAT0} <= 8}${execi 200 ~/mybin/tawan-lowpower-shutdown}${endif}${endif}

EDIT oops, forgot the lua script

--[[
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)
]]
conky_background_color = 0x151515
conky_background_alpha = 0

ring_background_color = 0xffffff
ring_background_alpha = 0.2
ring_foreground_color = 0x86c113
ring_foreground_color2 = 0x1994d1
ring_foreground_color3 = 0xaa0000
ring_foreground_alpha = 1
 
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='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=ring_background_color,
        -- "bg_alpha" is the alpha value of the base ring.
--        bg_alpha=ring_background_alpha,
        -- "fg_colour" is the colour of the indicator part of the ring.
--        fg_colour=ring_foreground_color,
        -- "fg_alpha" is the alpha value of the indicator part of the ring.
--        fg_alpha=ring_foreground_alpha,
        -- "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=26, y=25,
        -- "radius" is the radius of the ring.
--        radius=10,
        -- "thickness" is the thickness of the ring, centred around the radius.
--        thickness=6,
        -- "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
--    },
    {
        name='upspeedf',
        arg='wlan0',
        max=512,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color2,
        fg_alpha=ring_foreground_alpha,
        x=23, y=90,
        radius=11,
        thickness=5,
        start_angle=-90,
        end_angle=180
    },
    {
        name='downspeedf',
        arg='wlan0',
        max=2048,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color2,
        fg_alpha=ring_foreground_alpha,
        x=23, y=90,
        radius=17,
        thickness=5,
        start_angle=-90,
        end_angle=180
    },
    {
        name='memperc',
        arg='',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color2,
        fg_alpha=ring_foreground_alpha,
        x=23, y=131,
        radius=17,
        thickness=5,
        start_angle=-90,
        end_angle=180
    },
    {
        name='fs_used_perc',
        arg='/home/tawan/Data',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color,
        fg_alpha=ring_foreground_alpha,
        x=23, y=131,
        radius=11,
        thickness=4,
        start_angle=-90,
        end_angle=180
    },
    {
        name='fs_used_perc',
        arg='/',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color,
        fg_alpha=ring_foreground_alpha,
        x=23, y=131,
        radius=6,
        thickness=3,
        start_angle=-90,
        end_angle=180
    },
    {
        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=23, y=172,
        radius=17,
        thickness=4,
        start_angle=-90,
        end_angle=180
    },
    {
        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=23, y=172,
        radius=9,
        thickness=4,
        start_angle=-90,
        end_angle=180
    },
    {
        name='acpitemp',
        arg='',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color3,
        fg_alpha=ring_foreground_alpha,
        x=23, y=172,
        radius=13,
        thickness=2,
        start_angle=-90,
        end_angle=180
    }
}
 
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_round_rect(cr, x0, y0, w, h, r)
    if (w == 0) or (h == 0) then return end
    local x1 = x0 + w
    local y1 = y0 + h
    if w/2 < r then
        if h/2 < r then
            cairo_move_to  (cr, x0, (y0 + y1)/2)
            cairo_curve_to (cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, (y0 + y1)/2)
            cairo_curve_to (cr, x1, y1, x1, y1, (x1 + x0)/2, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, (y0 + y1)/2)
        else
            cairo_move_to  (cr, x0, y0 + r)
            cairo_curve_to (cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, y0 + r)
            cairo_line_to (cr, x1 , y1 - r)
            cairo_curve_to (cr, x1, y1, x1, y1, (x1 + x0)/2, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, y1- r)
        end
    else
        if h/2 < r then
            cairo_move_to  (cr, x0, (y0 + y1)/2)
            cairo_curve_to (cr, x0 , y0, x0 , y0, x0 + r, y0)
            cairo_line_to (cr, x1 - r, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, (y0 + y1)/2)
            cairo_curve_to (cr, x1, y1, x1, y1, x1 - r, y1)
            cairo_line_to (cr, x0 + r, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, (y0 + y1)/2)
        else
            cairo_move_to  (cr, x0, y0 + r)
            cairo_curve_to (cr, x0 , y0, x0 , y0, x0 + r, y0)
            cairo_line_to (cr, x1 - r, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, y0 + r)
            cairo_line_to (cr, x1 , y1 - r)
            cairo_curve_to (cr, x1, y1, x1, y1, x1 - r, y1)
            cairo_line_to (cr, x0 + r, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, y1- r)
        end
    end
    cairo_close_path (cr)
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
 
cs, cr = nil -- initialize our cairo surface and context to nil
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)

    if cs == nil or cairo_xlib_surface_get_width(cs) ~= conky_window.width or cairo_xlib_surface_get_height(cs) ~= conky_window.height then
        if cs then cairo_surface_destroy(cs) end
        cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    end
    if cr then cairo_destroy(cr) end
    cr = cairo_create(cs)

 
    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
 
    if update_num>5 then
        conky_round_rect(cr, 3, 0, conky_window.width-6, conky_window.height-3, 15)
        cairo_set_source_rgba(cr, rgb_to_r_g_b(conky_background_color, conky_background_alpha))
        cairo_fill(cr)
        for i in pairs(settings_table) do
            setup_rings(cr,settings_table[i])
        end
    end
    cairo_destroy(cr)
    cr = nil
end

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

Last edited by tawan (2010-05-03 08:05:13)

Offline

#520 2010-04-26 22:31:21

bobdob
Member
Registered: 2008-06-13
Posts: 138

Re: conky configs and screenshots!

kittykatt wrote:
bobdob wrote:

Does anyone know how to truncate a string based on pixel length rather than character length in conky?
Atm I am using a non fixed width font which means that the string doesn't always fit into the space.

http://omploader.org/tNDkzdw

I'm not quite sure on that one, though I'll be sure to ask around and do some digging myself. That would be a good thing to have around.

After googling til my fingers bleed, and no result, I coded it myself with the remaining bloody stumps:

/* gcc length.c -lX11 -lXft `pkg-config --cflags xft` */

#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>

int main (int argc, char **argv)
{
    int screen, len, pixels;
    char *string, *sep = "...";
    Display *dpy;
    XftFont *font;
    XGlyphInfo extents;

    if (argc < 5) {
        printf ("Usage: %s <font> <size> <string> <pixels>\n", argv[0]);
        return 1;
    }

    pixels = atoi (argv[4]);
    len = strlen (argv[3]);

    dpy = XOpenDisplay (NULL);
    screen = XDefaultScreen (dpy);
    font = XftFontOpen (dpy, screen,
                        XFT_FAMILY, XftTypeString, argv[1],
                        XFT_SIZE, XftTypeDouble, atof (argv[2]),
                        NULL);
    XftTextExtents8 (dpy, font, (FcChar8 *)argv[3], len, &extents);

    if (extents.xOff <= pixels) {
        printf ("%s", argv[3]);
    } else {
        string = malloc ((sizeof (char) * len) + 3);
        strcpy (string, argv[3]);
        do {
            len--;
            memcpy (string + len, sep, strlen (sep) + 1);
            XftTextExtents8 (dpy, font, (FcChar8 *)string,
                             strlen (string), &extents);
        } while (extents.xOff > pixels);
        printf ("%s", string);
        free (string);
    }

    return 0;
}

It's not the nicest code every but it works. Input the font, size, string and max pixel length and spits out a string truncated to fit.
I might try and patch conky to add this option at some point. For now it runs in three scripts (artist, album, title), since I couldn't get exec to pass arguments (Can it do this?).

And now some tasty pics:
vNGFkaA
vNGFkaQ
vNGFkag

Offline

#521 2010-04-30 09:16:25

drsexbot
Member
Registered: 2010-04-30
Posts: 2

Re: conky configs and screenshots!

I'll post the config later if anyone wants it, also i need to recall where i got the update section, but mostly i'll just go throguh citing where i learned how to do what and bla bla before i bother going post crazy =] i'm greatful for each part i learned and the people who posted the information, so i'm not letting them go forgotten.

R28G1.png

i've had a bit of trouble getting it to display gmail so i removed that, and descided to pull out the RSS (which was in the middle but i want tickign on the bottom) untill i un-lazy my butt. considered info on torrents and removed my GPU info from it aswell just for the time being as i find out how i screwed something up =P

anywayz, sorry for the long post, just tell me what you think and if you can't wait for me to post the configs and scripts just email me and i'll get back to you as soon as i can.

oh and for music it's just MPD stuff

${font}${color wheat3}MUSIC ${color azure} ${stippled_hr}${color MintCream}${if_running mpd}
${scroll 30 1 $mpd_smart }
${scroll 30 1 $mpd_album }
Bitrate $mpd_bitrate kbits/s
$mpd_status $mpd_elapsed/$mpd_length
Vol $mpd_vol%${endif}

sorry didn't show that off in the pic.

Last edited by drsexbot (2010-04-30 09:19:41)

Offline

#522 2010-04-30 12:01:22

archman-cro
Member
From: Croatia
Registered: 2010-04-04
Posts: 943
Website

Re: conky configs and screenshots!

drsexbot, awesome conkies! smile

Offline

#523 2010-05-06 19:47:55

Perre
Member
Registered: 2008-01-22
Posts: 189

Re: conky configs and screenshots!

drsexbot: What script are you using for the repo status info?
I really like Xynes perl script http://bbs.archlinux.org/viewtopic.php? … 01#p754701 but it needs bauerbill and powerpill and I'm using clyde for package management.
(I could of course have all of them installed, but I'm kinde OCD when it comes to having a "clean" computer. tongue)

Offline

#524 2010-05-07 06:33:30

drsexbot
Member
Registered: 2010-04-30
Posts: 2

Re: conky configs and screenshots!

Perre your reply is near the bottom of this =] hope that helps

conky
everything dumped in one file (configs and scripts)
http://www.multiupload.com/NXUM59RP0P

or if you'd prefer to just get some part quickly

clock:
http://pastebin.com/CAd9MsyT

email:
http://pastebin.com/EsevzP8f

music:
http://pastebin.com/8yUpEx7N

net:
http://pastebin.com/NbfDTU4v

netstat:
http://pastebin.com/7JiqwEmE

process:
http://pastebin.com/m393Nv29

RSS:
http://pastebin.com/LwFwkPqt

sys:
http://pastebin.com/itvbdcfb

update:
http://pastebin.com/kg9EDu6d

weather:
http://pastebin.com/Bb8Ngzwn


Start Scripts:
KDE:
http://pastebin.com/DKD2rL7V

Gnome / Openbox:
http://pastebin.com/tKQ9NA3J


info on the KDE start script:
You're going to need feh

this is different because of plasma desktop, and bla bla ^^ long story, but if you really want the background just say so and i'll tell you later or google conky and plasma desktop.

changed these a bit

aur.paconky
http://pastebin.com/LUSuyJJ8

reopos.paconky
http://pastebin.com/byb081sb


Where i got the Update and Weather scripts

Update:
http://bbs.archlinux.org/viewtopic.php?id=68104

Weather
grabbed from http://sen7.deviantart.com/art/Conky-Ni … -151418309

edit:
Perre, i wish i could be more OCD about my comp. i regret putting so much crap on it sometimes but then i do use it a bit. i'm just biding my time till i get a new lappy then i'm storing this one away for media and other storage. maybe testing some things from time to time =P

deep down i want to just set aside some space for this comp, my 360, and a slingbox, so when i get a netbook i'll be able to sit around looking smug.

oh as a small liittle note, i switched to gnome-shell today and had an issue with conky not showing up the way i originally confured it. to fix this, i just changed  line 8:
from
own_window_type overide
to
own_window_type normal

Last edited by drsexbot (2010-05-17 16:52:54)

Offline

#525 2010-05-07 11:37:20

Roline
Member
From: Netherlands
Registered: 2009-12-05
Posts: 207
Website

Re: conky configs and screenshots!

screenshot2010050713325.th.png

Conky Top:

own_window                yes
own_window_class          Conky
own_window_type           panel
own_window_transparent    no
own_window_colour              303030
own_window_hints          undecorated,below,sticky,skip_taskbar,skip_pager
update_interval           1
double_buffer                  yes
alignment                 top_middle
background                no
border_width              0
cpu_avg_samples           5
color1                            8f8f8f
color2                            e0e0e0
default_color             8f8f8f
default_outline_color     white
draw_borders              no
draw_graph_borders        no
draw_outline              no
draw_shades               no
use_xft                   yes
xftfont                   Sans:size=7
xftalpha                  1
gap_x                     0
gap_y                     0
minimum_size              1252 13
maximum_width             1252
net_avg_samples           2
no_buffers                yes
out_to_console            no
uppercase                 no
short_units               yes
pad_percents              1
text_buffer_size          512
temperature_unit          celsius
mpd_host                            localhost
mpd_port                            6600
if_up_strictness                address


TEXT
  ${color1}Datum: ${color2}${time %d/%m/%y}${color1}  Tijd: ${color2}${time %H:%M}${color1}${offset 50}Kernel: ${color2}${kernel}${color1}  Uptime: ${color2}${uptime_short}${color1}  Tempratuur: ${color2}${acpitemp}°C${color1}${offset 50}Batterij: ${color2}${battery_percent BAT0}%  ${color1}Ac: ${color2}${acpiacadapter ADP1}${color1}${offset 50}Cpu: ${color2}${cpu}%${color1}  GHz: ${color2}${freq_g}${color1}  Ram: ${color2}${memperc}%  ${color1}Swap: ${color2}${swapperc}%${color1}  /home: ${color2}${fs_used_perc /home}%${color1}${offset 50}Desktop: ${color2}${desktop}${color1}  Mpd: ${color2}${mpd_status}${color1}${offset 50}Pacman: ${color2}${execpi 60 /home/sander/.scripts/pacman-updates}${color1}

Conky Var

double_buffer yes

background yes
own_window yes
own_window_transparent yes
own_window_class Conkyvar
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager

draw_borders no
draw_shades no

gap_x 10
gap_y 15
alignment bottom_left

update_interval 5
default_color e0e0e0

use_xft yes
xftfont Sans:size=6

use_spacer none

#cpu_avg_samples 2
#net_avg_samples 2
#no_buffers yes
#text_buffer_size 2048

minimum_size 500 0
maximum_width 600

override_utf8_locale yes

TEXT
${exec tail /var/log/everything.log}

Bitbucket - DeviantART - Userstyles
*Currently Not Using Arch

Offline

Board footer

Powered by FluxBB