add hint-chess

This commit is contained in:
x70b1 2017-12-06 09:13:42 +01:00
parent af09856e07
commit d4c5fa83c4
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,14 @@
# Script: hint-chess
{ A short description of what your script does. Perhaps a few words about the dependencies and requirements, if necessary }
## Module
```
[module/hint-chess]
type = custom/script
exec = ~/polybar-scripts/hint-chess.sh
interval = 10
click-left = xdg-open https://www.chess.com/goto_ready_game & disown
```

View File

@ -0,0 +1,19 @@
#!/bin/sh
# Your chess.com username
username="your username here"
# Set prefix icon
icon="# "
# Set prefix icon color
color_games="#e06c75"
color_nogames="#e0e0e0"
games=$(curl -s "https://api.chess.com/pub/player/$username/games/to-move" | jq ".[] | length")
if [ "$games" -gt 0 ]; then
echo "%{F$color_games}$icon $games"
else
echo "%{F$color_nogames}$icon $games"
fi