Posted in Weather by alexwasserman 1817 days ago

UPDATED: Now has more options and better argument processing

A new script, using the ForeCast.io embed URL - http://blog.forecast.io/forecast-embeds/

Pass in your coordinates from http://itouchmap.com/latlong.html, the name you want and whether you want it LIGHT or DARK.

So, create a script geeklet to run something like this, depending on where you store the script:


USAGE: ./geekWeather2.sh -A LAT -O LON [-n NAME] [-d     LIGHT/DARK] [-u units] [-f font] [-z zoom ] [-h help]

   -A       Coordinates: LAT
   -O       Coordinates: LON
   -n       Name. One word. Defaults to GeekWeather
   -d       Dark or Light output. Default: LIGHT
   -u       Units: US is the default, or pick: US UK SI CA. Default: US [optional]
   -f       Font: Set a font to use. Default: Helvetica [optional]
   -z       Zoom: Defaults to 1. 2 will double the output image.
   -h       Show this message and exit.


$./geekWeather2.sh -A 40.410259 -O -74.035 -n AtlanticHighlands -d DARK -u SI -f Garamond -z 2
Converting to image
Fetching http://forecast.io/embed/#lat=40.410259&lon=-74.035&name=AtlanticHighlands&font=Garamond&units=SI ...
 ... done
Running image smoothing

This will then run the script, and create the image.

Then, create an image one pointing to:


Updated: https://github.com/alexwasserman/GeekWeather2

For questions, it's easier to comment on the GitHub site which emails notifications out, which this site doesn't, as far as I can tell.

Geeklet files to download


User Avatar
bselman 1813 days ago
Awesome glet! I haven't been able to get this to work. I've downloaded the homebrew and xcode products, everything is installed and updated, created the script and image in geektool using the same paths as yours with my username, yet nothing is happening/refreshing... I know I'm missing something...
User Avatar
bselman 1813 days ago
Nevermind....I forgot the FILE in my image command! DUH!
User Avatar
alexwasserman 1808 days ago
Great to hear it works.
User Avatar
DonMoeMU 1742 days ago
Does your Image URL: look like this

User Avatar
shaolex 1806 days ago
First of all, I love this weather Geeklet and thank you! My question is if there is any way to modify the color of the image output? I'm using the LIGHT skin but I would like it to be a little lighter/brighter color of gray (more white) so that it stands out a little more against my desktop.
User Avatar
alexwasserman 1805 days ago
Yes, you can do some post processing with an additional convert step.

You'd need to edit the existing 'convert' line to output to a temporary image, so change weather.png to temp.png.

Then, add something like in the next line:

convert -fill white -fuzz 30% -opaque '#888' /tmp/temp.png /tmp/weather.png

That will match the existing grey (#888) with a 30% fuzzy match to include any aliasing, and will turn it to dark grey. You can adjust the -fill parameter to whatever color you want. Names are here: http://en.wikipedia.org/wiki/X11_color_names . You can also use # values.

So, you'll get something like this:

convert -density 200 -fuzz 25% -transparent white $LIGHT pdf:/tmp/weather.pdf png:/tmp/temp.png

convert -fill maroon -fuzz 30% -opaque '#888' /tmp/temp.png /tmp/weather.png
User Avatar
bluespider 1800 days ago
Great work!!!! is it possible to

1. make the animation work for the image?

2. get the RightNow info too?
User Avatar
alexwasserman 1796 days ago

1. The website is created using HTML5, so there's no GIF or anything to save. The script converts the page to a PDF then to a PNG for display.

As far as I know GeekTool doesn't have the ability to display animated images, and I know it won't handle the HTML straight out, hence the conversion.

2. You can pull the RightNow using the GeekWeather script I wrote before, it's more customizable, but requires a dev account. This just pulls the standard information from the Forecast.io public embed.
User Avatar
bluespider 1796 days ago
awesome! Thanks for the response Alex, very much appreciated! Again, nice work!
User Avatar
technogorilla 1791 days ago
I am looking forward to giving this geeklet a try -- it looks really nice. Any chance you can post a really simple set of instructions for us non-programmer GeekTools users?
User Avatar
LostInInaka 1772 days ago
Any chance for this awesome script to be updated to output Celsius? (or sharing the source code for the app that does all the work?)
User Avatar
Leon 1771 days ago
Optional parameters explained here: http://blog.forecast.io/forecast-embeds/

Just edit the line in "geekWeather2.sh"
User Avatar
technogorilla 1764 days ago
I'm clearly missing something... and fully prepared for a "well, duh" moment.

Could it have something to do with the following error when installing homebrew:

`Error: Homebrew doesn't know what compiler versions ship with your version

of Xcode (dunno).`
User Avatar
YKargon 1762 days ago
I have the same problem. When I open up the image Geeklet, it just shows the default Monmouth, NJ picture.
User Avatar
technogorilla 1760 days ago
Thanks YKargon, I was beginning to think I was either too old or too dumb to figure this out. I remembered something about Xcode not being part of Mountain Lion, so I went looking... you can download [Xcode](https://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12#) for free from the app store -- be aware, it's a big download, 1.65GB.

I'm downloading now and will follow up when I try this again.
User Avatar
YKargon 1760 days ago
Please follow up, that would be great. I had heard something about XCode not being part of mountain lion, and I thought I downloaded a replacement recommended by Apple, but IDK how that works, maybe I was wrong.
User Avatar
technogorilla 1759 days ago
Well... I was part right. With Xcode installed the homebrew installed correctly and so did the GhostScript and ImageMagick apps. Unfortunately, it didn't seem to change anything for me.

I invoke the name of alexwasserman for some guidance.
User Avatar
skonesam 1748 days ago
Registered just to give this an up vote. Perfect!
User Avatar
bgibson72 1714 days ago
ok, I seem to be having the same issues with GeekWeather2 that YKargon and technogorilla are both having.

I'm supposed to paste the text from the .sh file into the command field for a geeklet shell, correct? or do I just use the "/Users/myuser/Documents/GeekWeather2/geekWeather2.sh 40.410259 -74.035055 "Atlantic Highlands" LIGHT" in that field per the directions.

And why would you use the weather.png image when it's just a static image for weather in New Jersey?

Please help as I'm close to getting this but it's frustrating!
User Avatar
alexwasserman 1704 days ago
bgibson72 -

Just use the short command the arguments to it:

This is my example:

/Users/myuser/Documents/GeekWeather2/geekWeather2.sh 40.410259 -74.035055 "Atlantic Highlands" LIGHT"

Basically, it's the script, then your coordinates, your location name, and whether you want it light or dark.

The weather.png is a link to the picture and will be recreated each time the script runs. It comes with my weather, because that's how it was when I zipped it up. It'll get overwritten.

- Alex
User Avatar
apitlekays 1650 days ago
Hi Alex,

Need a little help here. I'm on Mavericks, and has been trying to make this awesome little glet to work, but so far i've failed.

I've followed every step.

I used this for the shell script:

/Users/hafizhanif/Documents/GeekWeather2/geekWeather2.sh 52.406822 -1.519693 "Coventry" LIGHT

And this for the image:


But currently nothing is in display. Did i missed something?
User Avatar
marktenney2 1582 days ago
I'm missing something as well. Am I supposed to edit the shell script file or just leave it as is and add the arguments in my shell geek let?

I've installed the apps via Homebrew, but not Xcode. Do I need Xcode as well?

Homebrew couldn't install wkhtmltoimage but it was able to install wkhtmltopdf. Should that work?

Sorry, I'm really new to all this... :)
User Avatar
roadglide03 1579 days ago
Its part of that package go to /usr/local/bin and it should be there I just installed it and it showed up. Here is the real path in case the link did not get created for you:

wkhtmltoimage -> ../Cellar/wkhtmltopdf/0.11.0_rc1/bin/wkhtmltoimage
User Avatar
bgibson72 1572 days ago
Ok, I've gotten a little further this time, but all the output says for the script now is "converting to image". I ran the geekweather2.sh file manually in terminal and it runs but I don't see anything being output to the Documents/GeekWeather2/ folder. A YouTube video would be really nice...
User Avatar
djparadyme 1572 days ago
I could never get this to work. So I created my own, using phantomjs instead of wkhtmltopdf. It seems to be much faster, and I could actually get it to work.


It looks like for whatever reason, that url is going to the Geekweather2 geeklet, so here is a link to the github repo:


I'm not sure why I can't get these to show up as links...oh well.
User Avatar
rjman 1554 days ago
Hi, I seem to be stuck at your "clone the repo into a directory step"

This is the error on terminal:

Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

Could you help me configure what to do next?

User Avatar
djparadyme 1546 days ago
You should be able to clone the repo, as it's a public one on github.

You might need to use https, though.

Maybe try this:

git clone https://github.com/nickroberts/geektool-forecast.io-weather.git yourdirectory
User Avatar
djparadyme 1546 days ago
You can also just download the zip from github, as well:

User Avatar
rjman 1540 days ago
Thanks. I don't know why it's not working. I made the shell with the script and the image with the url.

When is the weather.png supposed to be created?
User Avatar
beaks 1569 days ago
#### For those having issues with the packages from Homebrew

#### update homebrew

cd /usr/local

git fetch origin

git reset --hard origin/master

#### update wkhtmltoimage

wkhtmltoimage is now part of wkhtmltopdf. If the wkhtmltopdf homebrew install doesn't work try this:

cd /usr/local/Library/Formula/

git checkout 6e2d550 /usr/local/Library/Formula/wkhtmltopdf.rb

brew install wkhtmltopdf

As of this post, wkhtmltopdf has been removed from brew. There is a binary available at http://sourceforge.net/projects/wkhtmltopdf/files/0.12.1-773cad3/
User Avatar
alexwasserman 1552 days ago
Actually, gave up on the wkhtml as the quality isn't so great - using webkit2png now, on my github link.

However, djparadyme has done a pretty awesome job, and is using the latest options from ForeCast.io on colors. Check his out.
User Avatar
jspence77 1534 days ago
Could you explain this in a simpler way? Not really sure what to do with all this info. I've put in my lat and long but don't really understand how I switch light/dark, get it to work, make it show up on my screen, or get it to work. Any chance I can get this a little more clearly explained? Thanks!
User Avatar
-cj81499- 1524 days ago
I've got it working, but the image is 800px X 600px. Is there any way to crop it?

Another problem I'm having is every time the script runs (every minute), the application Python opens and takes me out of whatever program I was using before and into Python.
User Avatar
jspence77 1522 days ago
User Avatar
gvantass 1521 days ago
I started having issues with GeekWeather2 a few days ago, so I came out to grab the latest version of everything, which I have done. However, I can't get the image to process anymore. It seems like the temp image is not created somewhere, but I'm not sure how to get it to work.

This is the result:

gvantass@Enso ~/Documents/GeekTool/GeekWeather2 $ ./geekWeather2.sh 42.294439 -89.105217 "The Homestead" LIGHT

Converting to image

--filename option requires exactly one url

Running image smoothing

convert: unable to open image `/tmp/tmpWeather-full.png': No such file or directory @ error/blob.c/OpenBlob/2645.

convert: unable to open file `/tmp/tmpWeather-full.png' @ error/png.c/ReadPNGImage/4021.

convert: no images defined `png:/tmp/GeekWeather.png' @ error/convert.c/ConvertImageCommand/3150.
User Avatar
gvantass 1517 days ago
Bah. It seems that my use of GeekWeather2 needed more than a drag and drop update. However, after reading things a little more carefully, the command line does not like the use of double quotes for my location name.

Also, is there some way to get the image to be a bit bigger by default? The one that is generated is more like a thumbnail
User Avatar
jshock 1483 days ago
I just discovered this site, and this is the first geeklet I've tried, and I can't figure this out! The "About" page says geeklets are scripts you can download, but I can't find any script to download. All I see is a snippet of html, and an example that runs a shell script. Where is the script? There is a line that says "create a script geeklet to run something like this" but it doesn't say what "this" is. How do you create a shell script from a snippet of html? -- a confused noob.
User Avatar
BigBadBobD 1482 days ago
jshock...go here..

User Avatar
jshock 1482 days ago
User Avatar
trams87 1456 days ago
Is there a way to turn everything in the embed code to white. I was able to turn the bars white but not everything else.
User Avatar
geekyfrog 1446 days ago
I've spent a lot of frustrating hours on this and I'm ready to ask for some help.

I've installed Homebrew, WebKit2Png and ImageMagick via Terminal.

My scripts filename is "geekWeather2.sh 41.635476, -70.933579 "New Bedford" DARK"

I've added a Geeklet shell by dragging the shell icon onto my desktop and under command I put my script's location: "/Users/jonathan/Documents/Geeklets/GeekWeather2/geekWeather2.sh 41.635476, -70.933579 "New Bedford" DARK"

Then I added a Geeklet image by dragging the image icon onto my desktop and under URL I put: "file://localhost/Users/jonathan/Documents/Geeklets/GeekWeather2/weather.png"

Nothing happens, no image, nothing. Even when I try and run my script via Terminal I don't get a weather.png in my folder. All that returns is:

"Usage: geekWeather2.sh



"New Bedford"


I even tried pointing the Geeklet image to "/tmp/GeekWeather.png" as it says on the Github (https://github.com/alexwasserman/GeekWeather2), which contradicts the instructions in this page.

Can someone please tell me what I'm doing wrong? Thanks.
User Avatar
alexwasserman 1438 days ago
Your script should be called geekWeather2.sh

Then, you run it from the command line with:

./geekWeather2.sh 41.635476, -70.933579 "New Bedford" DARK
User Avatar
geekyfrog 1438 days ago
Thank you! That fixed it.

For those out there who, like me, aren't computer savvy, this is exactly what I did to get this to work.

Leave all the downloaded filenames alone, script filename should be "geekWeather2.sh"

Drag and drop a shell onto your desktop using Geektool.

Under command I have: "/Users/jonathan/Documents/Geeklets/GeekWeather2/geekWeather2.sh 41.635476, -70.933579 "New Bedford" DARK

Then I checked the "override text" box and put a single space in the field in order to prevent this box from displaying text

Drag and drop an image onto your desktop using Geektool

Under URL I have: "file://localhost/tmp/GeekWeather.png"

That should do it. Thanks to Alex for this awesome tool.
User Avatar
blahdeblah 1433 days ago
Hey Alex,

Another quick question. The weather-full.png that is captured by webkit2png shows the widget but with "loading" in the center instead of the weather. I've tried to up the delay on webkit2png to as long as 10 seconds but it still captures the webpage stuck on "loading." Any idea what's going on? I've checked my lat and lon and they seem to be valid.
User Avatar
blahdeblah 1433 days ago
Ah never mind, removing quotations around the place name fixed it
User Avatar
alexwasserman 1432 days ago
hmm, odd. Quotes around the name shouldn't actually matter.

There is a built in 5 second delay for the page to render and the forecast to load. It's possible that sometimes it takes longer than that, and the script captures the loading image.

This is much the same as when you view the forecast website in a browser. 5 seconds was a trade-off I picked between responsiveness, and likelihood of completion.

It shouldn't get stuck on loading very often.

I just ran a quick test with and without quotes, both worked fine.

I'm glad you found something that works, but curious why it works.

You can comment on the github project if it happens again - at least that emails me. This site doesn't.
User Avatar
aaffleck 1421 days ago
I love this and it works great. But every time it runs, it launches a Python app rather than invoking python behind the scenes. Is there any way to fix it so that it doesn't run the app? I can't use apps in full-screen mode because when it runs, I am pulled out of the app and onto another screen. Very disconcerting.

User Avatar
alexwasserman 1421 days ago
From the GitHub:

Webkit2Png uses Python, and on OSX when it runs it'll put an icon in the dock. To suppress the Python icon follow these steps:


Just checked running from iTerm2 running with it in fullscreen mode and it didn't take it out of it.
User Avatar
aaffleck 1420 days ago
User Avatar
MLGcat 724 days ago
Would've been easier if it was a download. I'm stuck and this is what I have:

/Users/Tom/Documents/Geeklets/GeekWeather2/geekWeather2.sh 42.309579, -71.258986 "Wellesley" LIGHT

Log in to comment or register here.