SEARCH

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

You are not logged in.

#7551 2014-05-21 20:20:36

Deegan
Member
From: Italy Varese
Registered: 2011-11-19
Posts: 36

Re: Conky v1.9 Thread

Hi boys. big_smile
I use this simple conky for the meteo::

double_buffer yes
use_spacer yes
use_xft yes
update_interval 3

minimum_size 230 #255 
maximum_width 295 #307

override_utf8_locale yes
draw_shades no
draw_outline no 
draw_borders no
xftfont Arial:size=9
uppercase no 
stippled_borders 3
border_margin 9
border_width 10
default_color A9A9A9

#############################
# - Window specifications - #
#############################

## Create own window in instead of using desktop?

own_window yes
own_window_type normal ##override  ##desktop  
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

alignment top_middle
gap_x 0
gap_y 60

imlib_cache_size 0

# conky -c .conkyAccuweather

TEXT
${font D3Egoistism:size=10}${alignc}ACCUWEATHER

${font plastictomato:size=8}${goto 45}OGGI -- ${execpi 600 sed -n '29p' $HOME/Accuweather/curr_cond} C  ${goto 200}DOMANI -- ${execpi 600 sed -n '26p' $HOME/Accuweather/first_days} C 

${goto 170}${texeci 500 bash $HOME/Accuweather/1b1}
${image $HOME/Accuweather/cc.png -p -6,65 -s 160x88}

${image $HOME/Accuweather/ton.png -p 161,65 -s 160x88}

nce4c6.png

I have inserted these laces now::

####################
#  -  LUA load  -  #
####################

lua_load ~/lua/draw_bg.lua
lua_draw_hook_pre draw_bg
--[[
Background by londonali1010 (2009)

This script draws a background to the Conky window. It covers the whole of the Conky window, but you can specify rounded corners, if you wish.

To call this script in Conky, use (assuming you have saved this script to ~/scripts/):
	lua_load ~/scripts/draw_bg.lua
	lua_draw_hook_pre draw_bg

Changelog:
+ v1.0 -- Original release (07.10.2009)
]]

-- Change these settings to affect your background.
-- "corner_r" is the radius, in pixels, of the rounded corners. If you don't want rounded corners, use 0.

corner_r=55

-- Set the colour and transparency (alpha) of your background.

--bg_colour=0x2a2a2a
--bg_alpha=0.35

bg_colour=0x222222
bg_alpha=3


require 'cairo'
function rgb_to_r_g_b(colour,alpha)
	return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function conky_draw_bg()
	if conky_window==nil then return end
	local w=conky_window.width
	local h=conky_window.height
	local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
	cr=cairo_create(cs)
	
	cairo_move_to(cr,corner_r,0)
	cairo_line_to(cr,w-corner_r,0)
	cairo_curve_to(cr,w,0,w,0,w,corner_r)
	cairo_line_to(cr,w,h-corner_r)
	cairo_curve_to(cr,w,h,w,h,w-corner_r,h)
	cairo_line_to(cr,corner_r,h)
	cairo_curve_to(cr,0,h,0,h,0,h-corner_r)
	cairo_line_to(cr,0,corner_r)
	cairo_curve_to(cr,0,0,0,0,corner_r,0)
	cairo_close_path(cr)
	
	cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))
	cairo_fill(cr)
end

Only that starting the conky, they disappear me the images of the meteo...... sad

157hs2w.png

How could I resolve?
Thanks...

Offline

Help fund CrunchBang, donate to the project!

#7552 2014-05-21 20:46:47

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

Re: Conky v1.9 Thread

@ Deegan

Hi there.

Check this to start: ARGB Visuals

Are you running #! with compton?

I believe that draw_bg.lua script has a memory leak.

try this one ( it will not fix the problem you are having but there leak is fixed)

--[[Background originally by londonali1010 (2009)
    ability to set any size for background mrpeachy 2011
    ability to set variables for bg in conkyrc dk75

  the change is that if you set width and/or height to 0
  then it assumes the width and/or height of the conky window

so:

Above and After TEXT  (requires a composite manager or it blinks!)

 lua_load ~/wea_conky/draw_bg.lua
 TEXT
 ${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}

OR Both above TEXT (no composite manager required - no blinking!)

 lua_load ~/wea_conky/draw_bg.lua
 lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.2
 TEXT

Note
${lua conky_draw_bg 20 0 0 0 0 0x000000 0.2}
  See below:        1  2 3 4 5 6        7

${lua conky_draw_bg corner_radius x_position y_position width height color alpha}

covers the whole window and will change if you change the minimum_size setting

1 = 20             corner_radius
2 = 0             x_position l|r
3 = 0             y_position u|d
4 = 0             width
5 = 0             height
6 = 0x000000      color
7 = 0.4           alpha

######### calendar function ##################################################

then to use it, you activate the calendar function BELOW TEXT like this

${lua luacal {settings}}

#${lua luacal {x=,y=,tf="",tfs=,tc=,ta=,bf="",bfs=,bc=,ba=,hf="",hfs=,hc=,ha=,sp="",gh=,gt=,gv=,sd=}}
#    x=x position top left
#    y=y position top left
#    tf=title font, eg "mono" must be in quotes
#    tfs=title font size
#    tc=title color
#    ta=title alpha
#    bf=body font, eg "mono" must be in quotes
#    bfs=body font size
#    bc=body color
#    ba=body alpha
#    hf=highlight font, eg "mono" must be in quotes
#    hfs=highlight font size
#    hc=highlight color
#    ha=highlight alpha
#    sp=spacer, eg " " or sp="0"... 0,1 or 2 spaces can help with positioning of non-monospaced fonts

#    gt=gap from title to body
#    gh=gap horizontal between columns
#    gv=gap vertical between rows
#    sd=start day, 0=Sun, 1=Mon

#    hstyle = heading style, 0=just days, 1=date insert
#    tdf=title date font, eg "mono" must be in quotes
#    tdfs=title date font size
#    tdc=title date color
#    tda=title date alpha

# test line
-- ${lua luacal {x=40,y=40,tf="Monofur",tfs=24,tc=0xFFDEAD,ta=1,bf="Monofur",bfs=24,bc=0xFFDEAD,ba=1,hf="Monofur",hfs=24,hc=0x00BFFF,ha=1,sp=" ",gh=40,gt=25,gv=20,sd=0,hstyle=1,tdf="Monofur",tdfs=24,tdc=0x00BFFF,tda=1}}


]]

require 'cairo'
local    cs, cr = nil
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function conky_draw_bg(r,x,y,w,h,color,alpha)
if conky_window == nil then return end
if cs == nil then cairo_surface_destroy(cs) end
if cr == nil then cairo_destroy(cr) end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
w=w
h=h
if w=="0" then w=tonumber(conky_window.width) end
if h=="0" then h=tonumber(conky_window.height) end
cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
--top left mid circle
local xtl=x+r
local ytl=y+r
--top right mid circle
local xtr=(x+r)+((w)-(2*r))
local ytr=y+r
--bottom right mid circle
local xbr=(x+r)+((w)-(2*r))
local ybr=(y+r)+((h)-(2*r))
--bottom right mid circle
local xbl=(x+r)
local ybl=(y+r)+((h)-(2*r))
-----------------------------
cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_fill (cr)
------------------------------------------------------------
cairo_surface_destroy(cs)
cairo_destroy(cr)
return ""
end
-- ###### calendar function ##################################################
function conky_luacal(caltab) -- {x=,y=,tf="",tfs=,tc=,ta=,bf="",bfs=,bc=,ba=,hf="",hfs=,hc=,ha=,sp="",gt=,gh=,gv=,sd=,hstyle=,tdf=,tdfs=,tdc=,tda=}
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
--############################################################################
if caltab.x==nil then
caltab=loadstring("return" .. caltab)()
end
local cal_x=caltab.x
local cal_y=caltab.y
local tfont=caltab.tf		or "mono"
local tfontsize=caltab.tfs	or 12
local tc=caltab.tc			or 0xffffff
local ta=caltab.ta			or 1
local bfont=caltab.bf		or "mono"
local bfontsize=caltab.bfs	or 12
local bc=caltab.bc			or 0xffffff
local ba=caltab.ba			or 1
local hfont=caltab.hf		or "mono"
local hfontsize=caltab.hfs	or 12
local hc=caltab.hc			or 0xff0000
local ha=caltab.ha			or 1
local spacer=caltab.sp		or " "
local gaph=caltab.gh		or 20
local gapt=caltab.gt		or 15
local gapl=caltab.gv		or 15
local sday=caltab.sd		or 0
local hstyle=caltab.hstyle	or 0
--convert colors
--local font=string.gsub(font,"_"," ")
local tred,tgreen,tblue,talpha=rgb_to_r_g_b(tc,ta)
--main body text color
local bred,bgreen,bblue,balpha=rgb_to_r_g_b(bc,ba)
--highlight text color
local hred,hgreen,hblue,halpha=rgb_to_r_g_b(hc,ha)
--############################################################################
--calendar calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time( {    year=year,month=03,day=01,hour=00,min=0,sec=0} );
local t2 = os.time( {    year=year,month=02,day=01,hour=00,min=0,sec=0} );
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={ 31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
local day=tonumber(os.date("%w"))+1-sday
local day_num = today
local remainder=day_num % 7
local start_day=day-(day_num % 7)
if start_day<0 then start_day=7+start_day end
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
local x=mdays+start_day
local dnum={}
local dnumh={}
if mdays+start_day<36 then
dlen=35
plen=29
else
dlen=42
plen=36
end
for i=1,dlen do
    if i<=start_day then
    dnum[i]="  "
    else
    dn=i-start_day
        if dn=="nil" then dn=0 end
        if dn<=9 then dn=(spacer .. dn) end
        if i>x then dn="" end
        dnum[i]=dn
        dnumh[i]=dn
        if dn==(spacer .. today) or dn==today then
        dnum[i]=""
        end
        if dn==(spacer .. today) or dn==today then
        dnumh[i]=dn
        place=i
        else dnumh[i]="  "
        end
    end
end--for
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
if hstyle==0 then
    if tonumber(sday)==0 then
    dys={"SU","MO","TU","WE","TH","FR","SA"}
    else
    dys={"MO","TU","WE","TH","FR","SA","SU"}
    end
    --draw calendar titles
elseif hstyle==1 then
    if tonumber(sday)==0 then
    dys={"SU","MO"," ","  ","  ","FR","SA"}
    cairo_text_extents(cr,"MO",extents)
    local s=extents.x_advance+gaph
    local f=gaph*5
    local tdfont=caltab.tdf        or "mono"
    local tdfontsize=caltab.tdfs    or 12
    local tdc=caltab.tdc        or 0xffffff
    local tda=caltab.tda        or 1
    cairo_select_font_face (cr, tdfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (cr, tdfontsize);
    local tdred,tdgreen,tdblue,tdalpha=rgb_to_r_g_b(tdc,tda)
    cairo_set_source_rgba (cr,tdred,tdgreen,tdblue,tdalpha)
    local insert=os.date("%b %y")
    cairo_text_extents(cr,insert,extents)
    local w=extents.x_advance
    cairo_move_to (cr, cal_x+((s+f)/2)-(w/2), cal_y)
    cairo_show_text (cr,insert)
    cairo_stroke (cr)
    else
    dys={"MO","TU"," ","  ","  ","SA","SU"}
    cairo_text_extents(cr,"TU",extents)
    local s=extents.x_advance+gaph
    local f=gaph*5
    local tdfont=caltab.tdf        or "mono"
    local tdfontsize=caltab.tdfs    or 12
    local tdc=caltab.tdc        or 0xffffff
    local tda=caltab.tda        or 1
    cairo_select_font_face (cr, tdfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (cr, tdfontsize);
    local tdred,tdgreen,tdblue,tdalpha=rgb_to_r_g_b(tdc,tda)
    cairo_set_source_rgba (cr,tdred,tdgreen,tdblue,tdalpha)
    local insert=os.date("%b %y")
    cairo_text_extents(cr,insert,extents)
    local w=extents.x_advance
    cairo_move_to (cr, cal_x+((s+f)/2)-(w/2), cal_y)
    cairo_show_text (cr,insert)
    cairo_stroke (cr)
    end
end
--draw calendar titles
for i=1,7 do
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
cairo_move_to (cr, cal_x+(gaph*(i-1)), cal_y)
cairo_show_text (cr, dys[i])
cairo_stroke (cr)
end
--draw calendar body
cairo_select_font_face (cr, bfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, bfontsize);
cairo_set_source_rgba (cr,bred,bgreen,bblue,balpha)
for i=1,plen,7 do
local fn=i
    for i=fn,fn+6 do
    cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
    cairo_show_text (cr, dnum[i])
    cairo_stroke (cr)
    end
end
--highlight
cairo_select_font_face (cr, hfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, hfontsize);
cairo_set_source_rgba (cr,hred,hgreen,hblue,halpha)
for i=1,plen,7 do
local fn=i
    for i=fn,fn+6 do
    cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
    cairo_show_text (cr, dnumh[i])
    cairo_stroke (cr)
    end
end
--############################################################################
caltab=nil
dlen=nil
plen=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end
-- end main function #########################################################

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

Offline

#7553 2014-05-21 21:54:05

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

Re: Conky v1.9 Thread

Deegan wrote:

How could I resolve?
Thanks...

Some 'slight' changes to your conky code:

1. - to point to my accuweather script location
2. - changed: border_margin 9 to border_inner_margin 9  - border_margin is depreciated
3. - added the draw-bg.lua script I use as seen in earlier post.

This is on #! >> Debian SID with compton:
2014_05_21_18_41_04_1920x1080_Sector11.jpg

Modified conky:

# deegan-weather.conky

# pkill -xf "conky -c /media/5/conky/deegan-weather.conky" &
# conky -c /media/5/conky/deegan-weather.conky &

double_buffer yes
use_spacer yes
use_xft yes
update_interval 1

minimum_size 295 200 #255
maximum_width 295 #307

override_utf8_locale yes
draw_shades no
draw_outline no
draw_borders no
xftfont Arial:size=9
uppercase no
stippled_borders 3
border_inner_margin 9
border_width 10
default_color A9A9A9

#############################
# - Window specifications - #
#############################

## Create own window in instead of using desktop?

own_window yes
own_window_type normal ##override  ##desktop
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

alignment top_middle
gap_x 0
gap_y 60

imlib_cache_size 0

# conky -c .conkyAccuweather
lua_load /media/5/Conky/LUA/draw-bg.lua
### lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.45
## if using images - after TEXT
######  ${lua conky_draw_bg 10 0 0 0 0 0x000000 0.45}\
TEXT
${lua conky_draw_bg 10 0 0 0 0 0x000000 0.45}\
${font D3Egoistism:size=10}${alignc}ACCUWEATHER

${font plastictomato:size=8}${goto 45}OGGI -- ${execpi 600 sed -n '29p' /media/5/1b1_accuweather_images/curr_cond} C  ${goto 200}DOMANI -- ${execpi 600 sed -n '26p' /media/5/1b1_accuweather_images/first_days} C

${goto 170}${texeci 500 bash /media/5/1b1_accuweather_images/1b1}
${image /media/5/1b1_accuweather_images/cc.png -p -6,65 -s 160x88}

${image /media/5/1b1_accuweather_images/ton.png -p 161,65 -s 160x88}

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

Offline

#7554 2014-05-22 03:59:02

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: Conky v1.9 Thread

Does anyone know how to make this mrpeachy function work?

function image(im)--#################################################################
x=nil
x=(im.x or 0)
y=nil
y=(im.y or 0)
w=nil
w=(im.w or default_image_width)
h=nil
h=(im.h or default_image_height)
file=nil
file=tostring(im.file)
if file==nil then print("set image file") end
print(file)
---------------------------------------------
local show = imlib_load_image(file)
if show == nil then return end
imlib_context_set_image(show)
if tonumber(w)==0 then
width=imlib_image_get_width()
else
width=tonumber(w)
end
if tonumber(h)==0 then
height=imlib_image_get_height()
else
height=tonumber(h)
end
imlib_context_set_image(show)
local scaled=imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), width, height)
imlib_free_image()
imlib_context_set_image(scaled)
imlib_render_image_on_drawable(x, y)
imlib_free_image()
show=nil
end--function image ##################################################################

Ok, got it part of the way but now getting error. 'Imlib_load_image' (a nil value)

Last edited by ansem_of_nexus (2014-05-22 04:49:09)


You can find my work here

Make everything ok button

Offline

#7555 2014-05-22 18:47:04

Deegan
Member
From: Italy Varese
Registered: 2011-11-19
Posts: 36

Re: Conky v1.9 Thread

Ok Sector11, fantastico   big_smile

use_xft yes
xftfont ZeKton:size=8
override_utf8_locale yes
text_buffer_size 384
background yes
update_interval 1
total_run_times 0

#############################
# - Window specifications - #
#############################

own_window yes
own_window_type normal ##override  ##desktop  
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
border_inner_margin 9


imlib_cache_size 0
double_buffer yes
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
out_to_ncurses no
out_to_console no

minimum_size 260 
maximum_width 330
alignment top_middle
gap_x 0
gap_y 60

short_units yes
pad_percents 0
border_inner_margin 4
top_name_width 6
no_buffers yes
uppercase no

cpu_avg_samples 2
net_avg_samples 2
use_spacer right
color1 Grey        ##icons
color2 Ivory       ##text
color3 DarkGrey    ##divider lines
color4 Orange      ##headings
color5 5FBC0F

###  VGA. ${execi 8 aticonfig --odgt | grep 'Sensor' | cut -c43-47 | sed '/^$/d'}°C    
###  Controlla il consumo (in % di cpu) di tutti i processi conky
###  watch -n 0,5 ps -C conky -o cmd,pcpu

####################
#  -  LUA load  -  #
####################
lua_load ~/lua/draw_bg.lua
#lua_draw_hook_pre draw_bg


# conky -c .conkyAccuweather

TEXT
${font D3Egoistism:size=10}${alignc}ACCUWEATHER
${lua conky_draw_bg 10 0 0 0 0 0x222222 6}
${font plastictomato:size=8}${goto 45}OGGI -- ${execpi 600 sed -n '29p' $HOME/Accuweather/curr_cond} C  ${goto 200}DOMANI -- ${execpi 600 sed -n '26p' $HOME/Accuweather/first_days} C 

${goto 170}${texeci 500 bash $HOME/Accuweather/1b1}
${image $HOME/Accuweather/cc.png -p -6,65 -s 160x88}

${image $HOME/Accuweather/ton.png -p 161,65 -s 160x88}

35mmrrp.png

Offline

#7556 2014-05-22 20:01:36

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

Re: Conky v1.9 Thread

Deegan wrote:

Ok Sector11, fantastico   big_smile

Prego mio amico!


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

Offline

#7557 2014-05-22 22:40:56

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: Conky v1.9 Thread

2014_05_22_1400798084_1600x900_scrot.jpg


You can find my work here

Make everything ok button

Offline

#7558 2014-05-22 23:14:47

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

ansem_of_nexus wrote:

Does anyone know how to make this mrpeachy function work?

function image(im)--#################################################################
x=nil
x=(im.x or 0)
y=nil
y=(im.y or 0)
w=nil
w=(im.w or default_image_width)
h=nil
h=(im.h or default_image_height)
file=nil
file=tostring(im.file)
if file==nil then print("set image file") end
print(file)
---------------------------------------------
local show = imlib_load_image(file)
if show == nil then return end
imlib_context_set_image(show)
if tonumber(w)==0 then
width=imlib_image_get_width()
else
width=tonumber(w)
end
if tonumber(h)==0 then
height=imlib_image_get_height()
else
height=tonumber(h)
end
imlib_context_set_image(show)
local scaled=imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), width, height)
imlib_free_image()
imlib_context_set_image(scaled)
imlib_render_image_on_drawable(x, y)
imlib_free_image()
show=nil
end--function image ##################################################################

Ok, got it part of the way but now getting error. 'Imlib_load_image' (a nil value)

Do you have

require 'imlib2'

At the top of the script?

Offline

#7559 2014-05-22 23:21:15

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: Conky v1.9 Thread

mrpeachy wrote:

Do you have

require 'imlib2'

At the top of the script?

...... I thought I had it but it seems I mistakes libimlib2 for it.
Also since you answered I can ask if your function is better than the nomal Cairo way?

Last edited by ansem_of_nexus (2014-05-22 23:36:46)


You can find my work here

Make everything ok button

Offline

#7560 2014-05-29 14:26:57

Marenbraga
Member
Registered: 2013-11-14
Posts: 40

Re: Conky v1.9 Thread

Hi Sector11,
i see one of your conky configurations... it have brightness level...

How did you include the brightness level? Script you used?

beijos

Offline

#7561 2014-05-29 15:49:25

PackRat
#! Die Hard
From: USA
Registered: 2011-03-03
Posts: 1,572

Re: Conky v1.9 Thread

^

xbacklight -get

would be the simplest way to get your brightness level; xbacklight might not be installed by default, but is in the debian repos.

You will need to use cut - or maybe awk - to get rid of the decimals.

edit - after reading S11's post below, I obviously misinterpreted what you were asking about.

Last edited by PackRat (2014-05-29 20:24:25)


"It does not require many words to speak the truth." - Chief Joseph, Nez Perce tribe

Offline

#7562 2014-05-29 19:37:26

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

Re: Conky v1.9 Thread

Marenbraga wrote:

Hi Sector11,
i see one of your conky configurations... it have brightness level...

How did you include the brightness level? Script you used?

beijos

beijos - sem
Eu aceito abraços embora. smile

I use draw-bg.lua

--[[Background originally by londonali1010 (2009)
    ability to set any size for background mrpeachy 2011
    ability to set variables for bg in conkyrc dk75

  the change is that if you set width and/or height to 0
  then it assumes the width and/or height of the conky window

so:

Above and After TEXT  (requires a composite manager or it blinks!)

 lua_load ~/wea_conky/draw_bg.lua
 TEXT
 ${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}

OR Both above TEXT (no composite manager required - no blinking!)

 lua_load ~/wea_conky/draw_bg.lua
 lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.2
 TEXT

Note
${lua conky_draw_bg 20 0 0 0 0 0x000000 0.2}
  See below:        1  2 3 4 5 6        7

${lua conky_draw_bg corner_radius x_position y_position width height color alpha}

covers the whole window and will change if you change the minimum_size setting

1 = 20             corner_radius
2 = 0             x_position l|r
3 = 0             y_position u|d
4 = 0             width
5 = 0             height
6 = 0x000000      color
7 = 0.4           alpha

######### calendar function ##################################################

then to use it, you activate the calendar function BELOW TEXT like this

${lua luacal {settings}}

#${lua luacal {x=,y=,tf="",tfs=,tc=,ta=,bf="",bfs=,bc=,ba=,hf="",hfs=,hc=,ha=,sp="",gh=,gt=,gv=,sd=}}
#    x=x position top left
#    y=y position top left
#    tf=title font, eg "mono" must be in quotes
#    tfs=title font size
#    tc=title color
#    ta=title alpha
#    bf=body font, eg "mono" must be in quotes
#    bfs=body font size
#    bc=body color
#    ba=body alpha
#    hf=highlight font, eg "mono" must be in quotes
#    hfs=highlight font size
#    hc=highlight color
#    ha=highlight alpha
#    sp=spacer, eg " " or sp="0"... 0,1 or 2 spaces can help with positioning of non-monospaced fonts

#    gt=gap from title to body
#    gh=gap horizontal between columns
#    gv=gap vertical between rows
#    sd=start day, 0=Sun, 1=Mon

#    hstyle = heading style, 0=just days, 1=date insert
#    tdf=title date font, eg "mono" must be in quotes
#    tdfs=title date font size
#    tdc=title date color
#    tda=title date alpha

# test line
-- ${lua luacal {x=40,y=40,tf="Monofur",tfs=24,tc=0xFFDEAD,ta=1,bf="Monofur",bfs=24,bc=0xFFDEAD,ba=1,hf="Monofur",hfs=24,hc=0x00BFFF,ha=1,sp=" ",gh=40,gt=25,gv=20,sd=0,hstyle=1,tdf="Monofur",tdfs=24,tdc=0x00BFFF,tda=1}}


]]

require 'cairo'
local    cs, cr = nil
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function conky_draw_bg(r,x,y,w,h,color,alpha)
if conky_window == nil then return end
if cs == nil then cairo_surface_destroy(cs) end
if cr == nil then cairo_destroy(cr) end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
w=w
h=h
if w=="0" then w=tonumber(conky_window.width) end
if h=="0" then h=tonumber(conky_window.height) end
cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
--top left mid circle
local xtl=x+r
local ytl=y+r
--top right mid circle
local xtr=(x+r)+((w)-(2*r))
local ytr=y+r
--bottom right mid circle
local xbr=(x+r)+((w)-(2*r))
local ybr=(y+r)+((h)-(2*r))
--bottom right mid circle
local xbl=(x+r)
local ybl=(y+r)+((h)-(2*r))
-----------------------------
cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_fill (cr)
------------------------------------------------------------
cairo_surface_destroy(cs)
cairo_destroy(cr)
return ""
end
-- ###### calendar function ##################################################
function conky_luacal(caltab) -- {x=,y=,tf="",tfs=,tc=,ta=,bf="",bfs=,bc=,ba=,hf="",hfs=,hc=,ha=,sp="",gt=,gh=,gv=,sd=,hstyle=,tdf=,tdfs=,tdc=,tda=}
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
--############################################################################
if caltab.x==nil then
caltab=loadstring("return" .. caltab)()
end
local cal_x=caltab.x
local cal_y=caltab.y
local tfont=caltab.tf		or "mono"
local tfontsize=caltab.tfs	or 12
local tc=caltab.tc			or 0xffffff
local ta=caltab.ta			or 1
local bfont=caltab.bf		or "mono"
local bfontsize=caltab.bfs	or 12
local bc=caltab.bc			or 0xffffff
local ba=caltab.ba			or 1
local hfont=caltab.hf		or "mono"
local hfontsize=caltab.hfs	or 12
local hc=caltab.hc			or 0xff0000
local ha=caltab.ha			or 1
local spacer=caltab.sp		or " "
local gaph=caltab.gh		or 20
local gapt=caltab.gt		or 15
local gapl=caltab.gv		or 15
local sday=caltab.sd		or 0
local hstyle=caltab.hstyle	or 0
--convert colors
--local font=string.gsub(font,"_"," ")
local tred,tgreen,tblue,talpha=rgb_to_r_g_b(tc,ta)
--main body text color
local bred,bgreen,bblue,balpha=rgb_to_r_g_b(bc,ba)
--highlight text color
local hred,hgreen,hblue,halpha=rgb_to_r_g_b(hc,ha)
--############################################################################
--calendar calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time( {    year=year,month=03,day=01,hour=00,min=0,sec=0} );
local t2 = os.time( {    year=year,month=02,day=01,hour=00,min=0,sec=0} );
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={ 31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
local day=tonumber(os.date("%w"))+1-sday
local day_num = today
local remainder=day_num % 7
local start_day=day-(day_num % 7)
if start_day<0 then start_day=7+start_day end
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
local x=mdays+start_day
local dnum={}
local dnumh={}
if mdays+start_day<36 then
dlen=35
plen=29
else
dlen=42
plen=36
end
for i=1,dlen do
    if i<=start_day then
    dnum[i]="  "
    else
    dn=i-start_day
        if dn=="nil" then dn=0 end
        if dn<=9 then dn=(spacer .. dn) end
        if i>x then dn="" end
        dnum[i]=dn
        dnumh[i]=dn
        if dn==(spacer .. today) or dn==today then
        dnum[i]=""
        end
        if dn==(spacer .. today) or dn==today then
        dnumh[i]=dn
        place=i
        else dnumh[i]="  "
        end
    end
end--for
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
if hstyle==0 then
    if tonumber(sday)==0 then
    dys={"SU","MO","TU","WE","TH","FR","SA"}
    else
    dys={"MO","TU","WE","TH","FR","SA","SU"}
    end
    --draw calendar titles
elseif hstyle==1 then
    if tonumber(sday)==0 then
    dys={"SU","MO"," ","  ","  ","FR","SA"}
    cairo_text_extents(cr,"MO",extents)
    local s=extents.x_advance+gaph
    local f=gaph*5
    local tdfont=caltab.tdf        or "mono"
    local tdfontsize=caltab.tdfs    or 12
    local tdc=caltab.tdc        or 0xffffff
    local tda=caltab.tda        or 1
    cairo_select_font_face (cr, tdfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (cr, tdfontsize);
    local tdred,tdgreen,tdblue,tdalpha=rgb_to_r_g_b(tdc,tda)
    cairo_set_source_rgba (cr,tdred,tdgreen,tdblue,tdalpha)
    local insert=os.date("%b %y")
    cairo_text_extents(cr,insert,extents)
    local w=extents.x_advance
    cairo_move_to (cr, cal_x+((s+f)/2)-(w/2), cal_y)
    cairo_show_text (cr,insert)
    cairo_stroke (cr)
    else
    dys={"MO","TU"," ","  ","  ","SA","SU"}
    cairo_text_extents(cr,"TU",extents)
    local s=extents.x_advance+gaph
    local f=gaph*5
    local tdfont=caltab.tdf        or "mono"
    local tdfontsize=caltab.tdfs    or 12
    local tdc=caltab.tdc        or 0xffffff
    local tda=caltab.tda        or 1
    cairo_select_font_face (cr, tdfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (cr, tdfontsize);
    local tdred,tdgreen,tdblue,tdalpha=rgb_to_r_g_b(tdc,tda)
    cairo_set_source_rgba (cr,tdred,tdgreen,tdblue,tdalpha)
    local insert=os.date("%b %y")
    cairo_text_extents(cr,insert,extents)
    local w=extents.x_advance
    cairo_move_to (cr, cal_x+((s+f)/2)-(w/2), cal_y)
    cairo_show_text (cr,insert)
    cairo_stroke (cr)
    end
end
--draw calendar titles
for i=1,7 do
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
cairo_move_to (cr, cal_x+(gaph*(i-1)), cal_y)
cairo_show_text (cr, dys[i])
cairo_stroke (cr)
end
--draw calendar body
cairo_select_font_face (cr, bfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, bfontsize);
cairo_set_source_rgba (cr,bred,bgreen,bblue,balpha)
for i=1,plen,7 do
local fn=i
    for i=fn,fn+6 do
    cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
    cairo_show_text (cr, dnum[i])
    cairo_stroke (cr)
    end
end
--highlight
cairo_select_font_face (cr, hfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, hfontsize);
cairo_set_source_rgba (cr,hred,hgreen,hblue,halpha)
for i=1,plen,7 do
local fn=i
    for i=fn,fn+6 do
    cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
    cairo_show_text (cr, dnumh[i])
    cairo_stroke (cr)
    end
end
--############################################################################
caltab=nil
dlen=nil
plen=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end
-- end main function #########################################################

2014_05_29_16_20_58_1920x1080_Sector11.jpg 2014_05_29_16_21_33_1920x1080_Sector11.jpg

The test conky:

# conky -c /media/5/conky/test.conky &
# pkill -xf "conky -c /media/5/conky/test.conky" &

###  Begin Window Settings  ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager
#own_window_colour gray
own_window_class Conky
own_window_title A blank test

# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes

### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
# own_window_argb_visual yes # Options: yes or no

### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
# own_window_argb_value 255

minimum_size 500 0  # w|h
maximum_width 300

gap_x 0	# l|r
gap_y 10	# u|d

alignment tl
####################################################  End Window Settings  ###
###  Font Settings  ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont monofur:bold:size=12
#xftfont Anonymous Pro:bold:size=9
#xftfont Anonymous Pro:size=9
# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1.0

#font monofur:size=9

# Force UTF8? requires XFT ###
override_utf8_locale yes

uppercase no
######################################################  End Font Settings  ###
###  Color Settings  #########################################################
draw_shades no ##yes
default_shade_color 000000
draw_outline no
default_outline_color 000000

default_color DCDCDC #220 220 220	Gainsboro
color0 8FBC8F #DarkSeaGreen
color1 778899 #LightSlateGray
color2 F5F5DC #Beige
color3 87CEFA #LightSkyBlue
color4 48D1CC #MediumTurquoise
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 B0E0E6 #PowderBlue
color8 FFD700 #Gold
color9 FFA07A #LightSalmon
#####################################################  End Color Settings  ###
###  Borders Section  ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 05
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders yes #no
#default_graph_size 15 40
#####################################################  End Borders Secton  ###
###  Miscellaneous Section  ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background yes

# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none

# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 6144

# Subtract (file system) buffers from used memory?
no_buffers yes

# change GiB to G and MiB to M
short_units yes

# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2

# Imlib2 image cache size, in bytes. Default 4MiB Increase this value if you use
# $image lots. Set to 0 to disable th0e image cache.
imlib_cache_size 0

#default_bar_size 0 10

#   Maximum size of user text buffer, i.e. layout below TEXT line in config file
#  (default is 16384 bytes)
# max_user_text 16384

# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
# temperature_unit Fahrenheit
##############################################  End Miscellaneous Section  ###
###  LUA Settings  ###########################################################
## draw-bg.lua Above and/or After TEXT ###########
lua_load /media/5/Conky/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.45
#lua_draw_hook_post draw_bg 10 0 0 0 0 0x000000 0.45
# TEXT
#${lua conky_draw_bg 10 0 0 0 0 0x000000 0.45}
#######################################################  End LUA Settings  ###Settings  ###

update_interval 1
default_bar_size 0 12

TEXT
${lua conky_draw_bg 10 0 0 0 0 0xffffff 0.1}\
${lua conky_draw_bg 20 20 25 40 40 0xff0000 0.5}\
${lua conky_draw_bg 20 250 25 40 40 0x87CEFA 0.5}\
${lua conky_draw_bg 0 0 215 0 100 0xFFDEAD 1.0}\
${lua conky_draw_bg 0 0 335 230 50 0xCD5C5C 1.0}\
${time %T}${alignr}${time %x}
${alignc}UTC ${tztime UTC  %H:%M:%S}
${alignc}${uptime}
${alignc}${if_match ${desktop}==1}${color6}${endif}•${color} ${if_match ${desktop}==2}${color6}${endif}•${color} ${if_match ${desktop}==3}${color6}${endif}•${color} ${if_match ${desktop}==4}${color6}${endif}•${color} ${if_match ${desktop}==5}${color6}${endif}•${color}

${alignc}CPU μm ${color5}${freq_g}${color}
${alignc}Avg ${if_match ${cpu cpu0}<10}${color1}00${color5}${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100}${color1}0${color5}${cpu cpu0}\
${else}${color9}${cpu cpu0}${endif}${endif}${color5} %${color}
${alignc} ${color5}1${color}  |  ${color5}2${color}  |  ${color5}3 ${color}
${alignc}${if_match ${cpu cpu1}<10}${color1}00${color5}${cpu cpu1}\
${else}${if_match ${cpu cpu1}<100}${color1}0${color5}${cpu cpu1}\
${else}${color9}${cpu cpu1}${endif}${endif}${color}\
 | ${if_match ${cpu cpu2}<10}${color1}00${color5}${cpu cpu2}\
${else}${if_match ${cpu cpu2}<100}${color1}0${color5}${cpu cpu2}\
${else}${color9}${cpu cpu2}${endif}${endif}${color}\
 | ${if_match ${cpu cpu3}<10}${color1}00${color5}${cpu cpu3}\
${else}${if_match ${cpu cpu3}<100}${color1}0${color5}${cpu cpu3}\
${else}${color9}${cpu cpu3}${endif}${endif}${color}
${voffset -31}CPU ${color5}${platform f71882fg.2560 temp 1}${color}°\
${alignr}MB ${color5}${platform f71882fg.2560 temp 2}${color}°
GPU ${color5}${nvidia temp}${color}°\
${alignr}HD ${color5}${hddtemp /dev/sda}${color}°
${alignc}Fan ${color5}${platform f71882fg.2560 fan 1} ${color}RPM
${alignc}NVIDIA Freq MHz
${alignc}GPU ${color5}${nvidia gpufreq} ${color} MEM ${color5}${nvidia memfreq}${color}
 ${color1}${hr}
 ${execi 600 echo `date --date="0 day" | awk '{print $1" "$3" "$2}'`}
 ${execi 600 echo `date --date="1 day" | awk '{print $1" "$3" "$2}'`}
 ${execi 600 echo `date --date="2 day" | awk '{print $1" "$3" "$2}'`}
 ${execi 600 echo `date --date="3 day" | awk '{print $1" "$3" "$2}'`}
 ${execi 600 echo `date --date="4 day" | awk '{print $1" "$3" "$2}'`}
 ${execi 600 echo `date --date="5 day" | awk '{print $1" "$3" "$2" "$4}'`}


 ${color 000000}${execi 600 echo `date --date="6 day"`}
 ${execi 600 echo `date --date="5 day" | awk '{print $1" "$3" "$2" "$6" | "$4}'`}${color}



 ${execi 600 echo `date --date="0 day" | awk '{print $3" "$1}'`}
 ${execi 600 echo `date --date="1 day" | awk '{print $3" "$1}'`}
 ${execi 600 echo `date --date="2 day" | awk '{print $3" "$1}'`}
 ${execi 600 echo `date --date="3 day" | awk '{print $3" "$1}'`}
 ${execi 600 echo `date --date="4 day" | awk '{print $3" "$1}'`}
 ${execi 600 echo `date --date="5 day" | awk '{print $3" "$1}'`}

What these lines do:

  1. ${lua conky_draw_bg 10 0 0 0 0 0xffffff 0.1}\ <<--- the semi-transparent white background

    1. 0x000000 would be a black background

  2. ${lua conky_draw_bg 20 20 25 40 40 0xff0000 0.5}\ <<--- the red circle

  3. ${lua conky_draw_bg 20 250 25 40 40 0x87CEFA 0.5}\ <<--- the blue circle

  4. ${lua conky_draw_bg 0 0 215 0 100 0xFFDEAD 1.0}\ <<--- navajo white bar

  5. ${lua conky_draw_bg 0 0 335 230 50 0xCD5C5C 1.0}\ <<--- indian red bar


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

Offline

#7563 2014-05-31 00:23:13

Dobbie03
Resident Metaller
From: New Zealand
Registered: 2009-08-15
Posts: 1,591

Re: Conky v1.9 Thread

Just needing some help with conky and Gnome-Shell.  I have an audacious conky script running that shows the artwork of the current album, but for some reason the picture is extremely faded.  These are my configs:

Conky:

alignment top_bottom
background no
border_margin 5
border_width 5
default_color ffffff  #ffffff # grey 5f5f5f 3F3F3F 183149 3B3B3B 26211F
double_buffer yes
draw_borders no
draw_graph_borders no
draw_outline no
draw_shades no
gap_x 10
gap_y 10
maximum_width 1500
minimum_size 1550
no_buffers yes
override_utf8_locale yes
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_title conky
own_window_transparent yes
own_window_color 000000
own_window_argb_visual yes
own_window_argb_value 155
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_page
own_window_class conky
text_buffer_size 8000
total_run_times 0
update_interval 1
uppercase yes
use_xft yes
xftalpha 1
xftfont Raleway:pixelsize=9

#	Distric-Thin			fonts
#	Blue Highway
#	Raleway
#	Zekton
#	Calibri
#	Engebrechtre
#	Opeln2001
#	AvantGarde LT ExtraLight
#	AvantGarde LT ExtraLight

TEXT
${offset 125}${color #ffffff}${font AvantGarde LT ExtraLight:pixelsize=25}${if_running audacious}${exec audtool --current-song-tuple-data title| fold -s -w 500} 
${offset 125}${color #ffffff}${font AvantGarde LT ExtraLight:pixelsize=25}${if_running audacious}${exec audtool --current-song-tuple-data album| fold -s -w 500}
${offset 125}${color #ffffff}${font GeosansLight:pixelsize=25}${if_running audacious}${exec audtool --current-song-tuple-data rtist| fold -s -w 500}
${offset 125}${font AvantGarde LT ExtraLight:pixelsize=10}${if_running audacious}${color #ffffff}${exec audtool --current-song-bitrate-kbps} kbps ${color #ffffff}/ ${color #ffffff}${exec audtool --current-song-length}
${if_running audacious}${execpi 3 ~/.conky/shell-scripts/audacious-info.sh}
${image ~/.conky/img.png -p 4,4 -s 114x114}${endif}

Album art script:

#!/bin/bash

## TODO:
## *) Get album art (from web) at each album change (not song change).
## *) Draw background at each song change (not every 3secs).
## *) Create headphones.jpg or something equivalent via imagemagick 
##      on-the-fly

## Author: Anjishnu Sarkar
## Version: 1.0
## Acknowledgement(s):
## *) The imagemagick code to create round background is from the website
##      http://www.imagemagick.org/Usage/thumbnails/#rounded

## Feature(s):
## *) The conky window disappears when audacious is not playing.

## Info:
## *) The script assumes you have an image "folder.jpg" in each of your 
##      music albums.

## Installation:
## *********************
## chmod +x audacious-info.sh
## mkdir -p ~/.conky/shell-scripts/
## mkdir -p ~/.conky/pix/
## cp audacious-info.sh ~/.conky/shell-scripts/

## Next create a music.conkyrc. Copy the following relevant conky parts 
## in ~/.conky/music.conkyrc
## ***************************
## minimum_size 325 120
## text_buffer_size 2048
## imlib_cache_size 0
## border_outer_margin 10
## TEXT
## ${if_running audacious}${execpi 3 ~/.conky/shell-scripts/audacious-info.sh}${endif}
## *********************

Corners=10
Opacity=0.75
BGColor='grey'  ## '#bebebe'
# BGColor='#0000ff'
AlbumArt="folder.jpg"
BackUpArt="headphones.jpg"

## Do not change anything after this
CharLength=7
StaticWidth=127
MinWidth=335
Height=118
WordCount=0

ListPosition=$(audtool playlist-position)
Status=$(audtool playback-status)
EchoStatus="Audacious is $Status"

Title=$(audtool playlist-tuple-data title "$ListPosition")
if [ -z "$Title" ];then
    Title=$(basename "$(audtool playlist-song-filename \
            "$ListPosition")" .mp3 | sed 's/%20/ /g')
fi
TitleCount=$(echo "Title: "$Title"" | wc -m)

Album=$(audtool playlist-tuple-data album "$ListPosition")
AlbumCount=$(echo "Album: "$Album"" | wc -m)

Artist=$(audtool playlist-tuple-data artist "$ListPosition")
ArtistCount=$(echo "Artist: "$Artist"" | wc -m)

for varcount in $TitleCount $AlbumCount $ArtistCount 
do
    if [ $varcount -gt $WordCount ];then
        WordCount=$varcount
    fi
done

VarWidth=$(echo "${WordCount}*${CharLength}" | bc)
Width=$(echo ""$StaticWidth"+"$VarWidth"" | bc)

if [ $Width -le $MinWidth ];then
    Width=$MinWidth
fi

mkdir -p ~/.conky/pix/

DrawBG(){
    convert -size ${Width}x${Height} xc:${BGColor} \
        png:- | convert - \
         \( +clone  -threshold -1 \
            -draw "fill black polygon 0,0 0,"$Corners" "$Corners",0 \
            fill white circle "$Corners","$Corners" "$Corners",0" \
            \( +clone -flip \) -compose Multiply -composite \
            \( +clone -flop \) -compose Multiply -composite \
         \) +matte -compose CopyOpacity -composite  \
        -alpha on -channel RGBA -evaluate multiply ${Opacity} \
         ~/.conky/pix/
}

GetArt(){
    FilePath=$(audtool playlist-tuple-data file-path \
                "$ListPosition" | sed 's/file:\/\///') 
    if [ -f "$FilePath"/"$AlbumArt" ];then
        cp "$FilePath"/"$AlbumArt" ~/.conky/pix/
    else
        cp ~/.conky/pix/"$BackUpArt" ~/.conky/pix/"$AlbumArt"
    fi
}

GetProgress(){
    CurrLen=$(audtool current-song-output-length-seconds)
    TotLen=$(audtool current-song-length-seconds)
    if (( $TotLen )); then
        ProgLen=$(expr $CurrLen \* 100  / $TotLen)
    fi
}

AudaciousInfo(){
    case "$1" in
        bg)         DrawBG ;;
        art)        GetArt ;;
        status)     echo "$EchoStatus" ;;
        title)      echo "$Title" ;;
        artist)     echo "$Artist" ;;
        album)      echo "$Album" ;;
        progress)   GetProgress ;;
    esac
}

# if 
    AudaciousInfo bg
    AudaciousInfo art
    echo -n "\${image ~/.conky/pix/ -p 0,0}"
    echo -n "\${image ~/.conky/pix/"$AlbumArt" -p 9,9 -s 105x105}"
    echo ""
# fi

Can anyone please help?

Last edited by Dobbie03 (2014-05-31 00:23:33)

Offline

#7564 2014-05-31 00:38:39

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

Re: Conky v1.9 Thread

Dobbie03 wrote:

Just needing some help with conky and Gnome-Shell.

No idea if this will help but take a look: ARGB Visual


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

Offline

#7565 2014-05-31 00:54:08

Dobbie03
Resident Metaller
From: New Zealand
Registered: 2009-08-15
Posts: 1,591

Re: Conky v1.9 Thread

Sector11 wrote:
Dobbie03 wrote:

Just needing some help with conky and Gnome-Shell.

No idea if this will help but take a look: ARGB Visual

No it doesn't unfortunately.  Conky either won't start or is gltiched to hell.

Offline

#7566 2014-05-31 01:31:06

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

Re: Conky v1.9 Thread

Dobbie03 wrote:
Sector11 wrote:
Dobbie03 wrote:

Just needing some help with conky and Gnome-Shell.

No idea if this will help but take a look: ARGB Visual

No it doesn't unfortunately.  Conky either won't start or is gltiched to hell.

Strip everything under TEXT and leave just an image command to test with:
example

TEXT
${image /media/5/Conky/Conky_WeatherCom_metric/weather_com_images/30.png -p 4,4 }

then star playing with it ... it has to do with the ARGB values

own_window yes
own_window_title conky
own_window_transparent yes
own_window_color 000000
####own_window_argb_visual yes
####own_window_argb_value 155
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_page

I don't have Gnome and that makes the difference.  Are you using a composite manager?
2014_05_30_22_30_17_1920x1080_Sector11.jpg


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

Offline

#7567 2014-05-31 02:27:27

Dobbie03
Resident Metaller
From: New Zealand
Registered: 2009-08-15
Posts: 1,591

Re: Conky v1.9 Thread

Thanks Mr 11, see what I come up with.

Offline

#7568 2014-05-31 02:43:18

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

Re: Conky v1.9 Thread

Dobbie03 wrote:

Thanks Mr 11, see what I come up with.

This is yours as well, and the images were working - unless you changed distros - desktops:
2014_05_30_23_41_14_263x995_Sector11.jpg

# pkill -xf "conky -c /media/5/conky/Dobbie03-1.conky" &
# conky -c /media/5/conky/Dobbie03-1.conky &
# Use Xft?
use_xft yes
xftfont Open Sans Light:size=8
xftalpha 0.8
text_buffer_size 2048
uppercase yes

# Update interval in seconds
update_interval 1

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

# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_transparent yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#own_window_argb_visual yes
#own_window_argb_value 255

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

minimum_size 250

# Draw shades?
draw_shades no
default_shade_color 292421
# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border margins
border_inner_margin 5
border_outer_margin 0
draw_graph_borders no
# border width
border_width 0

# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 30
gap_y 40

#	Distric-Thin			fonts
#	Blue Highway
#	Raleway
#	Zekton
#	Calibri
#	Engebrechtre
#	Opeln2001
#	Open Sans Light
#	Open Sans Light

# -- Lua Load -- #
#lua_load ~/.draw_bg.lua
#lua_draw_hook_pre draw_bg

lua_load /media/5/Conky/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 20 0 0 0 0 0x000000 0.4
#lua_draw_hook_post draw_bg 20 0 0 0 0 0x000000 0.4
############ or use ################
#TEXT
#${lua conky_draw_bg 20 0 0 0 0 0x000000 0.4}


#lua_load ~/.bargraph_small.lua
#lua_draw_hook_post main_bars

imlib_cache_size 0

color1 0099CC
color2 9933CC
color3 669900
color4 E5520F
color5 CC0000
color6 AAAAAA
color7 484848

#${lua conky_draw_bg}

TEXT
${lua conky_draw_bg 20 0 0 0 0 0x000000 0.7}${execi 300 curl -s "http://weather.yahooapis.com/forecastrss?w=2348079&u=c" -o ~/.cache/weather.xml}${font Open Sans Light:size=15}${execi 300 grep "yweather:location" ~/.cache/weather.xml | grep -o "city=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}, ${execi 300 grep "yweather:location" ~/.cache/weather.xml | grep -o "country=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${font}
${font Open Sans Light:size=45}${alignr}${execi 300 grep "yweather:condition" ~/.cache/weather.xml | grep -o "temp=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}°${font}
${execi 300 cp -f ~/.weathericons/$(grep "yweather:condition" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*").png ~/.cache/weather.png}${image ~/.cache/weather.png -p 0,45 -s 60x60}
${execi 300 grep "yweather:condition" ~/.cache/weather.xml | grep -o "text=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}
${color6}${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 "[^\"]*"}${color}
${execi 300 cp -f ~/.weathericons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | head -n1).png ~/.cache/weather-today.png}${image ~/.cache/weather-today.png -p 0,145 -s 30x30}${execi 300 cp -f ~/.weathericons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | tail -n1).png ~/.cache/weather-tomorrow.png}${image ~/.cache/weather-tomorrow.png -p 130,145 -s 30x30}
${goto 60}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | head -n1}${goto 190}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | tail -n1}
${goto 60}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | head -n1}° ${color6}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | head -n1}°${color}${goto 190}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | tail -n1}° ${color6}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | tail -n1}°${color}${voffset 15}
${color7}${hr}${color}
${if_existing /proc/net/route wlan0}
${color1}Up:${color} ${color3}${upspeed wlan0}${color}${alignr}${color1}Down:${color} ${color3}${downspeed wlan0}${color}
${upspeedgraph wlan0 50,120 FF8800 FF8800}${alignr}${downspeedgraph wlan0 50,120 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup wlan0}${color}${alignr}${color1}Received:${color} ${color2}${totaldown wlan0}${color}
${else}${if_existing /proc/net/route eth0}
${color1}Up:${color} ${color3}${upspeed eth0}${color}${alignr}${color1}Down:${color} ${color3}${downspeed eth0}${color}
${upspeedgraph eth0 50,120 FF8800 FF8800}${alignr}${downspeedgraph eth0 50,120 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup eth0}${color}${alignr}${color1}Received:${color} ${color2}${totaldown eth0}${color}
${else}${if_existing /proc/net/route eth1}
${color1}Up:${color} ${color3}${upspeed eth1}${color}${alignr}${color1}Down:${color} ${color3}${downspeed eth1}${color}
${upspeedgraph eth1 50,120 FF8800 FF8800}${alignr}${downspeedgraph eth1 50,120 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup eth1}${color}${alignr}${color1}Received:${color} ${color2}${totaldown eth1}${color}
${else}${if_existing /proc/net/route ppp0}
${color1}Up:${color} ${color3}${upspeed ppp0}${color}${alignr}${color1}Down:${color} ${color3}${downspeed ppp0}${color}
${upspeedgraph ppp0 50,120 FF8800 FF8800}${alignr}${downspeedgraph ppp0 50,120 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup ppp0}${color}${alignr}${color1}Received:${color} ${color2}${totaldown ppp0}${color}
${else}
Network disconnected
${color6}Connect to a network to see statistics${color}
${voffset 50}
${endif}${endif}${endif}${voffset -15}
${color7}${hr}${color}
${font Open Sans Light:size=15}System Info
${color}${font Open Sans Light:pixelsize=10}USER: ${color1}${alignr}${nodename}
${color}${font Open Sans Light:pixelsize=10}DISTRO:  ${color1}${alignr}${pre_exec lsb_release -sd || cat /etc/*release}
${color}${font Open Sans Light:pixelsize=10}KERNEL: ${color1}${alignr}${kernel}
${color}${font Open Sans Light:pixelsize=10}ARCH: ${color1}${alignr}$machine
${color}${font Open Sans Light:pixelsize=10}CPU: ${color1}${alignr}${freq_g cpu0} GHz
${color}${font Open Sans Light:pixelsize=10}UPTIME: ${color1}${alignr}${uptime}
${color}${font Open Sans Light:pixelsize=10}PROCESSES: ${color1}${alignr}$processes ($running_processes running)
${color7}${hr}${color}
${font Open Sans Light:size=15}Processors/Memory
${color}${font Open Sans Light:pixelsize=10}CPU 1: ${color1}${alignc}${freq_g 0} ${color1}Ghz ${color2}${alignr}${cpu cpu0}${color1}%
${color}${font Open Sans Light:pixelsize=10}CPU 2: ${color1}${alignc}${freq_g 1} ${color1}Ghz ${color2}${alignr}${cpu cpu1}${color1}%
${color}${font Open Sans Light:pixelsize=10}CPU 3: ${color1}${alignc}${freq_g 2} ${color1}Ghz ${color2}${alignr}${cpu cpu2}${color1}%
${color}${font Open Sans Light:pixelsize=10}CPU 4: ${color1}${alignc}${freq_g 3} ${color1}Ghz ${color2}${alignr}${cpu cpu3}${color1}%
${alignr}${cpugraph cpu0 25,250 FF8800 FF8800 -l}
${color}${font Open Sans Light:pixelsize=10}RAM: ${color3}${alignc 10}${mem}
${color}${font Open Sans Light:pixelsize=10}TOTAL: ${color3}${alignc 10}${memmax}
${alignr}${loadgraph 25,250 FF8800 FF8800 -l}
${color7}${hr}${color}
${font Open Sans Light:size=15}Top Processes
${color}${font Open Sans Light:pixelsize=10}${color}${top_mem name 1}${color1}${alignc -10}${top_mem mem_res 1}${color2}${alignr}${top_mem mem 1}${color1} %
${color}${font Open Sans Light:pixelsize=10}${color}${top_mem name 2}${color1}${alignc -10}${top_mem mem_res 2}${color2}${alignr}${top_mem mem 2}${color1} %
${color}${font Open Sans Light:pixelsize=10}${color}${top_mem name 3}${color1}${alignc -10}${top_mem mem_res 3}${color2}${alignr}${top_mem mem 3}${color1} %
${color}${font Open Sans Light:pixelsize=10}${color}${top_mem name 4}${color1}${alignc -10}${top_mem mem_res 4}${color2}${alignr}${top_mem mem 4}${color1} %
${color}${font Open Sans Light:pixelsize=10}${color}${top_mem name 5}${color1}${alignc -10}${top_mem mem_res 5}${color2}${alignr}${top_mem mem 5}${color1} %
${color7}${hr}${color}
${font Open Sans Light:size=15}Temperatures
${font Open Sans Light:pixelsize=10}${color ffffff}CPU TEMP 0: ${color2}${alignr}${platform f71882fg.2560 temp 1} ${color1}°C${color2} ${color3}/ ${color2}105${color1} °C$color
${font Open Sans Light:pixelsize=10}${color ffffff}CPU TEMP 1: ${color2}${alignr}${platform f71882fg.2560 temp 1} ${color1}°C ${color3}/ ${color2}105${color1} °C$color
${font Open Sans Light:pixelsize=10}${color ffffff}TEMPERATURE 2: ${color2}${alignr}${platform f71882fg.2560 temp 2} ${color1}°C ${color3}/ ${color2}127${color1} °C$color
${font Open Sans Light:pixelsize=10}${color ffffff}TEMPERATURE 3: ${color2}${alignr}${platform f71882fg.2560 temp 2} ${color1}°C ${color3}/ ${color2}127${color1} °C$color
${font Open Sans Light:pixelsize=10}${color ffffff}GPU TEMP: ${color2}${alignr}${nvidia temp} ${color1}°C ${color3}/ ${color2}140${color1} °C$color
${font Open Sans Light:pixelsize=10}${color ffffff}M-BOARD TEMP: ${color2}${alignr}${platform f71882fg.2560 temp 2} ${color1}°C ${color3}/ ${color2}80${color1} °C$color
${font Open Sans Light:pixelsize=10}${color ffffff}SDA TEMP: ${color2}${alignr}${hddtemp /dev/sda}${color1} °C ${color3}/ ${color2}70${color1} °C$color
${font Open Sans Light:pixelsize=10}${color ffffff}FAN SPEED: ${color2}${alignr}${platform f71882fg.2560 fan 1}${font}${color1} RPM

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

Offline

#7569 2014-05-31 08:01:23

Dobbie03
Resident Metaller
From: New Zealand
Registered: 2009-08-15
Posts: 1,591

Re: Conky v1.9 Thread

Sector11 wrote:
Dobbie03 wrote:

Thanks Mr 11, see what I come up with.

This is yours as well, and the images were working - unless you changed distros - desktops:
http://s20.postimg.org/sn9biibux/2014_05_30_23_41_14_263x995_Sector11.jpg

# pkill -xf "conky -c /media/5/conky/Dobbie03-1.conky" &
# conky -c /media/5/conky/Dobbie03-1.conky &
# Use Xft?
use_xft yes
xftfont Open Sans Light:size=8
xftalpha 0.8
text_buffer_size 2048
uppercase yes

# Update interval in seconds
update_interval 1

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

# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_transparent yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#own_window_argb_visual yes
#own_window_argb_value 255

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

minimum_size 250

# Draw shades?
draw_shades no
default_shade_color 292421
# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border margins
border_inner_margin 5
border_outer_margin 0
draw_graph_borders no
# border width
border_width 0

# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 30
gap_y 40

#	Distric-Thin			fonts
#	Blue Highway
#	Raleway
#	Zekton
#	Calibri
#	Engebrechtre
#	Opeln2001
#	Open Sans Light
#	Open Sans Light

# -- Lua Load -- #
#lua_load ~/.draw_bg.lua
#lua_draw_hook_pre draw_bg

lua_load /media/5/Conky/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 20 0 0 0 0 0x000000 0.4
#lua_draw_hook_post draw_bg 20 0 0 0 0 0x000000 0.4
############ or use ################
#TEXT
#${lua conky_draw_bg 20 0 0 0 0 0x000000 0.4}


#lua_load ~/.bargraph_small.lua
#lua_draw_hook_post main_bars

imlib_cache_size 0

color1 0099CC
color2 9933CC
color3 669900
color4 E5520F
color5 CC0000
color6 AAAAAA
color7 484848

#${lua conky_draw_bg}

TEXT
${lua conky_draw_bg 20 0 0 0 0 0x000000 0.7}${execi 300 curl -s "http://weather.yahooapis.com/forecastrss?w=2348079&u=c" -o ~/.cache/weather.xml}${font Open Sans Light:size=15}${execi 300 grep "yweather:location" ~/.cache/weather.xml | grep -o "city=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}, ${execi 300 grep "yweather:location" ~/.cache/weather.xml | grep -o "country=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${font}
${font Open Sans Light:size=45}${alignr}${execi 300 grep "yweather:condition" ~/.cache/weather.xml | grep -o "temp=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}°${font}
${execi 300 cp -f ~/.weathericons/$(grep "yweather:condition" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*").png ~/.cache/weather.png}${image ~/.cache/weather.png -p 0,45 -s 60x60}
${execi 300 grep "yweather:condition" ~/.cache/weather.xml | grep -o "text=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}
${color6}${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 "[^\"]*"}${color}
${execi 300 cp -f ~/.weathericons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | head -n1).png ~/.cache/weather-today.png}${image ~/.cache/weather-today.png -p 0,145 -s 30x30}${execi 300 cp -f ~/.weathericons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | tail -n1).png ~/.cache/weather-tomorrow.png}${image ~/.cache/weather-tomorrow.png -p 130,145 -s 30x30}
${goto 60}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | head -n1}${goto 190}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | tail -n1}
${goto 60}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | head -n1}° ${color6}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | head -n1}°${color}${goto 190}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | tail -n1}° ${color6}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | tail -n1}°${color}${voffset 15}
${color7}${hr}${color}
${if_existing /proc/net/route wlan0}
${color1}Up:${color} ${color3}${upspeed wlan0}${color}${alignr}${color1}Down:${color} ${color3}${downspeed wlan0}${color}
${upspeedgraph wlan0 50,120 FF8800 FF8800}${alignr}${downspeedgraph wlan0 50,120 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup wlan0}${color}${alignr}${color1}Received:${color} ${color2}${totaldown wlan0}${color}
${else}${if_existing /proc/net/route eth0}
${color1}Up:${color} ${color3}${upspeed eth0}${color}${alignr}${color1}Down:${color} ${color3}${downspeed eth0}${color}
${upspeedgraph eth0 50,120 FF8800 FF8800}${alignr}${downspeedgraph eth0 50,120 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup eth0}${color}${alignr}${color1}Received:${color} ${color2}${totaldown eth0}${color}
${else}${if_existing /proc/net/route eth1}
${color1}Up:${color} ${color3}${upspeed eth1}${color}${alignr}${color1}Down:${color} ${color3}${downspeed eth1}${color}
${upspeedgraph eth1 50,120 FF8800 FF8800}${alignr}${downspeedgraph eth1 50,120 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup eth1}${color}${alignr}${color1}Received:${color} ${color2}${totaldown eth1}${color}
${else}${if_existing /proc/net/route ppp0}
${color1}Up:${color} ${color3}${upspeed ppp0}${color}${alignr}${color1}Down:${color} ${color3}${downspeed ppp0}${color}
${upspeedgraph ppp0 50,120 FF8800 FF8800}${alignr}${downspeedgraph ppp0 50,120 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup ppp0}${color}${alignr}${color1}Received:${color} ${color2}${totaldown ppp0}${color}
${else}
Network disconnected
${color6}Connect to a network to see statistics${color}
${voffset 50}
${endif}${endif}${endif}${voffset -15}
${color7}${hr}${color}
${font Open Sans Light:size=15}System Info
${color}${font Open Sans Light:pixelsize=10}USER: ${color1}${alignr}${nodename}
${color}${font Open Sans Light:pixelsize=10}DISTRO:  ${color1}${alignr}${pre_exec lsb_release -sd || cat /etc/*release}
${color}${font Open Sans Light:pixelsize=10}KERNEL: ${color1}${alignr}${kernel}
${color}${font Open Sans Light:pixelsize=10}ARCH: ${color1}${alignr}$machine
${color}${font Open Sans Light:pixelsize=10}CPU: ${color1}${alignr}${freq_g cpu0} GHz
${color}${font Open Sans Light:pixelsize=10}UPTIME: ${color1}${alignr}${uptime}
${color}${font Open Sans Light:pixelsize=10}PROCESSES: ${color1}${alignr}$processes ($running_processes running)
${color7}${hr}${color}
${font Open Sans Light:size=15}Processors/Memory
${color}${font Open Sans Light:pixelsize=10}CPU 1: ${color1}${alignc}${freq_g 0} ${color1}Ghz ${color2}${alignr}${cpu cpu0}${color1}%
${color}${font Open Sans Light:pixelsize=10}CPU 2: ${color1}${alignc}${freq_g 1} ${color1}Ghz ${color2}${alignr}${cpu cpu1}${color1}%
${color}${font Open Sans Light:pixelsize=10}CPU 3: ${color1}${alignc}${freq_g 2} ${color1}Ghz ${color2}${alignr}${cpu cpu2}${color1}%
${color}${font Open Sans Light:pixelsize=10}CPU 4: ${color1}${alignc}${freq_g 3} ${color1}Ghz ${color2}${alignr}${cpu cpu3}${color1}%
${alignr}${cpugraph cpu0 25,250 FF8800 FF8800 -l}
${color}${font Open Sans Light:pixelsize=10}RAM: ${color3}${alignc 10}${mem}
${color}${font Open Sans Light:pixelsize=10}TOTAL: ${color3}${alignc 10}${memmax}
${alignr}${loadgraph 25,250 FF8800 FF8800 -l}
${color7}${hr}${color}
${font Open Sans Light:size=15}Top Processes
${color}${font Open Sans Light:pixelsize=10}${color}${top_mem name 1}${color1}${alignc -10}${top_mem mem_res 1}${color2}${alignr}${top_mem mem 1}${color1} %
${color}${font Open Sans Light:pixelsize=10}${color}${top_mem name 2}${color1}${alignc -10}${top_mem mem_res 2}${color2}${alignr}${top_mem mem 2}${color1} %
${color}${font Open Sans Light:pixelsize=10}${color}${top_mem name 3}${color1}${alignc -10}${top_mem mem_res 3}${color2}${alignr}${top_mem mem 3}${color1} %
${color}${font Open Sans Light:pixelsize=10}${color}${top_mem name 4}${color1}${alignc -10}${top_mem mem_res 4}${color2}${alignr}${top_mem mem 4}${color1} %
${color}${font Open Sans Light:pixelsize=10}${color}${top_mem name 5}${color1}${alignc -10}${top_mem mem_res 5}${color2}${alignr}${top_mem mem 5}${color1} %
${color7}${hr}${color}
${font Open Sans Light:size=15}Temperatures
${font Open Sans Light:pixelsize=10}${color ffffff}CPU TEMP 0: ${color2}${alignr}${platform f71882fg.2560 temp 1} ${color1}°C${color2} ${color3}/ ${color2}105${color1} °C$color
${font Open Sans Light:pixelsize=10}${color ffffff}CPU TEMP 1: ${color2}${alignr}${platform f71882fg.2560 temp 1} ${color1}°C ${color3}/ ${color2}105${color1} °C$color
${font Open Sans Light:pixelsize=10}${color ffffff}TEMPERATURE 2: ${color2}${alignr}${platform f71882fg.2560 temp 2} ${color1}°C ${color3}/ ${color2}127${color1} °C$color
${font Open Sans Light:pixelsize=10}${color ffffff}TEMPERATURE 3: ${color2}${alignr}${platform f71882fg.2560 temp 2} ${color1}°C ${color3}/ ${color2}127${color1} °C$color
${font Open Sans Light:pixelsize=10}${color ffffff}GPU TEMP: ${color2}${alignr}${nvidia temp} ${color1}°C ${color3}/ ${color2}140${color1} °C$color
${font Open Sans Light:pixelsize=10}${color ffffff}M-BOARD TEMP: ${color2}${alignr}${platform f71882fg.2560 temp 2} ${color1}°C ${color3}/ ${color2}80${color1} °C$color
${font Open Sans Light:pixelsize=10}${color ffffff}SDA TEMP: ${color2}${alignr}${hddtemp /dev/sda}${color1} °C ${color3}/ ${color2}70${color1} °C$color
${font Open Sans Light:pixelsize=10}${color ffffff}FAN SPEED: ${color2}${alignr}${platform f71882fg.2560 fan 1}${font}${color1} RPM

Yup, that is mine, other than using Arch the other change is the upgrade to Gnome 3.12.  I don't know about anyone else but Gnome-Shell 3.12 has been a pain in my arse when it comes to conky.

I tried what I had in this conky config, no luck.

Offline

#7570 2014-05-31 13:07:55

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

Re: Conky v1.9 Thread

This Weather conky is based on Conky-Harmattan I used his [Mini] to tweak it to =7days of the week
14350411653_c2e695d9d2_o.png
With the permission of zagortenay333 i've edited/modificated his code.

I call separated one by one in this way via bash script ".con.sh" four templates.
here's first template...

# Conky settings #
background yes
update_interval 1
double_buffer yes
no_buffers yes
imlib_cache_size 10

# Window specifications #
gap_x 1020
gap_y 840
minimum_size 238 80
maximum_width 238
own_window yes
own_window_type desktop # other options are: override/normal/desktop/panel
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
#alignment middle_middle
#own_window_argb_visual yes
#own_window_argb_value 0

# Graphics settings #
draw_shades no
default_shade_color AAAAAA
draw_outline no
default_outline_color AAAAAA
draw_borders no
draw_graph_borders no

# Text settings #
use_xft yes
xftalpha 0
xftfont Droid Sans:size=10
text_buffer_size 256
override_utf8_locale yes
override_utf8_locale yes
imlib_cache_size 0

# Color scheme #
default_color FFFFFF
color1 A49379
color2 FFFFFF
color3 8B795E
color5 913030

TEXT
# Various images #
${if_existing /proc/net/route eth0}${execi 300 curl -s "http://weather.yahooapis.com/forecastrss?w=472135&u=c" -o ~/.cache/weather.xml}
${image ~/.conky/conky-weather/mini/fav-color.png -p 5,4 -s 228x105}\
${image ~/.conky/conky-weather/mini/border.png -p 5,4 -s 228x105}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 80,15 -s 1x83}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 157,15 -s 1x83}\
\
# The name of the days #
\
${color1}${voffset -3}${alignc 77}SUN
${color1}${voffset -14}${alignc}MOON${color}
${color1}${voffset -14}${alignc -77}HUM${color}
\
# The temperatures #
\
${color2}${voffset 51}${alignc 77}${execi 300 grep "yweather:astronomy" ~/.cache/weather.xml | grep -o "sunrise=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${color}
${voffset -14}${color2}${alignc}${execi 300 grep "yweather:astronomy" ~/.cache/weather.xml | grep -o "sunset=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${color}
${voffset -14}${color2}${alignc -77}${execi 300 grep "yweather:atmosphere" ~/.cache/weather.xml | grep -o "humidity=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"} %${color}
\
# The icons of the forecast and condition #
\
${image ~/.conky/conky-weather/icons/32.png -p 22,30 -s 48x48}\
${image ~/.conky/conky-weather/icons/31.png -p 96,30 -s 48x48}\
${image ~/.conky/conky-weather/icons/50.png -p 172,30 -s 48x48}\
${color1}${voffset 12}${alignc -55}${font cure:size=7}-lu: ${execi 300 grep "lastBuildDate" ~/.cache/weather.xml | cut -c 16-40}${else}${color5}${font cure:size=7}${goto 20}weather/err: eth0 not present ...check the connection${endif}${color}${font}

The rest and installation of this script, download here

In future i think to put all templated in a single file to be more aesthetic and less.
Thanks to the #! supporter and Sector11 for general assistance on the forum wink

Nili

Last edited by Nili (2014-06-02 15:57:43)


# 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

#7571 2014-05-31 13:31:43

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

Re: Conky v1.9 Thread

Dobbie03 wrote:

Yup, that is mine, other than using Arch the other change is the upgrade to Gnome 3.12.  I don't know about anyone else but Gnome-Shell 3.12 has been a pain in my arse when it comes to conky.

I tried what I had in this conky config, no luck.

OK, that explains that.

GNOME Shell 3.12 uses mutter composite manager built in similar to XFCE4's builring composite manager.

Fund out how to control that and maybe you'll have a chance.


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

Offline

#7572 2014-05-31 13:33:36

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

Re: Conky v1.9 Thread

@ Nili

Looks nice.  Thanks for sharing


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

Offline

#7573 2014-05-31 14:37:49

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

Re: Conky v1.9 Thread

Thanks, you're welcome!


# 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

#7574 2014-05-31 16:19:32

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

i need your help. i'm desperate. i've an error in my function (see bottom): http://postimg.org/image/nw1aypndp/

here is the code:

run=1
count=1

function rounded(cm)

local img_x=cm.x or 0
local img_y=cm.y or 0
local img_w=cm.w or 200
local img_h=cm.h or 200
local scaled=cm.sc or "no"
local scale_size=cm.sw or 200
local img_name=cm.hdd
local url=cm.url or ''
local r=cm.r or 20
local interval=10--conky updates before switching
local hdd=folder_rounded..img_name
local iv=20
local img_pos=string.find(img_name,"%p")
local img_cut=string.sub(img_name,0,img_pos-1)
local imagefile=img_cut..".png"
local imgf=folder_rounded..imagefile


if conky_window == nil then return end
local updates=tonumber(conky_parse("${updates}"))
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
--#########################################################################################################
--settings #####################################################



local updates = tonumber(conky_parse('${updates}'))
 if (math.mod(updates, iv) == 0) then

  os.execute("wget  -q -O "..hdd..' "'..url..'"') -- download image
  os.execute("mogrify -format png "..hdd.." ") -- convert image

 end -- of update
--------------------------------------------------------





if scaled=="yes" then --------------------------------------------------
local show = imlib_load_image(imgf)
  if show == nil then return 	end
  imlib_context_set_image(show)
  imgwidth= imlib_image_get_width()
  imgheight=imlib_image_get_height()
  img_w=scale_size
  img_h=(img_w*imgheight)/imgwidth
  imlib_free_image_and_decache()
end -- of scaled -------------------------------------------------------


-- ## CODE #############################################################
local updates=tonumber(conky_parse('${updates}'))
local timer=(updates %tonumber(interval))
if timer==0 or run==1 then
	if run==1 then count=1 end
	run=nil
end--timed section
-- #####################################################################

	w,h=img_w,img_h
	x,y=img_x,img_y

	local xtl=x+r
	local ytl=y+r
	--top right mid circle
	local xtr=(x+r)+((w)-(2*r))
	local ytr=y+r
	--bottom right mid circle
	local xbr=(x+r)+((w)-(2*r))
	local ybr=(y+r)+((h)-(2*r))
	--bottom right mid circle
	local xbl=(x+r)
	local ybl=(y+r)+((h)-(2*r))
	-----------------------------

cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_clip (cr);

cairo_new_path (cr); --/* path not consumed by clip()*/
image = cairo_image_surface_create_from_png (imgf);
iw = cairo_image_surface_get_width (image);
ih = cairo_image_surface_get_height (image);
cairo_scale (cr, w/iw, h/ih);
cairo_set_source_surface (cr, image, x, y);
cairo_paint (cr);
cairo_surface_destroy (image);
ny=0

cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end--end main function

Offline

Be excellent to each other!

#7575 2014-05-31 20:55:15

dk75
#! Junkie
Registered: 2012-06-14
Posts: 250

Re: Conky v1.9 Thread

Any imlib images ($image function) when transparency is set will be blurred/washed.
It was reported with Conky 1.9 and it still present in Conky 2.0.
It's a bug with how Conky draw Imlib images.


Debian Sid (Minted) x86_64/3.12-10, Conky 2.0_pre, Xorg 7.7/1.15.0, KDE 4.11.5, Intel X3100
Lenovo T61, HITACHI HTS722010K9SA00 100GB, WDC_WD5000BEVT 500GB
Linux user No.: 483055 | Conky Pitstop

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