SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#8351 2015-04-30 07:53:57

Temetka
#! CrunchBanger
From: California
Registered: 2014-08-25
Posts: 179

Re: Conky v1.9 Thread

I never really got down and dirty with LUA before. I've just taken OPC's (Other People's Conky's) and tweaked them for my needs / wants.

That being said in one of the ArchLinux forums, I found a link to here:

Original - http://www.noobslab.com/2012/11/install … linux.html

I am now tweaking away and will post my results when done. I'm just posting this here for future reference and if anyone wants (what I think to be) a good example of a nice simple conky/lua setp without being to overly complex.

I am working on moving some of the text to line up with the LUA circles, clean up the formatting of the processes and open ports and change out the weather from NOAA to accuweather. Mainly because NOAA doesn't list my city and LA county is too big to give an accurate result. I'd also like to merge his network info into one section for ETH and WLAN using if_up.

I'm doing all this on my ancient latitude D630 (which I love very much) running the latest x64 version of Linux Mint KDE (17 as of this posting). One of the things I really like about linux in general is seeing how awesome it runs on older gear. I have around 16 tabs open in FF, youtube streaming some trance (sue me), a few konsole sessions, some kate action (need to find a better editor) and im connected up to my 5TB buffalo terastation (NAS) where I keep all my important data.

When I first dove into the LUA script I was kind of shocked. To me it looked very complex, but then again it was my first time editing one. For all I know it's not all that complex when compared to what other people have done. That being said I have been borrowing enough conky code over the years that I can write my own from scratch now.

Kind of a long-ish post with no screenies. But just thought I'd share my thoughts and progress. I got an SSD coming soon and plan on installing it this machine along with a fresh install of #! to replace Mint. That way I wont feel so dirty posting in the #! forums as a dirty mint user.

Anyway code on, and hopefully tomorrow or friday I will have my update posted along with the LUA and conkyrc files.

Fun times. smile

EDIT: Isn't amazing what caffeine will do for you? I rather like the outcome.

snapshot1_zpscfw8p0ew.png

Okay as promised, here is my .conkyrc file

#==============================================================================
#                                  conkyrc
#
#  display : horizontal ring gauge
#
#  author  : SLK
#  version : v20121005-01
#  license : Distributed under the terms of GNU GPL version 2 or later
#
#  Modified by : Umair - http://www.NoobsLab.com
#==============================================================================

background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2
temperature_unit celsius

double_buffer yes
no_buffers yes
text_buffer_size 2048

gap_x 40
gap_y 50
minimum_size 500 200
maximum_width 800
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
alignment tr

draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

override_utf8_locale yes
use_xft yes
xftfont caviar dreams:size=9
xftalpha 0.5
uppercase no

default_color FFFFFF
color1 ffffff
color2 ffffff
color3 ffffff

lua_load ~/.conky/conky_grey.lua
lua_draw_hook_post main
TEXT
${font caviar dreams:size=11}${voffset -12}${offset 140}${font caviar dreams:size=11}${voffset 10}${color1}${pre_exec cat /etc/issue.net} #SHOW LINUXVER
${voffset 35}${font Ubuntu:size=10}${color1}
${offset 30}CPU${offset 70}RAM${offset 65}ROOT${offset 75}UP${offset 70}DOWN

${font caviar dreams:size=7}${voffset 0}${offset -2}${font caviar dreams:size=7}${voffset 10}${color1}${cpu}% ${freq_g} ${acpitemp}°C
${font caviar dreams:size=7}${voffset 0}${offset -2}${font caviar dreams:size=7}${voffset 2}${color1}${execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'| uniq | cut -c 1-22}
${font caviar dreams:size=7}${voffset -12}${offset 100}${font caviar dreams:size=7}${voffset -14}${color1}${mem}/${memmax}
${font caviar dreams:size=7}${voffset 0}${offset 200}${font caviar dreams:size=7}${voffset -12}${color1}${fs_used /}/${fs_size /}
${font caviar dreams:size=7}${voffset 0}${offset 200}${font caviar dreams:size=7}${voffset 5}${color1}${diskiograph 6,50 ffffff ffffff}  ${hddtemp /dev/sda} °C
${font caviar dreams:size=7}${voffset 0}${offset 200}${font caviar dreams:size=7}${voffset 3}${color1}HD I/O ${diskio}/s
${font caviar dreams:size=7}${voffset 0}${offset 310}${font caviar dreams:size=7}${voffset -45}${color1}${totalup wlan0}/${upspeed wlan0}
${font caviar dreams:size=7}${voffset 0}${offset 310}${font caviar dreams:size=7}${voffset 7}${color1}${upspeedgraph wlan0 6,60}
${font caviar dreams:size=7}${voffset 0}${offset 410}${font caviar dreams:size=7}${voffset -30}${color1}${totaldown wlan0}/${downspeed wlan0}
${font caviar dreams:size=7}${voffset 0}${offset 410}${font caviar dreams:size=7}${voffset 7}${color1}${downspeedgraph wlan0 6,60}
${font caviar dreams:size=7}${voffset 0}${offset 410}${font caviar dreams:size=7}${voffset 5}${color1}WLAN IP: ${addr wlan0}
${font caviar dreams:size=7}${voffset 0}${offset 410}${font caviar dreams:size=7}${voffset 5}${color1}ETH0 IP: ${addr eth0}




${font caviar dreams:size=10}${goto 160}${voffset -20}${time %A} ${time %d %B %Y} 
${font caviar dreams:size=18}${goto 169}${voffset -3}${time %H}:${time %M}  ${font caviar dreams:size=15}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LROP temperature temperature 30}°F
${font caviar dreams:size=8}${goto 159}${voffset -5}User: ${uid_name 1000}@${nodename} for ${uptime_short}
${font caviar dreams:size=8}${goto -12}${voffset 10}${color ffffff}${offset 20}    Battery 
${font caviar dreams:size=8}${goto -12}${voffset 0}${color ffffff}${offset 20}${battery_bar 4,70} 
${font caviar dreams:size=8}${goto -18}${voffset 0}${color ffffff}${offset 20}${battery}
${font caviar dreams:size=8}${goto -12}${voffset 0}${color ffffff}${offset 20}${acpiacadapter}
${font caviar dreams:size=8}${goto -12}${voffset 0}${color ffffff}${offset 20}${battery_time}
${font caviar dreams:size=7}${goto 120}${voffset -60}${color ffffff}${offset 20}TCP port open: ${tcp_portmon 1 65535 count}
${font caviar dreams:size=7}${goto 120}${voffset 2}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  0} ${tcp_portmon 1 65535 rport 0}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  1} ${tcp_portmon 1 65535 rport 1}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  2} ${tcp_portmon 1 65535 rport 2}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  3} ${tcp_portmon 1 65535 rport 3}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  4} ${tcp_portmon 1 65535 rport 4}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  5} ${tcp_portmon 1 65535 rport 5}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  6} ${tcp_portmon 1 65535 rport 6}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  7} ${tcp_portmon 1 65535 rport 7}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  8} ${tcp_portmon 1 65535 rport 8}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  9} ${tcp_portmon 1 65535 rport 9}
${font caviar dreams:size=8}${goto 250}${voffset -133}${color ffffff}${offset 20}Running Process:  ${running_processes}
${font caviar dreams:size=7}${goto 240}${voffset 3}${color ffffff}${offset 20}${top name 1}${top mem 1} ${top cpu 1}
${font caviar dreams:size=7}${goto 240}${voffset 0}${color ffffff}${offset 20}${top name 2}${top mem 2} ${top cpu 2}
${font caviar dreams:size=7}${goto 240}${voffset 0}${color ffffff}${offset 20}${top name 3}${top mem 3} ${top cpu 3}

${font caviar dreams:size=7}${goto 240}${voffset 0}${color ffffff}${offset 20}${top_mem name 1}${top_mem cpu 1}${top_mem mem 1}
${font caviar dreams:size=7}${goto 240}${voffset 0}${color ffffff}${offset 20}${top_mem name 2}${top_mem cpu 2}${top_mem mem 2}
${font caviar dreams:size=7}${goto 240}${voffset 0}${color ffffff}${offset 20}${top_mem name 3}${top_mem cpu 3}${top_mem mem 3}

and the lua config as well. note that I have it in the following folder: ~/home/myhomedir/.conky/conkygrey.lua

--==============================================================================
--                                 conky_grey.lua
-- 
--  display : horizontal ring gauge
--
--  author  : SLK
--  version : v20121005-01
--  license : Distributed under the terms of GNU GPL version 2 or later
--
--==============================================================================

require 'cairo'

--------------------------------------------------------------------------------
--                                                                    clock DATA
-- -- HOURS
-- clock_h = {
--     {
--     name='time',                   arg='%H',                    max_value=12,
--     x=110,                         y=80,
--     graph_radius=53,
--     graph_thickness=3,
--     graph_unit_angle=30,           graph_unit_thickness=30,
--     graph_bg_colour=0xffffff,      graph_bg_alpha=0.0,
--     graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.3,
--     txt_radius=34,
--     txt_weight=1,                  txt_size=10.0,
--     txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.6,
--     graduation_radius=53,
--     graduation_thickness=6,        graduation_mark_thickness=2,
--     graduation_unit_angle=30,
--     graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
--     },
-- }
-- -- MINUTES
-- clock_m = {
--     {
--     name='time',                   arg='%M',                    max_value=60,
--     x=110,                         y=80,
--     graph_radius=57,
--     graph_thickness=2,
--     graph_unit_angle=6,            graph_unit_thickness=6,
--     graph_bg_colour=0xffffff,      graph_bg_alpha=0.1,
--     graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.3,
--     txt_radius=70,
--     txt_weight=0,                  txt_size=9.0,
--     txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.6,
--     graduation_radius=57,
--     graduation_thickness=0,        graduation_mark_thickness=2,
--     graduation_unit_angle=30,
--     graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
--     },
-- }
-- -- SECONDS
-- clock_s = {
--     {
--     name='time',                   arg='%S',                    max_value=60,
--     x=110,                         y=80,
--     graph_radius=50,
--     graph_thickness=2,
--     graph_unit_angle=6,            graph_unit_thickness=2,
--     graph_bg_colour=0xffffff,      graph_bg_alpha=0.0,
--     graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.2,
--     txt_radius=40,
--     txt_weight=0,                  txt_size=12.0,
--     txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.3,
--     graduation_radius=0,
--     graduation_thickness=0,        graduation_mark_thickness=0,
--     graduation_unit_angle=0,
--     graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
--     },
-- }

--------------------------------------------------------------------------------
--                                                                    gauge DATA
gauge = {
{
    name='cpu',                    arg='cpu',                  max_value=100,
    x=40,                          y=60,
    graph_radius=30,
    graph_thickness=3,
    graph_start_angle=0,
    graph_unit_angle=3.59,          graph_unit_thickness=3.59,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.1,
    graph_fg_colour=0xffffff,      graph_fg_alpha=0.5,
    hand_fg_colour=0xFF0708,       hand_fg_alpha=0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFF0708,        txt_fg_alpha=0,
    graduation_radius=1,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=1,
    graduation_fg_colour=0xffffff, graduation_fg_alpha=0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xffffff,    caption_fg_alpha=0,
},
{
    name='memperc',                    arg='',                  max_value=100,
    x=140,                          y=60,
    graph_radius=30,
    graph_thickness=3,
    graph_start_angle=0,
    graph_unit_angle=3.59,          graph_unit_thickness=3.59,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.1,
    graph_fg_colour=0xffffff,      graph_fg_alpha=0.5,
    hand_fg_colour=0xFF0708,       hand_fg_alpha=0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFF0708,        txt_fg_alpha=0,
    graduation_radius=1,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=1,
    graduation_fg_colour=0xffffff, graduation_fg_alpha=0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xffffff,    caption_fg_alpha=0,
},

{
    name='fs_used_perc',                    arg='/',                  max_value=100,
    x=240,                          y=60,
    graph_radius=30,
    graph_thickness=3,
    graph_start_angle=0,
    graph_unit_angle=3.59,          graph_unit_thickness=3.59,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.1,
    graph_fg_colour=0xffffff,      graph_fg_alpha=0.5,
    hand_fg_colour=0xFF0708,       hand_fg_alpha=0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFF0708,        txt_fg_alpha=0,
    graduation_radius=1,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=1,
    graduation_fg_colour=0xffffff, graduation_fg_alpha=0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xffffff,    caption_fg_alpha=0,
},
{
    name='upspeedf',           arg='wlan0',                     max_value=100,
    x=340,                          y=60,
    graph_radius=30,
    graph_thickness=3,
    graph_start_angle=0,
    graph_unit_angle=3.59,          graph_unit_thickness=3.59,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.1,
    graph_fg_colour=0xffffff,      graph_fg_alpha=0.5,
    hand_fg_colour=0xFF0708,       hand_fg_alpha=0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFF0708,        txt_fg_alpha=0,
    graduation_radius=1,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=1,
    graduation_fg_colour=0xffffff, graduation_fg_alpha=0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xffffff,    caption_fg_alpha=0,
},
{
    name='downspeedf',           arg='wlan0',                max_value=100,
    x=440,                          y=60,
    graph_radius=30,
    graph_thickness=3,
    graph_start_angle=0,
    graph_unit_angle=3.59,          graph_unit_thickness=3.59,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.1,
    graph_fg_colour=0xffffff,      graph_fg_alpha=0.5,
    hand_fg_colour=0xFF0708,       hand_fg_alpha=0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFF0708,        txt_fg_alpha=0,
    graduation_radius=1,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=1,
    graduation_fg_colour=0xffffff, graduation_fg_alpha=0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xffffff,    caption_fg_alpha=0,
},


}

-------------------------------------------------------------------------------
--                                                                 rgb_to_r_g_b
-- converts color in hexa to decimal
--
function rgb_to_r_g_b(colour, alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

-------------------------------------------------------------------------------
--                                                            angle_to_position
-- convert degree to rad and rotate (0 degree is top/north)
--
function angle_to_position(start_angle, current_angle)
    local pos = current_angle + start_angle
    return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end

-------------------------------------------------------------------------------
--                                                              draw_clock_ring
-- displays clock
--
function draw_clock_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']

    -- background ring
    cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi)
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)

    -- arc of value
    local val = (value % max_value)
    local i = 1
    while i <= val do
        cairo_arc(display, x, y, graph_radius,(  ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360)  )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2))
        cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = (graph_unit_angle * i) - graph_unit_thickness

    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = 360 / graduation_unit_angle
        local i = 1
        while i <= nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end

    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * (math.cos((angle * 2 * math.pi / 360)-(math.pi/2)))
    local movey = txt_radius * (math.sin((angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight);
    cairo_set_font_size (display, txt_size);
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha));
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3);
    cairo_show_text (display, value);
    cairo_stroke (display);
end

-------------------------------------------------------------------------------
--                                                              draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_start_angle = data['graph_start_angle']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
    local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
    local graph_end_angle = (max_value * graph_unit_angle) % 360

    -- background ring
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)

    -- arc of value
    local val = value % (max_value + 1)
    local start_arc = 0
    local stop_arc = 0
    local i = 1
    while i <= val do
        start_arc = (graph_unit_angle * i) - graph_unit_thickness
        stop_arc = (graph_unit_angle * i)
        cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
        cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = start_arc

    -- hand
    start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
    stop_arc = (graph_unit_angle * val)
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
    cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
    cairo_stroke(display)

    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = graph_end_angle / graduation_unit_angle
        local i = 0
        while i < nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
            stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
            cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end

    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
    local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
    cairo_set_font_size (display, txt_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
    cairo_show_text (display, value)
    cairo_stroke (display)

    -- caption
    local caption = data['caption']
    local caption_weight, caption_size = data['caption_weight'], data['caption_size']
    local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
    local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
    cairo_set_font_size (display, caption_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
    cairo_move_to (display, x + tox + 5, y + toy + 1)
    -- bad hack but not enough time !
    if graph_start_angle < 105 then
        cairo_move_to (display, x + tox - 30, y + toy + 1)
    end
    cairo_show_text (display, caption)
    cairo_stroke (display)
end

-------------------------------------------------------------------------------
--                                                               go_clock_rings
-- loads data and displays clock
--
function go_clock_rings(display)
    local function load_clock_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_clock_ring(display, data, value)
    end
    
    for i in pairs(clock_h) do
        load_clock_rings(display, clock_h[i])
    end
    for i in pairs(clock_m) do
        load_clock_rings(display, clock_m[i])
    end
    for i in pairs(clock_s) do
        load_clock_rings(display, clock_s[i])
    end
end

-------------------------------------------------------------------------------
--                                                               go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
    local function load_gauge_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_gauge_ring(display, data, value)
    end
    
    for i in pairs(gauge) do
        load_gauge_rings(display, gauge[i])
    end
end

-------------------------------------------------------------------------------
--                                                                         MAIN
function conky_main()
    if conky_window == nil then 
        return
    end

    local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    local display = cairo_create(cs)
    
    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)
    
    if update_num > 5 then
--        go_clock_rings(display)
        go_gauge_rings(display)
    end

    cairo_surface_destroy(cs)
    cairo_destroy(display)
end

I had a *TON* of fun doing this. I love putting conky's together. Whether it's mine or borrowed from the 'net. I threw on some trance on youtube and got down to work. A few hours later...well you see the results. Like I mentioned before, this was my first time doing anything with lua files. I was a little nervous, not knowing the syntax and code structure. But I feel more confident now playing around with these. I only did some minimal editing to handle spacing and swapped the 'up' and 'down' locations. Next time around I will get a little more in depth. Playing around with conky/lua is very fun and addicting.

Anyway, have fun guys. Feel free to take the code. I put the source link in the top of this post so you can use his, or mine since I just cleaned it for my tastes.

Let me know what you think.


EDIT #2: Noticed I haven't updated the weather yet. I'll add that in later. It's getting to be about 4:30AM and I have to get *some* sleep before work.

=== Mod Edit ===

Please edit and use a thumbnail - To help those of us with slow connections and the CrunchBang server bandwidth.  Most image hosting sites will automatically generate thumbnail codes for you.

Of course use whatever service you wish, but please, get a thumbnail and use that or it will be changed by a moderator.

Avoid the large thumbnail www.imgur.com code, use the "medium" link thumbnail.  An example of the code:

[url=http://imgur.com/your_image_code][img]http://i.imgur.com/your_image_codem.jpg[/img][/url]

Notice the m in your_image_codem.jpg in the IMG code block

Users have been using www.postimage.org lately which does a nice job and is Multi-lingual as well.  Upload your image to the site and grab the Thumbnail for Forums (1) code.

Here is a generic piece of code if you need to create your own thumbnail:

[url=http://link.to.your.fullsized.image][img]http://link.to.your.thumbnail.image[/img][/url]

for your image.

Last edited by Sector11 (2015-04-30 21:48:23)

Offline

Help fund CrunchBang, donate to the project!

#8352 2015-04-30 20:46:11

wagmic1
#! CrunchBanger
Registered: 2013-11-15
Posts: 119

Re: Conky v1.9 Thread

j aiiiiiiiiime ça !
i loooooove it !


I need to learn how to speak/write English big_smile
latest Firefox on #! handylinux

Offline

#8353 2015-04-30 21:52:18

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

wagmic1 wrote:

I need to learn how to speak/write English big_smile

lol lol lol so do I

I agree - lovely conky!


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8354 2015-05-01 06:31:15

chepioq
#! Member
Registered: 2013-01-09
Posts: 79

Re: Conky v1.9 Thread

Hi Nili.
I added a line which show the city :

${font DejaVuSansMono:bold:size=8}${pre_exec cat /home/dominique/.cache/weather.xml | grep city | awk -F\" '{ print $2 }'}

The new conky's code:

# Conky settings #
background no
update_interval 3600
double_buffer yes
no_buffers yes
imlib_cache_size 10

# Window specifications #
gap_x 1190
gap_y 38
minimum_size 73
maximum_width 183
own_window yes
own_window_type normal
own_window_transparent yes
own_window_argb_visual yes
own_window_hints undecorate,skip_taskbar,skip_pager,below
double_buffer yes
draw_shades no
draw_outline no
draw_borders no
default_outline_color 000000
draw_graph_borders no

# Text settings #
use_xft yes
xftalpha 0.8
xftfont DejaVuSansMono:size=7
text_buffer_size 256
override_utf8_locale yes
imlib_cache_size 0

# Color scheme
default_color F2F2F2
color1 FFFFFF
color2 F5B800
color3 BFBFBF

TEXT
${execi 300 curl -s "http://weather.yahooapis.com/forecastrss?w=576999&u=c&d=8" | sed 's/Sun/Dim/g;s/Mon/Lun/g;s/Tue/Mar/g;s/Wed/Mer/g;s/Thu/Jeu/g;s/Fri/Ven/g;s/Sat/Sam/g' > ~/.cache/weather.xml}

${font DejaVuSansMono:bold:size=8}${voffset -13}${alignr}${color2}${execi 300 grep "yweather:condition" ~/.cache/weather.xml | grep -o "temp=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"} °${font}${color}
${font DejaVuSansMono:bold:size=8}${voffset 0}${alignr}${color1}Actuel${color}${font}
${execi 300 cp -f ~/conky-meteo/icons/$(grep "yweather:condition" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*").png ~/.cache/weather.png}${image ~/.cache/weather.png -p -1,1 -s 32x32}

${voffset -9}${alignr}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1'}°/${color2}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1'}°${color}
${font DejaVuSansMono:bold:size=8}${voffset 0}${alignr}${color1}Aujourd'hui${font}${color}
${execi 300 cp -f ~/conky-meteo/icons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1').png ~/.cache/weather-1.png}${image ~/.cache/weather-1.png -p -1,35 -s 32x32}

${voffset -9}${alignr}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2'}°/${color2}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2'}°${color}
${font DejaVuSansMono:bold:size=8}${voffset 0}${alignr}${color1}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2' | tr '[a-z]' '[A-Z]'}, ${execi 3600 date -d +1days +%d}${font}${color}
${execi 300 cp -f ~/conky-meteo/icons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2').png ~/.cache/weather-2.png}${image ~/.cache/weather-2.png -p -1,71 -s 32x32}

${voffset -9}${alignr}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3'}°/${color2}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3'}°${color}
${font DejaVuSansMono:bold:size=8}${voffset 0}${alignr}${color1}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3' | tr '[a-z]' '[A-Z]'}, ${execi 3600 date -d +2days +%d}${font}${color}
${execi 300 cp -f ~/conky-meteo/icons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3').png ~/.cache/weather-3.png}${image ~/.cache/weather-3.png -p -1,107 -s 32x32}

${voffset -9}${alignr}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4'}°/${color2}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4'}°${color}
${font DejaVuSansMono:bold:size=8}${voffset 0}${alignr}${color1}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4' | tr '[a-z]' '[A-Z]'}, ${execi 3600 date -d +3days +%d}${font}${color}
${execi 300 cp -f ~/conky-meteo/icons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4').png ~/.cache/weather-4.png}${image ~/.cache/weather-4.png -p -1,143 -s 32x32}

${voffset -9}${alignr}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5'}°/${color2}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5'}°${color}
${font DejaVuSansMono:bold:size=8}${voffset 0}${alignr}${color1}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5' | tr '[a-z]' '[A-Z]'}, ${execi 3600 date -d +4days +%d}${font}${color}
${execi 300 cp -f ~/conky-meteo/icons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5').png ~/.cache/weather-5.png}${image ~/.cache/weather-5.png -p -1,179 -s 32x32}

${voffset -9}${alignr}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==6'}°/${color2}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==6'}°${color}
${font DejaVuSansMono:bold:size=8}${voffset 0}${alignr}${color1}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==6' | tr '[a-z]' '[A-Z]'}, ${execi 3600 date -d +5days +%d}${font}${color}
${execi 300 cp -f ~/conky-meteo/icons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==6').png ~/.cache/weather-6.png}${image ~/.cache/weather-6.png -p -1,215 -s 32x32}

${voffset -6}${alignr}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==7'}°/${color2}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==7'}°${color}
${font DejaVuSansMono:bold:size=8}${voffset 0}${alignr}${color1}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==7' | tr '[a-z]' '[A-Z]'}, ${execi 3600 date -d +6days +%d}${font}${color}
${execi 300 cp -f ~/conky-meteo/icons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==7').png ~/.cache/weather-7.png}${image ~/.cache/weather-7.png -p -1,251 -s 32x32}

${voffset -6}${alignr}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==8'}°/${color2}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==8'}°${color}
${font DejaVuSansMono:bold:size=8}${voffset 0}${alignr}${color1}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==8' | tr '[a-z]' '[A-Z]'}, ${execi 3600 date -d +7days +%d}${font}${color}
${execi 300 cp -f ~/conky-meteo/icons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==7').png ~/.cache/weather-8.png}${image ~/.cache/weather-8.png -p -1,287 -s 32x32}

${font DejaVuSansMono:bold:size=8}${pre_exec cat /home/dominique/.cache/weather.xml | grep city | awk -F\" '{ print $2 }'}
${font DejaVuSansMono:size=8}${voffset 5}${color2}${execi 300 grep "yweather:astronomy" ~/.cache/weather.xml | grep -o "sunrise=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${color}${alignr}Lever
${color4}${execi 300 grep "yweather:atmosphere" ~/.cache/weather.xml | grep -o "humidity=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}%${alignr}Humidité${color}
${color5}${execi 300 grep "yweather:wind" ~/.cache/weather.xml | grep -o "speed=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${execi 300 grep "yweather:units" ~/.cache/weather.xml | grep -o "speed=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${alignr}Vent${color}
Coucher${alignr}${color2}${execi 300 grep "yweather:astronomy" ~/.cache/weather.xml | grep -o "sunset=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${color}

And the result:
1430461786.jpg

Offline

#8355 2015-05-01 10:28:33

Temetka
#! CrunchBanger
From: California
Registered: 2014-08-25
Posts: 179

Re: Conky v1.9 Thread

That looks really nice.  cool

Offline

#8356 2015-05-01 11:58:32

Nili
#! Die Hard
From: 127.0.0.1
Registered: 2013-03-20
Posts: 811
Website

Re: Conky v1.9 Thread

Great chepioq, i know that line but never use it, actually know where i am smile
documentation has a lot of feature on the part "Channel Elements".

For me would be interest to have some moon features from this code/service but it is not exposed to the public neutral


# Debian GNU/Linux 8:8.2 (netinst/stable)
# Packages Installed: 541
# Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt11-1+deb8u4 (2015-09-19) i686 GNU/Linux
# Startup finished in 2.850s (kernel) + 6.473s (userspace) = 9.324s

Offline

#8357 2015-05-02 06:45:02

chepioq
#! Member
Registered: 2013-01-09
Posts: 79

Re: Conky v1.9 Thread

I look for yahoo api, and I don't see nothing for moonphase.
But you can use additional scripts for that , like this : 1430548904.jpg

I upload the conky on Mega, if you want test : https://mega.co.nz/#!ldsngKrR!RHrF8UbPT … 78n9eFeSyk

Offline

#8358 2015-05-02 11:29:45

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

There is also Teo's » Conky weather+moon scripts (Accuw/WUndergr/NWS/Lunaf.com)
5) Moon phases' script - 5_19-3-14
4G1bRC6t.png


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8359 2015-05-02 12:59:39

Nili
#! Die Hard
From: 127.0.0.1
Registered: 2013-03-20
Posts: 811
Website

Re: Conky v1.9 Thread

I will look with much interest  thank you chepioq,
You're right, there is no code for moonphases at least to public, I have looked time after time myself.

Thanks Sector11,
Already saw Teo's great moon script, i mixed one day a month ago but in the end just i did not want to have two mixed code within, however I will see once again my position to use both.

So thanks both of you!

Kindly regards,
Nili


# Debian GNU/Linux 8:8.2 (netinst/stable)
# Packages Installed: 541
# Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt11-1+deb8u4 (2015-09-19) i686 GNU/Linux
# Startup finished in 2.850s (kernel) + 6.473s (userspace) = 9.324s

Offline

#8360 2015-05-02 14:45:49

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

I understand about not mixing two codes for resource reasons or whatever.  But when once considers using bash scripts that do other things on the net: RSS feeds, song titles and lyrics or album covers or LUA scripts ... isn't it really the same thing?

Again - it's all a personal choice anyway.  I have two of Teo's moon scripts - one is a development version.
2015_05_02_11_44_09_1920x1080_Sector11.jpg
Those are using old data files ... I move the "script command" that goes on line to a comment above TEXT for development purposes" once I have the data.  Saves going online as I do a lot of "saves"  big_smile


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8361 2015-05-02 16:29:44

Nili
#! Die Hard
From: 127.0.0.1
Registered: 2013-03-20
Posts: 811
Website

Re: Conky v1.9 Thread

Ok you're right, why do i use two conky anyway? one a panel and another for weather? isn't the same using two different sources within a file. smile

Yeah, go ahead and mix whatever we want enough to work.

By the way the left ones from your image looks aligned good, but i am not much into all those zodiac moon big_smile Weather enough
A simple moonphase like chepioq used is sufficient to me.

Kindly regards,
Nili


# Debian GNU/Linux 8:8.2 (netinst/stable)
# Packages Installed: 541
# Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt11-1+deb8u4 (2015-09-19) i686 GNU/Linux
# Startup finished in 2.850s (kernel) + 6.473s (userspace) = 9.324s

Offline

#8362 2015-05-02 20:41:53

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

chepioq wrote:

I look for yahoo api, and I don't see nothing for moonphase.
But you can use additional scripts for that , like this : http://pix.toile-libre.org/upload/img/1430548904.jpg

I upload the conky on Mega, if you want test : https://mega.co.nz/#!ldsngKrR!RHrF8UbPT … 78n9eFeSyk

I hate you!  In a Very Very Good You Are  A Genius Way That's an awesome little script ... I had to have have because I saw:

lua_load ~/conky-meteo/square_to_round.lua
lua_draw_hook_post main /home/sector11/conky-meteo/moon-phase/moon.jpg

And...

Sector11 thought
Noooooooo that can't be right ...

WRONG!  It's really REALLY nice!!!
KUDOS! and a Big Smile: 2015_05_02_17_37_05_1068x727_Sector11.jpg


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8363 2015-05-02 20:48:11

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

Nili wrote:

By the way the left ones from your image looks aligned good, but i am not much into all those zodiac moon big_smile Weather enough
A simple moonphase like chepioq used is sufficient to me.

Kindly regards,
Nili

Well, Teo did say it was "For all you obsessed with the moon, werewolves or LUNAtics."  big_smile
I just created that as a test ... I don't really use it ... I'm a conky nut. :8

Now chepioq's little script you bet I'm  going to use that.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8364 2015-05-03 05:45:10

chepioq
#! Member
Registered: 2013-01-09
Posts: 79

Re: Conky v1.9 Thread

Today, the script to show name for moonphase don't work,

It's because the www.lunaf.com html file is not the same.

I modified one line in conky :

${font DejaVuSansMono:bold:size=8}${offset 35}${voffset 20}${exec cat ~/.cache/moon-phase.html | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | grep "The current moon phase" | awk '{print $5,$6}' | sed 's/.The//'}

by this one

${font DejaVuSansMono:bold:size=8}${offset 35}${voffset 20}${exec cat ~/.cache/moon-phase.html | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | sed '/^$/d' | sed -n '/Universal Coordinated /,/Moon phases/p' | grep today | awk '{print $5,$6}' | sed 's/.The//'}

It works for today, but I don't know if it will work for other days.

Offline

#8365 2015-05-04 09:11:59

Temetka
#! CrunchBanger
From: California
Registered: 2014-08-25
Posts: 179

Re: Conky v1.9 Thread

Guys, I could use some help here.

If you take a look at this screen shot, perhaps one of you could answer my question.

snapshot2_zpsos0yh7ee.png

See how the weather information is not centered except for the first line? I'd like all 3 lines to be centered. I have made changes to my .conkyrc so I will post the code for that below as well as the weather.py script I am calling.

#==============================================================================
#                                  conkyrc
#
#  display : horizontal ring gauge
#
#  author  : SLK
#  version : v20121005-01
#  license : Distributed under the terms of GNU GPL version 2 or later
#
#  Modified by : Umair - http://www.NoobsLab.com
#==============================================================================

background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2
temperature_unit celsius

double_buffer yes
no_buffers yes
text_buffer_size 2048

gap_x 40
gap_y 50
minimum_size 500 200
maximum_width 800
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
alignment tr

draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

override_utf8_locale yes
use_xft yes
xftfont caviar dreams:size=9
xftalpha 0.5
uppercase no

default_color FFFFFF
color1 ffffff
color2 ffffff
color3 ffffff

lua_load ~/.conky/conky_grey.lua
lua_draw_hook_post main
TEXT
${font caviar dreams:size=11}${voffset -12}${offset 140}${font caviar dreams:size=11}${voffset 10}${color1}${pre_exec cat /etc/issue.net} #SHOW LINUXVER
${voffset 35}${font Ubuntu:size=8}${color1}
${offset 35}CPU${offset 75}RAM${offset 63}ROOT${offset 78}UP${offset 62}DOWN

${font caviar dreams:size=7}${voffset 0}${offset -2}${font caviar dreams:size=7}${voffset 10}${color1}${cpu}% ${freq_g} ${acpitemp}°C
${font caviar dreams:size=7}${voffset 0}${offset -2}${font caviar dreams:size=7}${voffset 2}${color1}${execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'| uniq | cut -c 9-20}
${font caviar dreams:size=7}${voffset -19}${offset 100}${font caviar dreams:size=7}${voffset -14}${color1}${mem}/${memmax}
${font caviar dreams:size=7}${voffset 18}${offset 105}${font caviar dreams:size=7}${voffset -14}${color1}${memgraph 6,70}
${font caviar dreams:size=7}${voffset -3}${offset 200}${font caviar dreams:size=7}${voffset -32}${color1}${fs_used /}/${fs_size /}
${font caviar dreams:size=7}${voffset 0}${offset 200}${font caviar dreams:size=7}${voffset 5}${color1}${diskiograph 6,70 ffffff ffffff}
${font caviar dreams:size=7}${voffset 0}${offset 200}${font caviar dreams:size=7}${voffset 3}${color1}HD I/O ${diskio}/s
${font caviar dreams:size=7}${voffset 0}${offset 310}${font caviar dreams:size=7}${voffset -53}${color1}${totalup wlan0}/${upspeed wlan0}
${font caviar dreams:size=7}${voffset 0}${offset 310}${font caviar dreams:size=7}${voffset 7}${color1}${upspeedgraph wlan0 6,60}
${font caviar dreams:size=7}${voffset 0}${offset 410}${font caviar dreams:size=7}${voffset -37}${color1}${totaldown wlan0}/${downspeed wlan0}
${font caviar dreams:size=7}${voffset 0}${offset 410}${font caviar dreams:size=7}${voffset 7}${color1}${downspeedgraph wlan0 6,60}
${font caviar dreams:size=7}${voffset 0}${offset 410}${font caviar dreams:size=7}${voffset 5}${color1}WLAN IP: ${addr wlan0}
${font caviar dreams:size=7}${voffset 0}${offset 410}${font caviar dreams:size=7}${voffset 5}${color1}ETH0 IP: ${addr eth0}

## Adding in cpubar graphs seems to kill all output except the cpu info


${font caviar dreams:size=10}${goto 170}${voffset -20}${time %A} ${time %d %B %Y} 
${font caviar dreams:size=18}${goto 220}${voffset 3}${time %H}:${time %M}
${font caviar dreams:size=9}${alignc}${execi 1200 /home/mike/weather.py 91740} ## I want the weather centered


${font caviar dreams:size=8}${goto 159}${voffset -5}User: ${uid_name 1000}@${nodename} for ${uptime_short}
${font caviar dreams:size=8}${goto -12}${voffset 10}${color ffffff}${offset 20}    Battery 
${font caviar dreams:size=8}${goto -12}${voffset 0}${color ffffff}${offset 20}${battery_bar 4,70} 
${font caviar dreams:size=8}${goto -18}${voffset 0}${color ffffff}${offset 20}${battery}
${font caviar dreams:size=8}${goto -12}${voffset 0}${color ffffff}${offset 20}${acpiacadapter}
${font caviar dreams:size=8}${goto -12}${voffset 0}${color ffffff}${offset 20}${battery_time}
${font caviar dreams:size=7}${goto 120}${voffset -85}${color ffffff}${offset 20}TCP port open: ${tcp_portmon 1 65535 count}
${font caviar dreams:size=7}${goto 120}${voffset 2}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  0} ${tcp_portmon 1 65535 rport 0}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  1} ${tcp_portmon 1 65535 rport 1}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  2} ${tcp_portmon 1 65535 rport 2}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  3} ${tcp_portmon 1 65535 rport 3}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  4} ${tcp_portmon 1 65535 rport 4}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  5} ${tcp_portmon 1 65535 rport 5}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  6} ${tcp_portmon 1 65535 rport 6}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  7} ${tcp_portmon 1 65535 rport 7}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  8} ${tcp_portmon 1 65535 rport 8}
${font caviar dreams:size=7}${goto 120}${voffset 0}${color ffffff}${offset 20}${tcp_portmon 1 65535 rip  9} ${tcp_portmon 1 65535 rport 9}
${font caviar dreams:size=8}${goto 270}${voffset -168}${color ffffff}${offset 20}Running Process:  ${running_processes}
${font caviar dreams:size=7}${goto 260}${voffset 3}${color ffffff}${offset 20}${top name 1}${top mem 1} ${top cpu 1}
${font caviar dreams:size=7}${goto 260}${voffset 0}${color ffffff}${offset 20}${top name 2}${top mem 2} ${top cpu 2}
${font caviar dreams:size=7}${goto 260}${voffset 0}${color ffffff}${offset 20}${top name 3}${top mem 3} ${top cpu 3}

${font caviar dreams:size=7}${goto 260}${voffset 0}${color ffffff}${offset 20}${top_mem name 1}${top_mem cpu 1}${top_mem mem 1}
${font caviar dreams:size=7}${goto 260}${voffset 0}${color ffffff}${offset 20}${top_mem name 2}${top_mem cpu 2}${top_mem mem 2}
${font caviar dreams:size=7}${goto 260}${voffset 0}${color ffffff}${offset 20}${top_mem name 3}${top_mem cpu 3}${top_mem mem 3}

Weather.py

# !/usr/bin/bash
METRIC=0 #Should be 0 or 1; 0 for F, 1 for C
if [ -z $1 ]; then
    echo "USAGE: weather.sh <locationcode>"
    exit 0;
fi

wget -q http://rss.accuweather.com/rss/liveweather_rss.asp\?metric\=${METRIC}\&locCode\=$1 -O - | gawk \
'/Currently:/ {CurWeather=$0}
/[0-9][0-9][0-9][0-9] Forecast<\/title>/ {nr=NR+3; split($0,z," "); split(z[1],r,"/|>"); DateIndx[x+1]=mktime(sprintf("%s %s %s 0 0 0",r[4],r[2],r[3]))} 
NR==nr   {postIndx[++x]=$0}
# x>2    {exit}
END{
    split(CurWeather,tmp,"Currently: ")
    split(tmp[2],tmp1,"<")
    CurWeather=sprintf("%s",tmp1[1])
    sub(":",",",CurWeather)
    
    for(x in postIndx){
		split(postIndx[x],tmp,";|&")
		split(tmp[1],tmp,">")
		split(tmp[2],statement," F ") # substitute C for F if metric differs
		split(tmp[2],temp)
		forecast[++y]=sprintf("%s %d-%dF %-15s",strftime("%a",DateIndx[x]),temp[5],temp[2],statement[3])
    }
    printf("Now: %s\nToday: %s\nTomorrow: %s",CurWeather,forecast[1],forecast[2],forcast[3])
}'

Any help would be greatly appreciated.
Thanks.

Also I derped and deleted my original screen shot from a few posts above. No big deal as it is a work in progress and I added a new one here. But full disclosure and all...


EDIT: As long as were on the topic. If I could center a calender underneath the time but above the weather, that'd be great.

Thanks again.  cool

Last edited by Temetka (2015-05-04 09:13:56)

Offline

#8366 2015-05-04 13:14:57

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

Give me a few hours and I'll have it all for you with a huge code cleanup.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8367 2015-05-04 17:45:56

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

@ Temetka

OK, back and looking at this ... here's an example of how the code is a mess the very first line after TEXT:

TEXT
${font caviar dreams:size=11}${voffset -12}${offset 140}${font caviar dreams:size=11}${voffset 10}${color1}${pre_exec cat /etc/issue.net}

1. calls a font: caviar dreams:size=11
2. moves what will eventually be displayed on the screen 12 pixels UP
3. moves what will eventually be displayed on the screen 140 pixels to the right
4. recalled the same font as #1  ?????????????????  DUH!!!!
5 move what will eventually be displayed on the screen 10 pixels DOWN  SAY WHAT!!!!!!!!!!
6. calls for colour 1 and displays: ${pre_exec cat /etc/issue.net}

For what 2 pixels is worth that line could be:

TEXT
${font caviar dreams:size=11}${goto 140}${color1}${pre_exec cat /etc/issue.net}${font}

or if you REALLY want that 2 pixels:

TEXT
${font caviar dreams:size=11}${voffset -2}${goto 140}${color1}${pre_exec cat /etc/issue.net}${font}

back later - complete with a calendar with today highlighted.

ALSO - please post your ~/.conky/conky_grey.lua LUA code.  I'll need that


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8368 2015-05-04 18:34:13

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

OH MY!!!  This is horrible ....

${goto -12}${offset 20}

1. move left 12 pixels from the left edge of the conky window, and then
2. move right 20 pixels - so that would be like:

${goto 8}

{sigh} sometimes I just don't believe the code I see!

And lets forget all those ${voffset 0}'s that do absolutely nothing, 0, zip, nada! {otro sigh}

Caviar dreams is not a mono font so spacing will be a questionable thing:
2015_05_04_15_40_53_513x349_Sector11.jpg
take a look at:

aic 0101010
wmo 1111111

Code cleaning up very nicely.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8369 2015-05-04 18:52:09

Inodoro Pereyra
#! Die Hard
From: Back in Buenos Aires
Registered: 2013-07-01
Posts: 844

Re: Conky v1.9 Thread

Sector11 wrote:

Give me a few hours and I'll have it all for you with a huge code cleanup.

Yeah, when I saw that code, I knew that was something for you. I wouldn't even dare to get my hands on it... ]:D ]:D ]:D

Offline

#8370 2015-05-04 19:26:04

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

Inodoro Pereyra wrote:
Sector11 wrote:

Give me a few hours and I'll have it all for you with a huge code cleanup.

Yeah, when I saw that code, I knew that was something for you. I wouldn't even dare to get my hands on it... ]:D ]:D ]:D

I'm getting there ... still need the LUA script for spacing though.
2015_05_04_16_18_15_502x424_Sector11.jpg

Also @ Temetka

if you are reading this what do you mean by:

## Adding in cpubar graphs seems to kill all output except the cpu info
How many do you have and where do you want them?
I have 3 so I can put up 4 such as:  0 = Average 1, 2 & 3

Code is just a little cleaner so far ...  wink

TEXT
${font caviar dreams:size=11}${alignc}${pre_exec cat /etc/issue.net}



${font Ubuntu:size=8}${goto 35}CPU${goto 130}RAM${goto 215}ROOT${goto 321}UP${goto 396}DOWN${font}




  ${cpu}% ${freq_g} ${acpitemp}°C\
${goto 101}${mem} / ${memmax}\
${goto 200}${fs_used /} / ${fs_size /}\
${goto 310}${totalup wlan0} / ${upspeed wlan0}\
${goto 410}${totaldown wlan0} / ${downspeed wlan0}

  ${execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'| uniq | cut -c 9-20}\
${goto 95}${memgraph 6,70}\
${goto 200}${diskiograph 6,70 ffffff ffffff}\
${goto 310}${upspeedgraph wlan0 6,60}\
${goto 410}${downspeedgraph wlan0 6,60}
${goto 200}HD I/O ${diskio}/s \
${alignr 10}WLAN IP: ${addr wlan0}
${alignr 10}ETH0 IP: ${addr eth0}

·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8371 2015-05-04 21:35:09

Temetka
#! CrunchBanger
From: California
Registered: 2014-08-25
Posts: 179

Re: Conky v1.9 Thread

Thanks for the help.

If you scroll up a few posts, you will see where I got original from. I pretty much copied and pasted what the other guy has. It's also in the start of the .conkyrc file

You asked for conky.lua. here it is:

--==============================================================================
--                                 conky_grey.lua
-- 
--  display : horizontal ring gauge
--
--  author  : SLK
--  version : v20121005-01
--  license : Distributed under the terms of GNU GPL version 2 or later
--
--==============================================================================

require 'cairo'

--------------------------------------------------------------------------------
--                                                                    clock DATA
-- -- HOURS
-- clock_h = {
--     {
--     name='time',                   arg='%H',                    max_value=12,
--     x=110,                         y=80,
--     graph_radius=53,
--     graph_thickness=3,
--     graph_unit_angle=30,           graph_unit_thickness=30,
--     graph_bg_colour=0xffffff,      graph_bg_alpha=0.0,
--     graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.3,
--     txt_radius=34,
--     txt_weight=1,                  txt_size=10.0,
--     txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.6,
--     graduation_radius=53,
--     graduation_thickness=6,        graduation_mark_thickness=2,
--     graduation_unit_angle=30,
--     graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
--     },
-- }
-- -- MINUTES
-- clock_m = {
--     {
--     name='time',                   arg='%M',                    max_value=60,
--     x=110,                         y=80,
--     graph_radius=57,
--     graph_thickness=2,
--     graph_unit_angle=6,            graph_unit_thickness=6,
--     graph_bg_colour=0xffffff,      graph_bg_alpha=0.1,
--     graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.3,
--     txt_radius=70,
--     txt_weight=0,                  txt_size=9.0,
--     txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.6,
--     graduation_radius=57,
--     graduation_thickness=0,        graduation_mark_thickness=2,
--     graduation_unit_angle=30,
--     graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
--     },
-- }
-- -- SECONDS
-- clock_s = {
--     {
--     name='time',                   arg='%S',                    max_value=60,
--     x=110,                         y=80,
--     graph_radius=50,
--     graph_thickness=2,
--     graph_unit_angle=6,            graph_unit_thickness=2,
--     graph_bg_colour=0xffffff,      graph_bg_alpha=0.0,
--     graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.2,
--     txt_radius=40,
--     txt_weight=0,                  txt_size=12.0,
--     txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.3,
--     graduation_radius=0,
--     graduation_thickness=0,        graduation_mark_thickness=0,
--     graduation_unit_angle=0,
--     graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
--     },
-- }

--------------------------------------------------------------------------------
--                                                                    gauge DATA
gauge = {
{
    name='cpu',                    arg='cpu',                  max_value=100,
    x=40,                          y=60,
    graph_radius=30,
    graph_thickness=3,
    graph_start_angle=0,
    graph_unit_angle=3.59,          graph_unit_thickness=3.59,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.1,
    graph_fg_colour=0xffffff,      graph_fg_alpha=0.5,
    hand_fg_colour=0xFF0708,       hand_fg_alpha=0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFF0708,        txt_fg_alpha=0,
    graduation_radius=1,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=1,
    graduation_fg_colour=0xffffff, graduation_fg_alpha=0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xffffff,    caption_fg_alpha=0,
},
{
    name='memperc',                    arg='',                  max_value=100,
    x=140,                          y=60,
    graph_radius=30,
    graph_thickness=3,
    graph_start_angle=0,
    graph_unit_angle=3.59,          graph_unit_thickness=3.59,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.1,
    graph_fg_colour=0xffffff,      graph_fg_alpha=0.5,
    hand_fg_colour=0xFF0708,       hand_fg_alpha=0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFF0708,        txt_fg_alpha=0,
    graduation_radius=1,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=1,
    graduation_fg_colour=0xffffff, graduation_fg_alpha=0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xffffff,    caption_fg_alpha=0,
},

{
    name='fs_used_perc',                    arg='/',                  max_value=100,
    x=240,                          y=60,
    graph_radius=30,
    graph_thickness=3,
    graph_start_angle=0,
    graph_unit_angle=3.59,          graph_unit_thickness=3.59,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.1,
    graph_fg_colour=0xffffff,      graph_fg_alpha=0.5,
    hand_fg_colour=0xFF0708,       hand_fg_alpha=0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFF0708,        txt_fg_alpha=0,
    graduation_radius=1,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=1,
    graduation_fg_colour=0xffffff, graduation_fg_alpha=0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xffffff,    caption_fg_alpha=0,
},
{
    name='upspeedf',           arg='wlan0',                     max_value=100,
    x=340,                          y=60,
    graph_radius=30,
    graph_thickness=3,
    graph_start_angle=0,
    graph_unit_angle=3.59,          graph_unit_thickness=3.59,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.1,
    graph_fg_colour=0xffffff,      graph_fg_alpha=0.5,
    hand_fg_colour=0xFF0708,       hand_fg_alpha=0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFF0708,        txt_fg_alpha=0,
    graduation_radius=1,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=1,
    graduation_fg_colour=0xffffff, graduation_fg_alpha=0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xffffff,    caption_fg_alpha=0,
},
{
    name='downspeedf',           arg='wlan0',                max_value=100,
    x=440,                          y=60,
    graph_radius=30,
    graph_thickness=3,
    graph_start_angle=0,
    graph_unit_angle=3.59,          graph_unit_thickness=3.59,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.1,
    graph_fg_colour=0xffffff,      graph_fg_alpha=0.5,
    hand_fg_colour=0xFF0708,       hand_fg_alpha=0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFF0708,        txt_fg_alpha=0,
    graduation_radius=1,
    graduation_thickness=0,        graduation_mark_thickness=1,
    graduation_unit_angle=1,
    graduation_fg_colour=0xffffff, graduation_fg_alpha=0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xffffff,    caption_fg_alpha=0,
},


}

-------------------------------------------------------------------------------
--                                                                 rgb_to_r_g_b
-- converts color in hexa to decimal
--
function rgb_to_r_g_b(colour, alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

-------------------------------------------------------------------------------
--                                                            angle_to_position
-- convert degree to rad and rotate (0 degree is top/north)
--
function angle_to_position(start_angle, current_angle)
    local pos = current_angle + start_angle
    return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end

-------------------------------------------------------------------------------
--                                                              draw_clock_ring
-- displays clock
--
function draw_clock_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']

    -- background ring
    cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi)
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)

    -- arc of value
    local val = (value % max_value)
    local i = 1
    while i <= val do
        cairo_arc(display, x, y, graph_radius,(  ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360)  )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2))
        cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = (graph_unit_angle * i) - graph_unit_thickness

    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = 360 / graduation_unit_angle
        local i = 1
        while i <= nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end

    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * (math.cos((angle * 2 * math.pi / 360)-(math.pi/2)))
    local movey = txt_radius * (math.sin((angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight);
    cairo_set_font_size (display, txt_size);
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha));
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3);
    cairo_show_text (display, value);
    cairo_stroke (display);
end

-------------------------------------------------------------------------------
--                                                              draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_start_angle = data['graph_start_angle']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
    local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
    local graph_end_angle = (max_value * graph_unit_angle) % 360

    -- background ring
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)

    -- arc of value
    local val = value % (max_value + 1)
    local start_arc = 0
    local stop_arc = 0
    local i = 1
    while i <= val do
        start_arc = (graph_unit_angle * i) - graph_unit_thickness
        stop_arc = (graph_unit_angle * i)
        cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
        cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = start_arc

    -- hand
    start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
    stop_arc = (graph_unit_angle * val)
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
    cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
    cairo_stroke(display)

    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = graph_end_angle / graduation_unit_angle
        local i = 0
        while i < nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
            stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
            cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end

    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
    local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
    cairo_set_font_size (display, txt_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
    cairo_show_text (display, value)
    cairo_stroke (display)

    -- caption
    local caption = data['caption']
    local caption_weight, caption_size = data['caption_weight'], data['caption_size']
    local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
    local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
    cairo_set_font_size (display, caption_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
    cairo_move_to (display, x + tox + 5, y + toy + 1)
    -- bad hack but not enough time !
    if graph_start_angle < 105 then
        cairo_move_to (display, x + tox - 30, y + toy + 1)
    end
    cairo_show_text (display, caption)
    cairo_stroke (display)
end

-------------------------------------------------------------------------------
--                                                               go_clock_rings
-- loads data and displays clock
--
function go_clock_rings(display)
    local function load_clock_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_clock_ring(display, data, value)
    end
    
    for i in pairs(clock_h) do
        load_clock_rings(display, clock_h[i])
    end
    for i in pairs(clock_m) do
        load_clock_rings(display, clock_m[i])
    end
    for i in pairs(clock_s) do
        load_clock_rings(display, clock_s[i])
    end
end

-------------------------------------------------------------------------------
--                                                               go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
    local function load_gauge_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_gauge_ring(display, data, value)
    end
    
    for i in pairs(gauge) do
        load_gauge_rings(display, gauge[i])
    end
end

-------------------------------------------------------------------------------
--                                                                         MAIN
function conky_main()
    if conky_window == nil then 
        return
    end

    local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    local display = cairo_create(cs)
    
    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)
    
    if update_num > 5 then
--        go_clock_rings(display)
        go_gauge_rings(display)
    end

    cairo_surface_destroy(cs)
    cairo_destroy(display)
end

What I meant by adding cpu seems is that I wanted to add 2 cpu graphs under the circle to show individual core activity. When run using the standard ${cpugraph cpu1 6,70} it would load the lua, but nothing else. Weird though, I just tried it again and it seems to be working but the spacing is all screwed up.

I've been kind of working on trying to clean the code up, but like you said - it's a mess. I don't know why the original author keeps calling the same font over and over. I thought you only had to open and close a font if you were using multiple fonts. EX:

${font arial size=12}Hello world${font}
${font comic sans size=36}Best font evar${font}

With regards to all the offsets, I think that was done because stuff is being called out of order in terms of how it's displayed. Or at least that's how it looks to me.

I will admit I spent a good deal of my weekend trying to get Outlook 2010 to run properly in Play On Linux with nos successs (so far). All I really did this weekend was slap my weather.py in there and cleaned up the spacing (by messing with the offsets, not cleaning the code actually) so it's easier to read on screen.

I've been planning a massive re-write, but just haven't had the time. I really appreciate any help.

Offline

#8372 2015-05-04 22:12:10

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

Temetka wrote:

Thanks for the help.

${font arial size=12}Hello world${font}
${font comic sans size=36}Best font evar${font}

I've been planning a massive re-write, but just haven't had the time. I really appreciate any help.

${font comic sans size=36}Best font evar${font} - Ummm lets agree to disagree here. lol lol lol lol

Actually the bit with font is partly true .. that are some pitfalls that people miss.
Check this out regarding spacing and fonts sizes.
Or this: goto offset and voffset - note the part about changing font sizes.

Now that I have the LUA script you are using I'll finish up what I have here.  I know ZERO about python so cant het that aligned, but Teo BigusGeekus has an RSS Accuweather "bash" script ( 1d)Accuweather RSS - 1d_12-2-14 )  that I modified to work with your conky that can be centred.
2015_05_04_18_45_46_1920x1080_Sector11.jpg
I have no wlan or battery so some things are "hard coded" and Teo's weather points to where I have it here on my machine. That's the default RSS feed conky on the left with modified like to match your style of output.

AND I can add cpubars where you want I think....

Here's the code I have at the moment - you'll need to edit things mentioned above.

# pkill -xf "conky -q -c /media/5/conky/Temetka/Temetka_s11.conky" &
# Completely re-written by Sector11 for Temetka
#==============================================================================
background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2
temperature_unit celsius

double_buffer yes
no_buffers yes
text_buffer_size 2048

gap_x 40
gap_y 50
minimum_size 500 0
maximum_width 500
own_window yes
own_window_transparent no #yes
#own_window_argb_visual yes
### ARGB can be used for real transparency
  own_window_argb_visual yes # Options: yes or no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
  own_window_argb_value 50
#own_window_hints undecorated,sticky,skip_taskbar,skip_pager,below
own_window_hints undecorated,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
alignment tr

draw_shades yes
default_shade_color 000000
draw_outline no
draw_borders no
draw_graph_borders no

override_utf8_locale yes
use_xft yes
xftfont caviar dreams:size=7
xftalpha 0.5
uppercase no

default_color ffffff
color0 B0E0E6 # PowderBlue
color1 778899 # LightSlateGray

# change GiB to G and MiB to M
short_units yes

#######lua_load ~/.conky/conky_grey.lua
##lua_load /media/5/conky/Temetka/conky_grey.lua
##lua_draw_hook_post main
TEXT
${font caviar dreams:size=11}${alignc}${pre_exec cat /etc/issue.net}${font}



${font Ubuntu:size=8}${goto 35}CPU${goto 130}RAM${goto 215}ROOT${goto 321}UP${goto 396}DOWN${font}




  ${cpu}% ${freq_g} ${acpitemp}°C\
${goto 101}${mem} / ${memmax}\
${goto 200}${fs_used /} / ${fs_size /}\
${goto 310}${totalup eth0} / ${upspeed eth0}\
${goto 410}${totaldown eth0} / ${downspeed eth0}

  ${execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'| uniq | cut -c 9-20}\
${goto 95}${memgraph 6,70}\
${goto 200}${diskiograph 6,70 ffffff ffffff}\
${goto 310}${upspeedgraph eth0 6,60}\
${goto 410}${downspeedgraph eth0 6,60}
${offset 200}HD I/O ${diskio}/s \
${alignr 10}WLAN IP: ${addr eth0}
${alignr 10}ETH0 IP: ${addr eth0}

## Adding in cpubar graphs seems to kill all output except the cpu info


${font caviar dreams:size=10}${alignc}${time %A} ${time %d %B %Y}
${font caviar dreams:size=18}${alignc}${time %H:%M}${font}

${font mono:size=8}${goto 191}${color}SU MO ${color0}${time %b %Y}${color} FR SA
${goto 191}${color1}${execpi 1800 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color0}&${color1}/' | sed ':a;N;$!ba;s/\n/\n${goto 191}/g'}${color}${font}

${font caviar dreams:size=9}${execi 600 bash $HOME/1d_accuweather_rss/1d}${alignc}Now: ${execpi 600 sed -n '1p' $HOME/1d_accuweather_rss/weather|cut -c12-}
${alignc}Today: ${execpi 600 sed -n '4p' $HOME/1d_accuweather_rss/weather|cut -c1-}
${alignc}Tomorrow: ${execpi 600 sed -n '7p' $HOME/1d_accuweather_rss/weather|cut -c1-}${font}

${font caviar dreams:size=8}${alignc}User: ${uid_name 1000}@${nodename} for ${uptime_short}

${font mono:size=8}${goto 20}Battery\
	${goto 160}TCP port open: ${tcp_portmon 1 65535 count}\
		${goto 335}Running Process:  ${running_processes}
${goto 20}${cpubar 4,70}\
	${goto 160}${tcp_portmon 1 65535 rip  0} ${tcp_portmon 1 65535 rport 0}\
		${alignr 20}${top name 1}${top mem 1} ${top cpu 1}
${goto 20}Charged\
${goto 160}${tcp_portmon 1 65535 rip  1} ${tcp_portmon 1 65535 rport 1}\
		${alignr 20}${top name 2}${top mem 2} ${top cpu 2}
${goto 20}acpiacadapter\
	${goto 160}${tcp_portmon 1 65535 rip  2} ${tcp_portmon 1 65535 rport 2}\
		${alignr 20}${top name 3}${top mem 3} ${top cpu 3}
${goto 20}battery_time\
	${goto 160}${tcp_portmon 1 65535 rip  3} ${tcp_portmon 1 65535 rport 3}\
		${alignr 20}${top_mem name 1}${top_mem cpu 1} ${top_mem mem 1}
	${goto 160}${tcp_portmon 1 65535 rip  4} ${tcp_portmon 1 65535 rport 4}\
		${alignr 20}${top_mem name 2}${top_mem cpu 2} ${top_mem mem 2}
	${goto 160}${tcp_portmon 1 65535 rip  5} ${tcp_portmon 1 65535 rport 5}\
		${alignr 20}${top_mem name 3}${top_mem cpu 3} ${top_mem mem 3}
	${goto 160}${tcp_portmon 1 65535 rip  6} ${tcp_portmon 1 65535 rport 6}
	${goto 160}${tcp_portmon 1 65535 rip  7} ${tcp_portmon 1 65535 rport 7}
	${goto 160}${tcp_portmon 1 65535 rip  8} ${tcp_portmon 1 65535 rport 8}
	${goto 160}${tcp_portmon 1 65535 rip  9} ${tcp_portmon 1 65535 rport 9}${font}

·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#8373 2015-05-04 22:37:11

Temetka
#! CrunchBanger
From: California
Registered: 2014-08-25
Posts: 179

Re: Conky v1.9 Thread

ZOMG!

Your last post looks almost exactly what I was picturing in my head.

I've added a SS of what I've been doing while at work. Not nearly as productive as you  have been (clients wanting my attention when I should be working on my conky wink )

snapshot3_zpsynsd6nny.png

Not much, I know. Here's my code so far:

background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2
temperature_unit celsius

double_buffer yes
no_buffers yes
text_buffer_size 2048

gap_x 40
gap_y 50
minimum_size 500 200
maximum_width 800
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
alignment tr

draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

override_utf8_locale yes
use_xft yes
xftfont caviar dreams:size=9
xftalpha 0.5
uppercase no

default_color FFFFFF
color1 ffffff
color2 ffffff
color3 ffffff

lua_load ~/.conky/conky_grey.lua
lua_draw_hook_post main
TEXT
${font caviar dreams:size=11}${goto 140}${color1}${pre_exec cat /etc/issue.net}${font}
${voffset 35}${font Ubuntu:size=8}${color1}${offset 35}CPU${offset 75}RAM${offset 63}ROOT${offset 78}UP${offset 62}DOWN

${font caviar dreams:size=7}${color1}${cpu}% ${freq_g} ${acpitemp}°C
${font caviar dreams:size=7}Core 1 ${cpugraph cpu1 10,50 EEEEEE A8A8A8}
${font caviar dreams:size=7}Core 2 ${cpugraph cpu2 10,50 EEEEEE A8A8A8}

Kind of basic, but just trying to re-write from scratch. Yours looks really nice!

Offline

#8374 2015-05-04 23:27:23

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

My version of your done!
2015_05_04_20_21_16_502x486_Sector11.jpg
I have an advantage - I'm retired (no customers or boss) and I've been doing conkys for 7 years.

Where you see I use "mono" for the font, please do the same.  The calendar and the "tcp_portmon" list will thank you.  A mono font lines it the decimals in the tcp_portmon lists.  big_smile

Have fun.

# pkill -xf "conky -q -c /media/5/conky/Temetka/Temetka_s11.conky" &
# Completely re-written by Sector11 for Temetka
#==============================================================================
background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2
temperature_unit celsius

double_buffer yes
no_buffers yes
text_buffer_size 2048

gap_x 40
gap_y 50
minimum_size 500 0
maximum_width 500
own_window yes
own_window_transparent no #yes
#own_window_argb_visual yes
### ARGB can be used for real transparency
  own_window_argb_visual yes # Options: yes or no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
  own_window_argb_value 0
#own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
own_window_hints undecorate,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
alignment tr

draw_shades yes
default_shade_color 000000
draw_outline no
draw_borders no
draw_graph_borders no

override_utf8_locale yes
use_xft yes
#xftfont mono:size=7
## xftfont monofur:bold:size=10
xftfont caviar dreams:size=7
xftalpha 0.5
uppercase no

default_color ffffff
color0 B0E0E6 # PowderBlue
color1 778899 # LightSlateGray

# change GiB to G and MiB to M
short_units yes

#######lua_load ~/.conky/conky_grey.lua
lua_load /media/5/conky/Temetka/conky_grey.lua
lua_draw_hook_post main
TEXT
${font caviar dreams:size=11}${alignc}${pre_exec cat /etc/issue.net}${font}





${font Ubuntu:size=8}${goto 40}CPU${goto 135}RAM${goto 232}ROOT${goto 345}UP${goto 430}DOWN${font}



  ${cpu}% ${freq_g} ${acpitemp}°C\
${goto 101}${mem} / ${memmax}\
${goto 200}${fs_used /} / ${fs_size /}\
${goto 310}${totalup eth0} / ${upspeed eth0}\
${goto 410}${totaldown eth0} / ${downspeed eth0}
  ${execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'| uniq | cut -c 9-20}\
${goto 95}${memgraph 6,70}\
${goto 200}${diskiograph 6,70 ffffff ffffff}\
${goto 310}${upspeedgraph eth0 6,60}\
${goto 410}${downspeedgraph eth0 6,60}
  Core 1 ${cpugraph cpu1 7,50 EEEEEE A8A8A8}\
${goto 200}HD I/O ${diskio}/s \
${alignr 10}WLAN IP: ${addr eth0}
  Core 2 ${cpugraph cpu2 7,50 EEEEEE A8A8A8}\
${alignr 10}ETH0 IP: ${addr eth0}

${font caviar dreams:size=10}${alignc}${time %A} ${time %d %B %Y}
${font caviar dreams:size=18}${alignc}${time %H:%M}${font}

${font mono:size=8}${goto 191}${color}SU MO ${color0}${time %b %Y}${color} FR SA
${goto 191}${color1}${execpi 1800 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color0}&${color1}/' | sed ':a;N;$!ba;s/\n/\n${goto 191}/g'}${color}${font}

${font caviar dreams:size=9}${execi 600 bash $HOME/1d_accuweather_rss/1d}${alignc}Now: ${execpi 600 sed -n '1p' $HOME/1d_accuweather_rss/weather|cut -c12-}
${alignc}Today: ${execpi 600 sed -n '4p' $HOME/1d_accuweather_rss/weather|cut -c1-}
${alignc}Tomorrow: ${execpi 600 sed -n '7p' $HOME/1d_accuweather_rss/weather|cut -c1-}${font}

${font caviar dreams:size=8}${alignc}User: ${uid_name 1000}@${nodename} for ${uptime_short}

${font mono:size=8}${goto 20}Battery\
	${goto 160}TCP port open: ${tcp_portmon 1 65535 count}\
		${goto 335}Running Process:  ${running_processes}
${goto 20}${cpubar 4,70}\
	${goto 160}${tcp_portmon 1 65535 rip  0} ${tcp_portmon 1 65535 rport 0}\
		${alignr 20}${top name 1}${top mem 1} ${top cpu 1}
${goto 20}Charged\
${goto 160}${tcp_portmon 1 65535 rip  1} ${tcp_portmon 1 65535 rport 1}\
		${alignr 20}${top name 2}${top mem 2} ${top cpu 2}
${goto 20}acpiacadapter\
	${goto 160}${tcp_portmon 1 65535 rip  2} ${tcp_portmon 1 65535 rport 2}\
		${alignr 20}${top name 3}${top mem 3} ${top cpu 3}
${goto 20}battery_time\
	${goto 160}${tcp_portmon 1 65535 rip  3} ${tcp_portmon 1 65535 rport 3}\
		${alignr 20}${top_mem name 1}${top_mem cpu 1} ${top_mem mem 1}
	${goto 160}${tcp_portmon 1 65535 rip  4} ${tcp_portmon 1 65535 rport 4}\
		${alignr 20}${top_mem name 2}${top_mem cpu 2} ${top_mem mem 2}
	${goto 160}${tcp_portmon 1 65535 rip  5} ${tcp_portmon 1 65535 rport 5}\
		${alignr 20}${top_mem name 3}${top_mem cpu 3} ${top_mem mem 3}
	${goto 160}${tcp_portmon 1 65535 rip  6} ${tcp_portmon 1 65535 rport 6}
	${goto 160}${tcp_portmon 1 65535 rip  7} ${tcp_portmon 1 65535 rport 7}
	${goto 160}${tcp_portmon 1 65535 rip  8} ${tcp_portmon 1 65535 rport 8}
	${goto 160}${tcp_portmon 1 65535 rip  9} ${tcp_portmon 1 65535 rport 9}${font}

·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

Be excellent to each other!

#8375 2015-05-05 00:35:41

Temetka
#! CrunchBanger
From: California
Registered: 2014-08-25
Posts: 179

Re: Conky v1.9 Thread

That looks awesome!

Not to be a pill but I have 2 questions. I decided the CPU info line about the CPU model # is stupid. I know I have an i5 CPU. So I want to remove that.

I also added in some opacity as I think it makes the conky pop more.

Secondly, I looked at my installed fonts and I don't have "mono." So I changed the conky.rc to use droid sans mono and it's not aligned. I can only assume I am calling the wrong font.

I changed the calendar spacing from 191 to 181. It looks more centered to my eyes.

snapshot4_zpsaqonqhz7.png

Here is the conky.rc file

# pkill -xf "conky -q -c /media/5/conky/Temetka/Temetka_s11.conky" &
# Completely re-written by Sector11 for Temetka
#==============================================================================
background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2
temperature_unit celsius

double_buffer yes
no_buffers yes
text_buffer_size 2048

gap_x 40
gap_y 50
minimum_size 500 0
maximum_width 500
own_window yes
own_window_transparent no #yes
#own_window_argb_visual yes
### ARGB can be used for real transparency
  own_window_argb_visual yes # Options: yes or no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
  own_window_argb_value 175
#own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
own_window_hints undecorate,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
alignment tr

draw_shades yes
default_shade_color 000000
draw_outline no
draw_borders no
draw_graph_borders no

override_utf8_locale yes
use_xft yes
#xftfont mono:size=7
## xftfont monofur:bold:size=10
xftfont caviar dreams:size=7
xftalpha 0.5
uppercase no

default_color ffffff
color0 B0E0E6 # PowderBlue
color1 778899 # LightSlateGray

# change GiB to G and MiB to M
short_units yes

lua_load ~/.conky/conky_grey.lua
lua_draw_hook_post main
TEXT
${font caviar dreams:size=11}${alignc}${pre_exec cat /etc/issue.net}${font}


${font Ubuntu:size=8}${goto 40}CPU${goto 135}RAM${goto 232}ROOT${goto 345}UP${goto 420}DOWN${font}



  ${cpu}% ${freq_g} ${acpitemp}°C\
${goto 101}${mem} / ${memmax}\
${goto 200}${fs_used /} / ${fs_size /}\
${goto 310}${totalup eth0} / ${upspeed eth0}\
${goto 410}${totaldown eth0} / ${downspeed eth0}
${goto 95}${memgraph 6,70}\
${goto 200}${diskiograph 6,70 ffffff ffffff}\
${goto 310}${upspeedgraph eth0 6,60}\
${goto 410}${downspeedgraph eth0 6,60}
  Core 1 ${cpugraph cpu1 7,50 EEEEEE A8A8A8}\
${goto 200}HD I/O ${diskio}/s \
${alignr 10}WLAN IP: ${addr wlan0}
  Core 2 ${cpugraph cpu2 7,50 EEEEEE A8A8A8}\
${alignr 10}ETH0 IP: ${addr eth0}

${font caviar dreams:size=10}${alignc}${time %A} ${time %d %B %Y}
${font caviar dreams:size=18}${alignc}${time %H:%M}${font}

${font mono:size=8}${goto 181}${color}SU MO ${color0}${time %b %Y}${color} FR SA
${goto 181}${color1}${execpi 1800 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color0}&${color1}/' | sed ':a;N;$!ba;s/\n/\n${goto 181}/g'}${color}${font}

${font caviar dreams:size=9}${execi 600 bash $HOME/1d_accuweather_rss/1d}${alignc}Now: ${execpi 600 sed -n '1p' $HOME/1d_accuweather_rss/weather|cut -c12-}
${alignc}Today: ${execpi 600 sed -n '4p' $HOME/1d_accuweather_rss/weather|cut -c1-}
${alignc}Tomorrow: ${execpi 600 sed -n '7p' $HOME/1d_accuweather_rss/weather|cut -c1-}${font}

${font caviar dreams:size=8}${alignc}User: ${uid_name 1000}@${nodename} for ${uptime_short}

${font droid sans mono:size=8}${goto 20}Battery\
	${goto 160}TCP port open: ${tcp_portmon 1 65535 count}\
		${goto 335}Running Process:  ${running_processes}
${goto 20}${cpubar 4,70}\
	${goto 160}${tcp_portmon 1 65535 rip  0} ${tcp_portmon 1 65535 rport 0}\
		${alignr 20}${top name 1}${top mem 1} ${top cpu 1}
${goto 20}Charged\
${goto 160}${tcp_portmon 1 65535 rip  1} ${tcp_portmon 1 65535 rport 1}\
		${alignr 20}${top name 2}${top mem 2} ${top cpu 2}
${goto 20}acpiacadapter\
	${goto 160}${tcp_portmon 1 65535 rip  2} ${tcp_portmon 1 65535 rport 2}\
		${alignr 20}${top name 3}${top mem 3} ${top cpu 3}
${goto 20}battery_time\
	${goto 160}${tcp_portmon 1 65535 rip  3} ${tcp_portmon 1 65535 rport 3}\
		${alignr 20}${top_mem name 1}${top_mem cpu 1} ${top_mem mem 1}
	${goto 160}${tcp_portmon 1 65535 rip  4} ${tcp_portmon 1 65535 rport 4}\
		${alignr 20}${top_mem name 2}${top_mem cpu 2} ${top_mem mem 2}
	${goto 160}${tcp_portmon 1 65535 rip  5} ${tcp_portmon 1 65535 rport 5}\
		${alignr 20}${top_mem name 3}${top_mem cpu 3} ${top_mem mem 3}
	${goto 160}${tcp_portmon 1 65535 rip  6} ${tcp_portmon 1 65535 rport 6}
	${goto 160}${tcp_portmon 1 65535 rip  7} ${tcp_portmon 1 65535 rport 7}
	${goto 160}${tcp_portmon 1 65535 rip  8} ${tcp_portmon 1 65535 rport 8}
	${goto 160}${tcp_portmon 1 65535 rip  9} ${tcp_portmon 1 65535 rport 9}${font}

Finally, I would like to thank you for your hard work. You really didn't have to clean this all up. But comparing this conky to the original code, it is far, far cleaner. You rock.

/wanders off to find the accuweather script.

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo