I would like to know how to create one of those lenses for unity. I know how to program. but I don't know where to start. Are there certain libraries I should use or docs that I should read? Are there wiki pages that I can reference?

My google-fu has so far failed me.

link|improve this question
feedback

3 Answers

up vote 11 down vote accepted

You can start here:

And check out some existing lenses if you want to reuse some of their code:

link|improve this answer
That's perfect, thanks! – user1974 May 16 '11 at 13:26
feedback

In case you want to develop in python, then you might want to look at a very nice wrapper class developed by Michael Hall called singlet: https://launchpad.net/singlet

A simple hello world lens would look like this:

#! /usr/bin/python
from singlet.lens import SingleScopeLens, IconViewCategory
from singlet.utils import run_lens

class HelloWorldLens(SingleScopeLens):
    class Meta:
        name = 'helloworld'

    cat1 = IconViewCategory("Cat One", "stock_yet")

    def search(self, phrase, results):
        results.append('http://google.com/search?q=%s' % phrase,
                             'file',
                             self.cat1,
                             "text/html",
                             phrase, phrase, '')
if __name__ == "__main__":
    import sys
    run_lens(HelloLens, sys.argv)

Which is a lot simpler and faster to write than the original library versions.

link|improve this answer
feedback

A lens should minimally have the following files to get it going.

  • mylens.lens - It mainly contains the meta data about the lens, for example, where to find the daemon of the lens, etc.
  • mylens.py - This is where you put all your code to get the lens running.
  • mylens.daemon
  • mylens.service - Provides information about the daemon.
  • setup.py - This should be pretty much self-explanatory.

Since you are pretty new to Unity lens development, I suggest you try creating your lens using the Singlet lens template. Singlet basically deals with all the basically that one has to do to get a lens up and running like hooking up the GObject and DBus.

Assuming that you don't know what a D-Bus is, Wikipedia has an informative article about D-Bus. In short, it is a message-bus system to allow different applications to interact with each other.

Useful links:

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.