New “Add to OmniFocus” extension for Firefox

Hello,

I made a new Firefox extension to capture web pages into OmniFocus: https://addons.mozilla.org/en-GB/firefox/addon/add-to-omnifocus/

The source code is here: https://github.com/mikl/add-to-omnifocus-webextension

What does it do?

It adds an OmniFocus icon to the toolbar. When you click it, OmniFocus’ Quick Entry window opens, pre-populated with the title and URL of the current Firefox tab.

This is necessary, because the current Clippings service on macOS does not capture any information from Firefox, so you’d have to fill in title and URL by yourself.

Down the line, I plan to add support for keyboard shortcuts as well.

Why would you use this?

If you ever want to turn a web URL into a task in OmniFocus, this saves a good deal of time.

If you’re required to use a browser-based ticketing system like JIRA, this can help bridge the gap between that and your OmniFocus.

Why did I not use the existing extension (AddToOmniFocus2)

While that still sorta works, it needed an update for OF3. Since I wanted to add more features than that currently has, and I did not want to take over the old code, I just created my own.

Hope this is useful to you :)

6 Likes

I just added it and used it. It works like a charm. Thank you, Mikl!

Thank you so much for doing this - it pulled it so well! Gave ya a 5 star rating! And, Thank You for choosing Firefox!!! :D

As someone who wrote a Firefox extension 15 years ago, tell me how the writing experience was.

The new WebExtensions API makes it pretty simple, at least if you’re not doing anything fancy.

The two important parts of this particular extension are

  1. the manifest, with a bunch of metadata, as well as the “browser-action” section, declaring that the extension wants to have a toolbar button.
  2. the background script that is a little bit of JavaScript defining what happens when the button is clicked (get the current tab, extract URL and title, open OmniFocus via the omnifocus:/// URL handler).

That’s about it, really.

As I understand it, the WebExtensions API is less powerful than the old one, but it’s very easy to wrap your head around if you already know JavaScript and DOM.

1 Like

Oh, and if anyone wants to learn extension development, the extension examples in particular are very good: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Examples

And Mozilla’s WebExtensions developer documentation in general: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions

The WebExtensions API is not cross-browser per se, but there’s a compatibility layer that makes it possible for a WebExtension to work on Chrome-based browsers, I’ll add that to my extension eventually to make it available on Chrome/Chromium/Brave/Edge/Vivaldi/etc.

1 Like

Thank you!

Curiosity – on the for ... .push in that snippet:

You don’t prefer .map ?

True, a .map would be a neater way of writing that.

for … of is just my instrument of habit, because it is more flexible and performs better for large amounts of data (due to not creating a closure (and thus extra garbage) for every iteration), but in this case, neither concern is relevant, so I’ll shorten it next time I touch that code :)

1 Like

Happy to report version 1.1.0 of the extension is live.

The main attraction is a right-click context menu item on links, that allows you to add said link as an OmniFocus task without having to open the page first:

Full changelog here: https://github.com/mikl/add-to-omnifocus-webextension/blob/master/CHANGELOG.md#110-2020-04-30

@mikl Thank you so much for this. I was just scouring the web, page after page, to figure out how to do exactly this. Again, many thanks!