Set a Keyboard Shortcut for Maximize Button on Mac OS
/* Posted October 6th, 2008 at 8:29am *//* Filed under Apple, Apps, How-To, Mac */
/* */

While you can easily minimize any window on Mac OS with a command-M keyboard shortcut, there’s no such built-in shortcut for the maximize action. In fact, the maximize capability in Mac OS has long been one of the major drawbacks compared to Windows, though many Mac users claim that a Windows-like full window maximize isn’t necessary due to how Mac users use their Macs. I’m going to have to beg to differ, the maximize button really ought to maximize the windows and do no less. While it’s slightly annoying that the maximize button doesn’t really maximize anything, at the very least you don’t have to live without a keyboard shortcut to activate it.
Creating a keyboard shortcut for maximize is actually quite an easy task, requiring just one external (but free) application–Quicksilver. First thing’s first, though; you’ll have to create an AppleScript to do the actual maximize. Quicksilver will simply allow you then to assign a keyboard shortcut to the script.

To create an AppleScript, launch AppleScript in Applications -> AppleScript -> Script Editor. Copy and paste the code below and close the editor. It will prompt you to save the script. Remember the script name and location for later.
tell application "System Events"
if UI elements enabled then
set FrontApplication to (get name of every process whose frontmost is true) as string
tell process FrontApplication
click button 2 of window 1
--button 2 is the green "zoom" button for all applications
--window 1 is always the frontmost window.
end tell
else
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
display dialog "UI element scripting is not enabled. Check 'Enable access for assistive devices'"
end tell
end if
end tell
Now download and install Quicksilver. When it completes, start it up. Press command-’ to open up the trigger dialog. Click the small “+” button at the bottom to add a hotkey trigger. Drag the AppleScript you created over to the “Select an item” box. Then close the window.

Once the trigger is created, you’ll see it appear on the trigger menu. Now double click on the newly created trigger to get the dialog to actually assign a hotkey to it.

A double click will spawn a window to the right. To assign a hotkey, click on the Edit button and then enter in the hotkey combination you’d like to use. Try command-option-something to minimize overwriting any existing hotkey shortcuts.

You’ll need to enable GUI scripting mode in AppleScript to enable the Quicksilver script. To do so you can simply execute your new keyboard shortcut combination and you’ll be prompted to enable it. Otherwise go to Applications -> AppleScript -> AppleScript Utility and set it there.

Also make sure that Quicksilver gets started up when you boot up Mac OS otherwise you’ll have to launch it yourself to enable the maximize hotkey. Simply enter the preferences and select “Start at login.”






















Hi guys,
here’s the more elegant way, as I think:
tell application “System Events”
set frontmostApplication to name of the first process whose frontmost is true
end tell
tell application frontmostApplication
if zoomed of window 1 is false then
set zoomed of window 1 to true
else if zoomed of window 1 is true then
set zoomed of window 1 to false
end if
end tell
Awesome, works perfectly. it was seriously annoying to not be able to rapidly maximize windows. thanks!
MisterFister (or any compassionate soul who can explain his elegant way):
For those of us not used to “tell” our Mac’s anything (but “thanks!”), could we trouble you to please offer a more step-by-step description for the faint-of-geek?
Thanks (Sooo) much
-d
I got my macbook a couple of weeks ago, and I’ve kinda struggled to adapt to the quirkiness of OSX.
This article is the single thing which has made a huge difference to my MacBooks usability though.
Thanks so much for taking time to share the script :-)
[...] programs are free. If you use quicksilver, you will want to use the “triggers” functionality. This page has some information and screenshots that show how to associate a script with a keyboard shortcut [...]
[...] programs are free. If you use quicksilver, you will want to use the “triggers” functionality. This page has some information and screenshots that show how to associate a script with a keyboard shortcut [...]
It works. Always missed this. You rule!
I think the mac keyboard shortcut should be
Command+Shift+M
we can all press 2 buttons with one hand? right…
It would be a nice complement
Or you could always use control or ‘alt’
instead of Shift
Key board shortcut for maximizing windows that is.
and FRRREEE4SSSSS2PPPPEEEECCCheech0