 
 # 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
+  frame.x += frame.w / 6
+  frame.y += frame.h / 8
+  frame.w /= 1.5
+  frame.h /= 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
+  frame.x += frame.w / 15
+  frame.w /= 1.15
 
 # Top Left Corner
 bind "1", ["cmd", "ctrl"], -> moveWindow (win, frame) ->
-  frame.size.width /= 1.5
-  frame.size.height /= 1.3
+  frame.w /= 1.5
+  frame.h /= 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
+  width = win.screen().frameIncludingDockAndMenu().w
+  frame.x = width - (frame.w / 1.5)
+  frame.w /= 1.5
+  frame.h /= 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
+  height = win.screen().frameIncludingDockAndMenu().h
+  frame.y = height - (frame.h / 1.3)
+  frame.w /= 1.5
+  frame.h /= 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
+  height = win.screen().frameIncludingDockAndMenu().h
+  width = win.screen().frameIncludingDockAndMenu().w
+  frame.x = width - (frame.w / 1.5)
+  frame.y = height - (frame.h / 1.3)
+  frame.w /= 1.5
+  frame.h /= 1.3
 
 # show clipboard contents
 bind "i", ["cmd", "ctrl"], -> 

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

  oldScreenRect = win.screen().frameWithoutDockOrMenu()
  newScreenRect = screen.frameWithoutDockOrMenu()

  xRatio = newScreenRect.w  / oldScreenRect.w
  yRatio = newScreenRect.h / oldScreenRect.h

  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()
