Determining if the Photoshop application is in focus from the UXP script

Hello,

Is there a way to determine if Photoshop is the application that has focus (i.e. is in the foreground from the user’s perspective) from the UXP script ?
I tried using require(“photoshop”).app.focus with no chance. I see that there exist a bringToFront method but no “focus” method.
It would greatly help me!

Thank you in advance.

Usually forum search is a good start to check if question was asked before and it seems it was, but looks like no way to determine yet. Unless it was silently added to the events

Thank you! Adding a notification listener on the hostFocusChanged event solved it.

1 Like