The second script I’d like to share is one to list or delete items from the OSX Lion launchpad. It’s a very basic script with semi-cryptic output, but it’s useable for the two or three times you’ll ever use it.
Have you looked at your launchpad? It probably has twenty or more items you would like removed, but, …., OSX doesn’t allow you to remove items. Luckily it’s just an SQLITE database and with a few carefully built SQL queries, we can cleanup duplicates and unwanted items.
How to use;
Will output a list like;
Adobe Acrobat Pro|16|com.adobe.Acrobat.Pro
Adobe After Effects CS5|18|com.adobe.AfterEffects
Adobe After Effects Render Engine|20|Adobe After Effects Render Engine
Adobe Bridge CS5|32|com.adobe.bridge4
First is the NAME of the item, the second is the ID. The third one (bundle_id) I have used to determine the company behind certain items.
If you have a duplicate item, you can make this list a bit more specific;
manage_launchpad.sh list Adium
Now write down the items you wish to remove by ID. In this case, 75.
manage_launchpad.sh delete 75
The Dock (which is responsible for the Launchpad) is restarted automatically.
The more observant of you will notice an “undocumented” feature; delete_no_restart . This will delete the item, but not restart the Dock.
manage_launchpad.sh delete_no_restart 75
#!/bin/sh [ "$1" == "" ] && echo Usage: $0 list \<optional title\> && echo or…. $0 delete \<required item_id\> && exit;
if [ "$1" == "list" ]; then
sqlite3 ~/Library/Application\ Support/Dock/*.db "SELECT title, item_id, bundleid FROM apps WHERE title LIKE '%$2%' ORDER BY title ASC;" && exit
[ "$1" == "delete_no_restart" ] && DR=no && OP=delete if [ "$OP" == "delete" ]; then
[ "$2" == "" ] && echo Usage: $0 delete \'App ID\' && exit;
sqlite3 ~/Library/Application\ Support/Dock/*.db "DELETE from apps WHERE item_id=$2;" && [ "$DR" == "yes" ] && killall Dock