How to automagically move windows between monitors with one keystroke?

7,483

Solution 1

I use the following AppleScript to do what you're asking to do; while it currently assumes the screens are the same size and positioned side-by-side, it should be relatively easy to change for other cases. Many techniques exist to run AppleScripts with keystroke commands; personally, I use Butler.

tell application "Finder"
    set _bounds to bounds of window of desktop
    set _width to item 3 of _bounds
end tell

set left_width to _width / 2

tell application "System Events"
    tell (first process whose frontmost is true)
        tell first window
            set {x, y} to (get position)
            if x < left_width then
                set position to {x + left_width, y}
            else
                set position to {x - left_width, y}
            end if
        end tell
    end tell
end tell

Solution 2

A quick search does yield a couple applications which include the functionality you're looking for - none of which seem to be free, though. They do have trials. I'll let you know if I find a free one.

SizeUp, Optimal Layout, WindowMover. SizeUp seems to be the best of the three, seeing as it's made by the same makers as Cinch and seems most lightweight.

Share:
7,483

Related videos on Youtube

btelles
Author by

btelles

Updated on September 18, 2022

Comments

  • btelles
    btelles over 1 year

    In Windows I had this great little app that allowed me to move application windows between 2 monitors with a click of a button (or a key-stroke).

    I'm aware of an application that will change the position of a window WITHIN a monitor, but not BETWEEN monitors.

    Do you know if there is in fact such an application?

  • btelles
    btelles over 12 years
    thanks but that's not quite what I was looking for.
  • HikeMike
    HikeMike over 12 years
    SizeUp is quite nice, I'm a happy customer.
  • user3333603
    user3333603 over 12 years
    The question is regarding os x lion, not windows.