Those of you lucky enough to have multiple monitors hooked up to you MacBook or MacBook Pro when you work may have come across this issue. When you remove that extra monitor some applications don't get re-positioned back on to your laptop display. I had this with one particular application that I use frequently, . Well somewhere along the way I dug up this use full terminal/apple script that solves the issue.
property processesToIgnore : {} tell application "Finder" set _b to bounds of window of desktop set screen_width to item 3 of _b set screen_height to item 4 of _b end tell tell application "System Events" set allProcesses to application processes set _results to "" repeat with i from 1 to count allProcesses set doIt to 1 repeat with z from 1 to count processesToIgnore if process i = process (item z of processesToIgnore) then set doIt to 0 end if end repeat if doIt = 1 then tell process i repeat with x from 1 to (count windows) set winPos to position of window x set _x to item 1 of winPos set _y to item 2 of winPos if (_x < 0 or _y < 0 or _x > screen_width or _y > screen_height) then set position of window x to {0, 22} end if end repeat end tell end if end repeat end tell
I don't recall where I may have dug this up, but if you think you know, please let me know in the comments so I can give credit.
4 responses so far ↓
1 // May 8, 2008 at 11:41 pm
I come across this issue all the time. Changing the display res, then changing it back always sorts it.
2 Dave // May 16, 2008 at 2:41 pm
Actually not always, KeePass X is one app that changing screen resolution does not work
3 // Apr 6, 2009 at 4:50 pm
I’ve tried a number of scripts that claimed to solve this problem, but yours is the only one I’ve found to work with KeePassX. Excellent, many thanks.
4 // Nov 20, 2009 at 8:02 pm
[...] came across a much nicer solution on bittube. The solution is great, but the source found there is a bit tricky to copy & paste so [...]
Leave a Comment