-
-
Save maxdevjs/634264c8fbc38cd617103b911a3863b8 to your computer and use it in GitHub Desktop.
GitHub Notifications in i3bar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# put this in your bin directory, e.g. /usr/bin or ~/.local/bin | |
sleep 20 # update interval | |
# you have to generate a new ACCESS_TOKEN for yourself here (https://github.com/settings/tokens, you only need "notifications" access) and replace the value | |
response=$(curl -s https://api.github.com/notifications?access_token=ACCESS_TOKEN) | |
if [[ $response =~ "{" ]] | |
then | |
touch ~/.gn; | |
echo "1" > ~/.gn; | |
else | |
touch ~/.gn; | |
echo "0" > ~/.gn; | |
fi | |
github-notifications |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=github notifications daemon | |
[Service] | |
Type=simple | |
ExecStart=/path/to/github-notifications | |
KillSignal=SIGKILL | |
TimeoutStartSec=6 | |
Restart=always | |
Environment=HOME=/home/YOUR_HOME | |
Environment=USER=YOUR_USER | |
Environment=XAUTHORITY=/home/YOUR_USER/.Xauthority | |
Environment=DISPLAY=:0 | |
[Install] | |
WantedBy=default.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# put this in your bin directory and set `status_command i3status-custom` in `~/.config/i3/config` | |
# I'm using FontAwesome for the icons, you can either install and configure it or use your own method. | |
# see: http://fontawesome.io/cheatsheet/ | |
i3status | while : | |
do | |
read line | |
github="$(cat ~/.gn)" | |
if [ $github -lt 1 ] | |
then | |
githubu="[{\"full_text\": \"\"}," | |
else | |
githubu="[{\"full_text\": \"\", \"color\": \"#78d966\"}," | |
fi | |
echo "${line/[/$githubu}" || exit 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment