How to refresh system.gui.getScreens() without restarting client?

Most of our clients are displayed on multiple monitors. One setup in particular uses a TV connected with miracast (basically a wireless monitor) to display OEE on the plant floor.

Operators will open the display on a laptop and edit run totals, targets, etc for the day then move the client to the TV, which is running in ‘Extend’ display mode (rather than mirroring displays, since the laptop resolution is smaller than the display and TV). Moving the windows between displays is done using the system.gui.getScreens() to populate active displays, and using system.gui.setScreenIndex() to swap.

My problem occurs when the operator either:
a) does not connect to the TV display prior to opening the client
b) the TV loses connection (someone moves or closes the laptop).
c) operator changes to mirrored mode to edit, then back to extended

Unless I reboot the client, trying to move windows to the TV simply drops them in the primary display. system.gui.getScreens() seems to recognize both displays reliably, but windows refuse to move to the TV.

Is there any way to retrieve a current/valid list of displays if the client is already initialized? I have tried using GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices() but it suffers from the same issue.

Thanks for your time.

I am having a similar problem with system.gui.getScreens(). I can only get the active monitors (“Screens”) to update if I close and reopen the parent client.

For example, I have two monitors turned on. If I turn off one of the monitors, system.gui.getScreens() still displays that there are two screens active. If I close and reopen the client with only one monitor turned on, it will now say that there is only one screen active.

I have tried using a client timer script to run the system.gui.getScreens() command, but it still will only update screen info if I close and reopen the client.

Any information regarding how to access the screen information without closing and reopening the client would be appreciated.