├── GeekWeather.plist ├── LICENSE ├── README.md └── geekWeather2.sh /GeekWeather.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Label 6 | GeekWeather 7 | 8 | ProgramArguments 9 | 10 | /Users/alex/Developer/Scripts/GeekWeather2/GeekWeather2.sh 11 | 40.410259 12 | -74.035055 13 | AtlanticHighlands 14 | DARK 15 | 16 | 17 | Nice 18 | 1 19 | 20 | StartInterval 21 | 60 22 | 23 | RunAtLoad 24 | 25 | 26 | StandardErrorPath 27 | /tmp/GeekWeather.err 28 | 29 | StandardOutPath 30 | /tmp/GeekWeather.out 31 | 32 | 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 alexwasserman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | GeekWeather 2 2 | ============= 3 | 4 | GeekWeather is a geeklet for [Geektool] that shows the [ForeCast] weather on your desktop. LIGHT is a lighter image for use on darker desktops, DARK is a darker image for use on lighter desktops. LAT and LON are the coordinates of the location you want the weather report for. 5 | 6 | *Requirements* 7 | - WebKit2Png ```brew install webkit2png``` 8 | - ImageMagick ```brew install imagemagick``` 9 | 10 | Version 11 | ---- 12 | 2.0 13 | 14 | Tech 15 | ----------- 16 | 17 | GeekWeather uses: 18 | 19 | * WebKit2Png: Converts the webpage to a PNG 20 | * ImageMagick: Image convertion 21 | * ForeCast [API] 22 | 23 | Script usage 24 | -------------- 25 | 26 | ```sh 27 | $./geekWeather2.sh 28 | Usage: geekWeather2.sh LAT LON NAME LIGHT/DARK 29 | $./geekWeather2.sh 40.4118 74.0198 AtlHighlands LIGHT 30 | ``` 31 | 32 | GeekTool 33 | -------- 34 | 35 | Run the script via LaunchD or via a script geeklet that returns no output. For LaunchD a plist is included. 36 | 37 | * GeekWeather.plist 38 | 39 | Drop that into ~/Library/LaunchAgents 40 | 41 | Then, point an image geeklet at /tmp/GeekWeather.png 42 | 43 | NB 44 | __ 45 | 46 | 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]. 47 | 48 | 49 | License 50 | ---- 51 | 52 | MIT. 53 | 54 | 55 | [GeekTool]:http://projects.tynsoe.org/en/geektool/ 56 | [ForeCast]:http://forecast.io/ 57 | [API]: https://developer.forecast.io/ 58 | [steps]:http://stackoverflow.com/questions/13865826/get-rid-of-the-python-launcher-icon-os-x 59 | 60 | 61 | -------------------------------------------------------------------------------- /geekWeather2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export PATH=/usr/local/bin:$PATH 4 | 5 | test $# -ne 4 && echo "Usage: `basename $0` LAT LON NAME LIGHT/DARK" && exit $E_BADARGS 6 | 7 | hash /usr/local/bin/webkit2png &> /dev/null 8 | if [ $? -eq 1 ]; then 9 | echo "WebKit2Png not found." 10 | echo "brew install webkit2png" 11 | exit 1 12 | fi 13 | 14 | hash /usr/local/bin/convert &> /dev/null 15 | if [ $? -eq 1 ]; then 16 | echo "ImageMagick not found." 17 | echo "brew install imagemagick" 18 | exit 1 19 | fi 20 | 21 | if [[ $4 =~ !(LIGHT|DARK) ]] ; then 22 | echo "Arg 4 must be one of LIGHT or DARK" 23 | echo $4 24 | exit $E_BADARGS 25 | fi 26 | 27 | cd `dirname $0` 28 | 29 | # rawurl code from http://stackoverflow.com/questions/296536/urlencode-from-a-bash-script 30 | rawurlencode() { 31 | local string="${1}" 32 | local strlen=${#string} 33 | local encoded="" 34 | 35 | for (( pos=0 ; pos