Vision Application Screen Indexing Issue

Good morning,

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).

2 Likes

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.

Not an answer to your question, but a different solution:

I typically handle multi-display projects with 2 buttons that allow the user to configure it as they want. It's more manual, but also more flexible.

Button 1 : Switches between windowed and fullscreen mode
Button 2 : Adds another window

add desktop:

#get parent desktop of parent window
desktop = Nav.getParentDesktop(system.gui.getParentWindow(event))
#open new desktop
Nav.openNewDesktop()

swap desktop mode:

#get parent desktop of parent window
desktop = Nav.getParentDesktop(system.gui.getParentWindow(event))
#swap parent desktop display mode
Nav.desktopSwapDisplayMode(desktop)

Nav library:

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)
3 Likes

I work with a lot of multi screen systems as well, and I like the the desktop names to be numbered from left to right and top to bottom as seen below

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

Here are some forum examples where I've demonstrated this approach:
Dual Monitor Screen Number Issue
How to Show Monitor Number Using the Label Display

2 Likes