Hide popup if lost keyboard focus. e.g by clicking on another app or changing the window with Alt+tab.
Detecting when focus is lost is actually harder than it sounds. The signals for losing focus happen when you move focus between the window and its child widgets (like the search entry or program list). It already hides when you click on another app. If it doesn't for you, that is a bug and you should open a issue just for that with all of the details of when it fails to happen. Unfortunately, there is no way to hide when you do "Alt+Tab". That key sequence is eaten by the window manager, so Whisker Menu has no idea when it has been pressed or what occurs because of it. Sorry.
Closing because Whisker Menu already does what it can to hide when focus is lost.