Hi everyone, note that this post is pretty much a copy of [IGN-4997].
I’m working on a Multi-Monitor setup with Vision where I have 2 desktops, “primary” and “secondary”, I have two Dockeds for menu buttons and I’m displaying the current window title. I’ve created a client tag (dataset, although it could also be a string array I guess) that will hold the current window path on each handle (system tag CurrentWindow doesn’t consider secondary handles from what I’ve seen), and will be using an index for ease of access to the needed path. This setup would allow me to do expressions like
[client]CurrentWindowByMonitor.value[desktopIndex, 0]
Problem is there is no way to get the desktop index or handle through an expression, I’ve created a simple script to get it like
def get_desktop_index():
all_handles = ["primary"]
all_handles.extend(system.gui.getDesktopHandles())
return all_handles.index(system.gui.getCurrentDesktop())
Then I’ve tried to bind my custom property desktopIndex to the expression
runScript('WindowUtils.get_desktop_index', 0)
But this always considers the value of system.gui.getCurrentDesktop() to be “primary”, thus always it returns 0. I had the understanding that system.nav and system.gui are relative to the desktop where they are invoked, but this doesn’t seem to be the case when using runScript, right?
Hopefully you can tell me anything that I’m missing, or maybe I could achieve the same result in some other way.
My essential problem is to know the CurrentWindow independently for each desktop handle, hopefully in a way that I could easily create binding for windows and templates that will be present on both desktops.
Currently I’m using this same setup but instead of using a runScript binding for any desktopIndex property, I would just compute this value during a visionWindowOpened event for windows, or componentRunning for Templates.