Soushi-Atsumi / Open-in-Sidebar

Very simple and useful extension. You can open a link in the sidebar.
https://addons.mozilla.org/en-US/firefox/addon/open_in_sidebar/
Mozilla Public License 2.0
21 stars 2 forks source link

Support request: JS functions to open & toggle sidebar #5

Closed pataquets closed 1 year ago

pataquets commented 1 year ago

I use tridactyl to control Firefox keyboard. It also allows you to do scripting. I'm aware of OiS shortcuts, but I'd like to be able to control it from tridactyl. As I'm no JS/FFx addon developer, I don't know where to look for the JS function names to call from tridactyl keybinds. I would like to know which function names I have to call to open/close/toggle the sidebar and for navigate any URL in the sidebar. If you think it's worth adding somewhere in the docs, I can send a PR, if requested. Thanks!

Soushi-Atsumi commented 1 year ago

Hi, pataquets

All of features of sidebar are API of Firefox. You can check API at https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/sidebarAction.

pataquets commented 1 year ago

So, does not the extension expose some sort of function easily callable which I can use? I've done some attempts with the code in your link and related pages, but no luck. It can be something in the way I'm using it from Tridactyl, thou. Please, bear with my ignorance. I'm quite clueless with Firefox & JS programming.

Soushi-Atsumi commented 1 year ago

Basically, calling some APIs always fails if it is not invoked in a background script, and sidebarAction is one of them. In addition, sidebarAction must be performed as a result of a user action. I don't know how Tridactyl calls functions, but I think Firefox's policy prevent calling functions which open/close/toggle the sidebar.

pataquets commented 1 year ago

OK. So using OiS from Tridactyl sounds quite cumbersome, specially with my limited knowledge. Also, I found Tridactyl's maintainer on the project's Matrix Channel and he kindly guided me in achieving the same using only Tridactyl. It's now being worked in an ongoing PR, in case you're interested. In any case, I'd like to thank you very much for the all your help and time. Much appreciated.