Note that it is my understanding that in KM, the main screen is always index 0, and then the screens are numbered from left to right from 1 to SCREENCOUNT(). I am wondering if there is a way to determine this via AppleScript?
I have found no function or token that returns the screen a given window is on, as of yet.
I can think of kludgy ideas like trying to get the dimensions of the screen the window is on and comparing to the dimensions of very screen to figure out where the window is, but obviously that is not a robust solution and of course fails if you have two screens with the same dimension. However, I would also like to be able to shift windows from one screen to another, and I have not been able to find a method for doing this.Īs far as I have been able to discover thus far, KM provides the facility to find out the number of screen, and to specify a screen to move a window to (either by number or by keyword tokens such as Main, External, Front, etc), but I cannot find a way to find out which screen a window is currently on to thereby determine what screen to move it to. I have the macros do said movement on the screen that the window is currently on.
I put together a series of macros (a la David S) to move windows around - left side, right side, top, bottom, the four corners.