   oldScreenRect = win.screen().frameWithoutDockOrMenu()
   newScreenRect = screen.frameWithoutDockOrMenu()
 
-  xRatio = newScreenRect.size.width  / oldScreenRect.size.width
-  yRatio = newScreenRect.size.height / oldScreenRect.size.height
+  xRatio = newScreenRect.w  / oldScreenRect.w
+  yRatio = newScreenRect.h / oldScreenRect.h
 
-  win.setFrame CGRectMake(Math.round((oldFrame.origin.x - NSMinX(oldScreenRect)) * xRatio) + NSMinX(newScreenRect),
-                          Math.round((oldFrame.origin.y - NSMinY(oldScreenRect)) * yRatio) + NSMinY(newScreenRect),
-                          Math.round(oldFrame.size.width * xRatio),
-                          Math.round(oldFrame.size.height * yRatio))
+  win.setFrame CGRectMake(Math.round((oldFrame.x - NSMinX(oldScreenRect)) * xRatio) + NSMinX(newScreenRect),
+                          Math.round((oldFrame.y - NSMinY(oldScreenRect)) * yRatio) + NSMinY(newScreenRect),
+                          Math.round(oldframe.w * xRatio),
+                          Math.round(oldframe.h * yRatio))
 
 moveWindow = (fn) ->
   win = api.focusedWindow()


# Center Window
bind "C", ["cmd", "ctrl"], -> moveWindow (win, frame) ->
  frame.origin.x += frame.size.width / 6
  frame.origin.y += frame.size.height / 8
  frame.size.width /= 1.5
  frame.size.height /= 1.3

# Center Window with borders
bind "b", ["cmd", "ctrl"], -> moveWindow (win, frame) ->
  frame.origin.x += frame.size.width / 15
  frame.size.width /= 1.15

# Top Left Corner
bind "1", ["cmd", "ctrl"], -> moveWindow (win, frame) ->
  frame.size.width /= 1.5
  frame.size.height /= 1.3

# Top Right Corner
bind "2", ["cmd", "ctrl"], -> moveWindow (win, frame) ->
  width = win.screen().frameIncludingDockAndMenu().size.width
  frame.origin.x = width - (frame.size.width / 1.5)
  frame.size.width /= 1.5
  frame.size.height /= 1.3

# Bottom Left Corner
bind "3", ["cmd", "ctrl"], -> moveWindow (win, frame) ->
  height = win.screen().frameIncludingDockAndMenu().size.height
  frame.origin.y = height - (frame.size.height / 1.3)
  frame.size.width /= 1.5
  frame.size.height /= 1.3

# Bottom Right Corner
bind "4", ["cmd", "ctrl"], -> moveWindow (win, frame) ->
  height = win.screen().frameIncludingDockAndMenu().size.height
  width = win.screen().frameIncludingDockAndMenu().size.width
  frame.origin.x = width - (frame.size.width / 1.5)
  frame.origin.y = height - (frame.size.height / 1.3)
  frame.size.width /= 1.5
  frame.size.height /= 1.3

# show clipboard contents
bind "i", ["cmd", "ctrl"], -> 

# Based on this Config: https://github.com/sdegutis/zephyros/wiki.p-config
# todo:
# - snapback window
# - send window space [dir]
