12/04/2011

While Epiphany is the default browser of GNOME, and it’s a great browser (I use it from time to time), Firefox is still my brower of choice, especially since it’s so extensible.

One of the very interesting features that came with Gecko 2 (the “engine” powering Firefox 4, Thunderbird 3.3, Seamonkey 2.1) is ctypes, a feature which «makes it possible to call C-compatible foreign library functions from JavaScript code without having to write your own binary XPCOM component». Many «desktop» runtimes (gjs, python) already allow that, but not having to mess with XPCOM, IDL and friends to get the same in Firefox is a huge plus!

Wanting to experiment with this feature, I wrote a very small module to export your bookmarks to Tracker. There no UI or bells or whistles, it just sits in the background and does its job. Because it’s pure Javascript, there’s no compilation involved, just install the plugin and you’re good to go. Now, why would you like to export your bookmarks to Tracker? Well, I’ve also pushed a branch called “needle-bookmarks” which, guess what, allows the Tracker search tool (aka needle) to query bookmarks too! And it’s just a matter of time before you get that into the search of the Shell overview…

Obligatory screenshot

How to get the code

1. Clone git://git.mymadcat.com/tracker-firefox
2. Generate the XPI with git archive --format=zip HEAD > tracker-firefox.xpi and install it in Firefox
3. Get the needle-bookmarks branch of tracker (hopefully merged into master soon) from its git repository
4. Search your bookmarks

Future ideas

I think it would be interesting to extend the plugin to add a history observer that would log events to Zeitgeist… Zeitgeist already has a Firefox plugin, but unless it has been fixed since last time I checked, it’s not working with Gecko 2. We’re in any case working more and more together with the Zeitgeist guys to make sure the Gnome 3.1 search experience will be greatly enhanced!

Fantastic! Always excited to hear about new tracker plugins. Something I would really like to see is the ability to index all pages I visit(including content). Yes it would be a massive index but I can’t tell you how often I’ve forgotten a website and Firefox’s search proved inadequate. Greer…
Anyway please try and convince the GS guys to require Tracker. As it stands now the search bar is anemic when it comes to files and since they made file browsing so hard to get to…

Adding full page indexing is actually quite tricky, since it’s hard to answer the question «what is the text of that web page?». What is the text of your gmail inbox? What is the text of twitter.com? That could be «solved» by adding a blacklist of pages to the plugin preferences.

That said, it would be a pretty cool feature that I’d like to have too, I guess if I come to that I’ll have to define a «time validity» parameter, so that old pages (the ones you didn’t access in a long time) are pruned, to avoid cluttering the DB too much. This is also a use case which maybe belongs to Zeitgeist, maybe not… The line is thin sometimes

Tracker is an external module of GNOME 3 (I think), so we’ll try to integrate there as much as we can.

Obviously certain pages would be difficult (no flash!) but a first attempt that simply indexed, say, the first 1000 words of character data would be useful. For other pages, you mentioned gmail, context obviously matters most but I think tracker can parse HTML and something like a whitelist could be used to provide proper directions for tracker’s ontology(I think there is an nie:contact, or something) to kick-in.
Providing a paring mechanism of some sort would be necessary but perhaps instead of removing old entries they simply get compressed and archived for awhile only to be checked upon deep searches(does tracker have this ability to support multiple DB contexts?).
Whatever the means, this would be a great feature.

Never mind bookmarks – make it export the browsing history. I haven’t used bookmarks for years, because the awesomebar makes them completely unnecessary – I just remember some word from the URL or title of the page I want to visit, type it, and pull it out of the awesomebar…

I actually have a very similar worflow (I only bookmark pages if I know the page title is not good enough for the awesome bar to retrieve it later).

Seif and I are currently working on making Zeitgeist fetch results from Tracker, so what we could have is bookmarks in Tracker («permanent» data), history in Zeitgeist («moving» data), and a unified interface fetching both and mashing the results together. That is not science fiction, that code is already partly there, but I don’t want to spoil Seif’s next blog post

Since you’ve had some success using ctypes to extend Firefox, would you consider looking at gnome-keyring support? Firefox desperately needs integration with gnome-keyring, either by storing a master password in gnome-keyring and unlocking it automatically (which will then encrypt the password store in Firefox) or by storing all passwords in gnome-keyring and providing a migration mechanism.

That’s one feature I’d like to have too, would be interesting to see if any gnome-keyring dev is interested in doing that… I think your first solution is better (storing master password in gnome keyring), since it still allows Firefox Sync (ex. weave) to sync your passwords with other devices… One would also have to check if the “master password” feature is exposed through JS in Gecko…