Desktop Focus Event Handler

I have a script that needs to execute every time a desktop gains focus.
The desktop contains one simple window, and serve as a screen-independent popup.
The internalFrameActivated event handler on the actual window doesn’t fire in this instance. It only fires when the desktop first opens and not whenever focus is gained.

I think I’ve exhausted all options to no success.

  • Adding a WindowFocusListener to the desktop object after creating it with system.gui.createDesktop() doesn’t seem to work, as the listener never seems to trigger once added?
  • Adding a FocusListener or a ComponentListener to a component inside the desktop doesn’t work, as the component doesn’t reliably gain focus upon clicking the window or titlebar.
  • Using a client expression tag that runs system.gui.getCurrentDesktop() always returns ‘primary’, so you can’t cheat in that way either.

The half-solution I’m using now is a click event on the window, which doesn’t fire when the window gains focus by clicking the titlebar. :frowning: