Upon disconnecting an external monitor from my laptop, I lose some of my apps as the disconnected monitor is still set as the default. Some of my windows are trying to display on the disconnected monitor.
I have a workaround, such as right clicking on the app icon and selecting move then using the arrow key to move the windows to my laptop. I'm wondering if there is a way in Java to listen for the disconnect, then reset my default screen to my laptop.
I thought about getting the number of and ID's of the screens that are available at startup and adding them to a property file. If a screen is disconnected, get the number of and ID's of the available screens again and compare those values to the values in my property file. I could then set the default to the screen that matches the new values and the stored values.
I haven't started coding this up yet. This is more investigative than anything at this point.