Skip to content

Instantly share code, notes, and snippets.

@npazo
Created January 19, 2017 21:58
Show Gist options
  • Save npazo/5496630475d7d6e7b644187e6e36d88d to your computer and use it in GitHub Desktop.
Save npazo/5496630475d7d6e7b644187e6e36d88d to your computer and use it in GitHub Desktop.
Get Count of Unread Notifications on macOS Sierra and set AnyBar
dir_loc=`getconf DARWIN_USER_DIR`/com.apple.notificationcenter/db
count=`sqlite3 $dir_loc/db 'select count(*) from presented_notifications'`
echo $count
if [ $count -ne 0 ]; then
/bin/echo -n "green" | nc -4u -w0 localhost 1739
else
/bin/echo -n "white" | nc -4u -w0 localhost 1739
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment