Prevent application from displaying badge icon in Dock
Any Spotify desktop user has likely noticed their pervasive notifications: whenever "one of our friends" joins Spotify, there's both an in-app notification as well as a red badge that appears on Spotify's icon in the Dock.
Is there a way to disable an application's ability to show a badge on its Dock icon?
I'm using Lion (10.7.8), and therefore don't have the 'Notifications' prefpane that was introduced in Mountain Lion.
I tried digging around in the app's resources and .plist file to see if there was a setting to enable/disable this... to no avail.
Solution 1:
No - the normal path is to use the Notifications prefpane to turn off notifications, but this would not help, since Spotify is not listed there.
I'm also very annoyed by Spotify's constant flood of notifications. I wonder if there was a way to drop all the social-related network traffic that goes into Spotify and somehow nip these notifications at the bud.
Solution 2:
Answer here solves your problem:
# "Usernoted" seems to be the "user notifications daemon", so get it's PID.
pid=$(ps aux | grep -i [u]sernoted | awk '{print $2}')
# Find the sqlite3 database that this program has open. It's in a "private" folder (app sandboxing).
db="$(lsof -p $pid | grep com.apple.notificationcenter/db/db\$ | awk '{print $9}')"
# I got the bundleid from Spotify.app/Contents/Info.plist
bundleid="com.spotify.client"
# I use 0 as the flags because you can change all the settings in System Preferences
# 5 seems to be the default for show_count
# Grab the next-highest sort order
sql="INSERT INTO app_info (bundleid, flags, show_count, sort_order) VALUES ( '$bundleid', 0, 5, (SELECT MAX(sort_order) + 1 FROM app_info) );"
# Run the command
sqlite3 "$db" "$sql"
# Restart usernoted to make the changes take effect
killall user noted
Then you can see Spotify in System Preferences -> Notifications, and can disable its notifications.