: Windows 7 Snap feature on MacOS X


hayesk
Apr 30th, 2010, 05:56 PM
So, as I watched a WIndows 7 ad showing the Snap feature, I thought to myself, why wouldn't I just tile the windows or arrange them myself? Turns out, it's a bit cumbersome to do - well, the right window. So I thought I'd make one myself. Here's how:

First, open AppleScript Editor and go to the Preferences. Enable the AppleScript menu in the menu bar. From there choose "Open Scripts Folder > Open Computer Scripts Folder" from that menu (it's a little script icon on the right side of the menu bar) - this is where you'll save the scripts.

Then paste the following code:


tell application "Finder"
set screenBounds to bounds of window of desktop
set frontmostApplication to name of the first process whose frontmost is true
end tell

set screenWidth to item 3 of screenBounds
set screenHeight to item 4 of screenBounds

tell application frontmostApplication
--display dialog frontmostApplication as string
set myWindows to windows whose visible is true
get bounds of item 1 of myWindows
-- left
set bounds of item 1 of myWindows to {1, 22, screenWidth / 2, screenHeight - 60}
-- right
-- set bounds of window 1 to {screenWidth / 2, 22, screenWidth + 1, screenHeight - 60}
end tell


Save this as "snap window left" in that window you opened.

Then remove the -- from the line below the --right line, and add -- to the line below --left

Save as "snap window right" in that window you opened. Now, when you choose one of those commands from the Scripts menu, it will act on the frontmost window.

You can enhance it a little too. You could save them as Application Bundles and put them in your dock. You may be able to assign Keyboard shortcuts to them using the Keyboard preferences too.

Also, I hard-coded 60 as my Dock height - you may need to change it for yours, especially if you have your dock on the side. The order of the dimensions are {left, top, right, bottom}

Hope you like.

ertman
May 1st, 2010, 08:36 AM
Just a general comment about the snap thing... thanks for posting it.

I find it interesting how MS has been touting this Windows snap feature and how great it is, but like everything else they just stole the idea. I have seen this featured modded into linux for years, and microsoft is touting how awesome they are for coming up with it.

Thom
May 1st, 2010, 08:55 AM
Can someone describe what "Snap" does?

fjnmusic
May 1st, 2010, 02:46 PM
Can someone describe what "Snap" does?

Oh snap!

ic3guy
May 1st, 2010, 03:03 PM
Can someone describe what "Snap" does?

If you drag a window to one side of your screen it will automatically re-size and maximize. Then if you drag another window to the other side of the screen it will also maximize but share equal space with the other window.

Windows 7 features - Snap - Microsoft Windows (http://windows.microsoft.com/en-US/windows7/products/features/snap)

For windows people, they like maximize to take up the entire screen. It took me a while to get used to it on a Mac. I prefer to take up only the space you need.

Low-gun
May 1st, 2010, 03:46 PM
Can I stir the pot by adding that the "snap feature" is better in theory than in practice? See, the problem I've witnessed with it is in cases where you need to juggle more than 2 windows at a time. As you push windows around, by times you'll accidentally drag one too close to the edge of the screen and "BAM!" now it's snapped itself and maximized. Adding a simple modifier key to this process might have been a fix, rather than going for the automated thing.

Low-gun
May 1st, 2010, 03:51 PM
BTW thanks for the post hayesk and for taking the time and effort to create and share this script

bighog
May 1st, 2010, 06:58 PM
I've been using Cinch for this for a while now. It works very well and I was happy to pay the $7 dollars for the no-nag license.

Irradiated Software - Cinch (http://www.irradiatedsoftware.com/cinch/)

Newdeal
May 1st, 2010, 07:27 PM
Better Touch Tool is a FREE program that is for the magic mouse or for the trackpad and does the same thing as cinch and the same thing as windows snap...just drag the window the the left side it takes up half the left, drag to the right takes up half on the right, drag to the top and it maximizes

silentsim
May 1st, 2010, 10:09 PM
I use an app called "SizeUp" which does the Snap feature to excellence.

This is one where you can assign keyboard commands...cinch/touchtool are for mouses I believe