Any ideas on how to get this to align right? The idea is to have the basic info across the top and the details down the right side. But the weather info won't sit where I want it to.
I imagine that I need you edit the weather.xslt but I'm not sure how to handle text alignment.
Thanks!
.conkrc
Code:
###### Conky Configuration File ######
#To prevent conky from flickering every update, we double buffer.
double_buffer yes
#Create window, and make it transparent
own_window yes
own_window_transparent yes
own_window_type normal
#Specifies a color of the background. In this case, I'm using a grey color specified in hex.
#own_window_colour 4D4D4D
background no
#Don't put conky in the task bar, the pager, and no decorations to the window.
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use Xft? Xft: Anti-aliased font, enable Xft font.
use_xft yes
override_utf8_locale no
# Xft font when Xft is enabled.
xftfont Bitstream Vera Sans:size=9
# set to yes if you want all text to be in uppercase. CAPS LOCK
uppercase no
# Text alpha when using Xft
xftalpha 0.8
# Draws a outline_color outline around all the text.
draw_outline no
# Gives text a shade_color shadow. Text shadows! Less standout than above.
draw_shade yes
# Set default text color, then set your default shade color, and outline color.
# Can be specified in words (black, white, blue, etc.) or using hex values (#000000, #FFFFFF, etc)
default_color white
default_shade_color black
default_outline_color black
# Borders
draw_borders no
border_margin 9
border_width 0
# Where to place the conky bar.
alignment top_right
# Specifies the gap between the specified starting point.
# Example: if I start at the top-left corner (0,0) then these values
# tell it to start printing the text out to x=0+40, y=0+5 (40,5)
gap_x 9
gap_y 9
# Add spaces to keep things from moving about? Uses more space, but
# prevents the text from moving back and forth as values change.
use_spacer no
# Subtract file system buffers from used memory?
no_buffers yes
# How many seconds per update of statistics?
update_interval 1.0
#####All items below TEXT are what appears on your screen.#####
TEXT
${font :size=16:bold}${color #b1b1b1}Ubuntu 7.10 $sysname $kernel $color ${alignr}${color #b1b1b1}(Uptime: $color$uptime${color #b1b1b1})$color ${font}
${stippled_hr}
${font :size=9}CPU ${cpu}% ${acpitemp}C${offset 50}Ram ${memperc}% ${mem}/${memmax}${offset 20}Swap ${swapperc}% ${swap}/${swapmax}${offset 55}Down ${downspeed eth0}Kb/s${offset 111}Up ${upspeed eth0}Kb/s
${cpugraph 16,120 435d6a b8bec1} ${membar 16,180} ${swapbar 16,180} ${downspeedgraph eth0 16,180 435d6a b8bec1} ${upspeedgraph eth0 16,180 435d6a b8bec1}
${offset 630}${color #b1b1b1}PROCESSING ${stippled_hr 2}$color
${offset 630}Core One:$color ${alignr}${cpu cpu1}%
${offset 630}Core Two:$color ${alignr}${cpu cpu2}%
${offset 630}Processes: ${alignr}$processes ($running_processes running)
${offset 630}${color #b1b1b1}TOP ${stippled_hr 2}$color
${offset 630}CPU% MEM% NAME$color
${offset 630}${top cpu 1} ${top mem 1} ${top name 1 | cut -c1-10}
${offset 630}${top cpu 2} ${top mem 2} ${top name 2 | cut -c1-10}
${offset 630}${top cpu 3} ${top mem 3} ${top name 3 | cut -c1-10}
${offset 630}${top cpu 4} ${top mem 4} ${top name 4 | cut -c1-10}
${offset 630}${top cpu 5} ${top mem 5} ${top name 5 | cut -c1-10}
${offset 630}${top cpu 6} ${top mem 6} ${top name 6 | cut -c1-10}
${offset 630}${top cpu 7} ${top mem 7} ${top name 7 | cut -c1-10}
${offset 630}${top cpu 8} ${top mem 8} ${top name 8 | cut -c1-10}
${offset 630}${color #b1b1b1}WEATHER${stippled_hr 2}$color
${offset 630}${execi 1800 /home/andrew/.conky/weather.sh}
weather.sh
Code:
#!/bin/sh
#
# Grab weather data from weather.com and format it according to the given XSLT
# Script written by boojit
# Modified by Hellf[i]re
# The orignal script and xslt can be downloaded from http://pondol.com/weather.tar.gz
# Usage:
# ${execi 1800 /path/to/weather/weather.sh location}
# Usage Example:
# ${execi 1800 /home/user/weather/weather.sh 03833}
# your Location ID: use http://xoap.weather.com/search/search?where=[yourcity] to find it
# U.S. users can just use their zip code; doubt that works for anyone else though (YMMV)
LOCID=11220
# s=standard units, m=metric units
UNITS=s
# where this script and the XSLT lives
RUNDIR=/home/andrew/.conky
# there's probably other stuff besides CURL that will work for this, but i haven't
# tried any others.
# you can get curl at http://curl.haxx.se/
CURLCMD=/usr/bin/curl
# get it at http://xmlsoft.org/XSLT/
XSLTCMD=/usr/bin/xsltproc
# you probably don't need to modify anything below this point....
# CURL url. Use cc=* for current forecast or dayf=10 to get a multi-day forecast
CURLURL="http://xoap.weather.com/weather/local/$LOCID?cc=*&unit=$UNITS&dayf=2"
# The XSLT to use when translating the response from weather.com
# You can modify this xslt to your liking
XSLT=$RUNDIR/weather.xslt
#filter (if you want to convert stuff to lower-case or upper case or something)
#FILTER="|gawk '{print(tolower(\$0));}'"
#####
eval "$CURLCMD \"$CURLURL\" 2>/dev/null| $XSLTCMD $XSLT - $FILTER"
weather.xslt
Code:
<!--
This XSLT is used to translate an XML response from the weather.com
XML API.
You can format this file to your liking. Two things you may feel
like doing:
1) Modify the layout of the fields or static text already defined
2) Add other fields from the XML response file that aren't referenced in this
XSLT. You can grab a full list by just doing a:
wget "http://xoap.weather.com/weather/local/$LOCID?cc=*&unit=$UNITS"
(change $LOCID and $UNITS to suit your needs)
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
<xsl:output method="text" disable-output-escaping="yes"/>
<xsl:template match="weather">
<xsl:apply-templates select="cc"/>
<xsl:apply-templates select="dayf/day[@d='1']"/>
</xsl:template>
<xsl:template match="cc">
<xsl:text>Location: </xsl:text><xsl:value-of select="obst"/>
<xsl:text>:
</xsl:text>
<xsl:text>
Temperature: </xsl:text><xsl:value-of select="tmp"/><xsl:value-of select="/weather/head/ut"/>
<xsl:if test="tmp != flik">
<xsl:text>
Feels Like: </xsl:text><xsl:value-of select="flik"/><xsl:value-of select="/weather/head/ut"/>
</xsl:if>
<xsl:text>
Conditions: </xsl:text><xsl:value-of select="t"/>
<xsl:text>
Wind: </xsl:text>
<xsl:choose>
<xsl:when test="wind/s = 'calm'"><xsl:text>0</xsl:text></xsl:when>
<xsl:otherwise><xsl:value-of select="wind/s"/></xsl:otherwise>
</xsl:choose>
<xsl:value-of select="/weather/head/us"/>
<xsl:choose>
<xsl:when test="wind/s = 'calm'"><xsl:text>(0mph)</xsl:text></xsl:when>
<xsl:otherwise><xsl:text> (</xsl:text><xsl:value-of select="round(wind/s * 0.6214)"/><xsl:text>mph)</xsl:text></xsl:otherwise>
</xsl:choose>
<xsl:text> (</xsl:text><xsl:value-of select="wind/t"/>
<xsl:text>)</xsl:text>
</xsl:template>
<xsl:template match="dayf/day[@d='1']">
<xsl:text>
Tomorrow: </xsl:text><xsl:value-of select="low"/><xsl:value-of select="/weather/head/ut"/>
<xsl:text> to </xsl:text><xsl:value-of select="hi"/><xsl:value-of select="/weather/head/ut"/>
<xsl:text>, </xsl:text><xsl:value-of select="part[@p='d']/t"/>
<xsl:text>
</xsl:text><xsl:value-of select="/weather/swa/a/t"/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
Bookmarks