Application lost focus event

I think you are looking for:

UGameViewportClient::LostFocus

You can derive from this class and make your own functionality, of course it needs to be done in c++.