As I posted a while back, there’s no real definitive help for doing javascript with multiple monitors. Now that I’m on Mac OSX, I thought I’d update with the info for that platform.
Firefox sees various values differently on the main screen and on the secondary screen… here is a quick table with the info — for reference sake, the secondary display is vertically positioned above the primary display, and my Dock is on the left side of the primary screen…
Variable | Primary | Secondary |
Actual Resolution | 1440×900 | 1920×1200 |
screen.top | 0 | -1200 |
screen.left | 0 | -269 |
screen.width | 1440 | 1920 |
screen.height | 900 | 1200 |
screen.availTop | 22 | -1200 |
screen.availLeft | 53 | -269 |
screen.availWidth | 1387 | 1920 |
screen.availHeight | 878 | 1200 |
So, you’d think the same script would work fine… but on the primary screen, moving to (0,0) put you at (availTop, availLeft), aka (22,53) because of the Dock and the OSX menu.
The code that worked for me…
resizeTo( 1024, screen.availHeight ); var screenTop = screen.availTop; if( screen.availHeight != screen.height ) { screenTop = 0; } moveTo( screen.availLeft, screenTop );
Another note, there seems to be some inconsistent behavior with OSX when you have the dock and menu bar in various positions.
I found that moveTo(0,0) was failing to move the window on a screen with a menu but no dock (the dock was on another monitor). Changing it to moveTo(1,0) was sufficient to make it work.