How To: Use Lion, the Witch, and the Escape key

Early in 2011, as we were testing our apps with the Lion developer previews, Peter and I noticed something odd with Witch in Lion: some, but not all, of our Macs were unable to dismiss the Witch switcher panel via the Escape key. Peter dug into Witch’s code, and could find no reason for this, so then we started looking at the operating system itself. What we found is that the problem is indeed in Lion, and it’s related to Front Row (which, ironically enough, isn’t in Lion).

In a nutshell, Lion is reserving the Command-Escape keystroke to activate Front Row, even though there’s no Front Row to activate. So if you use Command-Tab to activate Witch, and then press Escape to cancel the window, Lion sees a Command-Escape keypress, and captures it—Witch never sees it, and its switcher panel isn’t dismissed. (If you disabled Front Row in 10.6, or remapped its activation keys, and then upgraded to Lion, you’re probably not having this problem. But if you did use Command-Escape for Front Row, you’ll want to use this fix.) We filed an Apple bug report on this back in March of 2011, but it’s still open and unresolved.

To fix this problem, we’ve created a simple little application, Escape Key Liberator. Usage couldn’t be much easier: download and mount the disk image, then launch the program (right from the disk image; it’s fine). You’ll be greeted by this incredibly obvious dialog:

Click the Liberate button, then quit Escape Key Liberator. Now comes the only slightly annoying portion of the process: you must logout and login for the change to take effect.

But after that task is done, you should once again be able to use the Escape key to dismiss the Witch switcher panel. You can then delete (or zip and archive, for possible future use on another Mac) the Escape Key Liberator disk image; it’s a one-trick pony, and its trick is done.

(Note: If you’re the kind of person who prefers replacing the transmission in your car yourself, instead of taking the car to the shop, read on for instructions on freeing your Escape key without the ease of a couple of mouse clicks.)

To fix this problem, you need to insert/replace a bit of code in a preferences file. It’s not hard, but unfortunately, it’s the only way to fix the issue. (We tried to write a script to make the fix for you from Terminal, but the needed level of control over the preferences file isn’t available at the command line.) Read on for the solution.

These instructions assume you have a pure text editor that can edit binary plist files. BareBones makes two such editors, the $50 BBEdit and the free TextWrangler, though I’m sure there are others. You can also edit the file using a dedicated property list editor, such as the $30 PlistEdit Pro or the free Pref Setter. If you use a dedicated editor, though, you’ll need to modify these instructions to suit those programs. (For this simple edit, one of the text editors is probably the best option.)

  1. In Finder, navigate to your user’s Library > Preferences folder, and create a duplicate (in another location) of the file named com.apple.symbolichotkeys.plist. You shouldn’t need this, but if something goes wrong with your edit, having a backup will make you a much happier person.
  2. Launch your chosen editor, and then select File > Open. Navigate to your user’s Library > Preferences folder, and then open the file named com.apple.symbolichotkeys.plist.
  3. Use the editor’s search function to search for <key>73</key>; if nothing is found, go to step five. If something is found, it will look something like this (though the values will be different):
  4. Delete the entire entry (lines 679 to 694, inclusive, in the above shot) for key 73.
  5. Insert a blank line (by pressing Return) immediately above any existing <key>##</key> entry, as seen here:
  6. Copy the following block of text, and paste it onto the blank line you just created:
    		<key>73</key>
    		<dict>
    			<key>enabled</key>
    			<false/>
    			<key>value</key>
    			<dict>
    				<key>parameters</key>
    				<array>
    					<integer>65535</integer>
    					<integer>53</integer>
    					<integer>1179648</integer>
    				</array>
    				<key>type<key>
    				<string>standard</string>
    			</dict>
    		</dict>

    (The blank line should vanish after you paste.)

  7. Save the edited file, and quit the editor.

That’s all the editing that’s required. Now activate Witch, and see if Escape cancels the switcher panel. If it does, you’re done. If it doesn’t, then something probably went wrong with the edit. Restore your backup and try again; if you’re still stuck at that point, feel free to send me an email for further assistance.

The above information can also be used to solve the same issue in Mountain Lion.

Comments are closed.