Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Set up Windows 7 'Aero Snap' workalikes in OS X System
You may know about the Aero Snap feature of Windows 7 which allows a user to "resize to half" a window by dragging it to the left or right side of the screen, or to maximize it by dragging it to the top edge of the screen (or by using shortcuts).

With a few AppleScripts and the shortcut manager Spark, you can get this feature in Mac OS X -- at least via shortcuts, though not by dragging to a screen edge.

First, save these AppleScripts somewhere on your hard drive. I'm actually a beginner with AppleScript, so these scripts may not be perfect, but they work.

left.scpt:
-- get Dock height
tell application "System Events" to tell process "Dock"
  set dock_dimensions to size in list 1
  set dock_height to item 2 of dock_dimensions
end tell
-- get the new width and height for the window
tell application "Finder"
  set desktop_dimensions to bounds of window of desktop
  set new_width to (item 3 of desktop_dimensions) / 2
  set new_height to (item 4 of desktop_dimensions) - dock_height
end tell
-- get active window
tell application "System Events"
  set frontApp to name of first application process whose frontmost is true
end tell
-- resize window
tell application frontApp
  activate
  set bounds of window 1 to {0, 0, new_width, new_height}
end tell
right.scpt:
-- get Dock height
tell application "System Events" to tell process "Dock"
  set dock_dimensions to size in list 1
  set dock_height to item 2 of dock_dimensions
end tell
-- get the new width and height for the window
tell application "Finder"
  set desktop_dimensions to bounds of window of desktop
  set new_width to (item 3 of desktop_dimensions) / 2
  set new_height to (item 4 of desktop_dimensions) - dock_height
end tell
-- get active window
tell application "System Events"
  set frontApp to name of first application process whose frontmost is true
end tell
-- resize window
tell application frontApp
  activate
  set bounds of window 1 to {new_width, 0, new_width * 2, new_height}
end tell
fullscreen.scpt:
-- get Dock height
tell application "System Events" to tell process "Dock"
  set dock_dimensions to size in list 1
  set dock_height to item 2 of dock_dimensions
end tell
-- get the new width and height for the window
tell application "Finder"
  set desktop_dimensions to bounds of window of desktop
  set new_width to (item 3 of desktop_dimensions) / 2
  set new_height to (item 4 of desktop_dimensions) - dock_height
end tell
-- get active window
tell application "System Events"
  set frontApp to name of first application process whose frontmost is true
end tell
-- resize window
tell application frontApp
  activate
  set bounds of window 1 to {0, 0, new_width * 2, new_height}
end tell
minimize.scpt:
-- get active window
tell application "System Events"
  set frontApp to name of first application process whose frontmost is true
end tell
-- minimize window
tell application frontApp
  activate
  set miniaturized of window 1 to true
end tell
Now install and open Spark to configure the global hotkeys to execute these AppleScripts. Click on the button on the upper left corner and choose AppleScript. Now you just have to click on File, choose the AppleScript you want to be executed, and choose the shortcut. I personally used these shortcuts, but you may choose anything you want:
  • Command-Option-Left Arrow: set window to the left side of the screen
  • Command-Option-Right Arrow: set window to the right side of the screen
  • Command-Option-Down Arrow: minimize window
  • Command-Option-Up Arrow: maximize window
Also, don't forget to start Spark by clicking on Start Spark Daemon on the bottom of the program's window!

This works fine for almost all of my applications. iTunes behaves strangely with these AppleScripts, and it doesn't seem to work on Java applications either (Eclipse, Cyberduck). However, all other applications behave as expected.

I did this on Snow Leopard, but I guess it should work on Leopard as well.

[robg adds: I haven't tested this one.]
    •    
  • Currently 2.91 / 5
  You rated: 3 / 5 (23 votes cast)
 
[22,598 views]  

Set up Windows 7 'Aero Snap' workalikes in OS X | 8 comments | Create New Account
Click here to return to the 'Set up Windows 7 'Aero Snap' workalikes in OS X' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Set up Windows 7 'Aero Snap' workalikes in OS X
Authored by: stokessd on Dec 17, '09 07:48:17AM

That is such a windows way of working. I do the windows thing at work 40+ hours a week, and people I work with maximize everything and switch between apps with the task bar. I keep my windows large and arranged so I can click a corner of a covered window, it's way faster and more efficient. This everything should be full screen mentality that spawned MDI (evil evil evil) boggles my mind.

Sheldon



[ Reply to This | # ]
Set up Windows 7 'Aero Snap' workalikes in OS X
Authored by: jfm429 on Dec 17, '09 09:24:14AM

If you want this functionality (and a lot more too) check out SizeUp. It's a little menubar utility that does a lot of cool stuff. Supports multiple monitors too, which I like. And there's a free version called TwoUp that does just left/right/top/bottom.



[ Reply to This | # ]
Set up Windows 7 'Aero Snap' workalikes in OS X
Authored by: hho26 on Dec 17, '09 09:57:17AM

Good first version and works okay with dock positioned at the bottom of the screen and unhidden. But if dock is hidden at the bottom position, the resulting window size does not go to the bottom of the screen, it is as if the dock was unhidden.
If the dock is positioned at either the right or left sides, the resulting window is sized to the gap between the top screen edge and the top of the dock, creating a very thin window at the top of the screen.
Keep working on it and as a beginning applescript programmer, you have done good. Keep it up.



[ Reply to This | # ]
Set up Windows 7 'Aero Snap' workalikes in OS X
Authored by: stevebr on Dec 17, '09 10:10:03AM

Seconding TwoUp for this type of window management. It's very light on resources and has the advantage of working with apps that aren't scriptable (which may be the source of OP's problem with Java apps).

Incidentally, how did this tip get such a low rating? Having two large windows side-by-side can be useful in a number of circumstances.



[ Reply to This | # ]
Checkout Cinch by Irradiated Software
Authored by: bumper314 on Dec 17, '09 04:43:34PM

Shameless self promotion: checkout Cinch at http://www.irradiatedsoftware.com/cinch/



[ Reply to This | # ]
Set up Windows 7 'Aero Snap' workalikes in OS X
Authored by: Sesquipedalian on Dec 17, '09 08:41:34PM

Instead of Spark, you could try using Quicksilver to run these scripts. Mouse-based triggers on the corners and edges of the screen are one of its many features.

Simply set Quicksilver to run the appropriate script when hit the edge of the screen while dragging the window with your mouse. At the same time, set a keyboard-based trigger to run the script when you hit the desired key combo. Then you have it all, and still for free.

Edited on Dec 17, '09 08:42:28PM by Sesquipedalian



[ Reply to This | # ]
Set up Windows 7 'Aero Snap' workalikes in OS X
Authored by: Michelasso on Dec 18, '09 04:41:29AM

You guys are not serious, are you? I was actually looking for a way to disable it on Win7!! :D



[ Reply to This | # ]
Set up Windows 7 'Aero Snap' workalikes in OS X
Authored by: Fofer on Jan 16, '12 12:56:59AM

This is also a feature of the (free) BetterTouchTool:
http://blog.boastr.net/

Also the function of the ($1.99) app BetterSnappTool (from the same developer:)
http://itunes.apple.com/us/app/bettersnaptool/id417375580?mt=12



[ Reply to This | # ]