Firefox Quantum finally released on November 14, 2017. Quoting from this link:
In the past, you could develop Firefox extensions using one of three different systems: XUL/XPCOM overlays, bootstrapped extensions, or the Add-on SDK. By the end of November 2017, WebExtensions APIs will be the only way to develop Firefox extensions, and the other systems will be deprecated.
Using Firefox 57 Quantum and Web Extensions APIs, I want to make an extension that is capable of running on multiple screens. This extension would be used to show multiple screens dashboards.
The idea of it was so simple. If two or more screens are detected, every Firefox starting up then opens a new window for every monitor in full screen mode. I can do full screen, but facing issues to open on another monitor and detect how many monitors are attached.
Using browser.windows API to create another new tab, here's some snippet code:
getCurrentWindow().then((currentWindow) => {
let mirror1 = browser.windows.create({
url: "http://172.20.12.211:8080/ivi",
state: "fullscreen"
});
mirror1.then(() => {
browser.windows.remove(currentWindow.id);
var updateInfo = {
state: "fullscreen"
};
let mirror2 = browser.windows.create({
url: "http://172.20.12.211:8080/ivi",
state: "fullscreen"
});
mirror2.then((nextWindow) => {
var updateInfo = {
left: 1366
};
browser.windows.update(nextWindow.id, updateInfo);
});
});
});
Obviously, my solution above is hard-coded for two monitors and sets left parameter to 1366 px, hence this solution will not work properly if the screen resolution not equal to 1366x768 or if there are more than two monitors attached.
Thus, is there any API or better approach to detect how many monitors are attached and also check their resolution? Does Web Extension APIs have a feature for detecting multiple monitors and resolution values? If not, what are possible workarounds?