Feeds:
Posts
Comments

Archive for the ‘Utilities’ Category

Ubuntu Unity is a really cool and innovative approach for Ubuntu UI. There are many people who love it and many who hate it. I fall somewhere in the middle. I am really fascinated by the possibilities that Unity offers and hope that it becomes better as it matures. Lenses are one of the coolest pieces in Unity and unfortunately not much tutorial is written. So this is my stab to fill that void. I have tried to organize as many material as possible. Your comments on improving the article is always welcome !

In my tutorial on Unity , I mentioned that if no one else writes a Lens tutorial, I will write one and here it is 🙂 Lenses in Ubuntu are a really neat idea – One simplistic way is to view them as specialized search tools. You open the appropriate lens, type something and you get a list of results. But this explanation does not really do justice to the incredible amount of flexibility that they give. Lenses can group their results, have Unity render the results in different styles, have multiple sections that influence they way search is done and so on. Unity also provides a very powerful API that allows you to write literally anything that you can think of. This post will discuss the architecture, components and their potential capabilities in detail.

Ubuntu Lens Terminology

If you are using Unity, then you must be familiar with two default lens that come with it : Application lens and Files & Folders lens. Let me use that to explain the various parts of a Lens.

Places/Lenses : Both these words represent the same idea. Places is a terminology that was primarily used when Unity was introduced. Its usage is now slowly deprecated and the word Lenses is preferred. In the rest of this blog post, I will refer it as Lenses for uniformity. Let us take a look at the various parts of lens by taking the application lens as an example.

If you click on the Application lens, you can see that it is split into two important pieces. At the top, is a search textbox like entity that allows you to enter the query. At the bottom is the results pane that shows results of your query. At the left end of the search textbox is a search result indicator. When the search is still going on, the indicator will show a spinning circle. Once the search is done, it reverts to its default icon of a cross.

Sections : The simplest way to describe sections is that they behave like categories that are non overlapping. So if a given search query might result in different results when searched under different categories, each of the qualify as a section.

Consider a simple example – You are writing a lens for StackOverflow. You may want to search questions, tags, users and so on. The results of search query q as a question is not the same as when searching q as a tag. Hence questions, tags, users become sections. Unity allows you to easily have different sections and switch between them.

Sections are the entries in the dropdown list  at the right end of the search textbox. They are optional and many places need not have it. You can see all sections of a lens by clicking on the dropdown. Taking the example of Application lens, some of the sections are “All Applications”, “Accessories”, “Games”, “Graphics” etc.

Groups : Groups is a mechanism by which you can club certain search results under a meaningful entity. Each search result, might have one or more groups that allow you to organize the results. For eg, when you search in Application lens, the groups are “Most frequently used”, “Installed”, “Available for download” etc. Groups need not be non overlapping like sections. Given a search query, same result can occur in different groups. In addition, Unity allows you to have different icons for different groups. Also, each group can be rendered in a different style. I will discuss further details later in the blog post.

Difference between Sections and Groups : There are lot of differences between groups and sections. Sections are mostly non overlapping set of entries. Each section provides a different perspective of the same search query. In contrast, groups allow you to classify the search results from a query (and a section). Groups can be considered as a way to organize the results rather than influencing how the results are obtained (which the sections do).

Results : These are the output of a search query in a lens. Given a query and a section, you get a list of entries for results. Each of them can optionally be assigned to a group. Each result entry can display information about themselves in a concise way. In addition, Unity allows them to have any URI and a mime type. So the results of one lens might be files clicking which executes them. Or it can be results from web and clicking on them opens the link in a browser and so on. Unity also allows them to have custom icons.

Unity Lens – Technical Terminology

In the following section, we will discuss some terms used in Lens development.

DBUS : DBUS is one of the most important component in the development of lens. One way to view a lens is as a daemon that accepts a search query from Unity, does some processing and returns a result along with information on how to display them. DBUS is the conduit through which the entire communication between the daemon and Unity happens. For the purpose of the lens, you need to own a bus which will be used by Unity for communication.

Lens/Place Daemon : Lens/Place daemon is a program that exposes lens functionality. A single daemon can expose multiple lens functionalities. Each lens is identified by an entry. It accepts search string from Unity and sends out search results that annotated with group and other additional information.

Place File : A place file is how you inform Unity about the various lenses that your daemon is going to expose. It is a text file that ends with .place extension and usually placed in /usr/share/unity/places . It contains different groups of entries that describe the different lenses that are exposed.

Lens Entry : A lens or an entry in the place file is distinct entity that can accept a search query and provide appropriate results. Every place file contains atleast one lens entry. Every entry has a distinct location for itself in the Unity places bar (the vertical strip) on the left. The lens entry has 3 broad components : A model each for sections, groups and results. Results contain information about the groups they fall in and how to display themselves.

Results : As discussed above, a result is an entry that is the response to a query. A result can be assigned to one or more groups. In the most general sense, a result consists of 5 subparts :
(a) URI : This is a resource identifier to uniquely denote the location of search result. It can be a local item (file://) , web item (http://) and so on.
(b) Display Name : This is a name for the result that the user will see in the results pane.
(c) Comment : This is additional information about the result entry.
(d) MimeType : Since the URI can point to anything, it is important to inform Unity what action to perform when the user clicks on the result. The mimetype allows Unity to invoke the appropriate launcher.
(e) Icon : Each result can have its own icon to represent it visually. It can be an icon file or the generic name of the icon (eg video).

Renderer : Unity provides some flexibility in how the results are displayed. Each result falls into some group. We can request Unity to display each group in a specific way. This is accomplished by the use of renderers. When you setup the model for groups for the lens, we also specify how each group will be rendered. Some common renderers are :

(a) UnityDefaultRenderer : This is the default way to display the results. In this renderer, each result shows the icon and the display name beneath it.

Ubuntu Unity Lens results under UnityDefaultRenderer
(b) UnityHorizontalTileRenderer : In this renderer, the icon and display name for each result is shown. In addition, it also displays the comment associated with the result.

Ubuntu Unity Lens results under UnityHorizontalTileRenderer
(c) UnityEmptySearchRenderer : This renderer is used when the current search query returned no results. The result item construction is very similar to the results above. But the display name is displayed across the results pane.

Ubuntu Unity Lens results under UnityEmptySearchRenderer
(d) UnityShowcaseRenderer : I tried using it and the result was not much different from UnityDefaultRenderer. But according to the documentation, it should have a bigger icon.

Ubuntu Unity Lens results under UnityShowcaseRenderer
(e) UnityEmptySectionRenderer : I did not try this as it not make sense in the application I developed. Supposedly, it is used to imply that the current section is empty. If my interpretation is correct, then this is used when the current section returned no results for query but a different section might produce results. UnityEmptySearchRenderer on the other hand is used to imply that the current search query itself (regardless of the section) provides zero results.
(f) UnityFileInfoRenderer : Copying from the reference, this renderer is used in files place to show search results. Expects a valid URI, and will show extra information such as the parent folder and whatever data is in the comment column of the results.

Steps to write a Lens :

There are three major steps in writing a Lens.
(1) Writing a .place file
(2) Writing a Lens daemon
(3) If you want to distribute , Writing a service file

As an example, let us develop a Lens that does the following :
(1) It has two sections – In “Movie Names” section, only the names of the movie are shown. In “Genre” section, all movies are clubbed according to their genre which act as a groups. So if movie X is in genres Y and Z, X will be displayed in both groups Y and Z.
(2) Clicking on the result will open a browser and redirect to the IMDB page for the movie.
(3) The lens accepts queries from two places – When entered directly in the IMDB Lens and also from the dash. When searched from Dash , it will display movie names as a separate group.

At the initial state, the lens will look like this :

Ubuntu Unity Lens Initial state

For the sake of completeness, here is now it looks when you just search for Movie Names. Ubuntu Unity Lens Search for Movie Names

For the sake of completeness, here is now it looks when you just search for Genres. Basically, the results are grouped using the Genre. If a movie falls under multiple genres, it also falls into different groups. Ubuntu Unity Lens Search for Movie Genre

Let us take a look at how to write the IMDB lens as per the major steps above.

Writing a Place File :

As discussed above a place file contains the information that allows Unity to display the entries in the places bar. Information like which bus to use for communication, what shortcut to use etc are also involved. For the purpose of this tutorial, I will put up the place file I used for the IMDB lens. I will then explain the significance of each line. The file is named as imdbSearch.place and is placed in /usr/share/unity/places/ .

[Place]
DBusName=net.launchpad.IMDBSearchLens
DBusObjectPath=/net/launchpad/imdbsearchlens

[Entry:IMDBSearch]
DBusObjectPath=/net/launchpad/imdbsearchlens/mainentry
Icon=/usr/share/app-install/icons/totem.png
Name=IMDB Search
Description=Search Movies using IMDB
SearchHint=Seach Movies using IMDB
Shortcut=i
ShowGlobal=true
ShowEntry=true

[Desktop Entry]
X-Ubuntu-Gettext-Domain=imdbSearch-place

As you can see, the file has three sections. Each section contains a set of key-value pairs.

Place Section :
This is the simplest section and contains two key values – DBusName and DBusObjectPath. DBusName gives the name of the bus under which this entry can be found while DBusObjectPath provides the actual dbus object path. The names can be any valid DBus names.

Entry Section :
A place file can contain one or more entries. Each entry must contain a section that corresponds to it. Each entry will occupy a distinct location in the places bar. If there are multiple entries, each of them must have a unique name and object path. In the daemon code, all those entries must be added individually.

The various keys are :
DBusObjectPath : This is the DBus path used to communicate with this specific entry. Note that this path must be a child of mail DBusObjectPath. In our case, there is only one entry and hence we put it under the path “mainentry” of the original path.
Icon : Link to the icon file
Name : Name of the entry. When you hover over the entry in the places bar, this will be displayed.
Description : A long description of the lens. I am not sure where this is used.
SearchHint : This is the text that is displayed by default in the lens when the user selects it. In the image above, the search hint “Search Movies using IMDB”is displayed when the user selects the IMDB lens.
Shortcut : This gives the key which is used to trigger the lens. Of course, you can always use the mouse to select it. If this key is specified,then pressing Super+shortcut operns the lens. For the IMDB lens, pressing Super+i opens it.
ShowGlobal : This is an optional key and defaults to true. If it is set to false, then searches from the main dash are not sent to the lens. This seems to override the specification inside the lens daemon. ie If the place file specifies ShowGlobal as false and the daemon adds a listener to the event where user enters a query in the main dash, it is not invoked. Most of the time, I think it makes more sense for the lens to set this as false. For eg, it certainly does not make sense for IMDB lens to offer its service in the dash. Most of the time, when the user is searching in the dash, he is looking for some file or application. Polluting those results with IMDB results may not be wise. This is even more true if your lens takes a while to provide all the results.
ShowEntry : This is an optional key and defaults to true. If it is set to false, then the entry will not be displayed in the places bar. If this is set to false, then the Shortcut key becomes useless as well. Pressing the shortcut key does not invoke the lens. But if the ShowGlobal is set to true, then the lens will still be searchable via the dash. For eg, if for some reason, I decide that IMDB lens must only provide results to queries from dash I will set ShowGlobal to true and ShowEntry to false.

Desktop Entry Section :

This section is mostly optional. The most used key is that X-Ubuntu-Gettext-Domain. This key is used for internationalization purposes. If you want the lens should support internationalization, provide the appropriate entry name. If you are not familiar with internationalization in Ubuntu, there are two broad ways of achieving it : Either put all the translations statically in the file. Or put it in the appropriate .mo file which will then be put in some language-pack file. I included this line because Unity whines as “** Message: PlaceEntry Entry:IMDBSearch does not contain a translation gettext name: Key file does not have group ‘Desktop Entry'”.

Writing a Lens Daemon

The next step is to write a daemon that communicates with Unity over dbus path, does the search and returns annotated search results so that Unity can render them meaningfully. The daemon can be written in any language that support GObject introspection. Most common languages include C, Vala and Python. Vey informally, GOject is a mechanism by which bindings for other languages can be done relatively easily. The actual process needs multiple components. Based on the reference [2], this means that you must verify if the following packages are installed in the system – gir1.2-unity-3.0 , gir1.2-dee-0.5 and gir1.2-dbusmenu-glib-0.4 . Of course, the actual version numbers may change in the future. If installing does not make it work, look at the reference for additional instructions [2].

I will use the IMDB Search lens as an example to explain writing a lens daemon in Python. The full source code is in [1]. I will use snippets of the code to make the appropriate points. The first step is of course importing the appropriate libraries. If you see other Python lens file, they used to have a hack that probes Dee before importing Unity. In my tests I found it unnecessary. If you get some error in importing Unity, then take a look at other sample files [3] and do accordingly.

from gi.repository import GLib, GObject, Gio, Dee, Unity

The next step is to define the name of the bus that we will use to communicate with Unity. Note that this must exactly match the “DBusName” key in the place file.

BUS_NAME = "net.launchpad.IMDBSearchLens"

The next step is to define some constants for the sections in your lens. If your lens contain only one section, feel free to ignore the initial lines. Else define section constants appropriately. The only place where you will use these constants is to figure out which section the lens currently is in. The section ids are integers and are ordered from 0. Note that the order given here is the *exact* order in which the sections must be added to our lens in Unity.

Similarly, we can have constants for groups. Instead of creating lot of constants, I created the group ids dynamically. First, I create a list of all IMDB genres and use a hash to map the name to an integer (group id). Also note that I also have constants for groups – GROUP_EMPTY, GROUP_MOVIE_NAMES_ONLY and GROUP_OTHER.

One thing to notice is that if different sections have non overlapping groups, all of them must be defined here. Then based on current section, use the appropriate group. As an example, GROUP_MOVIE_NAMES_ONLY is used only with SECTION_NAME_ONLY. But we define it alongside other groups. Also note the group for empty, GROUP_EMPTY. This will be used if the search query returns no results.  As with sections, the order of groups defined here must exactly match the order in which they are added to group model. If you have reasonably small number of sections and groups, you can avoid the elaborate setup of writing constants.

SECTION_NAME_ONLY = 0
SECTION_GENRE_INFO = 1

allGenreGroupNames = [ "Action", "Adventure", "Animation", "Biography", "Comedy", "Crime", "Documentary", "Drama", "Family",    "Fantasy", "Film-Noir", "Game-Show", "History", "Horror", "Music",  "Musical", "Mystery", "News", "Reality-TV", "Romance", "Sci-Fi", "Sport", "Talk-Show", "Thriller", "War", "Western"]

numGenreGroups = len(allGenreGroupNames)
GROUP_EMPTY = numGenreGroups
GROUP_MOVIE_NAMES_ONLY = numGenreGroups + 1
GROUP_OTHER = numGenreGroups + 2

groupNameTogroupId = {}
#We create a hash which allows to find the group name from genre.
for i in range(len(allGenreGroupNames)):
        groupName = allGenreGroupNames[i]
        groupID = i
        groupNameTogroupId[groupName] = groupID

The next step is to define the skeleton of the lens daemon. It is a simple Python class. In the constructor, you define the entire model corresponding to each entry in the Lens. If you place file contains n entries, you will be defining n different PlaceEntryInfo. In our case we have only one. Hence we create a variable that points to the corresponding DBusObjectPath. It is impertative that the path exactly match DBusObjectPath of the entry.

Each PlaceEntryInfo consists of different models : sections_model, groups_model and results_model.  If you want the lens to respond to searches in dash, you will also need to setup global_groups_model and global_results_model . The code below contains information about the schema of the different models. You can consider them as more or less a code that can be blindly copied. If you want additional information about things that you can tweak in PlaceEntryInfo, take a look this url .

Note on Property based access :
One important thing to notice is that all the access is done using properties. There are two methods to do that :
(1) x.props.y
(2) x.get_property(“y”)

Choosing one of them is mostly based on your coding style. Choose one use it consistently.

class Daemon:
        def __init__ (self):
                self._entry = Unity.PlaceEntryInfo.new ("/net/launchpad/imdbsearchlens/mainentry")

                #set_schema("s","s") corresponds to display name for section , the icon used to display
                sections_model = Dee.SharedModel.new (BUS_NAME + ".SectionsModel");
                sections_model.set_schema ("s", "s");
                self._entry.props.sections_model = sections_model

                #set_schema("s","s") corresponds to renderer used to display group, display name for group , the icon used to display
                groups_model = Dee.SharedModel.new (BUS_NAME + ".GroupsModel");
                groups_model.set_schema ("s", "s", "s");
                self._entry.props.entry_renderer_info.props.groups_model = groups_model

                #Same as above
                global_groups_model = Dee.SharedModel.new (BUS_NAME + ".GlobalGroupsModel");
                global_groups_model.set_schema ("s", "s", "s");
                self._entry.props.global_renderer_info.props.groups_model = global_groups_model

                #set_schema(s,s,u,s,s,s) corresponds to URI, Icon name, Group id, MIME type, display name for entry, comment
                results_model = Dee.SharedModel.new (BUS_NAME + ".ResultsModel");
                results_model.set_schema ("s", "s", "u", "s", "s", "s");
                self._entry.props.entry_renderer_info.props.results_model = results_model

                #Same as above
                global_results_model = Dee.SharedModel.new (BUS_NAME + ".GlobalResultsModel");
                global_results_model.set_schema ("s", "s", "u", "s", "s", "s");
                self._entry.props.global_renderer_info.props.results_model = global_results_model

Once you have setup the models, you need to add listeners to events that you want to catch. The most important one is “notify::synchronized”. This called when Unity sets up your lens and wants to know the various groups and sections in your entry. In the code below, we add three different functions to that event. One gives the sections in the lens, other gives the groups and last gives the groups in dash.

Next we catch two events that are core to Lens – notify::active-search and notify::active-global-search . The first is triggered when the user searches something in the search textbox of the place while the second is triggered when user searches something in the dash. It is important to notice that the same search can trigger the events multiple times. By default, Unity does a decent job of batching calls providing search strings, but it is an important thing to consider if your lens does expensive operations. Take a look at the section of caching for additional details.

The event notify::active-section is triggered when the user changes the section of the lens by using the dropdown. You can then use your section constants to decide which section is currently selected.

notify::active is triggered when the user selects and leaves your place. Hence its an indirect way for your daemon to know if the lens is being visible to the user.

                # Populate the sections and groups once we are in sync with Unity
                sections_model.connect ("notify::synchronized", self._on_sections_synchronized)
                groups_model.connect ("notify::synchronized", self._on_groups_synchronized)

                #Comment the next line if you do not want your lens to be searched in dash
                global_groups_model.connect ("notify::synchronized", self._on_global_groups_synchronized)

                # Set up the signals we'll receive when Unity starts to talk to us

                # The 'active-search' property is changed when the users searches within this particular place
                self._entry.connect ("notify::active-search", self._on_search_changed)

                # The 'active-global-search' property is changed when the users searches from the Dash aka Home Screen
                #       Every place can provide results for the search query.

                #Comment the next line if you do not want your lens to be searched in dash
                self._entry.connect ("notify::active-global-search", self._on_global_search_changed)

                # Listen for changes to the section.
                self._entry.connect("notify::active-section", self._on_section_change)

                # Listen for changes to the status - Is our place active or hidden?
                self._entry.connect("notify::active", self._on_active_change)

Once you have set up the different models and functions to populate them, you need to add the entry to a PlaceController. If your lens has multiple entries, repeat the above process for each entry and once constructed call the add_entry of PlaceController to set them up. Note that the argument to PlaceController’s constructor is same as the DBusObjectPath for the Place section in your .place file.

                self._ctrl = Unity.PlaceController.new ("/net/launchpad/imdbsearchlens")
                self._ctrl.add_entry (self._entry)
                self._ctrl.export ()

Once we have setup all the models, the next step is to define the functions that are used.The first is to define the function that populates the entry’s section model. Note that we call append on the sections_model with two parameters : the name of the genre and an icon for it. You can also observe that when defined the “schema” of the sections_model, it accepted two strings. One other thing to note is the lack of use of any section constants – You must be careful to define the sections in the exact same order as the constants. In our case, it means that SECTION_NAME_ONLY followed by SECTION_GENRE_INFO.

        def _on_sections_synchronized (self, sections_model, *args):
                # Column0: display name
                # Column1: GIcon in string format. Or you can pass entire path (or use GIcon).
                sections_model.clear ()
                sections_model.append ("Movie Names", Gio.ThemedIcon.new ("video").to_string())
                sections_model.append ("Movie Genre", Gio.ThemedIcon.new ("video").to_string())

The next step is to define a set of groups. Due to the nature of this lens, we reuse the list to form it. Notice the use of UnityEmptySearchRenderer for the GROUP_EMPTY. For this example, I have used UnityHorizontalTileRenderer. Your lens might need some other renderer – Take a look at the renderer section above for a discussion of the different renderers.

                # Column0: group renderer, # Column1: display name, # Column2: GIcon in string format Or you can pass entire path (or use GIcon).
                groups_model.clear ()

                #Remember to add groups in the order you defined above (ie when defining constants)
                for groupName in allGenreGroupNames:
                        groups_model.append ("UnityHorizontalTileRenderer", groupName, Gio.ThemedIcon.new ("sound").to_string())
                #GROUP_EMPTY
                groups_model.append ("UnityEmptySearchRenderer", "No results found from IMDB", Gio.ThemedIcon.new ("sound").to_string())
                #GROUP_MOVIE_NAMES_ONLY
                groups_model.append ("UnityHorizontalTileRenderer", "Movie Names", Gio.ThemedIcon.new ("sound").to_string())
                #GROUP_OTHER
                groups_model.append ("UnityHorizontalTileRenderer", "Other", Gio.ThemedIcon.new ("sound").to_string())

The next step is to define the function that is called when the search changes in the place search box. Notice how we use the entry object to get the current section, the current results, current search query and so on. Finally, we invoke search_finished function which calls search.finished() which signals to Unity that we are done processing the query.

        def _on_search_changed (self, *args):
                entry = self._entry
                self.active_section = entry.get_property("active-section")
                search = self.get_search_string()
                results = self._entry.props.entry_renderer_info.props.results_model
                print "Search changed to: '%s'" % search
                self._update_results_model (search, results)
                #Signal completion of search
                self.search_finished()

There are other functions which we can detail. But mostly, they are very similar to code shown here. You can take a look at the python file linked below [1] for full glory.

So far all we have done is using some boilerplate code. From now on though, the code starts to differ based on the application. So I have not included the code that actually produces the results here. Take a look at the python file for details.

Testing Instructions

Once you have written the python file , you want to test your baby. Here are the steps :

(1) Include the following code in your daemon. This code was literaly copied from Unity Sample Place [3] code.

if __name__ == "__main__":
        session_bus_connection = Gio.bus_get_sync (Gio.BusType.SESSION, None)
        session_bus = Gio.DBusProxy.new_sync (session_bus_connection, 0, None, 'org.freedesktop.DBus', '/org/freedesktop/DBus', 'org.freedesktop.DBus', None)
        result = session_bus.call_sync('RequestName', GLib.Variant ("(su)", (BUS_NAME, 0x4)), 0, -1, None)

        # Unpack variant response with signature "(u)". 1 means we got it.
        result = result.unpack()[0]

        if result != 1 :
                print >> sys.stderr, "Failed to own name %s. Bailing out." % BUS_NAME
                raise SystemExit (1)

        daemon = Daemon()
        GObject.MainLoop().run()

(2) Copy your place file to /usr/share/unity/places/ . If you have any custom icons, copy them to the location specified in your .place file.
(3) Open up a new terminal and invoke your daemon file. Also remember to set the executable bit on.
(4) Open up another terminal and type “setsid unity”. Using setsid is a very neat trick I learnt from the sample place file. Basically, it starts Unity in a new session. This forces it to read all the place files again. Also if you make any change to the daemon code, you can kill it and restart it. Unity will start communicating with your new daemon. Additionally, setsid will also ensure that Unity does not have controlling terminal but will still dump all debug information in the terminal it was opened.
(5) Open the lens and type your query and watch the results appear !

Debugging Checklist

If your lens is not working as expected, here are somethings to verify :

(1) Make sure that your place file is copied to /usr/share/unity/places .
(2) Make sure that busname and object path match exactly in your place file and your daemon file.
(3) Make sure that Python file has its executable bit on. This is important if you want to run it a service/daemon that runs automatically. More on that below.
(4) If you are simply testing it, then is your Daemon file running ? If you are running it as a service, is your service file contain information that match your place and daemon file ?
(5) Did you restart Unity  – preferably as “setsid unity”
(6) Did you make any recent changes to place file ? If so make sure it is copied and restart Unity.
(7) Check for any exception information in the terminal that you started your daemon. If its a service, enable logging and examing the log files.
(8) Check if your lens is actually started. If you used “setsid unity” in a terminal, it would be logging the various steps it does. One sample invocation showing successful starting of lenses is this :

    ** (<unknown>:6114): DEBUG: PlaceEntry: Applications
** (<unknown>:6114): DEBUG: PlaceEntry: Commands
** (<unknown>:6114): DEBUG: PlaceEntry: Files & Folders
** (<unknown>:6114): DEBUG: PlaceEntry: IMDB Search
** (<unknown>:6114): DEBUG: /com/canonical/unity/ applicationsplace
** (<unknown>:6114): DEBUG: /com/canonical/unity/filesplace
** (<unknown>:6114): DEBUG: /net/launchpad/imdbsearchlens

(9) If your lens works but puts results in strange groups, make sure that order of groups in synchronize and the constants are same.
(10) Common errors and fixes :


** Message: PlaceEntry Entry:IMDBSearch does not contain a translation gettext name: Key file does not have group ‘Desktop Entry’ :

This is not an error. If this annoys you add a [Desktop Entry] section. See above for details.

** (<unknown>:6114): WARNING **: Unable to connect to PlaceEntryRemote net.launchpad.IMDBSearchLens: No name owner

This is again not an error but indicates that either your daemon program is not running or is not able to own the bus specified in the .place file.

Installation Instructions

Since I primarily wrote the IMDB lens for learning Unity, I do not know much about the actual installation process. Here are some generic tips :

(1) If you want a simple method of installation, use distutils. It accepts a list of files and the location where they must be copied. This is the cleanest way.
(2) If you are going to install it and expect the lens to start automatically, then you should write a .service file that knows which bus start and which file to invoke to make that happen. The service file is usually put in “/usr/share/dbus-1/services/” . In this case, also make sure that the daemon file is actually executable !

[D-BUS Service]
Name=net.launchpad.IMDBSearchLens
Exec=/path/to/daemom/file

Various Tips On Writing Lenses

(1) Most of the simple daemons use constants for sections and groups. If you want them to setup them up dynamically, take a look how it is done in the IMDB lens.
(2) Avoiding repeated searches :
When the user enters a query in the lens, it is not necessary that the search function will be called only once. Remember that there is no concept of return key to indicate that query is complete. In fact, if the user presses the return key, it selects (and opens) the first result. The way Unity handles this scenario is by batching the calls. Lets say the user wants to search “blah blah2”. If the user continuously types the query with minimal interruption of the keyword, then the entire query will be sent to lens in one shot. On the other hand, if the user is a slow typer and enters “blah b” before waiting for a second or so, Unity will call the search function with partial query. When the user completes the query , the lens will be called with the entire query.

This behavior complicates your lens behavior, especially if the processing is time consuming. There are different techniques to avoid running calculations repeatedly (IMDB lens uses the first two techniques):
(a) Have a cutoff : Your code might decide not to search if the length of string is less that say 4 characters.
(b) Have a cache with timeout : You can use a local cache that stores your previous results . When you get a new query, check your cache first and return the results from it. For added benefit, have a cache timeout that removes elements that were added long time ago.
(c) Memoize using functools : A very cool technique that is used in other lenses is to memoize the function call. This technique works if the function is reasonably simple – the key is the function argument and the value is the return value of the function. One simple example is shown below. In the example, we defined a decorator called memoize_infinitely and apply it to function foo. Foo accepts an input and returns an output. This decorator, automagically creates a cache for each function. When the function is called with some argument, it is first checked in the cache. If it is found, then it is returned without invoking the function. Else the function is called and the result is stored in the cache. This technique is widely used. For a specific example,take a look at the AskUbuntu lens [3] .

import functools
def memoize_infinitely(function):
    cache = {}
    @functools.wraps(function)
    def wrapped(*args):
        if not args in cache:
            cache[args] = function(*args)
        return cache[args]
    return wrapped

@memoize_infinitely
def foo(input):
	return input + 1

(3) Handling long computations :
If your lens returns lot of results or the processing for each result entry takes a lot of time, then its a good idea to display the information as it arrives. The results model has a function called flush_revision_queue which periodically sends the data so far to Unity. For eg, in the case of IMDB lens , fetching the genre information is expensive. So, the code flushes the results every time five movies were processed. This allows the user to see some results without waiting for eternity to get complete results.

Links

    [1] The code for IMDB lens which I have tried to comment as much as possible is my github page. For convenience, I have also given the individual files : Readme, imdb-search.py, imdbSearch.place .

    [2] Unity Places – now with 100% More Python : This blog post contains a brief discussion on developing Unity lenses in Python. It has some info on installation and links to a sample lens in Python. I would advise you to start with the sample lens code given in this blog post before making drastic changes. This way you can make sure that the initial lens setup is fine and the issue is really in your code 🙂
[3] Link to some Good Unity Python Lens codes : As of now there are few other good Unity lenses written in Python. Here are some of  my favorites – AskUbuntu lens, Launchpad lens, Evernote lens, Book-Search lens, Music search lens , Spotify lens . I have tried to incorporate all cool features in IMDB Search lens , so that it will become a one stop place for most important Lens features 🙂

    [4] Ubuntu Unity Architecture : This contains some language independent discussion of Unity architecture and additional information of the data structure it uses.
[4] IMDbPy : The IMDB search lens was developed using the excellent IMDbPy library. It has very convenient API that allows development of IMDB based applications a snap.

  [5] Ubuntu Unity Lens Python API Links : Here are some links for documentation that I found  – Dee API, Unity API . The document for Unity also encompasses the documentation for Places.

Advertisements

Read Full Post »

I released a new version of Chrome Nanny that incorporated few requested features. They are:

 

1. Validate regular expressions when they are entered in blockset.

2. More robust error handling inside the extension.

3. Always allow access to Chrome extension links even if you block *.*

4. Disallow *.* from White list.

5. Do not strip www/http from the blocksite. So a block url of www.ft.com will not block www.microsoft.com unless the url is ft.com.

6. Multiple internal changes that will allow implementation of other Chrome Nanny features faster.

 

Let me know how this version works !

Read Full Post »

GNOME Do is one of the coolest utilities in Linux. If you are a keyboard person you will love it. Even otherwise, do check it out as even a rudimentary use of it will tremendously improve your productivity. I have been using GNOME Do for almost a year now. I had been thinking of blogging about it for long but hesitated since it already had lot of good tutorials. I will give a brief tutorial of GNOME Do and an overview of various common tweaks you can do to get the best out of it.

What is GNOME Do

GNOME Do is , at its core, an application launcher. That is , it gives a convenient way to start some application. There are two things that makes it cool : First is that it is a self learning system which adapts to your usage and idiosyncrasies. Second is that when you add some plugins, GNOME Do will allow you to manipulate different types of objects – files, directories, contacts and more.

The discussion above may not seem interesting enough to you – Consider how you usually start an application. If you are a geek, you may use the terminal (or use the Run Application dialog using Alt-F2). There are few problems : You would have to remember the exact name of the utility and you need to type its entire name all the time. Basically, your terminal does not become intelligent automatically and figures out that when you typed "sy", you wanted to run Synaptic. You can try autocomplete or you can set aliases but it you just shifted the problem rather than solving it. The second option is to use the menu. That is really painful – Take your hand off the keyboard, click on the menu, figure out under which submenu the application is in, select it and click it – Sure it sounds exaggerated but each time you do it, it shaves some seconds out of your productive time and these seconds add up !

The plain vanilla GNOME Do waits in the background. When you type some special invokation keystroke, it springs up. You can type part of the app’s name and it automatically finds it. Even better , it gets better over time. Now a days, most of the time , I can reach the app I want in 1 or 2 keystrokes.

Comparison with Other utilities

Before discussing GNOME Do more, I wanted to discuss other related utilities. Application Launchers are very common in most OSes and there are a variety of them to select from in Linux. I have tried Launchy before – It worked sort of , but somehow I preferred GNOME Do better. One big advantage of Launchy is its cross platformness. I know there are others like Kupfer, Katapult etc but some GNOME Do seems the best to me. There is a new one in the horizon – Synapse. I am pretty intrigued with this one as it also uses information from Zeitgeist. I have been using it for past few days but it has not made me change my launcher – But given its Zeitgeist integration, I intend to keep an eye over Synapse.

Another big utility which is not really a launcher but can be tweaked to do is Autokey. Autokey’s incredible scripting support allows much more complex interactions possible. But for most basic application launching , GNOME Do will be enough (though with the help of a few plugins).

Installation and Setup

One (minor) thing to note is that GNOME Do is written in C#. I do not find anything significant there but some people may object to installing Mono based software in a Linux system. I hope that as more and more neat utilities like Banshee, Tomboy become widely used the objections will fade away. You can install , GNOME DO from Synaptic (package name is gnome-do). Or if you are a command line person use,

sudo apt-get install gnome-do

If you are interested in getting the latest and greatest GNOME Do as soon as possible , install its PPA. GNOME has been silent lately, but I found few announcements about a rewrite. Hope it keeps evolving. The name of the ppa is ppa:do-core/ppa . You can add the repository by

sudo add-apt-repository ppa:do-core/ppa

Invoking it is very simple . It is in Applications -> Accessories. If you are a command line person, enter "gnome-do" in terminal. I think by default, GNOME Do adds itself to startup applications.

Tweaking the Preferences

GNOME Do starts up and waits silently in the background. You can check the notification area in the gnome panel. The icon for GNOME Do looks like a star in a pink (or some color similar) background. The default keystroke to bring to foreground is Super+Space where Super is the Windows key in keyboard. The interface is really minimalistic which we will explore later. Now click on the arrow in the top right corner and select the preferenes.

There are four tabs (as of this writing). Check all the items in ‘General‘ tab. In the ‘Keyboard‘ tab, you can alter the keys used in GNOME Do. I think most of the defaults are fine. The simplest item to change is the keystroke to Summon the application which by default is Super+Space. You can change it to others like Ctrl+Space or Alt+Space etc. If you want to change it to something more complex , then you would have to use GNOME’s keyboard mapping utility. To change the looks, use the ‘Appearance‘ tab. I like the Glass them with black background but your preference might vary. We will discuss the plugin tab shortly.

Since there are multiple ways to use GNOME Do, I will split them into various parts in the increasing order of complexity and sophistication.

Basic Operations I – Invoking Applications

The basic way to invoke some application is to summon GNOME Do using Super+Space and then type the first few characters of the name. For ease of use, GNOME Do allows you to use the application’s name and not necessarily its actual underlying command. For eg, you type, "gnome-activity-journal" to invoke GNOME Activity Journal (GAJ) in the terminal. In GNOME Do, just entering part of "GNOME Activity Journal" will do. As you use GNOME Do frequently, it "learns" your pattern. If you use GAJ often, then after few usage , it will show GAJ after you just pressed the letter G.

Sometimes you typed part of the application name and GNOME Do keeps showing some other application. Dont worry . Just use the arrow key to see all the candidate list. Lets say, you want to invoke "Gettings Things GNOME" (GTG) and typed GNOME. It might show GAJ as its first result. You can either keep typing or press the arrow keys and select GTG to invoke it.

Tips for using GNOME Do Effectively – I

Even though, we are still scratching the surface of GNOME Do, you can gain immediate productivity gains. You need not use the menu at all to invoke, say, Gedit, Firefox, Open office , VLC player etc. All of them can be invoked from GNOME Do and just by few keystrokes. Neat – isnt it ?

One thing that you will notice is that when two applications share some common prefix , there are two ways to handle it. Either you type extra characters to disambiguate or you use the arrow keys to select from candidate list. It is important to know when to do what. GNOME Do also has a neat feature to mitigate this issue. Basically, it allows you type any ‘subsequence’ of the application name instead of its exact prefix. For eg, if the application’s name is abcdef, you can invoke it as abcd.. or abef or adf.. etc. Basically you can type part of its name in mixed order and GNOME Do will still figure out the application. Sooner or later, you will develop your own set of strings to disambiguate. There are lot of apps that start with the string "gnome-". I usually ignore the first string and type the next word. So, to disambigute say "GNOME Activity Journal" and "GNOME Terminal", I will use say journal for GAJ and terminal for the later. The idea is to find some string which uniquely identifies the application. There is another neat way to do it using Aliases which we will see later.

A related feature is that GNOME Do allows most of the navigation keys in the candidate list. So you can use keys like Home, End , Page Up , Page Down to zip through the list.

Basic Operations II – Performing Tasks

GNOME Do is a task oriented application launcher. There are two idiomatic ways to perform some tasks. ie you can invoke tasks as ,

<Items> <Action>

Or

<Action> <items>

Lets say you want to chat with X. In first way you say as ‘X and Chat’. In second way , you say ‘Chat X’. GNOME Do allows both ways to perform the task.

You can notice that GNOME Do has two panes. When you were invoking applications, the application name came up in the first pane. If you look closely now, the second pane will contain the word ‘Run’. Now type something else like Desktop. Notice the second pane, the action changes to "Open". Here you are treating pane 1 as items pane and pane 2 as actions pane. One thing to note is that both of them have different alternatives. Pressing arrow keys on first pane will show other alternative applications (items) and doing it in second pane will show other possible actions. In the plain GNOME Do has a restricted set of actions, but we will increase it soon. The same discussion applies when you swap the panes and use Action in pane 1 and item in pane 2.

To move between the panes use the tab and shift+tab keys. Use the arrow or other navigation keys to select other items/actions. If you want to cancel what you are typing , press Esc. Remember that Esc clears everything you typed. If you want to modify selection from just one pane, use the Shift+tab key. Lets say you are in pane 2 and selected some action. Pressing Esc now resets everything and gives you a clean slate. Pressing shift+tab, just returns it items pane where you can select some other item without changing the action selected. If the first pane is empty, pressing Esc closes GNOME Do.

As of now, you know two things. Invoking applications by typing their name and typing some item and select some other action to perform on it. These will constitute around 80-90% of your interaction with GNOME Do. When we add new plugins, all they do is increase the variety of either item types to operate on (eg email contacts in addition to files) and new actions to perform on them (eg open a terminal in a folder instead of just opening it in Nautilus).

Another important idea is that of the ‘Extra’ pane. Most of the time you will be working with just two panes. For some rare actions you may need more of them. Consider for eg renaming a file. You need a pane to give the action (rename), one to select the file and another to give the new name. The new name is entered in the extra pane. There are few other actions that use the extra pane. When you select them, they automatically extend the GNOME Do screen to include the third pane.

Tips for using GNOME Do Effectively – II

Sometimes, you would want GNOME Do to shut up and wait for your full text instead of showing possibilities. One eg is when you type an actual command which is not listed. Or may be you want to send a status message to twitter and do not want GNOME Do to interpret as something else. Typically, Do will try to find matches and if it does not find any , it will give up . You can find this, when the keystrokes are show in the upper half of item pane like superscripts in tiny font. Basically, GNOME Do has entered its text mode where it will wait for you to type the text. One way to force it to go to text mode is then "." (dot) operator. Pressing period key will immediately move to text mode where you can type any thing you want. Of course, you need to press tab to go to action pane after typing your text.

The next common thing involves multiple items – Either you want to perform single action on multiple items or many actions on a single item. Lets say, you want to open file1,file2… file10.txt. Type the word ‘file’ in items pane. Press the arrow key to see all the candidates. Since all the files shared the same prefix, GNOME Do will show all the files (file1 to file10) as candidates. Now select the first file (file1) using arrow keys and press the "," (comma) key. The item’s icon will change to a "+" sign. Now move down and select file2 to file10. Remember to press "," on each of them. Now press tab to go to the next pane and select the appropriate action. This will cause all the files to get opened in bulk.

The method to perform multiple actions on same item is similar. Lets say you want to open Desktop in Nautilus and also open a terminal there. In the items pane, select the file. Go to the actions pane using tab. Press the arrow key to see all actions. Select the first action and press "Shift+Enter". Now do the same for other actions. You will see GNOME Do triggering one action after the other on the same item.

Plugins

Plugins make GNOME Do even more powerful. There are literally tens of plugins covering all varieties of tasks. Plugins either introduce new actions on items or new item types. I will discuss about plugin development later in the post. In the mean while, let us see some of the coolest plugins and how to use them to improve productivity.

There are broadly two types of plugings : Official and Community. The distinction does not matter much to a typical user. To install a new plugin, press Super+Space , click the arrow , select the Preferences option. Now go to the ‘Plugins’ tab. Select "All Plugins" from the dropdown.

Neat Plugins

1. Files and Folders plugin

This is the most useful of all plugins and I use it heavily. The basic functionality allows you add some specific folders and files to be added to the GNOME Do index. By default, GNOME Do only indexes folders specified in the Nautilus bookmarks. If you access some files very frequently, then use this plugin to add them. Lets say, I have my research files in some path. If I want to access them via GNOME Do, all I need to do is to add the folder to this plugin. Now when I type a prefix of the file names in this folder, they will be opened.

This plugin also has a Configure button. Clicking it will take you to a dialog which contains ‘Indexed folders’ and ‘Ignored Folders’. You can add as many folders as you want and also mention the depth to index. A good set of folders is to include your home , Desktop and other folders that you access frequently. If you dump most of your stuff in Desktop, then increase its depth. By default, it does not index hidden files which makes sense. Do not index folders which have too many files in them as it defeats the whole purpose.

This plugin also has other amazing featues – for eg It allows you to browse a folder . Type a folder name and press the right arrow. It will show all the contents of folder in the candidate list. It also has options to copy or move a file. For other features look at File and Folder plugin’s wiki url.

2. Locate and Tracker plugins

This two plugins are very closely related to the previous plugin. There is usually a tradeoff between using Files and Folders and locate plugin. You should not use Files and Folders to index every folder in your computer. That will make GNOME Do slow and kinda defeats the whole purpose. So index folders and files that you access frequently use the previous plugin. For files or folders that you access infrequently, use this plugin. Basically, this is a wrapper over the locate command. For eg, I have indexed the files that I frequently use for posting blogs. I also have few folders where I store supporting stuff. I usually use the locate plugin to find them.

There are two ways to use the plugin. The easiest is to select ‘Locate Files‘ action in first pane and type the query word in second pane. If you do it the other way, Do will try to interpret it as a file. So in that case you are better off going to the text mode – type the dot in first pane , go to text mode, type the query , press tab to go to next pane and then select locate files action.

The tracker plugin allows you to do full text search for the keyword you gave. Basically, instead of searching for file names, you use file content to search.

3. Rhythmbox and Banshee plugins

Whether you are a Rhythmbox or a Banshee person, GNOME Do has plugins that allow you to control these applications. Once you install, they make the entire music library searchable. You can select an album and play it. There are also basic actions to pause, play , go next and previous. If your keyboard has multimedia keys then I do not see any reason to use these actions. The ability to select an album and add them to play queue is really neat though. If you have both the plugins, sometimes you can get confused – Based on whether they come from Banshee or Rhythmbox , the option to play it in the other player may not be available.

4. GNOME Terminal plugin

This is a simple plugin which has two options. If you selected some file or folder and select the ‘Open Terminal here‘ action, it will open a new terminal and cd in to the folder (or parent folder for a file). If it is a executable file or script, you can use ‘Run in terminal‘ command to invoke it. This is slightly different from the Run action as it starts a terminal and then invokes the command.

5. Firefox and OpenSearch plugins

These are two nifty plugins if you use Firefox. Firefox plugin indexes all your firefox bookmarks and allows them to opened in your default browser using the ‘Open URL’ action. OpenSearch reuses the OpenSearch plugin in your system and makes it accessible through GNOME Do. For eg , if you installed say wikipedia opensearch plugin, you can enter a keyword and search it in Wikipedia. It will open your default browser to show the search results.

The way it works is a bit tricky. It recognizes only user installed OpenSearch plugins. This means the default ones that come with Firefox like Google, Yahoo or Bing dont work out of the box. To fix it, manually copy /usr/lib/firefox-<version>/searchplugins/en-US/*.xml to ~/.mozilla/firefox/<yourprofile>/searchplugins/ . I have used the en-US which I think covers most opensearch plugins. If your plugin uses some other locale, copy them too. Now enter the keyword to search (preferrably in text mode) and use the ‘Search Web’ action and select the appropriate OpenSearch provider.

6. Window Manager Plugin

This is a plugin that is useful sometimes. Typically you use GNOME Do to invoke applications. But once the application is invoked, then this plugin adds some more window management options like Close, Minmize, Maximimze etc. I typically use either the ‘Focus‘ option to bring to front (which is very useful if you are also using docky) and ‘Move Window To‘ some other workspace. If there are multiple instances running, type the application name and then use the arrow key. The name of the application will have a tree like structure showing all the instances which you can select using navigation keys and then perform the appropriate window action.

7. Pidgin , Evolution and Thunderbird plugins

If you are using Pidgin or Evolution, you can use these plugins. These add Pidgin contacts and Evolution/Thunderbird mail contacts to be indexed by GNOME Do. For Pidgin contacts, you will see a Chat action that opens a new window. For Evolution contacts, it opens up a new mail to window. For some reason it does not work for Thunderbird even though it uses xdg-email internally. But still it is cool to say Chat X or Mail Y !

8. GNOME Screenshot Plugin

This is a simple plugin but I added it as the plugin wiki seems to be wrong. For using this plugin enter ‘Current Window‘ or ‘Whole Screen‘ as item and ‘Take Screenshot’ as action. Optionally select a timer. I usually use when I want to take some snapshot for my blog posts. This is much easier that opening screenshot and setting the values manually. This currently does not work for me . When I find the reason, I will post back.

Plugins that are not working for me

GNOME Do has few plugins that do not seem to work for me. For eg, the ‘aliases’ plugin seems very promising but never worked for me. It allows you to enter an alias for an application and then use it to invoke it. Its a great idea but surprising does not work.

Two other plugins that I wish that worked are the Thunderbird and Screenshot plugin. Thunderbird correctly indexes all the mail contacts. When I use the Mail action, I get an error that says ‘gvfs-open: file:///home/blah/xdg-email%20%20’emailid’%20%20%20%20%20: error opening location: Error stating file ‘/ home/blah/xdg-email ’emailid’ ‘: No such file or directory . I have been intending to work it for quite some time but never got around it. May be I will do it this weekend. The Screenshot plugin also gave a similar error – hopefully one change will fix them both. I will update the post once I got some results.

Geek Stuff

Following are some misc stuff that are of interest to geeks. Feel free to ignore this section if not interested.

1. All plugins in GNOME Do are written in Mono and use Mono.AddIns framework. There are a few potential plugin ideas to explore. I will give it a shot during my vacation. Currently, there exists plugins that index firefox bookmarks and use Firefox’s opensearch details. Something that indexes Chrome’s bookmarks should be neat. It would be useful to fix the Thunderbird plugin to support mail and attach actions. Same holds for Screenshot plugin. Another plugin that needs fixing is the Alias plugin. Now that , Empathy has become the default plugim, I think there is a need to have a Empathy plugin similar to Pidgin .

2. Running gnome-do in a terminal is a great way to know what is going on in the background. Probably a good debugging idea too !

3. By default, GNOME Do indexes all the menu items in GNOME Menu. If you want to add some other entry, add a ‘.desktop’ file to ~/.local/share/applications. You can use other desktop files as reference.

4. If you added a script (and indexed that folder via Files and Folders plugin or added a .desktop) file, make sure that it has executable bit turned on. Else GNOME Do will not show ‘Run’ action and will show only ‘Open’ action.

References

1. GNOME Do Main Wiki Page : Contains basic information about installation, usage and other stuff.

2. Plugin Doc : Contains documentation for few plugins.

3. GNOME Do White Paper : Contains few technical details and the motivation behind GNOME Do.

4. Writing Plugins : Basic information about writing plugins.

Conclusions

GNOME Do is a very neat utility and can dramaticaly improve your productivity when used with right set of plugins. I hope this post gave you some tips on using it more effectively. Good luck with GNOME Do !

Read Full Post »

GNOME Activity Journal and Zeitgeist are some of the fascinating recent projects in Linux. I have been a user from their initial versions and have been intending to write a tutorial on it. Two reasons I kept postponing it : GNOME Activity Journal kept changing very frequently and writing a comprehensive Zeitgeist tutorial will take too much time given its potential ! So I decided to split my tutorial into two parts : A basic tutorial on GNOME Activity Journal, Zeitgeist and Sezen and a more geeky post on Zeitgeist in the near future.

[Update Jun 24 2011] : Updated information about Activity Log Manager and data providers.

Why are Zeitgeist and GNOME Activity Journal so cool ?

I will make an assumption here that the reader is a relatively active user of Linux. Everyone knows Linux is cool, secure and blah blah but it is still does not have enough traction in Desktop. Sure Linux dominates in servers and embedded systems but Desktop is where the mind share is. I will not say that Linux Desktop is hard to use but we have not provided compelling reasons for people to try it out. Recently, there has been some effort to make Desktop more user friendly, especially from Ubuntu and Fedora – Let the force be with them 🙂

If you have been following GNOME, you would have heard the term "Document Centric GNOME" thrown around often. If you want, take a look at this insightful (though sort of outdated) GUADEC presentation that started it all.

One of the important problems in Desktop is finding the files you used to perform some task – This is not necessarily the files you used today morning or yesterday. If that is the case, you can always take a look at recently used documents. Let us take few examples :

1. Where are the set of pdf files I used to learn Gaussian Processes last week ?

2. When I was fixing an issue in Chrome Nanny last month what were the files I kept opened in Vim ?

3. I want to buy the book I checked out in Amazon last week. What is its url ? It must be in my web history – But wait was it in Chrome or Firefox?

4. How many excel sheets did I look at last week ? Where are they all located ?

5. Last friday, I listened to some awesome songs in Rhythmbox and I want to listen the same set of songs again. How do I find out all the songs that played then ?

6. More generally, I performed task1 under some context – which involves set of files, websites and other stuff. Note that it is application independent and might involve multiple applications. It must be possible to get into that context anytime I want effortlessly.

These are some of the common scenarios that occurs to us. But no OS has so far provided any convenient way to solve them. Of course, the usual answer is to organize your folders properly or keep a note of things you did. These are not solutions at all. If I organize them properly then each file will be nested deeply and remembering the organization becomes a pain. The folder paradigm is useful but not very intuitive or convenient for users. Remember that for a lot of people (ignoring techies), using Computer is usually a means to get some job done. They are not obsessively focused on organizing the computer. They have a job to complete and we must make it as simple as possible for them to complete it.

Just think how it is done in the real world. You always have an option of filing all the necessary items into a locker so that you can find it later. It must be possible to do the same in a computer : create a task context, view previous activities etc. Zeitgeist and GNOME Activity Journal are some of the tools that will help you in that quest. For some more exotic scenarios , check out the usecases in Zeitgeist vision document. Very few of the usecases can be realized immediately through them but the underlying framework is robust enough to support all of them and more ! GNOME 3.0 has some grand ideas on transforming the Desktop as we know. IMHO, Zeitgeist , GNOME Activity Journal , GNOME Shell are going to make using Linux really cool.

High Level Overview of Zeitgeist , GNOME Activity Journal and Sezen

Zeitgeist is a tricky thing to nail – You can consider it as a daemon that stores all the relevant "events" in your computer. Events can be as simple as user opening a file or browsing to a site or something more complex. Zeitgeist silently stores all the events in its db. The information stored can be arbitrary – it can be as simple as filename or as complex as the entire file content and metadata. Some of the possible metadata include tags, geo location etc. Zeitgeist exposes an API that allows other data "providers" to save and query events. It is the underlying framework over which other cool tools can be written using its API or extended using plugins. Informally, Zeitgeist shuns the folder paradigm and embraces a timeline/task based paradigm. This is a powerful idea as it provides you an additional dimensions (time, context) to browse the files , in addition to folder structure.

GNOME Activity Journal is an "activity browser". It allows you to view in a timeline all the activities you did in the past. Note the emphasis on activity. Potentially an activity can be any interaction with some resource. The activity can be as simple as viewing a file or chatting with a contact. In the future, activity can be as complex as you want. The journal will allow you to search for past activities, filter activities based on source , annotate the activities and so on. Timeline is not the only way to view the files/activities. You can find them by mode of use or even tags that are manually annotated. Infact, it even has a cool feature where it "infers" related files based on usage patterns.

Sezen is a neat applet that allows you to search for activities/files in a convenient way. The search in Zeitgeist sort of sucks now and I use Sezen to fill the void. I hope that the journal will have a more powerful and convenient search mechanism.

Installation

Hopefully your interest is now piqued. You can always install Zeitgeist and GNOME Activity Journal from the Ubuntu repository , but it is usually stale. If you are ok with it use the following instructions to install it.

sudo apt-get install zeitgeist gnome-activity-journal

If you want to enjoy the latest features without waiting for a new version of Ubuntu, then add the zeitgeist ppa to the list of repositories. The steps are :

sudo add-apt-repository ppa:zeitgeist/ppa

sudo apt-get update

sudo apt-get install zeitgeist gnome-activity-journal

Some time ago there was a bug where due to some issue in Zeitgeist, GNOME Activity Journal will not start. If I am right, the reason was that when Zeitgeist was updated, the daemon was still running with the old version . If you are bitten by that bug, either restart the system. Alternatively, run this command :

zeitgeist-daemon –replace &

Sezen is a utility that allows you to view the recently used files in a convenient fashion. Some of the functionalities of Sezen overlaps with that of GNOME Activity Journal. When the journal’s search becomes more useful, Sezen may not be needed. Assuming you have installed the PPA, you can install Sezen by

sudo apt-get install sezen

GNOME Activity Journal

GNOME Activity Journal is an "activity browser". It helps you to browse your recently used files, websites or contacts. The information is presented in a chronological fashion. It integrates tightly with Zeitgeist and tracker . As one of the website put it , it is a "viewport to the past". You can access it from Applications > Accessories > Activity Journal.

Multi View

The journal has three different views – multi view, thumb view and timeline view. The default is the multi view which allows you to see the details of 3 days at a time. So your screen will look something like this :

GNOME Activity Journal Multiview

You can immediately notice some things : Information about the last three days are displayed. If you have used in extensively, then information is categorized into files accessed in morning, afternoon and evening. This means that it is now easier to view the files you accessed on morning of 16th of last month. What is more : the journal also classifies files based their type. So you can see that there are atleast 3 different types of file type : You have sections like "Edited or Read documents", "Worked with Images" and "Conversation with contact". As you have different types of data providers, you can view them in a more granular way. Examples include audio,video and websites. Hovering over one of the items will show the preview of that item. So you can immediately take a peek at the item’s content. Of course, you can always click on the item and it will open up in the appropriate application.

You can also see the arrow buttons on the either side of the screen that allows you to navigate across the timeline. If you take a look at the bottom panel, there is a bar chart which depicts the user activity. You can go to any past time by clicking on the appropriate bar. For eg, you can click on somewhere in the middle of bottom panel for August to look at the journal for that time period. If the date you want to check is long back, then click on the left edge of the bottom panel and it will take you back in time in a faster scale. Once you reached the month and approximate date, you can use the right/left arrows to go to the exact timeline. The bars highlighted in orange indicate the dates that are shown in the multiview.

So if you want to know which images you checked out on say Oct 1 2010, all you need to do is to go to that date – either using bottom panel or the navigation arrows. Now expand the itemset "Worked with images" and you will find all the images you viewed on that day. You can always click on the arrow icon on the toolbar to get the current day’s details.

Thumb View

Thumb view is another commonly used view. This is especially useful if you viewed lot of images or videos. You can notice that thumb view is available for only single day. You can still the arrows or the bottom panel to navigate to other days.

GNOME Activity Journal Thumb View

Timeline View

This is my favorite view as it packs lot of information in a concise fashion. All the items are show one by one and near each item there is a blue square to indicate the time it was accessed. For eg you can infer that I accessed gBlogStats.ods somewhere around 11 AM on Oct 9 twice. Similarly, I accessed the file gblognotes.txt intermittently starting from early morning 1 AM till around 8 PM. Each of the blue squares indicate one access. It can either viewing the file or saving it. Using this you can answer the question how many time did I access a file or go to a website. Very neat !

GNOME Activity Journal Timeline View

Pinning Items

Some times you may think that few of the items are important and want to highlight them separately. In GNOME Activity Journal , it is done via pinning the item. So, right click and item and select "Add Pin". This item will be now highlighted at the top separately. You can again right click on the item and select "Remove Pin" to bring it back to original status. Alternatively, you can click on the pin icon of a pinned item to unpin it. You can notice that pinning applies only to Multi View. Also pinned items show up in the slot for "Today". This kinda make sense as the journal typically opens show today’s details and you have an one click access to it. I hope they soon add a feature where I can highlight few items that is specific to a day.

A image showing a few pinned items and about to add pin to another item is shown below.

GNOME Activity Journal Pin Item

Searching Items

There are two major ways to filter items in GNOME Activity Journal. One is the temporal way where you want to see all websites you accessed on Sep 1 2010. If this is the usecase, you can use the naviagation arrows or the bottom panel to go to the appropriate date and see all the files. Another alternate way is to see all the file with "blog" in their names. If this is your usecase, you can use search icon at the toolbar. Clicking it will display a textbox and a dropdown showing the various types of items. So this means that I can filter an item based on partial name and also its "type". As you can see in the screenshot , there are lot of different types of entities ranging from documents , email, notes, chat conversations etc. A screenshot showing a search is shown below :

GNOME Activity Journal Search Items

Note that you can search items only in the multi view. When you enter a query and select the appropriate type, the journal highlights the selected files with a bold blue font. This is where I personally feel GNOME Activity Journal has dropped the ball. When you filter an item, it does not show a new screen which lists the match items in a timeline. Instead it maintains the same multi view and just bolds the filtered file. What is worse is that if I want to find if I had accessed the filtered file last week, I have to manually scroll. In one of the screencasts, it was claimed that when a particular day has a file that matches the filter, it will be highlighted in blue. I am not fully sure it works correctly.

There are multiple ways in which you can improve this page : For eg having separate time line for search results , or atleast highlighting days with matches in blue, using tracker/ fts plugin so that I can search the content, use tracker so that tags work in search etc. I am sure that these minor issues will be fixed soon. Till then you can use Sezen to work around the journal limitations. Look at the section on Sezen for additional details. If you want to do a full text search then use tracker. Please see the section on Tracker for additional details.

Tags And Related Files

Another neat feature of Zeitgeist is allowing you to tag files. I believe this is done using Tracker internally. To add tags to an item, right click it and select "More Information". This will open a new dialog like the one shown below.

GNOME Activity Journal Tags

You can see that tags for the file can be entered one by one on the textbox. You can also delete any previously added tags. In the same dialog, you will see an interesting feature – "Used With" . If I use the files in a group, then Zeitgeist will recognise it and show it. Of course, it might have some noise, but most of the times it is bang on. For eg, I usually use the file "gblognotes.txt" as a scratch pad where I jot down all my ideas , basic structure etc. "gblogpost.txt" is the file where the actual post is written. The other two ods files were used to track blog related statistics. They have lot of co-occurrence and thats why Zeitgeist recognised them. The last three are essentially noise which might have occurred because I used them concurrently. It should be interesting to see if these items will go off when they do not co-occur frequently.

Another neat feature is that any tags that get added here gets reflected in the file’s tracker property page. For eg, right click on the file for which the tags were added. If you had tracker, then you will see a new tab called "Tags". Browsing it you can see that the added tag is checked. As an example, in the screenshot below, you can see that the file has "blog" tag enabled.

GNOME Activity Journal Tracker Integration

Controlling Zeitgeist logging using Activity Log Manager

Sometimes you feel that the relentless logging of Zeitgeist is a bit too much. There might be three different scenarios .

(1) You want to delete some past event from Zeitgeist log

(2) You want to stop entire Zeitgeist logging for some time.

(2) You want to instruct Zeitgeist to never log certain (types of) files.

The first is easy to perform. Once an item is added to the journal, you can always right click it and say "Delete Item from Journal". This will remove it from the list. There is also an option "Delete all events with this URI". This deletes all the events corresponding to a certain file from the logs. The primary inconvenience with this method is that if you want to delete lot of files, then you have to go about it manually.

When this article was first written,  there was no elegant way to control the logging, short of coding it yourself. Recently, the developers released Activity Log Manager that provides a reasonably convenient mechanism to achieve that.

If you are using the Zeitgeist PPA , the software can be installed by

sudo apt-get install activity-log-manager

Once installed, it can be invoked by “activity-log-manager” from the command line. There are multiple use cases that are handled by this tool .

(1) Pause Zeitgeist logging temporarily

Sometimes, you may want to temporarily stop Zeitgeist from logging. For eg, sometimes, I grade students homeworks and do not want them to enter the logs. In scenarios like this, you can stop it by invoking “activity-log-manager” and clicking on the button that looks like a tick. In the screenshot below, it’s the button near “Logging Active”. This will stop the logging till you enable it or restart the computer (or log back in).

(2) Deleting Previous Zeitgeist Events using History tab

If there is some time interval within which you want to delete all events logged by Zeitgeist , you will be using the “History” tab. The log manager conveniently gives two options : One is to delete the events in the past few minutes/hours/days etc. The other is to give explicitly the date range. Most of the time this should do the trick.

There are some slight inconveniences though. If you want to partially delete events then you are stuck with using Activity Journal. For eg, if I want to delete few events from the last 15 minutes but not all then its not possible from here. The second issue is that the more general option for making Zeitgeist forget events only accept dates and not time ranges. For eg, I cannot currently delete events from say Jun 22 1 PM to Jun 23 4 PM . Hopefully this will be fixed in the future. The screenshot is below.

Zeitgeist Activity Log Manager History Tab

 

(3) Blacklisting Zeitgeist Events from an Application using “Applications” tab

If you want to prevent events from a specific application from entering Zeitgeist logs, then use the “Applications” tab. This tab allows you to add events from known applications. Clicking on “Add” button shows a dialog with known applications and selecting it prevents events generated from that application from entering the Zeitgeist logs. You can add as many applications as you want.

Currently, this shows only the applications that have .desktop entries. And it is not possible to add custom applications. The list of applications are not sorted. It has a rudimentary prefix match support. For eg, if you want to block Google Chrome typing a prefix like “goog” takes you to it. Typing a non prefix like Chrome does not seem to work. The screenshot shows the tab with the list of applications.

Zeitgeist Activity Log Manager Applications Tab

 

(4) Blacklisting  or Preventing Zeitgeist Events from a folder or file types using “Files” tab.

This is the final use case. Sometimes you may not want Zeitgeist to log events from some folder. Or may be you do not want Zeitgeist logging your music events. The “Files” tab allows you to do it.

The files tab is broadly split into two blocks. In the first block, you can block events from certain types of files – Like audios, text files, videos etc. I am not sure if you will ever want to use this broad a blacklist as it negates the use of Zeitgeist , but I am glad the developers provided this option.

The second block allows you to enter a set of folders such that any events under those folders do not cause Zeitgeist events. You can use the dropdown to select either few pre specified folders or use the “Other” options to select an altogether new folder. In the screenshot below, I have selected temp folder to be blacklisted. This is my scratch folder for my programming and do not want them to be logged as they will be anyway deleted soon !

Zeitgeist Activity Log Manager Files Tab

 

Hopefully, these options satisfy most of the potential use cases. Zeitgeist is a cool idea and once it has the log manager , it is even more cool !

Before we discuss slightly more techie stuff, let me discuss two other tools that work in conjunction with Zeitgeist and GNOME Activity Journal – Sezen and Tracker.

Sezen

Sezen is another neat utility that internally uses Zeitgeist. It is similar to GNOME Activity Journal in the sense that it also allows you to "browse" files. But it is more heavily oriented towards searching. To install Sezen enter the following command in the terminal :

sudo apt-get install sezen

Unfortunately, it does not have a menu option to launch and must be invoked from commandline. Of course, you can always add an launcher. To invoke it , type in a terminal :

sezen &

This should start Sezen. You can notice that the screen looks remarkably pithy. It just has a textbox to enter query and few options to narrow down the filter. When you enter a query, all the results are shown organized by time. All files accessed today, yesterday, last week, last month etc are grouped in a temporal fashion. This is kinda the interface that I want Activity Journal to sport. Sezen also has a more sophisticated search than activity journal. As an example, I entered my query as blog. Files like "gajSezen.png" are selected even though it does not have the word "blog" in its name. The reason is that I have placed these images in a subdirectory of "blog" folder (ie blog/gaj/gajSezen.png) . This is very useful because you enter some search query for a directory and find which files you accessed recently and when. Neat !

GNOME Activity Journal Sezen Search

Of course, there are lot of places where Sezen can improve – I do not think Sezen uses tracker’s full text search. It would be awesome to merge temporal, folder, content information and provide an unified search interface. Even better will be merge it with GNOME Activity journal. Similarly, it is not possible to select all images and documents. The filters behave like exclusive ones. If they can behave like checkboxes then it will be cool !

Tracker

Tracker can be considered as a search engine for your local file system – in other words a desktop search utility. So far all Linux desktop search utilities suck. The recent versions of Tracker seem to be okay. GNOME Activity Journal uses tracker for search. Tracker can index files in your system and also their content. It has a full text search (fts plugin) that allows you to search based on their content,name and path. It can index a variety of file formats. One limitation of GNOME Activity Journal and Sezen is that they do not perform full text/content based search. If you want to find all the files that contain the word say "Gaussian Processes" then tracker is the way to go . Tracker is a dependency of Journal and must be installed with it. You can access it from Applications -> Accessories -> Tracker Search Tool.

GNOME Activity Journal Tracker Search

You can find that Tracker interface is remarkably similar to GNOME Activity Journal or Sezen. I have given a search query of blog and you can see that not only it displays files with the word "blog" in their name but also the files which have the word "blog" in their content. So you can filter the results based on their file type : like documents, images etc

Now that we have covered the basics of the tools, lets delve into the details.

Data Providers

There are lot of tools that send their data to Zeitgeist without you doing anything on your own. For other applications they must be patched so that the data can be sent to Zeitgeist. Note that the information transfer can happen both the ways : Applications can send the files accessed to Zeitgeist and they can also get information about the file usage. eg Rhythmbox can use Zeitgeist to find the most used music files or the music files that are listened together. The potential is endless.

Lot of the applications though must be modified to send the data to Zeitgeist. Previously, there was a bunch of scripts that you must download to patch the applications to send their events. Now these scripts have matured and have become Linux packages on its own.

To install data providers, start synaptic and enter “zeitgeist-datasource” in the search window. You can see a huge list of applications for which providers are available like Vim, Emacs, Rhythmbox etc. Install the data sources for which you want the events to logged .

 

Zeitgeist – Docky Integration

If you are using Docky to have a jazzy dock in your system then you can make it even more cool by integrating it with Zeitgeist. To do that right click on Docky icon and select Settings. Go to the Docklets tab and enable the Recent Documents docklet. Go to Helpers tab and enable "Zeitgeist Integration" and "Zeitgeist Journal".

Now when you right click on any application icon in the dock (whether they are running or in dock already) you can see two new menu items : "Most Used Items" and "Most Recently Used Items". So if you want to open a file in gedit, right click the icon and select the file from the most used list and watch it open ! If Docky makes life easy, Zeitgeist integration makes you feel the joie de vivre.

Techie Stuff

1. If you are curious about the event flow, you can run Zeitgeist daemon in the command line. It outputs lots of verbose output and I learned lot about its workings from it. For eg in a terminal enter the following and go about your business. The logs will be displayed in your terminal.

zeitgeist-daemon –quit

zeitgeist-daemon &

2. Zeitgeist, GNOME Activity Journal, Sezen are all written in Python and are relatively small projects. Spend an evening skimming through the source files.

3. If you want to find how activities are stored internally check out the folder ~/.local/share/zeitgeist/. Specifically, take a look at the file activity.sqlite .

4. All the black listed items are encoded in JSON format in the file /home/neo/.local/share/zeitgeist/blacklist.json .

Potential Applications

The post Integrating Zeitgeist into GNOME contains lot of excellent comments that indicate the potential applications of Zeitgeist. I have copied my favorite comments verbatim from there :

1. Imagine that smart playlists are powered by zeitgeist. You would get a whole slew of new options like "Songs I listen to while chatting with Babes" or "Songs I never listen to in the office".

2. Show you top 20 most listened song for the week/month/year and also show songs you never listened too.

3. If both Rhythmbox and Banshee would have been integrated with zeitgeist, we could have had (for an example) a playcount synchronised for every song. It would be useful when creating new dynamic playlists.

4. Software Center in Ubuntu can display the application usage count. For eg, this can indicate unused applications to customer which can be uninstalled to free space. Alternatively, you can collect apps in to groups and use the co-installation and usage count to recommend new packages to users. Isn’t it cool !

Summary

Zeitgeist , GNOME Activity Journal and Sezen are few of the GNOME utilities that I am pretty excited about. Even though their current features are limited, they have enormous potential and can be used to develop really cool applications. I have few plugins in my mind – for eg enhancing GNOME Do with Zeitgeist and few other plugins. I will write a post once something concrete is done.

Each of the tool has its own use. So use GNOME Activity Journal for finding which files you accessed when (even at granular level like which hour). If you want a more enhanced and generic search use Sezen. If you want to search based on their content then use Tracker.

Resources

1. GNOME Activity Journal – Contains lot of useful links and the usecases.

2. Zeitgeist – The magic tool behind GNOME Activity Journal and Sezen.

3. Sezen – No specific URL. Lot of useful posts in the link.

4. Tracker – Another neat project that GNOME Activity Journal internally uses and provides full text search.

5. Seif Lotfy’s blog : Has lot of useful news on Zeitgeist.

Read Full Post »

I am an absent minded person and use tasks and to-do lists extensively to maintain my sanity. I use a collection of tools to keep myself organized . I have talked about two of them already : Hamster for Time Tracking and Sunbird for reminders . Task Coach is the third tool I frequently use.

Task Coach is a very powerful task/to-do list management tool . There are many cool things to say about it – It is cross platform and hence you can use the same task list across OSes. It is even available for IPhone and IPod Touch ! It has an extensive set of functionalities and lot of ways to customize the app to suit you.

Task Coach Or Sunbird

There are multiple tools to maintain to-do lists – like Google tasks, Remember the milk , Sunbird etc. Each of them have its own set of neat features. One of the main reasons I use Task Coach is that it is desktop based. Web based to-do apps are cool and portable etc , but they do not offer the extensive set of features that Task Coach has. Also, I spend most of the time in front of my laptop and do not use any smart phones – So a desktop task manager seemed like the perfect option to me.

That narrows the choice between Task Coach and Sunbird. I use both of them extensively. The rule of thumb for me is that , if the task is very simple and needs a reminder then use Sunbird . This includes things like calling my family in India regularly, wishing my friends on their birthdays correctly, doing some regular system administration tasks each week etc. Each of the tasks are straightforward and have a simple structure.

I use Task Coach for more complex tasks. I use Task Coach if the task at hand has sub tasks – Or if I want to track the number of hours I spent on this project. (I also use Hamster to track the timing but it is easier to store the information along the task). I also use Task Coach when I want to categorize my tasks.

Installation

If you are in Ubuntu, you can use apt-get to install task coach.

    sudo apt-get install taskcoach

If you are in other operating systems (Linux or Mac or Windows) , you can download the appropriate installation file from Task Coach’s download page .

If you are in Ubuntu, you can start Task Coach from Applications -> Office -> Task Coach. I guess the process is similar to other operating systems.

Playing With Categories

Categories is one of the important features in Task Coach. You use Task Coach to stay organized – but that does not mean your to-do list can be unorganized. You can use Categories to group your tasks in to appropriate bins. Task Coach has multiple neat touches that makes using Categories a breeze.

Creating a New Category

To create a new category, use Category -> New Category. If you have the Category viewer (more on this later), you can use it to create categories faster. Once you do that you will see a Categories window which has multiple options to create a Category.

The first tab is the Description tab. It has fairly straightforward options. You can enter a title and description. Additionally , you can specify if the sub categories are mutually exclusive. This means that if this category has two sub categories, then a task can belong to only one of them.

 

Task Coach Category Description

 

The next tab is the Notes tab. Categories in Task Coach are complex objects and can contain multiple notes . I consider notes as additional information to the category but which are not really tasks. For eg notes can include email Ids or Phone numbers, preferred way of contacting etc.  As seen in the picture below, a category can have multiple notes.

 

Task Coach Category Notes

 

The third tab is the Attachments tab. In this you can attach additional resources needed for the tasks. This can either be local resources like files. Or it can be remote resources like URLs. I typically use this feature to point to folders that contain the necessary relevant resources.

 

Task Coach Category Attachment

 

The last tab is that of Appearance. If you are using Task Coach extensively, you will amass a long list of categories and tasks and you will need a fast way to eyeball them. Appearance to rescue. This tab allows you to create custom foreground and background colors to the category. You can also differentiate them by varying icons and font but I usually find that colors do the job.

Task Coach Category Apperance

 

Advanced Categories Stuff

Creating categories is just the first step in using Task Coach. As you use Task Coach more, you will notice that you want to allocate tasks to finer categories. For eg, I had a single category called Research where I put most of my tasks. As my defense gets closer, I created two sub categories – one for Bayesian networks , the topic of my research and another for my thesis. What is more, I can set up notes,attachments and colors for each sub category which allows me to group them together.

Tasks

Tasks are the meat of Task Coach. Tasks in Task Coach are complex objects with lot of features. I will try my best to introduce most of the important features.

Once you created categories (and subcategories), the next step is to create tasks within them. To create a task, select Task -> New Task. (Ctrl + insert for keyboard addicts). You will see a new window with lots of tabs. If you feel it is cluttered, it is. But it also gives you enormous flexibility and power. The Description tab is fairly straight forward. One important field in this tab is that of Priority. You can assign different levels of priority to a task. By default, Task Coach orders the tasks based on their due date and priority. Priority is very important if you have multiple tasks in a category or multiple sub task inside a task.

The next tab is the "Dates" tab. This gives some options to specify when the task starts , ends and actually completed. Task Coach also has options to create reminders like Outlook or Sunbird. Again, you can set a task to recur based on some pattern and you will use "Dates" tab for doing it.

Task Coach Task Dates

 

The Progress tab is used to describe what percentage of task is completed. The "Categories" tab allows you to assign the task to some Category. Task Coach allows a task to be in multiple categories/ subcategories at the same time. For eg, the test task I created is in all the categories I created. Note that if you have set your subcategories to be mutually exclusive, then the task can belong to only one of them.

Task Coach Task Categories

 

In my opinion, "Budget" tab is misnamed. It allows you to do two things. It allows you to assign the maximum amount of time you allow yourself to do this task. For eg, I can give myself 10 hours to a task. You can track your time spent on this task and it keeps a track of your "time" budget. It also has a "Revenue" option which allows you to calculate how much money you have earned or should charge the client. In the screenshot, I have set myself a 10 hour budget. I have spent 2 hours already on the task which leaves 8 more hours. I charge $100 to the client and this means, the client has to pay me $200 as of now.

 

Task Coach Task Budget

 

The "Efforts" tab is one of the most important tabs. It is highly useful to store the time you spent on the task. Basically an "Effort" is the time you spent on the task. There are two ways to enter an effort for the task : Manual and automatic. You use the Effort tab to enter efforts manually and also to verify the effort you spent so far in the task.

This was the way in which I entered the detail that I spent 2 hours in the test task that I created. For each task, you can have as many efforts as you want. Task Coach also has a convenient way to see all your effort details (or even group per day/week/month). The Efforts tab work in conjunction with the information in Budget tab. If you set any budget/revenue, it gets reflected in this tab.

 

Task Coach Task Effort

 

The Notes, Attachments , Appearance tabs are straight forward. You can attach multiple notes / attachment to a task. See the discussion in Category for additional details. You can also set a task to have a foreground/ background different from its parent categories. For eg, I set my test task to have an orange color even though the individual categories used different foreground colors.

Of course, once a task is created, you can edit it by double clicking it. You can increase/decrease its priority , mark it as completed etc. You can add notes or attachments.

Efforts

Efforts are an important topic that I want to discuss it again. Basically, an effort is amount of time you spent on a task. You can specify an effort on a task automatically or manually. If you are doing a task NOW, then you can start the effort tracker. There are multiple ways to do that : Easiest is to right click on a task and select "Start Tracking Effort".  Alternatively, you can select Effort -> Start Tracking Effort .  When you stopped working on a task , you can stop tracking effort in the same way as you started the effort.

The manual way to specify a effort happens when you want to make an entry in Task Coach , the time spent on the project at some time in the past. Again, there are two ways to do that – If there is a single effort to add to task, the easiest way is Effort -> New Effort. This will open a new window, where you can select a Task and add Start and End times. If you are going to add multiple efforts for the same task, then the easiest way is to double click on the task and open the edit task window. Go to the "Effort" tab and add multiple efforts to the same task.

Templates

Templates are one of the neat ideas in Task Coach. If you notice that you are entering similar details in task then it is time to create a template out of a task. A sample scenario is this : Lets say, I create tasks t1, t2. Both of them need same notes, attachments, colors, revenues etc. You can manually enter details for each task individually. Or you can create a template from the task and then use this template to create new tasks.

Lets say you have a task t1 which contains the settings that you want some future task t2,t3,t4 etc to contain. The first step is to create a template out of t1. So click on the task t1 and select File->Save Selected Task as Template. It will ask you to enter a name for the new template. Enter some meaningful name. When you want to create tasks t2,t3 etc , go to Task->New Task from Template and select the template you saved. This will create a new task with almost all the settings inherited from the old task t1. A very neat functionality !

Task Manager

I used the name Task Viewer as the generic name for the primary window of Task Coach. You can see my sample window here.

Task Coach Task Viewer

 

You can see two important panes – One which shows all the tasks and other is the category viewer. The primary pane is where all your tasks are shown. It shows by default the most important attributes of the task – Title, Categories, Start and Due Date. If you want , you can alter the attributes it shows from View -> Columns. There are two primary views of the tasks pane – Tree and List view. You can use the drop down near the tool bar to toggle the views.

You can use the category pane as a filter to show only the tasks from a selected set of categories. For eg, if I want to see only tasks from my Thesis category, I will check that category and uncheck all others.

Task Coach has lot of very useful "views". To access them select View->New Viewer and select the viewers available. My favorite viewers are the category , calendar and effort. These are alternative ways of looking at your tasks and very useful.

Task Coach also has a filter option to select a subset of events based on some condition. For eg , you can hide completed or overdue tasks. You can see all tasks that are due next week and so on.

By default, the tasks are sorted by Due Date. You can alter that from View –> Sort and selecting the field.

Preferences

You can access Task Coach’s preferences from Edit->Preferences. Most of the preferences are the sensible ones. One change, I will suggest is Files->Auto Save after every change. Some times, I make the changes in Task Coach but forget to save them. Since I use AllTray to hide them to panel, some of the changes are lost during shut down.

Syncing/Sharing Task Coach To-Do Lists

Task Coach is available in all major operating systems. Lot of time , you will want to sync your task / to do list across OS or machines. There are many different ways to do it.

1.If you want to share across operating systems in the same machine, then the easiest solution is to put the tsk file in a common folder and let the Task Coach in individual OS access the same file.
2. If you want it to be accessed across machines, you can use services like DropBox or Ubuntu One. Just mark the folder containing the tsk file to be synced . Repeat the same process in the next machine. Now changes in each machine will be reflected across machines.
3. Task Coach supports SyncML. You can sync it using any Funambol server. A list of the available server is at the wikipedia page for SyncML.
4. Use Task Coach Portable. Store the files and the program in a USB disk and carry it wherever you go.

Misc Stuff

1. It look a while for me to figure it out . But Task Coach has support for drag and drop. This means you can drag and drop files to create attachments.
2. You can export tasks, categories as HTML or CSV. If the task contained efforts, then they can be exported as ICS files.
3. You can print list of tasks or email them .
4. Task Coach internally uses the tsk file which is nothing but xml. I do not see any reason to tinker with the raw data, but I can think of lot of additional data mining that can be done using the information.
5. Task Coach has a portable edition which can be used to have tasks on the go.

Potential Usage Cases

Task Coach is a very flexible and powerful application. This means it is possible to have multiple use cases. I have explained how I use it at the start of the post. If there is some complex task with lot of sub tasks , I use Task Coach. It allows me to track my progress and do some useful annotation on the tasks. It also allows me to simultaneously do multiple tasks at a time. I also have multiple categories for handling different scenarios. For eg, I have categories for my blogging, research, self development, programming projects, my course work , long term things  etc. The flexibility that Task Coach provides is amazing.

I also work as a Graduate Research Assistant (GRA) in my university. I use Task Coach as a pseudo project management and tracking application. So whenever I get some email on a task, I make an entry in Task Coach and add the email text as description. Since it also has effort tracking and priority, it makes an excellent project management and tracking tool.

I know a friend who uses Task Coach to work as per the GTD (Getting Things Done) methodology. Since Task Coach is very flexible, it is a simple matter of creating appropriate categories and subcategories to get GTD going.

Useful Resources

1. Home Page of Task Coach.
2. Task Coach Screen Shots .
3. Task Coach download page.
4. Task Coach : FAQ1 and  FAQ2 .

Task Coach is a very powerful tool for maintaining to do lists and task management. At first, its interface might look cluttered or even worse unintuitive to beginners. But trust me, it is this flexibility from which Task Coach derives its power. You will start loving it once you get a hang of it. Have fun with Task Coach !

 

Add to DeliciousAdd to DiggAdd to FaceBookAdd to Google BookmarkAdd to RedditAdd to StumbleUponAdd to TechnoratiAdd to Twitter

Read Full Post »

This week , instead of writing a new technical post, I spent some time improving the quality of old posts. I did some analysis of search terms used to access my blog and updated the posts which I seem did not fully answer the user’s query. This can be as simple as adding a FAQ, adding new sections or providing links to better resources.

The post on Empathy Chat Messenger Tutorial got some extra love. I added a FAQ and also updated the section on group chats. I also rewrote other sections. So you may want to take a look at it too !

Read Full Post »

Sunbird and Hamster are two applications by which I get most of work done. I have already talked about Hamster at Time Tracking in Linux using Hamster . In this post, I will talk about Sunbird and Lightning.

Sunbird at its heart is a simple stand alone calendar application. You can manage tasks , add events and reminders and sync calendars. Lightning is a Thunderbird extension which gives access to all of Sunbird’s features from Thunderbird. So , once you are comfortable with one of sunbird/lightning , it is very easy to work with the other.

The decision to select one is primarily based on whether you want a stand alone or Thunderbird extension. In my case, I wanted a stand alone calendar application. I was subscribed to multiple online calendars (Google, Exchange, my university’s event calendar etc) and it did not make sense to integrate all of them with Thunderbird. Also, Lightning’s remainders were not playing well when you minimized Thunderbird using AllTray . With Lightning 1.0 and Thunderbird 3.0 , the problem is no longer there but I had become used to Sunbird.

Note : Mozilla foundation will not add any more new features to Sunbird and will focus primarily on Lightning extension for Thunderbird. That is not a big deal as Sunbird, as it exists , is a very stable application. Also most of the discussion here applies to Lightning too. So if you decide to go with Lightning instead of Sunbird, the instructions in this post will still work.

Sunbird Installation

Installing Sunbird is very easy. If you are in Ubuntu (Lucid or something older) , you can use apt-get to install it.

    sudo apt-get install sunbird

I think the instructions for other operating systems is very similar. You can also check out Sunbird’s download page for more details about installing.

Sunbird Tasks

Tasks are one of the important tasks in Sunbird. You can consider a task as anything that should be completed by some due date. Tasks are very similar to Events and the difference between them is mostly pedantic. Tasks have a start date, due date, recurrence and reminders. Tasks have some additional information like the current status and completion percentage . Sunbird will very helpfully color code your tasks based on their status and due date. You can also optionally hide all the completed tasks. Also, you can classify your tasks using "Category" field and assign it to one of your local or online calendars, provided you have appropriate providers (more on that later).

If you do not use tasks much, you can always hide it by unchecking View -> Task List. (And vice versa).

Sunbird Calendars

Calendars are one of the basic ideas in Sunbird. Calendars can be local (residing in your hard disk) or online (eg Google Calendars, Outlook Exchange server or even Remember The Milk). You can optionally have more that one calendar. For eg, I have multiple calendars – one for my personal stuff, one for my research, one for my university’s events etc. It is always a good idea to have multiple calendar – one for each purpose.

Sunbird Local Calendars

The simplest type of calendar is the local calendar. To create a new local calendar, File -> New Calendar (or Ctrl + L). Select "On My Computer" for local calendar. Click Next. Select a name for the calendar and a color by which the events in this calendar will be highlighted. I usually find color coding of events is very useful when you have multiple calendars and you skim over them. Click Next and then select Finish. Your local calendar is now created. All the local calendars will be listed  at the left hand corner of Sunbird.

Sunbird Online / Remote Calendars

The other important type of calendars is the online / remote calendars where some server publishes the calendar and Sunbird acts as a client application. (Some thing like Outlook does for Exchange Server). Sunbird is versatile as it supports a variety of calendar formats (ICS, CalDAV etc). It also allows you to plug in providers if your calendar server has some different format. To add a remote calendar , File -> New Calendar -> On the Network -> Select protocol and give URL -> Next -> Select colors for this calendar -> Finish.  Some of the popular remote/online calendar providers are :

a. Google Calendar : Adding Google Calendar has become very easy recently after Google added CalDAV support. Follow the instructions at Enable Google Calendar in Mozilla Sunbird  . You can also check out Google Calendar Provider  plugin if the first instructions did not work out.
b. Outlook/Exchange server : There are two cases here. The first case is you want to move some of your outlook appointments to Sunbird. In this case, you can export your appointments into a csv/ical file from Outlook    and import it into Sunbird using File->Import .

The other scenario is you want to sync to a Exchange server. I never found a good solution to sync Sunbird and Outlook/Exchange. I finally used a indirect way to achieve it. The basic idea was to sync Exchange and Google Calendar using the instructions at Getting started with Google Calendar Sync. Then use Sunbird to sync the events from Google Calendar as discussed above.
c. Apple iCal : Lot of Apple’s apps use iCal format and it works very well with Sunbird as it supports ICS. You can import the ics file and create a new calendar.
d. Syncing with Smart Phones (IPhone / Android / Blackberry etc) : The basic idea is same. Google has apps in each of the smart phones to interact with google calendar. So use the app to sync the smart phone and google calendar. Make Sunbird sync with Google calendar.
e. Other Providers : Other calendar servers may have different format. Sunbird has lot of provider add-ons which can import/sync calendars to Sunbird. See the list of these providers  . Probably the most common is Remember the Milk. If you are interested in RTM, then check Remember The Milk’s instructions to sync tasks/events.

Other Calendar Operations

Sunbird has other calendar operations other than creating it. You can import events from a calendar file (typically ics/ical). You can export Sunbird’s calendar events and import it to other applications like Outlook. You can also publish your calendar to your own CalDAV server as an ics file. The other cool stuff is to Subscribe to be a remote calendar. This is useful if you want to follow some organization’s public schedule. For eg, I follow my university’s event calendar. For Apple’s fan boys,  they provide their events as an ICS calendar.  All these operations are available from the File menu.

You can also delete a calendar by either right clicking on it and selecting "Delete Calendar" . Online calendars are refreshed every few minutes – so if you want to get the latest events NOW, do File->Reload Remote Calendars (or Ctrl+R) .

Creating Events and Reminders with Sunbird

Once you create a calendar, the next thing to do is to set up some events and reminders. If you have multiple calendars, select the calendar in which you want the new event to reside in. File -> New Event (Ctrl+N) . This will bring up the event dialog window. You can enter the title/location of the event , the category of the event (some birthday or meeting etc) and also optionally change the calendar.

The other fields are pretty intuitive if you have used other calendar applications like Outlook. You can have very flexible (custom) recurrence and remainders which makes scheduling events pretty powerful . Sunbird also has a basic event scheduling features. When you create a new event , you can invite additional participants and check their conflicts. Again, you can make this event as public or private which is very important for online calendars like Google Calendar. All these options are available from the "New Event" dialog. There are additional options available to control the event/appointments in the Options menu of the New Event dialog.

Sunbird will show a reminder for the event at the time you have set . You can snooze the reminders or dismiss it. Sunbird can show reminders only when it is running. So I usually start it at bootup and also minimize it using AllTray. You can find the instructions at my AllTray Primer.

Advanced Stuff

If you want to play around with Sunbird’s internals – most of the stuff is present at ~/.mozilla/sunbird/<profile name> . The calendar information is usually at storage.sdb . This is a SQLite file and you can play around with it. The database schema is a bit unintuitive but you will have fun figuring out how all the stuff are organized – Try finding how Sunbird stores recurrence, remainders and other stuff like attachments.

Sunbird also has lot of extensions (or addons). You can the entire list at Sunbird’s addons page. One of my favorite addon is FoxClocks which allows me to find out times at other countries/time zones fast. This is especially needed in US as I never correctly know the time zone differences across texas/new york / california/ seattle etc. To install an addon, download the xpi file. Tools -> Addons -> Install and select the xpi file. Restart Sunbird to apply it.

Sunbird also has lot of themes. If you are not satisfied with the default theme , you can find new ones at Sunbird’s Themes page. To install an addon, download the theme file. Tools -> Addons -> Select Theme tab -> Install and select the theme file. Restart Sunbird to apply it.

Lightning Extension for Thunderbird

If for some reason you do not want to use Sunbird as a stand alone application and want to use it along with Thunderbird, then you can install the Lightning extension. The extension can be downloaded from its official homepage. If you are in Thunderbird 3 , then you can install it by Tools -> Addons -> Get Addons tab. Type "Lightning" in the search box. Install the Lightning extension. You may want to restart Thunderbird for applying it.

Note that the above steps only works if you are using a 32 bit version of Thunderbird. If you are using 64 bit computer then you need to manually download the extension file from Mozilla’s page. Go to Mozilla’s Lightning release page, select the latest stable version and select your OS. Download the lightning.xpi file. To install it , Tools -> Addons -> Install and select the xpi file and you are all set.

Once you install Lightning, there are two ways to use it. The first way is as a side pane. Enable the today pane at View -> Today Pane -> Show Today Pane (or F11) . You can cycle around through different views in Today pane (only tasks/only events or both ). This is probably the best way as it conserves space.

If you want to do lot of changes in your calendar, then it is a good idea to switch to a Sunbird-ish view. If you look at Thunderbird , at the top right corner, there will be two innocuous looking icons – One looks like a calendar and other like tasks. Clicking on them opens Events and Tasks in different tabs. People using Sunbird will be immediately comfortable with this interface.

Sunbird and Lightning are really cool applications. Have fun with them !

References

1. You can find lot of information at Sunbird’s  Home page.
2. More details about Sunbird can be found at its FAQ page.
3. Lightning’s release page is here.

 

Add to DeliciousAdd to DiggAdd to FaceBookAdd to Google BookmarkAdd to RedditAdd to StumbleUponAdd to TechnoratiAdd to Twitter

Read Full Post »