What are the names of the variables (in terms of Applescript variables or otherwise) that track the currently focused application, the layout of applications in spaces, the currently focused space, and whether two applications share a space in a split view rather than 2 applications appearing in a desktop?
How does one (given a variable identifying an application) assign focus to a particular window of that application if that window resides in a split screen view?
To make the reason for asking this question concrete: the goal is to write an Applescript (or other kind of script) that assigns a keyboard shortcut that rapidly allows swapping focus between two applications that share a split screen view?
The simplest algorithm I can think of for accomplishing this (since it appears to not be a built in setting) is to
- get list of current spaces (including desktops, full screen applications, and split screen applications)
- get currently focused space
- if currently focused space is assigned to split-screen applications, get list of those applications and application windows (each should be length 2).
- get currently focused application
- assign focus to next element in the list of application windows in the currently focused split screen view (which should be the other application window in the currently focused split screen)
I'm not sure if this would work quite as well to solve the problem pointed out in Switch focus in split view regarding two windows of the same application, but at least this would be a start.