GeekTool: GeekWeather2 w/ auto geo-location...

If you haven't downloaded geektool for the Mac, I would definitely recommend doing so for the 'tinkerers' out there.  I first saw it on LifeHacker and have been somewhat infatuated with it.  Here is what one of my mac's looks like:
Click the image to see it full resolution.
Since the bash command line outputs can be downloaded as geeklets and are relatively easy, I'm going to focus on how to setup the GeekWeather2 geeklet.  In addition to setting that up, I'll also show you how I was able to get it to update the image based on my current location rather than statically set Longitude, Latitude parameters.  (Geeklet is simply another term for a widget specific to geektool.)  Continue through to the page break to learn more.

PreReqs:
  1. Install GeekTool
  2. Install HomeBrew, if you don't already have it.
    • Toward the bottom of the page you'll see an install section with a command line you need to copy and paste into the Mac Terminal.
    • You may need to prepend the line w/ 'sudo' like so:
      • sudo ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  3. Install WebKit2Png
    • brew install webkit2png
  4. Install ImageMagick
    • brew install imagemagick
  5. Download the GeekWeather2 shell script from github
    • It's the .sh file you'll need.
    • Or if you want to be really cool, clone it or fork it to your local system.  That way whenever updates are made you can simply sync/clone from the master as updates are published.
    • GeekTool could even do the sync/cloning for you.  Interest peaked yet?
    • I downloaded the shell script into my dropbox account so it shows up on all my macs and I can reference it as a somewhat universal location in the geeklet.
  6. For GeoLocation, I downloaded and use LocateMe
    • You just need to download the file that says "LocateMe".  It's compiled and works on Mavericks.
    • I had to compile from a new version since the original broke on Mavericks, I've done that for you in my fork.
    • Again, you can save the file anywhere, I save it on my dropbox so it follows me on all my macs.
    • WiFi is required for Geolocation to work.  It simply must be turned on, it doesn't necessarily have to be connected in case you happen to be on a hardwired connection.
Now the Magic:
  1. First drag the image geeklet onto the desktop and open the script window like shown:
  2. In the script window you first capture the Latitude and Longitude in variables then for the 3rd line you enter the path to the script and pass it the variables.
  3. networksetup -setairportpower en1 on
    #above line needed if running on something like a mac mini that is 'wired' Wifi is required for geolocation.
    
    LAT="$(~/Dropbox/LocateMe/LocateMe -f "{LAT}")"
    LON="$(~/Dropbox/LocateMe/LocateMe -f "{LON}")"
    ~/Dropbox/GeekTool/Geekweather2.sh -A $LAT -O $LON -n YourLocation
    
    #If you want Celsius/Metric simply add -u UK to the 3rd line.
    
    • The script by default places the image generated to the local tmp directory. file:///tmp/GeekWeather.png
  4. Drag and drop the image geeklet onto the desktop and set it's file location to the one specified above.  I suggest a 5~10 second refresh since it's just an image anyway.  Also helps for updating the image when coming out of sleep mode.


  5. That's it, you should have a nice little geeklet on your desktop that you can be proud of.  \(^o^)/

    Now the only thing left to do is figure out a way to get city/state info out of LocateMe.  It's going to require adding some additional functionality, but seems possible w/ the CoreLocation.Framework.  The fun just never ends!  

Comments

mac os x 10.7.5 said…
詳しい日本語訳が欲しいです。
Zsoldier said…
GeekToolより今Ubersichtの方がおすすめです。そちのほうはもっとHTMLとかつかってますからはるかにパワフル。http://tracesof.net/uebersicht/

Popular posts from this blog

NSX-T: vCenter and NSX-T Inventory out of Sync (Hosts in vSphere not showing up in NSX-T)

MacOS: AnyConnect VPN client was unable to successfully verify the IP forwarding table modifications.

vCenter: Cluster Skip Quickstart Workflow via API