OSX + JavaScript + Multiple Monitors
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 );
About this entry
You’re currently reading “OSX + JavaScript + Multiple Monitors,” an entry on Elegando
- Published:
- 04.08.08 / 9pm
- Category:
- JavaScript
No comments
Jump to comment form | comments rss [?] | trackback uri [?]