Jump to content

Firefox autocomplete workflow


Recommended Posts

Hello fellows Automaters,

 

I wanted to share with you the Workflow I just created using Alfred. I wanted to be able to autocomplete my Firefox bookmarks in real time. All the existing workflows I have found seemed to be more or less broken because they rely on things that have changed (more info at the end of the post)[1], so I decided to write something that would do what I wanted. After some hair pulling and doc reading, I managed to have that running.

 

It's 4 pieces of code to glue together:

 

- a Firefox extension, Sync bookmarks to disk      that monitors changes in the bookmarks. When something changes, it invokes what's called a Native Application, and pass all the bookmarks to this Native Application. It has not UI (yet?) and works automatically. If you don't perform the second and third code setup explained below, it will fail silently.

- a Native Application manifest to install inside Firefox settings. It will allow the extension to actually invoke a Python script outside the main Firefox process and write a file outside the internal browser sandbox.

- the Python script that is invoked by the Native Application, it should be made executable and placed somewhere on your drive. It receives the data from Firefox and save it as is in /tmp/bookmarks.json. You can even look at this file and find your workflow on the first steps have been done.

- and finally an Alfred Workflow, that reads the file dumped by the python script, do a bit of transformation and populates the autocomplete popup.

 

The end results looks like this:

- add a bookmark to Firefox

- invoke Alfred, type "ff" followed by the words of the title of your bookmark and it should appear

 

All these parts are available at https://github.com/octplane/firefox-bookmark-to-disk  and pretty much any of these can be modified to your liking. The documentation is pretty rudimentary so please tell me if some parts need explaining.

 

This is my first real contribution here and to the Alfred ecosystem, so feel free to indicate me if there are better ways to publish and package that (apart from doing an actual Macos installer :D)...

 

Thanks!

Pierre.

 

1: it seems that the places.sqlite file is now actively locked by Firefox and it is not possible to open it when the Browser is running. It results in the dreaded `Error: database is locked` from the one that tries to read the database.

 

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...