proginosko / LeechBlockNG

LeechBlock NG (Next Generation) for Firefox is a simple productivity tool designed to block those time-wasting sites that can suck the life out of your working day. All you need to do is specify which sites to block and when to block them.
https://www.proginosko.com/leechblock/
Mozilla Public License 2.0
716 stars 65 forks source link

Possibility for external programs to lockdown (API?) #246

Open dylanmorroll opened 2 years ago

dylanmorroll commented 2 years ago

I'm not sure on the ins and outs of web development and what Firefox supports, so I'm unsure if this is possible, but it would be nice if external programs could trigger LeechBlock to enter/exit lockdown mode.

For example, I use a simple timer for GNOME that switches between a work mode and a break mode. It would be cool if I could wire it up, so when in work mode it would activate a lockdown, and when it break mode it would deactivate it.

I'm not sure how this would work. Perhaps it could expose an API which could be called from programs outside Firefox? But I'm not sure if Firefox allows this.

I'm interested to hear your thought and insights.

Mirr0red commented 2 years ago

A quick search led me to this page: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging, which is probably what you are looking for, but it would require an app running in the background. I'm not experienced with WebExtensions or anything like that, but I can't seem to think of any other way this could be done.