Skip to content

Instantly share code, notes, and snippets.

@mshub
Created November 20, 2013 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mshub/7566985 to your computer and use it in GitHub Desktop.
Save mshub/7566985 to your computer and use it in GitHub Desktop.
#!/bin/bash
GNOME_USER=$(ps -ef | grep "gnome-session --session=" | head -1 | cut -d " " -f 1)
read W1 W2 T <<< `curl -s http://www.accuweather.com/en/in/pune/204848/weather-forecast/204848 | html2text \
| grep -ie "currently" -A 1 | tail -1 | awk '{gsub(/^ +| +$|[[:cntrl:]]/,"" )}1' | cut -d " " --fields=1,2,3`
AMPMTIME=$(date +"%p"); HOURTIME=$(date +"%H")
# if [ $AMPMTIME = "PM" -a $HOURTIME -gt "8" -o $AMPMTIME = "AM" -a $HOURTIME -lt "5" ]; then
# ICONFOLDER='/usr/share/pixmaps/WeatherIcons/Night'
# else
# ICONFOLDER='/usr/share/pixmaps/WeatherIcons/Day/'
#fi
#ICON=$(find $ICONFOLDER -name "$W1*")
export DISPLAY=:0.0 && sudo -u $GNOME_USER notify-send "~ Weather Forecast ~" "$W1 $W2 $T C" #-i "$ICON"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment