1
0
mirror of https://github.com/alrayyes/dotfiles/ synced 2023-11-14 15:56:30 +00:00
dotfiles/private_dot_config/polybar/bin/private_executable_notification-reddit.sh

13 lines
389 B
Bash
Raw Normal View History

2021-03-13 14:35:22 +00:00
#!/bin/sh
URL="https://www.reddit.com/message/unread/.json?feed=bc32fdcb4a67282ee7cac839c0a52083aadc79f0&user=alrayyes"
USERAGENT="polybar-scripts/notification-reddit:v1.0 u/reddituser"
notifications=$(curl -sf --user-agent "$USERAGENT" "$URL" | jq '.["data"]["children"] | length')
if [ -n "$notifications" ] && [ "$notifications" -gt 0 ]; then
2022-10-09 15:30:41 +00:00
echo "$notifications"
2021-03-13 14:35:22 +00:00
else
2022-10-09 15:30:41 +00:00
echo ""
2021-03-13 14:35:22 +00:00
fi