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;
manage_launchpad.sh listWill output a list like;
1Password|3|ws.agile.1Password
Acrobat Distiller|11|com.adobe.distiller
Activity Monitor|462|com.apple.ActivityMonitor
Address Book|5|com.apple.AddressBook
Adium|6|com.adiumX.adiumX
Adium|75|com.adiumX.adiumX
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.bridge4First 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 AdiumAdium|6|com.adiumX.adiumX
Adium|75|com.adiumX.adiumXNow write down the items you wish to remove by ID. In this case, 75.
manage_launchpad.sh delete 75The 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 75The script:
#!/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
fi
DR=yes
OP=$1
[ "$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
fi