How catch window lost focus if user pull down quick settings menu(wifi,bluetooth etc)?

is it possible? visibilitychange does not change even if i tap many times on quick settings menu.

document.addEventListener(
  "visibilitychange",
  function () {
    if (document.hidden) {
      console.log("hidden");
    } else {
      console.log("not hidden");
    }
  },
  false
);