On Client Startup Open previous windows Multi Monitor

Im trying to set up Multi Monitor and would like to open up screen that is previously open before exit or shutdown.

Haven't done this before, my initial thought would be to "export" the config to some sort of external file when the client shuts down and then read the same file when it starts up.

Database. I imagine that the client and desktop handle names could be inserted or updated on window close, and then, they could be retrieved during the client startup script.

I've done this on a project before, but it's a bit complex.

First, make sure all of your secondary desktops you've opened have a naming convention similar to "Desktop #", so in mine, the primary is always named "primary", but the secondary desktops are named "Desktop 1", "Desktop 2", and "Desktop 3" for a quad-screen setup.

I had ours also set up to track per computer settings, but to simplify this example, I'll leave that out.

You'll need a memory string array tag that needs to be at least as large as the number of screens you will be tracking (I think I set ours to 10 even though we only have/use 4)

I have function in a project script Vision.Navigation:

def updateActiveWindowList(deskHandle, event):
	'''
	Updates the client window array with new values on window navigation
	
	Args:
		deskHandle (str): Desktop handle to update (Should be in the format "Desktop #")
		event: Event called by VisionOpenWindow
		
	'''
	
	deskIndex = 0 if deskHandle == 'primary' else int(deskHandle[8:])
	tagPaths = ['OpenedWindows[%d]' % deskIndex]
	system.tag.writeAsync(tagPaths, [event.source.path])

That script is called from the visionWindowOpened event handler on each main window with this:

Vision.Navigation.updateActiveWindowList(system.gui.getCurrentDesktop(), event)

Then on the client startup script when opening all the desktops, I read in this tag value and populate each desktop based on the index of the desktop with a fallback/default window if it's blank.

Thank you. This helps a lot. I will try to apply what you have here.

Hi Michael,

I'm not sure where to put the scripts that you showed here?

The updateActiveWindowList is in a script file here on my project:
image

And the one-line is calling that script in the visionWindowOpened event handler on the main view for each screen: