Hacking the Unity Shell – An Alternative Apps Lens
(fret not, this is not only a wall of text, there’s a juicy screencast at the end if you make it all the way)
Me being the maintainer of the applications lens in Unity you might wonder why I am now blogging about an alternative apps lens – let alone why I actually wrote the alternative myself!
I am personally quite happy about the current default apps lens in Unity. It doesn’t try to be too smart, but aims more for the simple and intuitive. That’s why we only do prefix matching on the words in the application, egĀ if the user types “term” it matches th word “Terminal”, but not “XTerm”. We also want the matching to be consistent with that of the results coming from the Ubuntu Software Center – which also works with prefix matching.
Not all users find prefix matching to be the best thing since sliced bread. I like it, but astonishingly the whole world doesn’t think like me!? Nonetheless I can respect that
Some users wants to see substring matching which means that “term” matches both “Terminal” and “XTerm”. More progressive users wants a more powerful approach that we can call subpattern matching where the letters in the input string must occur in the same order in the string we test against, eg. “term” matches both “Terminal”, “XTerm” and “Television Remote”. This can also be thought of as some sort of “acronym matching”.
Matching algorithms aside some users simply hate to search for their apps and doesn’t like to go digging in the filters we have on the right (the filters are also hidden by default which makes them not so easily discoverable). They want to browse their good olde hierarchical menus.
… some users abhor the Most Used and Downloadable apps categories of the deafults lens – and some users probably want something completely different!
Had I not been an old fart I would probably gladly had added tonnes of options to the unity-lens-applications codebase trying to make everyone happy. But I am an old fart
I want a simple and tight codebase and I don’t want tonnes of options because that makes the code harder to maintain. More tricky maintenance means that the ones that are happy with the defaults will suffer.
Enter the power of Unity! You see; Unity is not only a shell in the user-facing kinda way. It is also a shell in the programmable kind of way
The default lenses are not hard coded, you can replace them. So you can replace the apps lens as well if you want.
I’ve aired the idea of writing an alternative apps lens numerous times to the ones requesting changes, but none ever appeared that I know of. So I was thinking that I could maybe kick start that effort if I provide a solid starting point. Hence I whipped up Bliss, https://launchpad.net/unity-lens-bliss.
Bliss is a very simple replacement for the apps lens. It does basic searching with substring matching and it allows you to browse your apps by category. It also contains a good collection of bugs, but I’ve been dogfooding it here for a while now and it’s nothing unbearable
Considering the new focus on power users for the Precise cycle I thought/hoped that I could inspire someone to grab the code and write a production ready app launcher specifically tailored for power users. I made the code so that it should be easy to hack on and extend, so let’s see where it ends up…
Caveat emptor: Bliss is by no means official or anything. It is a quick hack to showcase how you can go about this, mostly intended for developers who want to do their own thing. That is also why you wont find a PPA for it (not from me at least
).
Intruding Bliss, an Alternative Apps Lens for Unity from Mikkel Kamstrup Erlandsen on Vimeo.
So branch it, hack it, break, it, fork it. Knock yourselves out!
(I know of at least two obvious bugs: b1) the back arrow sometimes doesn’t appear as the first item, b2) the More Apps shortcut on the dash home screen breaks when you remove unity-lens-applications)
Tags: unity
November 4th, 2011 at 19:53
How about listing prefix matches first, then substring matches? You could also move items which are used more often closer to the top of the list, but I guess that would start getting much more complex.
So, for your example (term), you’d end up with a list like this:
- terminal
- terminator
- XTerm (or closer to the top, if used often)
November 4th, 2011 at 20:00
Bliss has a simple scoring mechanism in place that handles this mostly already, it can definitely be made a lot better, but, as indicated in the post, I’ll leave that for others to pursue (at least for now).
November 6th, 2011 at 13:15
Cool. Perhaps one could write a lens that uses the lenvenshtein distance. For people who can’t spell
November 6th, 2011 at 13:58
Indeed Elvis, making it easy for enterprising hackers to play around with such things was exactly why I wrote this