I am encountering an issue with screen indexing for the Vision application. My workstation is configured with three external monitors and one laptop display. The desired behavior is for the Vision application to launch on a specific, non-default display. However, despite attempts to modify display settings within both the Designer and the Client Launcher, the application consistently opens on the laptop screen.
Could you please provide insight into potential configuration parameters or procedures that might be overlooked, preventing the application from launching on the designated monitor?
The indices are Java Swing's indices, not necessarily the ones from the OS.
If you try a different number (in the launcher configuration), do you get different behavior?
Because this is Vision, there is also the possibility of fixing it after login via a client startup script, but you can't run a script before some user has logged in (you could use autologin and then switch users, potentially).
Yes , I am getting same result. No matter what number I put in index in client launcher configuration , it always open vision application on Laptop window.
def getParentDesktop(window):
'''
Get the parent desktop JFrame for supplied window.
Args:
window (obj) : window on the desktop
Returns:
desktop (JFrame) : window's parent desktop JFrame
'''
while not isinstance(window, JFrame):
window = window.getParent()
desktop = window
return desktop
def desktopIsWindowedMode(window):
'''
Determine if a desktop is in windowed mode or not.
Args:
window (ovj) : Window to determine if the parent desktop is in fullscreen or windowed mode
Returns:
isWindowMode (BOOL) : True if desktop is in window mode
'''
#undecorated = fullscreen
return not getParentDesktop(window).isUndecorated()
def openNewDesktop():
'''
Open a new desktop window
Args:
n/a
Returns:
desktop (JFrame) : newly opened desktop
'''
#base desktop handle
dHandle = 'Desktop '
#get handles
handles = system.gui.getDesktopHandles()
#no desktops open yet
if len(handles) == 0:
nextIndex = 0
#other desktops open
else:
#get list of the desktop indicies from the handle
openDesktopIndicies = [int(handle.replace(dHandle,'')) for handle in handles]
#get max index and increment for next index
nextIndex = max(openDesktopIndicies)+1
#get the current window
window = system.nav.getCurrentWindow()
#open new desktop with current window
desktop = system.gui.openDesktop(handle=dHandle+str(nextIndex),windows = [window, 'Nav'])
desktop.setAlwaysOnTop(False)
return desktop
def desktopSwapDisplayMode(desktop):
'''
Swap the selected "desktop" to windowed/fullscreen mode from fullscreen/windowed mode.
Args:
desktop (JFrame) : JFrame of desktop to be swapped to windowed mode.
Returns:
n/a
'''
window = desktop
if window.isUndecorated():
# Switch to windowed mode.
window.dispose()
window.setUndecorated(False)
window.setExtendedState(JFrame.NORMAL)
window.setVisible(True)
else:
# Switch to full screen mode.
window.dispose()
window.setUndecorated(True)
window.setExtendedState(JFrame.MAXIMIZED_BOTH)
window.setVisible(True)
Here is the code I developed for sorting the screens:
from java.awt import GraphicsEnvironment
# Get the bounds of each screen from the graphics environment and sort them from right to left, top to bottom
screens = sorted([device.defaultConfiguration.bounds for device in GraphicsEnvironment.getLocalGraphicsEnvironment().screenDevices], key=lambda screen: (screen.x, screen.y))
for index, screen in enumerate(screens):
# Find the desired screen and do something with it here
# The indexes will be sorted from left to right and top to bottom
print index, screen.x, screen.y, screen.width, screen.height