Listing Unity’s Scopes and Originating Package

1 minute read

I recently upgraded to Ubuntu 14.04 (beta2), and I got all of my “lenses” (searching additional items in the dash menu), that look like this:

Of course there’s a way to disable those lenses, but I actually want to remove those I’ll never use (like flickr).
The problem  - lenses are installed using packages that don’t always match the lens’ name. Using apt-file (a utility for finding files inside packages) and parallel, I built a little script.
First, install parallel and apt-file, and update apt-file’s cache:

sudo apt-get install parallel apt-file
sudo apt-file update

Then execute this script:

find /usr/share/unity/scopes/ -name \*.scope | parallel '
 ROW=$(apt-file search {});
 FILE=$(echo $ROW | cut -f 2 -d ":");
 PACK=$(echo $ROW | cut -f 1 -d ":");
 NAME=$(cat $FILE | grep ^Name | head -1 | sed "s/^Name\=//");
 echo "$PACK: $NAME"' | sort

you’ll see a list of lens friendly names, sorted by containing package, like this:

unity-scope-gourmet: Gourmet
unity-scope-guayadeque: Guayadeque
unity-scope-manpages: Manpages
unity-scope-musicstores: Music store
unity-scope-musique: Musique
unity-scope-openclipart: OpenClipArt
unity-scopes-master-default: Applications
unity-scopes-master-default: Books

That way you can see which lenses you’ll never use and remove the matching package (using apt-get or your favorite package manager).
Of course, if you remove a package you’ll lose access to all lenses inside it, so think it through!