Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

6 Answers 6

up vote 1 down vote accepted

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
share|improve this answer

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|improve this answer
1  
SizeUp is quite nice, I'm a happy customer. –  Daniel Beck Sep 4 '11 at 16:55

For Linux I am still looking for a solution.

UltraMon is a shareware that solves the problem nicely for Windows.

The following script can be used on Apple Mac OS X. The short cut can be created with Quicksilver

--  Window Moving Script between multiple monitors for Apple Mac OS X 10.x
-- (something I've been doing with UltraMon for quite a while)
--  inspired by:
--     http://www.tidbits.com/webx?14@@.3c7b1ae3/5
--     http://macscripter.net/viewtopic.php?id=24511
-- and http://daringfireball.net/2006/12/display_size_applescript_the_lazy_way
-- thanx for the input ... I was looking for a solution of this quite a while
-- best to be used with a custom trigger in Quicksilver where this script is assigned to a
-- keyboard short cut (I use ALT Cursor-Right) 
-- you might want to put Quicksilver into your Autostart Objects
-- 2009-09-14 Wolfgang Fahl

--
-- get the front Window
-- 
on getFrontWindow1()
    tell application "System Events"
        set theFrontWindow to first window of (first process whose frontmost is true)
        -- set theFrontWindow to the front window
        set windowname to name of theFrontWindow as string
        say "Moving" & windowname
        --display dialog "front most windows is " & name of  theFrontWindow buttons ("Cool") giving up after 3 default button 1
        return theFrontWindow
    end tell
end getFrontWindow1
--
-- get the front Window
-- 
on getFrontWindow()
    tell application "System Events"
        repeat with theapp in (every application process whose visible is true and frontmost is true)
            repeat with ew in (every window of theapp)
                return ew
            end repeat
        end repeat
    end tell
end getFrontWindow
--
-- list all windows
--
on listWindows()
    tell application "System Events"
        repeat with theapp in (every application process whose visible is true and frontmost is true)
            repeat with ew in (every window of theapp)
                set windowname to name of ew as string
                say windowname
            end repeat
        end repeat
    end tell
end listWindows

--
-- message dialog
--
on show(aMessage)
    -- display a dialog with a message
    display dialog aMessage buttons {"Ok"} default button "Ok"
end show

--
-- get the screen information
--
on getScreenInfo(theIndex)
    -- get the Screen Information from the windowserver defaults
    -- we are using awk to go to the DisplaySets sections and assume that Active = ... is
    -- at the start of each section
    -- we'll find OriginX= ...,OriginY= ..., Width = ... and Height= ... entries
    -- and return all of them a a list like
    -- 0 0     1920 1200
    -- 0 1920  1650 1050
    set screenInfo to do shell script "defaults read /Library/Preferences/com.apple.windowserver | awk '
        BEGIN { FS=\"=\" }
        /Active/  { screens++ }
        { gsub(\";\",\"\",$2) }
        /^ *OriginX/ { ox[screens] = $2 }
        /^ *OriginY/ { oy[screens] = $2 }
        /^ *Width/   { w[screens]  = $2 }
        /^ *Height/  { h[screens]  = $2 }
        END       {
                for (si=1;si<=screens;si++) {
                    print ox[si],oy[si],w[si],h[si]
                    }
            }'"
    set theInfo to paragraph theIndex of screenInfo
    return {word 1 of theInfo, word 2 of theInfo, word 3 of theInfo, word 4 of theInfo}
end getScreenInfo

--
-- move the front window to another monitor
--
tell application "System Events"
    -- get the OffsetX,OffsetY,Width and Height information for the screens
    -- here we assume that two screens are present (without checking this ...)
    -- first screen info
    set theScreen1 to getScreenInfo(1) of me

    -- second screen info
    set theScreen2 to getScreenInfo(2) of me

    -- for the functionality of this script we are happy with the resolution info for the time being
    set startX to item 1 of theScreen1
    set startY to item 2 of theScreen1
    set resolutionX to item 3 of theScreen1
    set resolutionY to item 4 of theScreen1

    set startX2 to item 1 of theScreen2
    set startY2 to item 2 of theScreen2
    set resolutionX2 to item 3 of theScreen2
    set resolutionY2 to item 4 of theScreen2

    -- make some nois to let everybody know we have receive the command
    beep

    -- 1st, determine current X & Y Positions of the current front window
    set theWindow to getFrontWindow() of me
    set thePosition to position of theWindow

    -- uncomment this if you'd like to debug
    -- display alert name of theWindow & ": " & ((first item of thePosition) as string) & ", " & ((second item of thePosition) as string) & " screen1:" & (startX as string) & "," & (startY as string) & "-" & (resolutionX as string) & "," & (resolutionY as string) & " screen2:" & (startX2 as string) & "," & (startY2 as string) & "-" & (resolutionX2 as string) & "," & (resolutionY2 as string)
    set currXPos to (first item of thePosition)
    set currYPos to (second item of thePosition)

    -- are we on the first monitor?
    if currXPos < resolutionX / 2 then
        -- move right
        set newX to currXPos + resolutionX
        set newY to currYPos - startY2
    else
        -- move left
        set newX to currXPos - resolutionX
        if newX < startX then
            set newX to startX
        end if
        set newY to currYPos + startY2
    end if
    -- Now we move the window moveX pixels to the right (or left if negative)
    set position of theWindow to {(newX), (newY)}
end tell
share|improve this answer

That might help http://apple.stackexchange.com/questions/1488/how-to-move-a-window-to-another-space-without-using-the-mouse

share|improve this answer
1  
thanks but that's not quite what I was looking for. –  btelles Sep 3 '11 at 1:13

Try BetterTouch Tool. I have been using it since it first came out and it works wonderfully. The best of all, ABSOLUTELY FREE! But feel free to donate to the developer, since the app is absolutely awesome!

share|improve this answer

I use these shortcuts all the time:

[Win+M] – Minimize all open windows

[Win+Shift+M] – Undo all window minimization

[Win+D] :- Toggle showing the desktop

[Windows+Up] – Maximize window

[Windows+Down] – Minimize windows / Restore

[Windows+Left] – Dock window to the left side

[Windows+Right] – Dock window to the right side

[Windows+Shift Up] – Maximize vertical size of window

[Windows+Shift Down] – Restore vertical size

[Windows+Shift Left] – Move window to left monitor

[Windows+Shift Right] – Move window to right monitor

[Win+Spacebar] – Aero desktop peek

[Win+Home] – minimize/maximize all inactive windows

[Alt+F4] - Close the active window

[Alt+Tab] - Switch to previous active window

[Alt+Esc] – Cycle through all open windows

[Win+Tab]- Flip 3D

[Ctrl+Win+Tab]- Persistent Flip 3D

Check here for more helpful Windows Shortcuts

share|improve this answer
3  
The question is regarding os x lion, not windows. –  Vervious Sep 4 '11 at 21:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.