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.
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
the manifest, with a bunch of metadata, as well as the “browser-action” section, declaring that the extension wants to have a toolbar button.
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.
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.
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 :)
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: