Originally Posted by
abumaia
Thanks Crinos, but I got it figured out already, a few posts up.
I see that... gave me what I needed to lay it all out. this method has the added benefit of being transparent with alphachannel. (which is the reason for the all of the converts)
Code:
#if Sunrise <= Time and Time < Sunset, show Sun, else, show Moon
${if_match ${execi conkyForecast --datatype=SR} <= ${time %H:%M} } ${if_match ${time %H:%M} < ${execi conkyForecast --datatype=SS} }${execpi 3600 ~/.conky/conkyparts/conkymoon.sh SUN}${endif}${else}${execpi 3600 ~/.conky/conkyparts/conkymoon.sh MOON}${endif}
conkymoon.sh
Code:
#!/bin/bash
############################################################
# This work is licensed under the Creative Commons #
# Attribution-Share Alike 3.0 Unported License. #
# To view a copy of this license, visit #
# http://creativecommons.org/licenses/by-sa/3.0/ #
# or send a letter to Creative Commons, 171 Second Street, #
# Suite 300, San Francisco, California, 94105, USA. #
############################################################
# conkytemplate.sh
# by Crinos512
# Usage:
#${if_match ${execi conkyForecast --datatype=SR} <= ${time %H:%M} } ${if_match ${time %H:%M} < ${execi conkyForecast --datatype=SS} }${execpi 3600 ~/.conky/conkyparts/conkymoon.sh SUN}${endif}${else}${execpi 3600 ~/.conky/conkyparts/conkymoon.sh MOON}${endif}
#
MoonPic=http://static.die.net/moon/320.jpg
MoonImage="320.jpg"
MoonImageDir="$HOME/Images/moon"
MoonImageX="280"
MoonImageY="110"
SunPic=http://sohowww.nascom.nasa.gov/data/realtime/mdi_igr/512/latest.jpg
SunImage="latest.jpg"
SunImageDir="$HOME/Images/sun"
SunImageX="30"
SunImageY="110"
ImageSize="75x75"
### FIX FOR KDE4 TRANSPARENCY
#feh --bg-scale "`grep 'wallpaper=' ~/.kde/share/config/plasma-desktop-appletsrc | head -n1 | tail --bytes=+11`"
mkdir $MoonImageDir
cd $MoonImageDir
rm -f $MoonImage ${MoonImage/./-1.} difference.png threshold_mask.png
wget $MoonPic -O $MoonImageDir/$MoonImage
convert $MoonImage \( +clone -fx 'p{0,0}' \) -compose Difference -composite -modulate 100,0 +matte difference.png
convert difference.png -threshold 1% threshold_mask.png
convert $MoonImage threshold_mask.png +matte -compose CopyOpacity -composite ${MoonImage/./-1.}
convert ${MoonImage/./-1.} -sigmoidal-contrast 2,0% $MoonImage
mkdir $SunImageDir
cd $SunImageDir
rm -f $SunImage ${SunImage/./-1.} difference.png threshold_mask.png
wget $SunPic -O $SunImageDir/$SunImage
convert $SunImage \( +clone -fx 'p{0,0}' \) -compose Difference -composite -modulate 100,0 +matte difference.png
convert difference.png -threshold 1% threshold_mask.png
convert $SunImage threshold_mask.png +matte -compose CopyOpacity -composite ${SunImage/./-1.}
convert ${SunImage/./-1.} -sigmoidal-contrast 2,0% $SunImage
### DO NOT EDIT BELOW THIS LINE
if [[ $1 == "SUN" ]]
then echo "\${image $SunImageDir/$SunImage -p $SunImageX,$SunImageY -s $ImageSize}"
elif [[ $1 == "MOON" ]]
then echo "\${image $MoonImageDir/$MoonImage -p $MoonImageX,$MoonImageY -s $ImageSize}"
fi
exit 0
### More tinkering later.... bed time. ###
Bookmarks