SEARCH

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

You are not logged in.

#7576 2014-06-01 17:59:12

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

Re: Conky v1.9 Thread

dk75 wrote:

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.

is there a way to fix this problem? or a workaround??

Offline

Be excellent to each other!

#7577 2014-06-01 19:01:43

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

Re: Conky v1.9 Thread

You display pictures with Cairo... but then, it displays PNG only... need external command (Image Magick) to convert them to PNG.

PS: there was wrapper to display Imlib images inside Cairo but... it never worked for me.


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

#7578 2014-06-01 23:05:09

diggle
Member
Registered: 2014-06-01
Posts: 10

Re: Conky v1.9 Thread

Hi im new to linux and need some help if anybody on here could help me out with these conkys on how to set them up

Thank u


http://bigrza.deviantart.com/art/Conky- … -134566184

http://www.deviantart.com/art/Cornet-Conky-171920478

Offline

#7579 2014-06-02 02:37:28

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

Re: Conky v1.9 Thread

diggle wrote:

Hi im new to linux and need some help if anybody on here could help me out with these conkys on how to set them up

Thank u


http://bigrza.deviantart.com/art/Conky- … -134566184

http://www.deviantart.com/art/Cornet-Conky-171920478

The first one says it needs conkyforecast for the weather part, which will be a problem as that script doesnt work anymore (some who have used conkyforecast before have reported it works for them but i dont think a new user will be able to get it working)

in the second one you have conkyrcs calling lua scripts

for example in the file named "conkyrcmx" this line

lua_load ~/scripts/otherrings.lua

you need to take the script called otherrings.lua and put it somewhere then edit the line in conkyrcmx to point to the location

similar for the conkyrc "conkyclo"
it calls the lua script "clock.lua"

lua_load ~/scripts/clock.lua
lua_draw_hook_pre clock_rings

if you dont want to edit, make a folder called "scripts" in your home folder and put the lua scripts in there, then they will be found

looks like there is a shell script to start everything : "conkycor.sh"

#!/bin/bash
sleep 20
conky -c ~/.conkyclo &
sleep 10
conky -c ~/.conkyrcmx
exit 0

the 2 conkyrcs "conkyrcmx" and "conkyclo" need to be put somewhere and then edit the shell script to point to them
if they are in your home folder then the shell script will find them without editing

Offline

#7580 2014-06-02 09:43:19

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

Re: Conky v1.9 Thread

is there a better way to draw a border then a rectangle as background? this way looks good if you use a square image as foreground. but if i use a rounded image as foreground then it looks stupid (see below).

here my current work:
rounded image as foreground: http://postimg.org/image/pbyaovful/
square image as foregound: http://postimg.org/image/cbzv2eurt/

Offline

#7581 2014-06-02 10:31:33

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

Re: Conky v1.9 Thread

lionhead wrote:

is there a better way to draw a border then a rectangle as background? this way looks good if you use a square image as foreground. but if i use a rounded image as foreground then it looks stupid (see below).

here my current work:
rounded image as foreground: http://postimg.org/image/pbyaovful/
square image as foregound: http://postimg.org/image/cbzv2eurt/

adjust strings where needed to fit the picture

tlx=0
tly=0
radius=20
w=100
h=100
cairo_set_line_width(cr,2)
cairo_arc(cr,tlx,tly,radius,(180*(math.pi/180)),(270*(math.pi/180))
cairo_arc(cr,(tlx+w),tly,radius,(270*(math.pi/180)),(0*(math.pi/180))
cairo_arc(cr,(tlx+w),(tly+h),radius,(0*(math.pi/180)),(90*(math.pi/180))
cairo_arc(cr,tlx,(tly+h),radius,(90*(math.pi/180)),(180*(math.pi/180))
cairo_close_path(cr)
cairo_set_source_rgba(cr,1,1,1,1)
cairo_stroke(cr)

You can find my work here

Make everything ok button

Offline

#7582 2014-06-02 15:08:45

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

Re: Conky v1.9 Thread

Just updated previously yweather code to a single file.
14350411653_c2e695d9d2_o.png

changed .con3 letter name to yweather now it is not necessary to make load 1 2 3 4
also consumes less CPU, early eat 2 to 4% now consume only 1 to 2% and load instant.

terminal:

./.conky/yweather

bash:

(sleep 5 && conky -c /home/nili/.conky/yweather) &

yweather code:

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

# Window specifications #
gap_x 1025
gap_y 510
minimum_size 238
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
draw_outline no
draw_borders no
default_outline_color AAAAAA
draw_graph_borders no

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

# Color scheme #
default_color FFFFFF
color1 A49379
color2 FFFFFF
color3 9999CC
color4 A6A6A6
color5 913030

TEXT
# Various images #
${if_existing /proc/net/route eth0}${execi 900 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 900 grep "yweather:astronomy" ~/.cache/weather.xml | grep -o "sunrise=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${color}
${voffset -14}${color2}${alignc}${execi 900 grep "yweather:astronomy" ~/.cache/weather.xml | grep -o "sunset=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${color}
${voffset -14}${color2}${alignc -77}${execi 900 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 900 grep "lastBuildDate" ~/.cache/weather.xml | cut -c 16-40}${color}${font}

# Various images #
${execi 900 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,127 -s 228x105}\
${image ~/.conky/conky-weather/mini/border.png -p 5,127 -s 228x105}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 80,138 -s 1x83}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 157,138 -s 1x83}\
\
# The name of the days #
\
${color3}${voffset -25}${alignc 77}NOW
${color3}${voffset -14}${alignc}NEXT+3h${color}
${color3}${voffset -14}${alignc -77}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2' | tr '[a-z]' '[A-Z]'}${color}
\
# The temperatures #
\
${color2}${voffset 51}${font Droid Sans :bold:size=12}${alignc 74}${execi 900 grep "yweather:condition" ~/.cache/weather.xml | grep -o "temp=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}°${font}${color}
${voffset -14}${color4}${alignc}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1'}°${color}
${voffset -14}${color4}${alignc -77}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2'}°${color}
\
# The icons of the forecast and condition #
\
${execi 900 cp -f ~/.conky/conky-weather/icons/$(grep "yweather:condition" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*").png ~/.cache/weather.png}${image ~/.cache/weather.png -p 22,150 -s 48x48}\
${execi 900 cp -f ~/.conky/conky-weather/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 96,150 -s 48x48}\
${execi 900 cp -f ~/.conky/conky-weather/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 172,150 -s 48x48}\

# Various images #
${execi 900 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,239 -s 228x105}\
${image ~/.conky/conky-weather/mini/border.png -p 5,239 -s 228x105}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 80,250 -s 1x83}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 157,250 -s 1x83}\
\
# The name of the days #
\
${color3}${voffset -3}${alignc 77}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3' | tr '[a-z]' '[A-Z]'}${color}
${color3}${voffset -14}${alignc}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4' | tr '[a-z]' '[A-Z]'}${color}
${color3}${voffset -14}${alignc -77}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5' | tr '[a-z]' '[A-Z]'}${color}
\
# The temperatures #
\
${color4}${voffset 53}${alignc 77}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3'}°${color}
${voffset -14}${color4}${alignc}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4'}°${color}
${voffset -14}${color4}${alignc -77}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5'}°${color}
\
# The icons of the forecast and condition #
\
${execi 900 cp -f ~/.conky/conky-weather/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 22,268 -s 48x48}\
${execi 900 cp -f ~/.conky/conky-weather/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 96,268 -s 48x48}\
${execi 900 cp -f ~/.conky/conky-weather/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 172,268 -s 48x48}\

# Various images #
${execi 900 curl -s "http://weather.yahooapis.com/forecastrss?w=472135&u=c&d=10" -o ~/.cache/weather.xml}
${image ~/.conky/conky-weather/mini/fav-color.png -p 5,352 -s 228x105}\
${image ~/.conky/conky-weather/mini/border.png -p 5,352 -s 228x105}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 80,364 -s 1x83}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 157,364 -s 1x83}\
\
# The name of the days #
\
${color3}${voffset -5}${alignc 77}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==6' | tr '[a-z]' '[A-Z]'}${color}
${color3}${voffset -14}${alignc}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==7' | tr '[a-z]' '[A-Z]'}${color}
${color3}${voffset -14}${alignc -77}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==8' | tr '[a-z]' '[A-Z]'}${color}
\
# The temperatures #
\
${color4}${voffset 53}${alignc 77}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==6'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==6'}°${color}
${voffset -14}${color4}${alignc}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==7'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==7'}°${color}
${voffset -14}${color4}${alignc -77}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==8'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==8'}°${color}
\
# The icons of the forecast and condition #
\
${execi 900 cp -f ~/.conky/conky-weather/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 22,380 -s 48x48}\
${execi 900 cp -f ~/.conky/conky-weather/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 96,380 -s 48x48}\
${execi 900 cp -f ~/.conky/conky-weather/icons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==8').png ~/.cache/weather-8.png}${image ~/.cache/weather-8.png -p 172,380 -s 48x48}${else}${color4}${voffset 5}${offset 0}yweather error, check your connection...${endif}${color}\

\
# code end #
\

Removed some unwanted text and fixed if there is no connection present.

Last edited by Nili (2014-06-02 16:57:33)


# 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

#7583 2014-06-02 15:24:32

#!_828
#! Tinfoil Hat
From: Ohio, U. S. of A.
Registered: 2013-09-19
Posts: 1,244

Re: Conky v1.9 Thread

@Nili

Whenever you post an image, I only see the Flickr notification that the image in unavailable (in eight languages, only two of which I understand)


Those who would trade essential liberty for temporary security deserve neither
Member of the (Un)Official #! Emergency Tinfoil Hat Distribution Center
Emergency Tinfoil Hat Conky Alert System development team

Offline

#7584 2014-06-02 15:44:07

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

Re: Conky v1.9 Thread

Sorry #!_828, you'll see those errors from Flickr because i wiped my images from flickr room.
- reason for this action just want to arrange them better. hereafter there will be no such problem with my images.

Since yesterday i'm making new ones. Sorry again.
Nili

Edit: partly fixed some images, only old screenshots/desktop threads that are locked i can't fix ;(

Last edited by Nili (2014-06-02 16:26:48)


# 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

#7585 2014-06-06 15:08:52

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

Re: Conky v1.9 Thread

Sector11 wrote:
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 #########################################################

http://s20.postimg.org/ulsuizamh/2014_05_29_16_20_58_1920x1080_Sector11.jpg http://s20.postimg.org/om53fbpu1/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

IT WORKS!!!!!!!!

Obrigada, amigo!
big_smile

Offline

#7586 2014-06-06 16:31:01

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

Re: Conky v1.9 Thread

Marenbraga wrote:

IT WORKS!!!!!!!!

Obrigada, amigo!
big_smile

cool  You're welcome!


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

Offline

#7587 2014-06-11 10:44:59

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

Re: Conky v1.9 Thread

Remade yweather (mini usage).
6iXnxHF.png

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

# Window specifications #
gap_x 1090
gap_y 642
minimum_size 173
maximum_width 173
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
draw_outline no
draw_borders no
default_outline_color AAAAAA
draw_graph_borders no

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

# Color scheme #
default_color E6E6E6
color1 B46A6A
color2 E6E6E6
color3 CCB399
color4 A6A6A6
color5 913030

TEXT
# Various images #
${if_existing /proc/net/route eth0}${execi 900 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 164x75}\
${image ~/.conky/conky-weather/mini/border.png -p 5,4 -s 164x75}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 59,15 -s 1x45}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 115,15 -s 1x45}\
\
# The name of the days #
\
${color1}${voffset 3}${goto 25}SUN
${color1}${voffset -9}${goto 77}MOON${color}
${color1}${voffset -9}${goto 135}HUM${color}
\
# The temperatures #
\
${color2}${voffset 40}${goto 17}${execi 900 grep "yweather:astronomy" ~/.cache/weather.xml | grep -o "sunrise=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${color}
${voffset -9}${color2}${goto 75}${execi 900 grep "yweather:astronomy" ~/.cache/weather.xml | grep -o "sunset=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${color}
${voffset -9}${color2}${goto 135}${execi 900 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 17,24 -s 32x32}\
${image ~/.conky/conky-weather/icons/31.png -p 73,24 -s 32x32}\
${color4}${image ~/.conky/conky-weather/icons/50.png -p 135,32 -s 16x16}${color}\
${color4}${voffset 12}${goto 87}fetched:${execi 900 grep "lastBuildDate" ~/.cache/weather.xml | cut -c 32-40}${color}

# Various images #
${execi 900 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,94 -s 164x75}\
${image ~/.conky/conky-weather/mini/border.png -p 5,94 -s 164x75}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 59,108 -s 1x45}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 115,108 -s 1x45}\
\
# The name of the days #
\
${color3}${voffset -5}${goto 25}NOW
${color3}${voffset -9}${goto 75}NEXT${color}
${color3}${voffset -9}${goto 135}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2' | tr '[a-z]' '[A-Z]'}${color}
\
# The temperatures #
\
${color2}${voffset 40}${goto 24}${execi 900 grep "yweather:condition" ~/.cache/weather.xml | grep -o "temp=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}°c${color}
${voffset -9}${color4}${goto 73}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1'}°${color}
${voffset -9}${color4}${goto 128}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2'}°${color}
\
# The icons of the forecast and condition #
\
${execi 900 cp -f ~/.conky/conky-weather/icons/$(grep "yweather:condition" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*").png ~/.cache/weather.png}${image ~/.cache/weather.png -p 17,115 -s 32x32}\
${execi 900 cp -f ~/.conky/conky-weather/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 72,115 -s 32x32}\
${execi 900 cp -f ~/.conky/conky-weather/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 126,115 -s 32x32}\

# Various images #
${execi 900 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,175 -s 164x75}\
${image ~/.conky/conky-weather/mini/border.png -p 5,175 -s 164x75}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 59,190 -s 1x45}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 115,190 -s 1x45}\
\
# The name of the days #
\
${color3}${voffset 5}${goto 24}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3' | tr '[a-z]' '[A-Z]'}${color}
${color3}${voffset -9}${goto 78}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4' | tr '[a-z]' '[A-Z]'}${color}
${color3}${voffset -9}${goto 134}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5' | tr '[a-z]' '[A-Z]'}${color}
\
# The temperatures #
\
${color4}${voffset 40}${goto 20}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3'}°${color}
${voffset -9}${color4}${goto 73}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4'}°${color}
${voffset -9}${color4}${goto 128}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5'}°${color}
\
# The icons of the forecast and condition #
\
${execi 900 cp -f ~/.conky/conky-weather/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 17,196 -s 32x32}\
${execi 900 cp -f ~/.conky/conky-weather/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 72,196 -s 32x32}\
${execi 900 cp -f ~/.conky/conky-weather/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 126,196 -s 32x32}\

# Various images #
${execi 900 curl -s "http://weather.yahooapis.com/forecastrss?w=472135&u=c&d=10" -o ~/.cache/weather.xml}
${image ~/.conky/conky-weather/mini/fav-color.png -p 5,257 -s 164x75}\
${image ~/.conky/conky-weather/mini/border.png -p 5,257 -s 164x75}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 59,273 -s 1x45}\
${image ~/.conky/conky-weather/mini/separator-v.png -p 115,273 -s 1x45}\
\
# The name of the days #
\
${color3}${voffset 5}${goto 24}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==6' | tr '[a-z]' '[A-Z]'}${color}
${color3}${voffset -9}${goto 78}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==7' | tr '[a-z]' '[A-Z]'}${color}
${color3}${voffset -9}${goto 134}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==8' | tr '[a-z]' '[A-Z]'}${color}
\
# The temperatures #
\
${color4}${voffset 40}${goto 20}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==6'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==6'}°${color}
${voffset -9}${color4}${goto 73}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==7'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==7'}°${color}
${voffset -9}${color4}${goto 128}${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==8'}°${color2}/${execi 900 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==8'}°${color}
\
# The icons of the forecast and condition #
\
${execi 900 cp -f ~/.conky/conky-weather/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 17,278 -s 32x32}\
${execi 900 cp -f ~/.conky/conky-weather/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 72,278 -s 32x32}\
${execi 900 cp -f ~/.conky/conky-weather/icons/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==8').png ~/.cache/weather-8.png}${image ~/.cache/weather-8.png -p 126,278 -s 32x32}${else}${color4}${voffset 5}${offset 0}yweather error... no connection!${endif}${color}\

\
# end of code #
\

download as a file here


# 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

#7588 2014-06-12 06:44:28

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

Re: Conky v1.9 Thread

conky-minimalistic-v2 (preview) since it's been requested

use_xft yes
xftfont cure:size=8
xftalpha 0.8
text_buffer_size 2048
update_interval 2
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 2560 0
draw_shades no
draw_outline no
draw_borders no
stippled_borders 0
border_width 1
default_color white
#default_shade_color black
#default_outline_color grey
own_window_colour 151515
alignment bottom_left
# Color
default_color CCCCCC
color1 CC3366
color2 913030
color3 7A7A7A
color4 8B795E
color5 D70751

gap_x 5
gap_y 5
no_buffers yes
uppercase no
cpu_avg_samples 1
net_avg_samples 1
override_utf8_locale yes
use_spacer none
lua_load ~/.conky/background.lua
lua_draw_hook_pre draw_bg

TEXT
${if_match ${desktop}==1}${color1}1${else}${color}1${endif}${offset 8}${if_match ${desktop}==2}${color1}2${else}${color}2${endif}${color} ${color3}$nodename${color} \
${color4}[${color3}${user_number}${color4}][${color3}${execi 60 find /media/nili/Toshiba/.Trash-1000/files /media/nili/dat2/.Trash-1000/files /media/nili/Lacie/.Trash-1000/files /media/nili/Seagate/.Trash-1000/files /media/nili/I3/.Trash-1000/files ~/.local/share/Trash/files -type f | wc -l}${color4}] ${color2}\#${color} \
${color4}${pre_exec lsb_release -d | cut -f 2| tr "[:upper:]" "[:lower:]"} ${color2}\#${color} \
${color3}-ut${color4} ${uptime_short} ${color2}\#${color} \
${color3}knl${color4} ${kernel} ${color2}\#${color} \
${color3}cpu1${color4} ${cpugauge cpu1 8,16} ${cpu cpu1}% ${color2}\#${color} \
${color3}cpu2${color4} ${cpugauge cpu2 8,16} ${cpu cpu2}% ${color2}\#${color} \
${color3}ram${color4} ${memperc}% (${mem}) ${color2}\#${color} \
${color3}/=home${color4} ${fs_used_perc /}% (${fs_free /}) ${color2}\#${color} \
${color3}sdb${color4}${if_mounted /media/nili/dat2} ${fs_used_perc /media/nili/dat2}% (${fs_free /media/nili/dat2})${else} ?${endif} ${color2}\#${color} \
${color3}ia${color4} ${addr eth0} ${color2}\#${color} \
${color3}mail${color4} ${if_existing /proc/net/route eth0}${execi 60 python ~/.conky/.gmail.py}${else}no con...${endif} ${color2}\#${color} \
${color3}google${color4} ${if_existing /proc/net/route eth0}${texeci 1 ping -q -c 1 google.com |grep avg |cut -d "/" -f 5} ms${else}no con...${endif} ${color2}\#${color} \
${color3}rx${color4} ${downspeed eth0} (${execi 300 vnstat | grep "today" | awk '{print $2 $3}'}) ${color2}\#${color} \
${color3}tx${color4} ${upspeed eth0} (${execi 300 vnstat | grep "today" | awk '{print $5 $6}'}) ${color}

download rest of needed files here


# 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

#7589 2014-06-16 17:52:12

CSCoder4ever
BL Keyboard Troll
From: /dev/zero
Registered: 2013-09-03
Posts: 2,256

Re: Conky v1.9 Thread

Just realized I forgot to share my Dzen2 conky! yikes

that happily runs on my laptop w/ the i3 WM big_smile

1e67ff0c_Screenfetch4_24_14.png?noCache=1402940061

Code:

background no
out_to_x no
out_to_console yes
update_interval 1
total_run_times 0
use_spacer none

TEXT
^fg(\#07fb10)uptime: $uptime | CPU: ${cpu cpu0}% | Temp: ${exec sensors | awk '/Core 0/ {print substr($3,2,4)}'} C | memory: $mem/$memmax | Battery: ${battery_percent BAT0}% | server ${fs_free 
/server/mount}/${fs_size /server/mount} | wlan0: ${downspeed wlan0}/s

tried it out on my sister's netbook, and it works great under #! as well!

please forgive me sector11 lol  8o

Offline

#7590 2014-06-16 19:55:06

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

Re: Conky v1.9 Thread

CSCoder4ever, that Java thing -Dosgi is killing your memory, almost eat half of your RAM.
What is it a game or application?


# 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

#7591 2014-06-16 20:13:58

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

Re: Conky v1.9 Thread

CSCoder4ever wrote:

Just realized I forgot to share my Dzen2 conky! yikes

that happily runs on my laptop w/ the i3 WM big_smile

tried it out on my sister's netbook, and it works great under #! as well!

please forgive me sector11 lol  8o

Forgive you for what? That's not a conky!  That's not even a free sample!  Remember the little old lady in Wendy's?

Where's the conky?

And besides, it doesn't run on my #! ... and none of this, 'But you're not running i3 either!' ... I already know that! 8o
{in my best Capt. Steven Hiller voice} ... and what this Dzen2 thing anyway?

However, saying that, a slightly modified - roll - CSCoder4ever.i3_v2.conky runs here just fine.  tongue
2014_06_16_16_52_55_1920x1080_Sector11.jpg
There is only one thing I don't like about it (personal opinion) - it moves around as values change, other than that it is as fine an example of a one liner I have seen.

Please forgive my last comment: Well done!  big_smile


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

Offline

#7592 2014-06-16 20:20:33

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: Conky v1.9 Thread

Sector11 wrote:

... and what this Dzen2 thing anyway?

https://wiki.archlinux.org/index.php/Dzen
tongue

Offline

#7593 2014-06-16 20:58:38

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

Re: Conky v1.9 Thread

@ Head_on_a_Stick - shhhhhhhhhhhhh I knew that too! Was just having some fun.  big_smile

 16 Jun 14 | 17:56:09 ~
    $ ser dzen2
p   dzen2    - General-purpose messaging and notification program for X11
 
 16 Jun 14 | 17:56:22 ~
    $ sho dzen2
Package: dzen2                           
State: not installed
Version: 0.9.5~svn271-4
Priority: optional
Section: x11
Maintainer: Ryan Kavanagh <rak@debian.org>
Architecture: amd64
Uncompressed Size: 153 k
Depends: libc6 (>= 2.15), libx11-6, libxft2 (> 2.1.1), libxinerama1, libxpm4
Description: General-purpose messaging and notification program for X11
 Dzen was designed to be scriptable in any language and integrate well with window managers like dwm, wmii and
 xmonad though it will work with any window manger.
Homepage: https://github.com/robm/dzen

Tags: implemented-in::c, interface::commandline, interface::x11, role::program, uitoolkit::xlib, use::monitor
 
 16 Jun 14 | 17:56:33 ~
    $ 

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

Offline

#7594 2014-06-16 21:19:58

CSCoder4ever
BL Keyboard Troll
From: /dev/zero
Registered: 2013-09-03
Posts: 2,256

Re: Conky v1.9 Thread

Sector11 wrote:
CSCoder4ever wrote:

Just realized I forgot to share my Dzen2 conky! yikes

that happily runs on my laptop w/ the i3 WM big_smile

tried it out on my sister's netbook, and it works great under #! as well!

please forgive me sector11 lol  8o

Forgive you for what? That's not a conky!  That's not even a free sample!  Remember the little old lady in Wendy's?

Where's the conky?

And besides, it doesn't run on my #! ... and none of this, 'But you're not running i3 either!' ... I already know that! 8o
{in my best Capt. Steven Hiller voice} ... and what this Dzen2 thing anyway?

However, saying that, a slightly modified - roll - CSCoder4ever.i3_v2.conky runs here just fine.  tongue
http://s20.postimg.org/3v3ryy2yx/2014_06_16_16_52_55_1920x1080_Sector11.jpg
There is only one thing I don't like about it (personal opinion) - it moves around as values change, other than that it is as fine an example of a one liner I have seen.

Please forgive my last comment: Well done!  big_smile

you joker you! tongue

just needed a way to check my system usage and resources in a tiling-friendly way, and that was it 8o

Offline

#7595 2014-06-16 21:56:57

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

Re: Conky v1.9 Thread

CSCoder4ever wrote:

you joker you! tongue

just needed a way to check my system usage and resources in a tiling-friendly way, and that was it 8o

I try.  ]:D

Like I said, as a one liner it's really nice.  But using it as you have it in the bar is "perfect" and looks great with your setup.

And your code ... No bloat that's for sure. cool

Conky - is like all things: If it works for you and fills your needs, it's perfect for you 

My first conky, started big, down the right side of my desktop.  Then it got bigger and became two then three and more.  Just because I like configuring them, today I have trimmed back and only run ... aaaaa never mind ... this is about your little slice of conky.


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

Offline

#7596 2014-06-16 22:11:55

CSCoder4ever
BL Keyboard Troll
From: /dev/zero
Registered: 2013-09-03
Posts: 2,256

Re: Conky v1.9 Thread

^ Yep!
still using that same conky I made for my desktop, as that one pretty much just works.
someday I'll look into making it look even more awesome, but for now, it works ( still ) 8o

Nili wrote:

CSCoder4ever, that Java thing -Dosgi is killing your memory, almost eat half of your RAM.
What is it a game or application?

A couple Java IDEs, this was taken when I was in my college semester still.

but now you know why I want a laptop that can support 8GB RAM  lol

Last edited by CSCoder4ever (2014-06-16 22:12:58)

Offline

#7597 2014-06-16 22:49:13

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

Re: Conky v1.9 Thread

CSCoder4ever wrote:

just needed a way to check my system usage and resources in a tiling-friendly way, and that was it 8o

What version of i3 are you running? Current version of i3 with JSON you can run conky in the i3 statusbar with color; no need for dzen2 - example from i3 thread.

dkeg wrote a good HowTo for conky in i3 with JSON in that thread.

image8b80b6e36489b5643f4a50cc1fd4f7cf.png

conkyrc

out_to_x no
own_window no
out_to_console yes
background no
max_text_width 0
update_interval 1.0
total_run_times 0
short_units yes
cpu_avg_samples 4
use_spacer none

TEXT
# JSON for i3bar
 
 [

 	{ "full_text" : "  Up: ${uptime_short}  " , "color" : "\#C9C9C9" },
	
    { "full_text" : "  SDC: ${execpi 60 /usr/bin/hddtemp -n /dev/sdc}°C  " , "color" :
                ${if_match ${execpi 60 /usr/bin/hddtemp -n /dev/sdc}>=80}"\#FF2828"${else}${if_match ${execpi 60 /usr/bin/hddtemp -n /dev/sdc}>=50}"\#FAFA10"${else}"\#C9C9C9"${endif}${endif} },	
 
    { "full_text" : "  CPU: ${execpi 60 /home/doug/conky/cputempc.sh}°C  " , "color" :
                ${if_match ${execpi 60 /home/doug/conky/cputempc.sh}>=80}"\#FF2828"${else}${if_match ${execpi 60 /home/doug/conky/cputempc.sh}>=50}"\#FAFA10"${else}"\#C9C9C9"${endif}${endif} },

    { "full_text" : "  CPU: ${cpu}%  " , "color" :
                ${if_match ${cpu}>33}"\#FF2828"${else}"\#C9C9C9"${endif} },

    { "full_text" : "  RAM  ${memperc}%  " , "color" :
                ${if_match ${memperc}>33}"\#FF2828"${else}"\#C9C9C9"${endif} } ,
		
	{ "full_text" : "  ETH0: Up:  ${upspeedf eth0} " , "color" :
                ${if_match ${upspeedf eth0}<=500}"\#C9C9C9"${else}"\#00EEEE"${endif} },
		
	{ "full_text" : "  Down:  ${downspeedf eth0} " , "color" :
                ${if_match ${downspeedf eth0}<=500}"\#C9C9C9"${else}"\#00EEEE"${endif} },

	{ "full_text" : "  ${time %a %e %b  %k:%M}  " , "color" : "\#C9C9C9" } 

],

Last edited by PackRat (2014-06-16 22:57:14)


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

Offline

#7598 2014-06-17 09:33:10

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

Hi,
I'd like to add a lua function in the "draw_bg.lua"'s script... The idea might be choosing or not to draw a frame around, the problem is ... I got the idea but I can't do it because I'm too bad in coding lua...
So I founded a "wlourf lua script" which do a frame and I'd like to extract this function and add it in the draw_bg.lua script...
This script was first used to display datas from a french radio, source Examples
radio-box.lua:

require 'cairo'
require 'imlib2'


function string:split(delimiter)
--source for the split function : http://www.wellho.net/resources/ex.php4?item=u108/split
  local result = { }
  local from  = 1
  local delim_from, delim_to = string.find( self, delimiter, from  )
  while delim_from do
    table.insert( result, string.sub( self, from , delim_from-1 ) )
    from  = delim_to + 1
    delim_from, delim_to = string.find( self, delimiter, from  )
  end
  table.insert( result, string.sub( self, from  ) )
  return result
end



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


function create_pattern_linear(cr,x,y,w,h,col0,col1,alpha0,alpha1,orientation)
	alpha0=tonumber(alpha0)
	alpha1=tonumber(alpha1)	
	if orientation=="nn" then
		p={x+w/2,y,x+w/2,y+h}
	elseif orientation=="ne" then
		p={x+w,y,x,y+h}
	elseif orientation=="ee" then
		p={x+w,y+h/2,x,y+h/2}		
	elseif orientation=="se" then
		p={x+w,y+h,x,y}		
	elseif orientation=="ss" then
		p={x+w/2,y+h,x+w/2,y}
	elseif orientation=="sw" then
		p={x,y+h,x+w,y}
	elseif orientation=="ww" then
		p={x,y+h/2,x+w,y+h/2}
	else
		p={x,y,x+w,y+h}	
	end
		
	local pat = cairo_pattern_create_linear (p[1],p[2],p[3],p[4])
	cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col0,alpha0))
	cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col1,alpha1))
	cairo_set_source (cr, pat)
	cairo_pattern_destroy(pat)
end

function draw_square(cr,x,y,width,height,radius,img)
	local degrees = math.pi / 180.0
	radius=tonumber(radius)
	--more  simple?
	if img ~=nil then
		img_exist = io.open(img,"r")	
		if img_exist==nil then img=nil end
		flag_img=(img_exist==nil)
		io.close()
	end

	if img == nil then
		cairo_new_sub_path (cr);
		if radius>0 then
			cairo_arc (cr, x + width - radius, y + radius, radius, -90 * degrees, 0 * degrees);
			cairo_arc (cr, x + width - radius, y + height - radius, radius, 0 * degrees, 90 * degrees);
			cairo_arc (cr, x + radius, y + height - radius, radius, 90 * degrees, 180 * degrees);
			cairo_arc (cr, x + radius, y+ radius, radius, 180 * degrees, 270 * degrees);
		else
			cairo_rectangle(cr,x,y,width,height)
		end
		cairo_close_path (cr);
	else
		local image = imlib_load_image(img)
		imlib_context_set_image(image)
		w = imlib_image_get_width()
		h = imlib_image_get_height()
		if h>w then 
			ratio = width/h
		else
			ratio = width/w
		end 
		buffer = imlib_create_image(width,height);	
				
		imlib_context_set_image(buffer)
    	imlib_blend_image_onto_image(image, 0, 
                                       0, 0, w,h, 
                                       0, 0, width,height)
        imlib_context_set_image(image)
        imlib_free_image()
		imlib_context_set_image(buffer)
        imlib_save_image(img .. ".png")	
        imlib_free_image()

		local surface = cairo_image_surface_create_from_png(img .. ".png")
		if radius>0 then
			cairo_arc (cr, x + width - radius, y + radius, radius, -90 * degrees, 0 * degrees);
			cairo_arc (cr, x + width - radius, y + height - radius, radius, 0 * degrees, 90 * degrees);
			cairo_arc (cr, x + radius, y + height - radius, radius, 90 * degrees, 180 * degrees);
			cairo_arc (cr, x + radius, y+ radius, radius, 180 * degrees, 270 * degrees);
		else
			cairo_rectangle(cr,x,y,width,height)
		end
		cairo_translate(cr,x,y)
		cairo_clip(cr)
		cairo_set_source_surface (cr, surface, 0, 0)
		cairo_paint (cr)
		cairo_surface_destroy (surface);
	end
	return img_exist
end



function draw_frame (cr,x0,y0,width,height,colorA,colorB,alphaA,alphaB,colorC,colorD,alphaC,alphaD,radius,border,orientation,img)

	create_pattern_linear(cr,x0,y0,width,height,colorC,colorD,alphaC,alphaD,orientation)
	draw_square(cr,x0,y0,width,height,radius)
	cairo_fill (cr);

	if img==nil then cairo_set_operator(cr,CAIRO_OPERATOR_SOURCE) end
	create_pattern_linear(cr,x0,y0,width,height,colorB,colorA,alphaB,alphaA,orientation)
	draw_square(cr,x0+border,y0+border,width-border*2,height-border*2,radius,img)
	cairo_fill (cr);
	cairo_set_operator(cr,CAIRO_OPERATOR_OVER)

end



function conky_main_radio_box (radio_file,x0,y0,font_txt,font_size,order,
	display_cover,border,radius,space_cover_frame,orientation,
	colFrame0,colFrame1,alphaFrame0,alphaFrame1,
	colTxt0,colTxt1,alphaTxt0,alphaTxt1,
	colBd0,colBd1,alphaBd0,alphaBd1)
	if conky_window == nil then return end
	--if tonumber(conky_parse("${updates}"))<2 then return end

	border=tonumber(border)
	--default values:
	if radio_file==nil then print("Error : no text file to parse");return end
	if x0		==nil then x0=5 end
	if y0		==nil then y0=5 end
	if font_txt	==nil then font_txt="Japan" end
	if order	==nil then order="ABT" end
	if border	==nil then border=3 end
	if radius	==nil then radius=5 end
	if space_cover_frame==nil then space_cover_frame=5 end
	if colFrame0==nil then colFrame0="000000" end
	if colFrame1==nil then colFrame1="FFFFFF" end
	if colTxt0	==nil then colTxt0="000000" end
	if colTxt1	==nil then colTxt1="000000" end
	if colBd0	==nil then colBd0=colFrame0 end
	if colBd1	==nil then colBd1=colFrame1 end
	if font_size==nil then font_size=12 end
	if alphaFrame0== nil then alphaFrame0=1 end
	if alphaFrame1== nil then alphaFrame1=1 end
	if alphaTxt0== nil then alphaTxt0=1 end
	if alphaTxt1== nil then alphaTxt1=1 end
	if alphaBd0	== nil then alphaBd0=alphaFrame0 end	
	if alphaBd1	== nil then alphaBd1=alphaFrame1 end	
	
	local colFrame0 = "0x" .. colFrame0
	local colFrame1 = "0x" .. colFrame1
	local colTxt0 	= "0x" .. colTxt0
	local colTxt1 	= "0x" .. colTxt1
	local colBd0 	= "0x" .. colBd0
	local colBd1	= "0x" .. colBd1
	local spaceline = font_size/4
	local hmargin,vmargin = border,border/2

	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)	

	--read the text file
	local file = io.open(radio_file,"r")	
	local line,lineok="",""
	local track={}
	if file ~= nil then
		while true do
		 	line = file:read("*l")
			if line == nil then break end
			lineok = string.split(line,":")
			if lineok[2]~=nil and lineok[2]~="" then
				track[lineok[1]]=lineok[2]
			end
		end
	else
		 track["Error"]="Can't read " .. radio_file
	end	
	io.close()
	
	--possibles values of variable order
	local syntax={
		A="artist",
		B="album",
		L="label",
		R="radio",
		T="title",
		Y="year"}

	--calculate text width and height and put text to display in tags array
	local te=cairo_text_extents_t:create()
	local maxW, maxH = 0,0
	local tags={}
	cairo_set_font_size(cr,font_size)
	cairo_select_font_face(cr, font_txt, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
	for w in string.gmatch(order, ".") do
		table.insert(tags,track[syntax[w]])
		cairo_text_extents (cr,tags[#tags],te)
		maxW = math.max(maxW,te.width)
		maxH = math.max(maxH,te.height)
	end

	--if error reading text file, display message and hide cover
	if track.Error ~=nil then 
		table.insert(tags,track.Error)
		cairo_text_extents (cr,tags[#tags],te)
		maxW = math.max(maxW,te.width)
		maxH = math.max(maxH,te.height)
		display_cover=false
	end

	
	local height_frame = #tags*(maxH+spaceline)+2*border+2*vmargin
	local padding = 2*border+2*hmargin
	if padding==0 then padding =5 end
	local width_frame = maxW+padding

	x00=x0 --reminder for cover
	if display_cover=="1" then
		x0=x0+height_frame + space_cover_frame--offset for cover
	end
	--draw text frame
	draw_frame (cr,x0,y0,width_frame,height_frame,
		colFrame1,colFrame0,alphaFrame1,alphaFrame0,
		colBd0,colBd1,alphaBd0,alphaBd1,
		radius,border,orientation)

	--write the text
	create_pattern_linear(cr,x0,y0,maxW,height_frame,colTxt0,colTxt1,alphaTxt0,alphaTxt1,orientation)
	local x1,y1=x0+padding/2,y0+border+vmargin

	cairo_select_font_face(cr, font_txt, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
	cairo_set_font_size(cr,font_size)

	for k=1,#tags do
		cairo_text_extents (cr,tags[k],te)
		local yY = y1+maxH*k+spaceline*(k-1)
		cairo_move_to(cr,x1,yY)
		cairo_show_text(cr,tags[k])
	end

	--frame for the cover
	if display_cover=="1" then
		x0=x00
		flag_img = nil
		draw_frame (cr,x0,y0,height_frame,height_frame,
			colFrame0,colFrame1,alphaFrame0,alphaFrame1,
			colBd0,colBd1,alphaBd0,alphaBd1,
			radius,border,orientation,track.cover)
		if flag_img ==nil then
			create_pattern_linear(cr,x0,y0,x0+maxW,y0+height_frame,colTxt0,colTxt1,alphaTxt0,alphaTxt1)
			local te=cairo_text_extents_t:create()
			cairo_text_extents (cr,"No cover",te)
			cairo_move_to(cr,border+height_frame/2-te.width/2,y0+height_frame/2+te.height-border)
			cairo_show_text(cr,"No cover")
		end
	end
	cairo_destroy(cr)
	cairo_surface_destroy(cs)
end

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:

lua_load ~/Conky/LUA/draw_bg.lua
TEXT
${lua conky_draw_bg 20 0 0 0 0 0x000000 0.4}


${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

20             corner_radius
 0             x_position
 0             y_position
 0             width
 0             height
 0x000000      color
 0.4           alpha

]]

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

If someone experimented in lua understood what I'd like to do... I would be great and help apreciate. Thanks

Offline

#7599 2014-06-17 19:32:14

dynendal
New Member
Registered: 2014-06-17
Posts: 4

Re: Conky v1.9 Thread

Today I quickly added an XKCD comic updater. It's not the best script but it's an easy way to see if there's a new comic very quickly. It's only optimized for today's one-panel comic but if you play around with the dimensions you could get it right for any comic.

My personal hurdles:
Bash check clipped url filename to see if it exists on local machine. Learned about basename command
Conky doesn't accept wildcards so I had to copy a new static image every time.
Positioning is going to be different for everybody. The image can get cut off but you need to set minimum size.
EDIT: Added code so it resizes correctly to aspect.

My conkyrc changes/addition:

minimum_size 200 800
maximum_width 250


${font sans-serif:bold:size=8}XKCD ${hr 2}
${execi 5000 ~/bin/xkcd.sh}
${image ~/bin/XKCD.png -p 0,405 -f 310}

For the bash script you need to apt-get:

lynx
imagemagick

lynx for HTML handling and imagemagick for the mogrify command.

Create a new directory called XKCD in your ~/bin. This is where it will check if it's new.

I put this "xkcd.sh" bash script in my ~/bin folder like a few other conky scripts.

#!/bin/bash

XKCDPNG=`lynx --dump "http://xkcd.org"|grep http://imgs.xkcd.com/comics/*`
XKCD=$(basename $XKCDPNG)
DIR="/home/YOURUSERNAMEHERE/bin/xkcd"

cd $DIR

if [[ -e $XKCD ]];
then
	echo ""
   #echo "$XKCD"
else 
	echo ""
   rm *png
   wget $XKCDPNG
   cp -rf ${XKCD} /home/YOURUSERNAMEHERE/bin/XKCD.png
   mogrify -resize 217 /home/YOURUSERNAMEHERE/bin/XKCD.png
fi

conkyxkcd.jpg

And yeah it looks ugly with bigger comics but I thought I'd share to see if anyone can improve the conky code so it maintains dimensions?

EDIT: I removed the conky image option -s 217x200. Now you can see the first panel of a comic at around 200px. Not sure how to resize maintaining aspect ratio but I think this is pretty good.

EDIT2: I edited code above to include bash command to resize the static file based on aspect on an arbitrary number of 215. :) Enjoy.

Last edited by dynendal (2014-06-17 22:32:32)

Offline

Be excellent to each other!

#7600 2014-06-17 21:55:59

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

Re: Conky v1.9 Thread

I like it!!!!
2014_06_17_18_53_19_1920x1080_Sector11.jpg
Thanks!

-----------------------------------------------------------
And in accordance with the screenshot thread:

Please continue to use thumbnails (please try to avoid the large thumbnail imgur.com code) linking to the larger image to help those of us with slow connections. An example of the code needed is below. Most image hosting sites will automatically generate this for you as well. I've been using postimage.org lately which does a nice job.

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

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

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