Skip to content

Instantly share code, notes, and snippets.

@kylehotchkiss
Created August 16, 2011 03:52
Show Gist options
  • Save kylehotchkiss/1148409 to your computer and use it in GitHub Desktop.
Save kylehotchkiss/1148409 to your computer and use it in GitHub Desktop.
Got sick of seeing adobe's crap in my Launchpad. Also didn't like the ghetto air based options for fixing that. This currently straight up deletes the item from your Launchpad DB, but you can reset it back if you want. It's open source, so make it your ow
##
## Launchpad Editor
## Copyright 2011 Hotchkissmade
## Released under the GPL
##
import sqlite3, operator, sys, os
try:
path = os.path.expanduser("~") + "/Library/Application Support/Dock/"
lpdb = os.listdir(path)
dbs = []
for db in lpdb:
stat = os.stat(path + db)
dbs.append([stat.st_mtime, db])
sorted(dbs, key=operator.itemgetter(1))
lpdb = dbs[len(dbs) - 1][1]
launchpad = sqlite3.connect(path + lpdb)
apps = launchpad.cursor()
apps.execute("select title,bundleid from apps")
print "Launchpad is currently displaying the following apps:"
rows = apps.fetchall()
c = len(rows) - 1
o = 0
for x in range(0, c - 1):
#
# Apple stuff is fine.
# Adobe can't properly handle OSX software to
# save their wallets. #seewhatijustdid
#
if not "com.apple" in rows[x][1] and not "X11" in rows[x][0]:
if "adobe" in rows[x][1] or "Adobe" in rows[x][0]:
app = "\033[1;31m" + rows[x][0] + "\033[0m,"
o += 2; # Adobe's app names are statisitcally longer.
else:
app = "\033[1;34m" + rows[x][0] + "\033[0m,"
o += 1;
if o % 4 == 0:
print app
else:
print app,
if not "com.apple" in rows[c][1] and not "X11" in rows[c][0]:
app = "and \033[1;34m" + rows[c][0] + "\033[0m."
print app
print "\nType the name of the app you would like to remove from Launchpad below, exactly as it is shown above. Seperate multiple apps with a comma:"
remove = raw_input()
if "," in remove:
remove = remove.split(", ")
for app in remove:
if apps.execute("DELETE FROM apps WHERE title='" + app +"';").rowcount == 1:
print "\033[1;32m" + app + " removed\033[0m"
else:
if apps.execute("DELETE FROM apps WHERE title='" + remove +"';").rowcount == 1:
print "\033[1;32m" + app + " removed\033[0m"
print "\nNext, type \033[0;104;30m sudo killall Dock \033[0m and Launchpad will restart"
launchpad.commit()
launchpad.close()
except KeyboardInterrupt:
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment