Doing Services.wm.getMostRecentWindow with the first argument being a windowType, will give you the most recent window of that type.
However I want to get the most recent window NOT of a given windowType alert:alert which is the notification thingy:
Is there anyway to do this?
I saw the Services.wm.getZOrderDOMWindowEnumerator but there is a warning on MDN saying this may not work on all Linux/Mac systems.
I also could not use Services.wm.getEnumerator and check a timestamp each window was focused as there doesn’t seem to be a property or a DOM attribute for this.
On some systems you wouldn’t even have to worry about this, especially Mac and some Linux desktop environments. But the mix between native and non-native notifications really is a bummer for devs.
I don’t think you can access the window timestamp from javascript. However “most recent” effectively means first in z-order, and you can get an enumerator in z-order. Iterate through from front to back, until you find a window you like, and that is your most recent.