Skip to content

Instantly share code, notes, and snippets.

@dschep
Last active January 8, 2016 19:49
Show Gist options
  • Save dschep/8fbb5b1dcc5b4726e566 to your computer and use it in GitHub Desktop.
Save dschep/8fbb5b1dcc5b4726e566 to your computer and use it in GitHub Desktop.
Stupid simple GitHub desktop notifications! Requires cURL, jq, and notify-send.
#!/bin/bash
USER='Your username, Duh.'
TOKEN='An access token that has access to notifications, make one here: https://github.com/settings/tokens'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
API_URL=https://api.github.com
date=
while sleep 30; do
curl -u $USER:$TOKEN $API_URL/notifications?since=$date |\
jq -r 'map("\(.subject.title) \(.repository.full_name)") | .[]' |\
xargs -n1 -d '\n' notify-send -i $DIR/octocat.png
date=$(date +%FT%T)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment