Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript access to quickmove popup #136

Closed
sbliven opened this issue Nov 8, 2023 · 3 comments
Closed

Javascript access to quickmove popup #136

sbliven opened this issue Nov 8, 2023 · 3 comments

Comments

@sbliven
Copy link

sbliven commented Nov 8, 2023

I previously was able to trigger the quickmove popup from the console with window.quickmove.openFile(). Now with Thunderbird 15 / quickmove 2.7.0 I no longer have a top-level quickmove object. Is there a new way to access extensions programmatically in TB Supernova?

For context, I am using tbkeys to launch quickmove with a keystroke, something not supported by the built-in shortcut manager.

@sbliven
Copy link
Author

sbliven commented Jan 16, 2024

Maybe this should be a feature request for the ability to launch the quickmove window from javascript.

@kewisch
Copy link
Owner

kewisch commented Jan 20, 2024

Yeah, it is now a WebExtension. You'll need to use ExtensionManager to grab the extensions context and then call https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction/openPopup .

Untested:

    let extension = ExtensionParent.GlobalManager.getExtension(ADDON_ID);
    let api = await extension.apiManager.asyncGetAPI("browserAction", extension, "addon_parent");
    api.browserAction.openPopup();

Making it simpler is probably out of scope, so I'll close this issue. Good luck :)

@kewisch kewisch closed this as completed Jan 20, 2024
@sbliven
Copy link
Author

sbliven commented Jun 21, 2024

Thanks for the help, @kewisch. I've been trying to make this work on and off but I've mostly given up now. I'll post my progress in case anyone comes across this thread.

I'm currently binding the following function:

let extension = ExtensionParent.GlobalManager.getExtension('[email protected]');
let api = extension.apiManager.getAPI('browserAction', extension, 'addon_parent');
console.log(`api.browserAction = ${api.browserAction}`);
api.browserAction && api.browserAction.openPopup();

This logs api.browserAction = undefined to console. I suspect it might be undefined because I'm calling from outside a user action (tbkeys doesn't use the built-in shortcut manager, so its possible it doesn't count as user-triggered).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants