mirror of
https://github.com/alrayyes/dotfiles/
synced 2023-11-14 15:56:30 +00:00
13 lines
389 B
Bash
13 lines
389 B
Bash
#!/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
|
|
echo "$notifications"
|
|
else
|
|
echo ""
|
|
fi
|