Firefox extension: check if window is minimized

I am trying to track the status of a Firefox window ("maximized", "minimized", "normal", "full screen"; see here ). However, no matter what I try, I can never see the minimized event; the rest is fine. For example, if I add listeners to the window, for example

window.addEventListener("activate", function(event) { dump("activate " + window.windowState + " " + window.screenX + " " + window.screenY + "\n"); }, false);
window.addEventListener("deactivate", function(event) { dump("deactivate " + window.windowState + " " + window.screenX + " " + window.screenY + "\n"); }, false);
window.addEventListener("resize", function(event) { dump("resize " + window.windowState + " " + window.screenX + " " + window.screenY + "\n"); }, false);

I never see 2 as window.windowState (2 = STATE_MINIMIZED). I tried to get around using screenX and screenY, but that doesn't help. When I minimize the window, a deactivation event occurs, not a resize, when window.windowState is 3 (STATE_NORMAL) and the old screenX / screenY values.

Is there a way to tell when a Firefox window is minimized? I am at the end of my mind.

+4
source share
1 answer

You must listen to the event sizemodechange. That the event that fires after the window is minimized or maximized. The event resizedoes not fire to minimize the window, because technically the window does not change - it is hidden. And the event deactivateis probably triggered before the window is minimized when it still has a normal state (I have not tested it yet).

+4
source

All Articles