Originally Posted by
paramvir
Hi Paramvir,
I finally got a chance to upgrade to 0.7.5. Great job! Conkywx is becoming very powerful!
I worked on a new concept, this morning. I wanted to optimize my script, to get rid of some cruft. And, in the process, I managed to get the Conkywx weather section down to a single line of code.
Well... two lines, actually. This also served the purpose of being able to easily switch between Metric & Imperial weather stats by commenting/uncommenting a single line of code.
In the example(s) below, I switched between Imperial & Metric stats (and took two screenshots) in less than 30 sec.
Here's how my .conkyrc looks now...
"/home/vindsl/.conkyrc" (Metric Weather Stats selected)
Code:
<SNIP>
####
## Define the locations of Conkywx files (required)
## Set the path to your .confs, seds, and templates here.
## Tips n' Tricks: seds files must be marked as executable, e.g. have execute permissions.
#
template0 "/usr/share/conkywx/conkywx.sh"
template1 "/etc/conkywx/vindsl-imperial-conkywx.conf"
template2 "/usr/share/conkywx/examples/wx-wu-vindsl-imperial-weather-template.sh"
template3 "/usr/share/conkywx/examples/wx-wu-vindsl-imperial-weather-seds.sh"
template4 "/etc/conkywx/vindsl-metric-conkywx.conf"
template5 "/usr/share/conkywx/examples/wx-wu-vindsl-metric-weather-template.sh"
template6 "/usr/share/conkywx/examples/wx-wu-vindsl-metric-weather-seds.sh"
TEXT
<SNIP>
##################################
## CONKYWX WEATHER ##
##################################
${voffset 4}${font DroidSans:bold:size=8.25}${color4}CONKYWX${offset 8}${color6}${voffset -2}${hr 1}${font}
####
## Uncomment for Imperial Weather Stats.
# ${execpi 900 ${template0} -c "${template1}" -t "${template2}" | "${template3}"}${font}
####
## Uncomment for Metric Weather Stats.
${execpi 900 ${template0} -c "${template4}" -t "${template5}" | "${template6}"}${font}
<SNIP>
"/usr/share/conkywx/conkywx.sh" is a standard "conkywx.sh" file.
"/etc/conkywx/vindsl-imperial-conkywx.conf" and,
"/etc/conkywx/vindsl-metric-conkywx.conf" are standard "conkywx.conf" files.
- One has been configured for Imperial stats
- One has been configured for Metric stats
- Proper Settings will depend on YOUR locale, as always
- Both conf files have been suitably renamed, and moved to /etc/conkywx/
"/usr/share/conkywx/examples/wx-wu-vindsl-imperial-weather-template.sh" and,
"/usr/share/conkywx/examples/wx-wu-vindsl-metric-weather-template.sh" have changed a little.
- Made some changes to alignment and spacing, et cetera
- Specified "mph" or "km/h" in the respective files
- Both templates have been renamed for continuity
Here's how they look...
"/usr/share/conkywx/examples/wx-wu-vindsl-imperial-weather-template.sh"
Code:
##################################
## VinDSL | rev. 12-10-01 09:09 ##
##################################
## IMPERIAL WEATHER TEMPLATE ##
##################################
${voffset 6}${goto 34}${font Weather:size=44}${color6}y${font}${voffset -35}${font Arrows:size=28}${goto 164}${color6}TT:[FCTT]${font}
${voffset -43}${font RadioSpace:size=33}${color6}${alignc 12}[PT]${font}
${voffset 2}${font DroidSansFallback:bold:size=7.4}${alignc 6}${color5}Feels${offset 3}like${offset 1}:${offset 2}${color6}[FL]${offset 2}${color5}/${offset 3}${color6}[FCTT]${font}
${voffset -40}${goto 203}${font DroidSansFallback:bold:size=8.75}${color6}[D1T]${font}
${voffset 0}${goto 203}${font DroidSansFallback:bold:size=7.3}${color5}CoR${offset 3}${color6}[D1P]${font}
${voffset -45}${goto 188}${font KRARound:size=41.5}${color6}I${font}
${voffset 6}${font Ubuntu:size=22.75}${color5}${alignc}[CT]${font}
${voffset 7}${alignc 5}${font}${font DroidSansFallback:bold:size=8}${color5}Sunrise${offset 1}:${offset 1}${color6}[SR]${offset 6}${color5}Sunset${offset 1}:${offset 1}${color6}[SS]${font}
${voffset 8}${goto 85}${font DroidSansFallback:bold:size=7.55}${color5}Humidity${offset 1}:${offset 2}${color6}[HM]${font}${voffset 11}${goto 84}${font DroidSansFallback:bold:size=7.55}${color5}Barometer${offset 1}:${offset 2}${color6}[BR]${font}${voffset 11}${goto 84}${font DroidSansFallback:bold:size=7.55}${color5}Bar${offset 3}Trend${offset 1}:${offset 2}${color6}[FCTP]${font}${voffset 11}${goto 84}${font DroidSansFallback:bold:size=7.55}${color5}Moonrise${offset 1}:${color6}[MR]${font}${voffset 11}${goto 85}${font DroidSansFallback:bold:size=7.55}${color5}Moonset${offset 1}:${color6}[MS]${font}
${voffset -61}${goto 16}${font ConkyWindNESW:size=41.6}${color6}[BF]${font}${voffset -36}${goto 196}${font MoonPhases:size=35}${color6}[MIF]${font}${voffset -36}${goto 198}${font MoonPhases:size=35}${color6}8${font}
${voffset -1}${goto 22}${font DroidSansFallback:bold:size=8.45}${color3}[WS] mph${voffset -1}${goto 203}[MP]${font}
${voffset 8}${goto 25}${font DroidSans:bold:size=8.5}${color5}[D2D]${goto 85}[D3D]${goto 144}[D4D]${goto 201}[D5D]${font}
${voffset 2}${goto 23}${font ConkyWeather:size=32}${color6}[D2F]${goto 83}[D3F]${goto 142}[D4F]${goto 200}[D5F]${font}
${voffset 1}${goto 25}${font DroidSans:bold:size=8.5}${color3}[D2T]${goto 85}[D3T]${goto 144}[D4T]${goto 201}[D5T]${font}
${voffset -1}${goto 24}${font DroidSans:bold:size=8.45}${color5}CoR${offset 3}${color3}[D2P]${goto 84}${color5}CoR${offset 3}${color3}[D3P]${goto 144}${color5}CoR${offset 3}${color3}[D4P]${goto 201}${color5}CoR${offset 3}${color3}[D5P]${font}
"/usr/share/conkywx/examples/wx-wu-vindsl-metric-weather-template.sh"
Code:
##################################
## VinDSL | rev. 12-10-01 08:09 ##
##################################
## CONKYWX WEATHER TEMPLATE ##
##################################
${voffset 6}${goto 34}${font Weather:size=44}${color6}y${font}${voffset -35}${font Arrows:size=28}${goto 164}${color6}TT:[FCTT]${font}
${voffset -43}${font RadioSpace:size=33}${color6}${alignc 12}[PT]${font}
${voffset 2}${font DroidSansFallback:bold:size=7.4}${alignc 6}${color5}Feels${offset 3}like${offset 1}:${offset 2}${color6}[FL]${offset 2}${color5}/${offset 3}${color6}[FCTT]${font}
${voffset -40}${goto 203}${font DroidSansFallback:bold:size=8.75}${color6}[D1T]${font}
${voffset 0}${goto 203}${font DroidSansFallback:bold:size=7.3}${color5}CoR${offset 3}${color6}[D1P]${font}
${voffset -45}${goto 188}${font KRARound:size=41.5}${color6}I${font}
${voffset 6}${font Ubuntu:size=22.75}${color5}${alignc}[CT]${font}
${voffset 7}${alignc 5}${font}${font DroidSansFallback:bold:size=8}${color5}Sunrise${offset 1}:${offset 1}${color6}[SR]${offset 6}${color5}Sunset${offset 1}:${offset 1}${color6}[SS]${font}
${voffset 8}${goto 85}${font DroidSansFallback:bold:size=7.55}${color5}Humidity${offset 1}:${offset 2}${color6}[HM]${font}${voffset 11}${goto 84}${font DroidSansFallback:bold:size=7.55}${color5}Barometer${offset 1}:${offset 2}${color6}[BR]${font}${voffset 11}${goto 84}${font DroidSansFallback:bold:size=7.55}${color5}Bar${offset 3}Trend${offset 1}:${offset 2}${color6}[FCTP]${font}${voffset 11}${goto 84}${font DroidSansFallback:bold:size=7.55}${color5}Moonrise${offset 1}:${color6}[MR]${font}${voffset 11}${goto 85}${font DroidSansFallback:bold:size=7.55}${color5}Moonset${offset 1}:${color6}[MS]${font}
${voffset -61}${goto 16}${font ConkyWindNESW:size=41.6}${color6}[BF]${font}${voffset -36}${goto 196}${font MoonPhases:size=35}${color6}[MIF]${font}${voffset -36}${goto 198}${font MoonPhases:size=35}${color6}8${font}
${voffset -1}${goto 21}${font DroidSansFallback:bold:size=8.45}${color3}[WS] km/h${voffset -1}${goto 203}[MP]${font}
${voffset 8}${goto 25}${font DroidSans:bold:size=8.5}${color5}[D2D]${goto 85}[D3D]${goto 144}[D4D]${goto 201}[D5D]${font}
${voffset 2}${goto 23}${font ConkyWeather:size=32}${color6}[D2F]${goto 83}[D3F]${goto 142}[D4F]${goto 200}[D5F]${font}
${voffset 1}${goto 25}${font DroidSans:bold:size=8.5}${color3}[D2T]${goto 85}[D3T]${goto 144}[D4T]${goto 201}[D5T]${font}
${voffset -1}${goto 24}${font DroidSans:bold:size=8.45}${color5}CoR${offset 3}${color3}[D2P]${goto 84}${color5}CoR${offset 3}${color3}[D3P]${goto 144}${color5}CoR${offset 3}${color3}[D4P]${goto 201}${color5}CoR${offset 3}${color3}[D5P]${font}
Now, as 42dorian would say, this is where I get experimental.
Conkywx allowed me to move the SEDs out of the .conkyrc file, and place them as stand-alone files, in a different location. This makes switching between Imperial & Metric stats a simple one-line affair, in .conkyrc.
** NOTE: These files MUST be marked as executable, otherwise Conky will give you "the finger", e.g. a "permissions" error.
Here's how the SEDs files look...
"/usr/share/conkywx/examples/wx-wu-vindsl-imperial-weather-seds.sh"
Code:
##################################
## VinDSL | rev. 12-10-01 09:26 ##
##################################
## IMPERIAL WEATHER SEDs ##
##################################
sed -e 's/Calm mph'/'\$\{offset 8\}Calm/g' |
sed -e 's/New Moon'/'\$\{offset -13\}New Moon/g' |
sed -e 's/Waxing Crescent'/'\$\{offset -3\}Waxing/g' |
sed -e 's/First Quarter'/'\$\{offset -5\}First Qtr/g' |
sed -e 's/Waxing Gibbous'/'\$\{offset -3\}Waxing/g' |
sed -e 's/Full'/'\$\{offset 6\}Full/g' |
sed -e 's/Waning Gibbous'/'\$\{offset -3\}Waning/g' |
sed -e 's/Last Quarter'/'\$\{offset -5\}Last Qtr/g' |
sed -e 's/Waning Crescent'/'\$\{offset -3\}Waning/g' |
sed -e 's/TT:Falling'/'\$\{offset -4\}d/g' |
sed -e 's/TT:Rising'/'\$\{offset -5\}c/g' |
sed -e 's/TT:Steady'/'\$\{offset -8\}RQ/g' |
sed -e 's/TT:N\/A'/'/g'
"/usr/share/conkywx/examples/wx-wu-vindsl-metric-weather-seds.sh"
Code:
##################################
## VinDSL | rev. 12-10-01 09:45 ##
##################################
## METRIC WEATHER SEDs ##
##################################
sed -e 's/Calm km\/h'/'\$\{offset 8\}Calm/g' |
sed -e 's/New Moon'/'\$\{offset -13\}New Moon/g' |
sed -e 's/Waxing Crescent'/'\$\{offset -3\}Waxing/g' |
sed -e 's/First Quarter'/'\$\{offset -5\}First Qtr/g' |
sed -e 's/Waxing Gibbous'/'\$\{offset -3\}Waxing/g' |
sed -e 's/Full'/'\$\{offset 6\}Full/g' |
sed -e 's/Waning Gibbous'/'\$\{offset -3\}Waning/g' |
sed -e 's/Last Quarter'/'\$\{offset -5\}Last Qtr/g' |
sed -e 's/Waning Crescent'/'\$\{offset -3\}Waning/g' |
sed -e 's/TT:Falling'/'\$\{offset -4\}d/g' |
sed -e 's/TT:Rising'/'\$\{offset -5\}c/g' |
sed -e 's/TT:Steady'/'\$\{offset -8\}RQ/g' |
sed -e 's/TT:N\/A'/'/g'
That's about it, for now. I'm still trying to get to the point where I can publish a data dump, but things are changing soooo fast!
You're doing a GREAT job on Conkywx, Paramvir! Keep up the good work...
Bookmarks