Is there any way for KM to know that Alfred is now the focused window?

Hi @martin
I tried this macro but I encountered an issue. Please read it here: Check if Raycast is running - #4 by iamdannywyatt

Is it possible to fix this?
Thanks