Skip to content

Instantly share code, notes, and snippets.

@rikschennink
Last active October 26, 2015 08:48
Show Gist options
  • Save rikschennink/05b712393acaf14dfcf0 to your computer and use it in GitHub Desktop.
Save rikschennink/05b712393acaf14dfcf0 to your computer and use it in GitHub Desktop.
Adds Spotify to Notification Center so you can prevent it from showing the notification badge in the menu bar. Credits: http://apple.stackexchange.com/questions/153182/remove-dock-notification-badge-for-apps-not-in-notification-center/194316#194316
# "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 usernoted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment