Conky Help

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
CJoya

Conky Help

Post by CJoya »

Hello!

I recently discovered Conky, and now I'm hooked on it! Unfortunately, that means I'm up til wee hours of the morning doing code...

Anyways. I'm trying to get weather available on Conky, and I've tried doing two methods, both of which don't work for some odd reason:

This is the entire Conky code for me:

Code: Select all

# Use Xft?
use_xft yes
xftfont Trebuchet MS:size=9
xftalpha 0.8
text_buffer_size 2048

# 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 no
    own_window_transparent yes
    own_window_type desktop
    own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

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

# Minimum size of text area
minimum_size 180 0

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border margins
border_margins 3

# border width
border_width 1

# Default colors and also border colors
default_color DarkRed
own_window_colour white

# Text alignment, other possible values are commented
alignment top_right

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

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer none

TEXT
SYSTEM ${hr 2}

Host: ${alignr}${nodename}
Kernel:  ${alignr}${kernel}
CPU: ${cpu cpu}% ${alignr}${cpubar 8,60 cpu}
RAM: $memperc% ${alignr}${membar 8,60}
Uptime: ${alignr}${uptime}

DATE ${hr 2}
${alignc 35}${font Trebuchet MS:size=26}${time %H:%M}${font}
${alignc}${time %a %d %b %Y}

HD ${hr 2}

Home:
${fs_free /home}/${fs_size /home} ${alignr}${fs_bar 8,60 /home}
Root:
${fs_free /root}/${fs_size /root} ${alignr}${fs_bar 8,60 /root}

NETWORK ${hr 2}
${if_existing /proc/net/route wlan0}
${voffset -6}${font PizzaDude Bullets:size=14}C${font}   Up: ${upspeed wlan0} kb/s ${alignr}${upspeedgraph wlan0 8,60 BEBEBE BEBEBE}
${voffset 4}${font PizzaDude Bullets:size=14}D${font}   Down: ${downspeed wlan0} kb/s ${alignr}${downspeedgraph wlan0 8,60 BEBEBE BEBEBE}
${voffset 4}${font PizzaDude Bullets:size=14}J${font}   Upload: ${alignr}${totalup wlan0}
${voffset 4}${font PizzaDude Bullets:size=14}O${font}   Download: ${alignr}${totaldown wlan0}
${voffset 4}${font PizzaDude Bullets:size=14}Y${font}   Signal: ${wireless_link_qual wlan0}% ${alignr}${wireless_link_bar 8,60 wlan0}
${voffset 4}${font PizzaDude Bullets:size=14}A${font}   Local Ip: ${alignr}${addr wlan0}
${else}${if_existing /proc/net/route eth0}
${voffset -6}${font PizzaDude Bullets:size=14}C${font}   Up: ${upspeed eth0} kb/s ${alignr}${upspeedgraph eth0 8,60 789E2D A7CC5C}
${voffset 4}${font PizzaDude Bullets:size=14}D${font}   Down: ${downspeed eth0} kb/s ${alignr}${downspeedgraph eth0 8,60 789E2D A7CC5C}
${voffset 4}${font PizzaDude Bullets:size=14}J${font}   Upload: ${alignr}${totalup eth0}
${voffset 4}${font PizzaDude Bullets:size=14}O${font}   Download: ${alignr}${totaldown eth0}
${voffset 4}${font PizzaDude Bullets:size=14}Y${font}   Local Ip: ${alignr}${addr eth0}
${endif}${else}${if_existing /proc/net/route eth1}
${voffset -6}${font PizzaDude Bullets:size=14}A${font}   Up: ${upspeed eth1} kb/s ${alignr}${upspeedgraph eth1 8,60 789E2D A7CC5C}
${voffset 4}${font PizzaDude Bullets:size=14}U${font}   Down: ${downspeed eth1} kb/s ${alignr}${downspeedgraph eth1 8,60 789E2D A7CC5C}
${voffset 4}${font PizzaDude Bullets:size=14}N${font}   Upload: ${alignr}${totalup eth1}
${voffset 4}${font PizzaDude Bullets:size=14}T${font}   Download: ${alignr}${totaldown eth1}
${voffset 4}${font PizzaDude Bullets:size=14}a${font}   Local Ip: ${alignr}${addr eth1}
${endif}${else}
${font PizzaDude Bullets:size=14}4${font}   Network Unavailable
${endif}

WEATHER ${hr 2}
${execi 1800 /home/cdjoya/.nsweather/nwsweather.sh}

${endif}
The end part (Weather) is what I"m working on. I found two ways of doing ConkyWeather. One is using the above code, in conjunction with this:

Code: Select all

#!/bin/sh
#
#----------------------------------------------------------------
# This script will take current ASOS observations from an
# XML file from the National Weather Service website and
# feed it to an XML stylesheet for display in the
# desktop system monitor, conky.
#----------------------------------------------------------------
# The script and xslt can be found at the following address:
# http://www.meteor.iastate.edu/~bschwedl/nwsweather.tar.gz
#----------------------------------------------------------------
# Instructions for modification of the display can be found
# throughout the files.
#----------------------------------------------------------------
# Usage: 
# ${execi 1800 /path/to/weather/nwsweather.sh}
# Put this line in your .conkyrc file to update the data
# Since this data updates each hour, a 30 minutes time
# interval should be good enough to keep the data up to date.
# 1800 is the update interval in seconds.
#----------------------------------------------------------------
# Creator:	Benjamin Schwedler
# Contact:	bschwedler@gmail.com
#
# Changelog:	
#  [2007.11.27]
#   File Created
#  [2008.07.28]
#   DATAXML variable changed to reflect new data hierarchy on
#    NWS website
#----------------------------------------------------------------

# Set your location here. The location is the ICAO airport 
# code which can be found by exploring the following NWS site:
# http://www.nws.noaa.gov/data/current_obs/
LOC="KBUF"

# This is the directory where you have places the script and
# xslt file.
DIRPATH="/home/cdjoya/.nwsweather"

# curl and xsltproc needed to properly parse the files
# http://curl.haxx.se/
# http://xmlsoft.org/XSLT/
XSLTPATH=/usr/bin/xsltproc
CURLPATH=/usr/bin/curl

# DATAXML is the page from which the observed data is fetched
DATAXML=http://www.nws.noaa.gov/xml/current_obs/KBUF.xml

# Calls the xslt for parsing of the data.
# This file can be modified to display the desired output.
DATAXSLT=$DIRPATH/nwsweather.xslt

# Runs the command to parse data and display in conky
eval "$CURLPATH \"$DATAXML\" 2>/dev/null | $XSLTPATH $DATAXSLT -" 
The other method (which makes sense and doesn't at the same time) is using the method described here: http://ubuntuforums.org/showthread.php? ... ky+weather

I've tried both methods, and neither work... What in the world am I doing wrong?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
ThistleWeb

Re: Conky Help

Post by ThistleWeb »

Have you tried the Crunchbang forums? They are an excellent resource for Conky.
CJoya

Re: Conky Help

Post by CJoya »

I'll look through there again (I must admit, I looked at the website after a glass or two of wine, and three or four hours of doing the code...)

Thanks for the suggestion! :)
edwardr

Re: Conky Help

Post by edwardr »

I've used kaivalagi's approach from the ubuntu forum link you posted several times and it worked like a charm each time. See my example here
http://forums.linuxmint.com/viewtopic.p ... 60#p326232

Why don't you give it another shot?
CJoya

Re: Conky Help

Post by CJoya »

edwardr wrote:I've used kaivalagi's approach from the ubuntu forum link you posted several times and it worked like a charm each time. See my example here
http://forums.linuxmint.com/viewtopic.p ... 60#p326232

Why don't you give it another shot?
Ok. So, how would i put this into my code? Simply delete my weather section (which I'm not to sure where that ends) and paste yours in?

I'm starting to think that ConkyWeather may be too advanced for me :(
vrkalak

Re: Conky Help

Post by vrkalak »

Not true ... If I could figure out the Conky Weather script, anybody can. Don't give up.

Mint Forum's Conky Show-off thread > http://forums.linuxmint.com/viewtopic.p ... ky+showoff
Crunchbang Forums Conky Help thread > http://crunchbanglinux.org/forums/topic ... onky-help/
Crunchbang Forums: My Conky Config > http://crunchbanglinux.org/forums/topic ... ky-config/
Conky Pitstop > http://conky.pitstop.free.fr/wiki/index ... =Main_Page
DevientART: Conky Artists Group > http://conky-artists-group.deviantart.com/
Main Conky site > http://conky.sourceforge.net/
Conky's FAQ > http://conky.sourceforge.net/faq.html
Ubuntu Forum Conky thread > http://ubuntuforums.org/showthread.php?p=1645914
Linux.com: Experts Guide to Configuring Conky > http://www.linux.com/archive/feature/136147

Hopefully one or more of these links, from my personal bookmarks will help.
edwardr

Re: Conky Help

Post by edwardr »

Try this,

Follow kaivalagi's instructions for installing conkyforecast, registering with xoap, and determining your location code. Make sure to follow his instructions on copying the conkyForecast.config template file into your home folder and editing it to have your weather.com partner id, registration code, and location code (I think one of the codes showed up in two places in the config file).

Save my text as a file called weather.template in /home/cdjoya/weather.template

In your conkyrc file, replace your line:

${execi 1800 /home/cdjoya/.nsweather/nwsweather.sh}

with this line:

${execpi 1800 conkyForecast --location=UKXX0092 --template=/home/cdjoya/weather.template}

Change the location code in the above line with your location code.

Save your conkyrc file. Saving your conkyrc file should cause the displayed conky to refresh, and hopefully display your weather!
CJoya

Re: Conky Help

Post by CJoya »

edwardr wrote:Try this,

Follow kaivalagi's instructions for installing conkyforecast, registering with xoap, and determining your location code. Make sure to follow his instructions on copying the conkyForecast.config template file into your home folder and editing it to have your weather.com partner id, registration code, and location code (I think one of the codes showed up in two places in the config file).

Save my text as a file called weather.template in /home/cdjoya/weather.template

In your conkyrc file, replace your line:

${execi 1800 /home/cdjoya/.nsweather/nwsweather.sh}

with this line:

${execpi 1800 conkyForecast --location=UKXX0092 --template=/home/cdjoya/weather.template}

Change the location code in the above line with your location code.

Save your conkyrc file. Saving your conkyrc file should cause the displayed conky to refresh, and hopefully display your weather!
I did as you said, and it STILL won't work!!! :(

I'm going to be bald by the time I'm 24... ugh.
kcriggio824

Re: Conky Help

Post by kcriggio824 »

did you ever figure this out? I used your example of code and made a few changes. Now mine is working and i am showing two locations. I did run into a problem though. When I found that one of the .sh files was not set to run as program. Once i changed that it gave conky permission to use the file and it came right up. Hope this helps

Code: Select all

# Use Xft?
use_xft yes
xftfont Trebuchet MS:size=8
xftalpha 0.8
text_buffer_size 2048


# Update interval in seconds
update_interval .5

# 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 override

    own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

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

# Minimum size of text area
minimum_size 180 0

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border margins
#border_margin 5

# border width
border_width 1

# Default colors and also border colors
default_color white
own_window_colour white

# Text alignment, other possible values are commented
alignment top_right

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

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer none

TEXT
SYSTEM ${hr 2}
Kernel:  ${alignr}${kernel}
CPU: ${freq} Mhz ${alignr}${cpu cpu}% ${cpubar 8,60 cpu}
RAM: ${alignr}$memperc% ${membar 8,60}
Uptime: ${alignr}${uptime}

HD ${hr 2}
Home ${fs_free /home}/${fs_size /home} ${alignr}${fs_bar 8,60 /home}
#Root ${fs_free /root}/${fs_size /root} ${alignr}${fs_bar 8,60 /root}
#Media ${fs_free /media}/${fs_size /media} ${alignr}${fs_bar 8,60 /media}

NETWORK ${hr 2}
#${wireless_link_bar 8,60 eth1}
#${if_existing /proc/net/route eth1}
Up: ${upspeed eth1}${alignr}Dn: ${downspeed eth1}
${upspeedgraph eth1 8,60 789E2D A7CC5C}        ${wireless_link_qual eth1}%${alignr}${downspeedgraph eth1 8,60 789E2D A7CC5C}
${totalup eth1}${alignr}${totaldown eth1}
#${endif}${else}${font PizzaDude Bullets:size=14}4${font}   Network Unavailable${endif}

#WEATHER ${hr 2}
${color white}WEATHER ${hr 1}${color}

${execi 1800 /home/kriggio824/Scripts/nwsweather/nwsweatherP.sh}


${execi 1800 /home/kriggio824/Scripts/nwsweather/nwsweatherS.sh}

Code: Select all

#!/bin/sh
#
#----------------------------------------------------------------
# This script will take current ASOS observations from an
# XML file from the National Weather Service website and
# feed it to an XML stylesheet for display in the
# desktop system monitor, conky.
#----------------------------------------------------------------
# The script and xslt can be found at the following address:
# http://www.meteor.iastate.edu/~bschwedl/nwsweather.tar.gz
#----------------------------------------------------------------
# Instructions for modification of the display can be found
# throughout the files.
#----------------------------------------------------------------
# Usage: 
# ${execi 1800 /path/to/weather/nwsweather.sh}
# Put this line in your .conkyrc file to update the data
# Since this data updates each hour, a 30 minutes time
# interval should be good enough to keep the data up to date.
# 1800 is the update interval in seconds.
#----------------------------------------------------------------
# Creator:	Benjamin Schwedler
# Contact:	bschwedler@gmail.com
#
# Changelog:	
#  [2007.11.27]
#   File Created
#  [2008.07.28]
#   DATAXML variable changed to reflect new data hierarchy on
#    NWS website
#----------------------------------------------------------------

# Set your location here. The location is the ICAO airport 
# code which can be found by exploring the following NWS site:
# http://www.weather.gov/data/obhistory/KPSM.html
LOC="KPSM"

# This is the directory where you have places the script and
# xslt file.
DIRPATH="/home/kriggio824/Scripts/nwsweather"

# curl and xsltproc needed to properly parse the files
# http://curl.haxx.se/
# http://xmlsoft.org/XSLT/
XSLTPATH=/usr/bin/xsltproc
CURLPATH=/usr/bin/curl

# DATAXML is the page from which the observed data is fetched
DATAXML=http://www.nws.noaa.gov/xml/current_obs/$LOC.xml

# Calls the xslt for parsing of the data.
# This file can be modified to display the desired output.
DATAXSLT=$DIRPATH/nwsweatherP.xslt

# Runs the command to parse data and display in conky
eval "$CURLPATH \"$DATAXML\" 2>/dev/null | $XSLTPATH $DATAXSLT -" 
Locked

Return to “Compiz, Conky, Docks & Widgets”