title: Google Chrome: how to fetch "minimized" event?
body: <p>I try to fetch all events when the state of a window changes. So far, I use a content script that adds a &quot;resize&quot; listener to the window: <code>window.onresize = function() {...}</code>. This allows me to fetch when a window's state changes to &quot;normal&quot;, &quot;maximized&quot; and &quot;fullscreen&quot;.</p>
  <p>However, I have no idea what to do to also get &quot;minimized&quot;. Minimizing a window does not fire &quot;resize&quot; events. I tried to use the onFocusChanged API to add an listener, i.e., <code>chrome.windows.onFocusChanged.addListener(function(windowId) {...}));</code>, but it has its issues. Firstly, if the window I minimize has the focus, <code>windowId = -1 (chrome.windows.WINDOW_ID_NONE)</code>, so I cannot fetch the window to readout its state. And secondly, if the window doesn't have the focus, the <code>onFocusChanged</code> event is not fired.</p>
  <p>In short, how can I detect when a Chrome window has been minimized?</p>