Thursday, May 17, 2012

Restoring Mail Keyboard Shortcuts

I’ve long used the Keyboard pane in System Preferences to assign shortcuts for the items in “From” pop-up menu in Mail’s “New Message” window. This lets me send the message from a different account just by pressing a key.

(Interestingly, this same technique works for the standard “Save as PDF…” menu item when printing, but not for user-supplied PDF services.)

Mac OS X 10.7 Lion introduced a bug whereby editing a keyboard shortcut for any application would render the Mail keyboard shortcuts inoperable. If you examine Mail’s preferences file, you can see that a non-printable character is inserted on either side of the menu item title. Preferences for other applications are unaffected; I think some part of the OS doesn’t like that the titles of these menu items contain angle brackets.

Before editing a shortcut in System Preferences, you can use this Terminal command to save your Mail keyboard shortcuts:

defaults read com.apple.mail NSUserKeyEquivalents

Copy everything in curly braces, which for me is:

{
    "Add Sender to Address Book" = "@~^$y";
    "Michael Tsai <dropdmg@c-command.com>" = "@^$d";
    "Michael Tsai <eaglefiler@c-command.com>" = "@^$e";
    "Michael Tsai <mjt@c-command.com>" = "@^$c";
    "Michael Tsai <mjt@mjtsai.com>" = "@^$m";
    "Michael Tsai <mtsai@atpm.com>" = "@^$a";
    "Michael Tsai <spamsieve@c-command.com>" = "@^$s";
}

To restore the Mail keyboard shortcuts, type:

defaults write com.apple.mail NSUserKeyEquivalents '

Then paste, enter the closing ', and press Return.

Update (2012-07-31): This bug seems to be fixed in Mountain Lion.

6 Comments RSS · Twitter


"Interestingly, this same technique works for the standard “Save as PDF…” menu item"

Thank you. I did not know that, and it will prove useful to me. (I seem to be only four years behind the curve on this one...)


I use keyboard shortcuts tied to AppleScripts launched with FastScripts. The use GUI scripting.


SharonZardetoo

Chucky: You might find these similar keyboard shortcut ideas handy, too: http://www.macworld.com/article/1165129/five_keyboard_shortcuts_you_should_set_up_now.html


Allen Watson

Interesting, but what do you do if you have already clobbered your Mail shortcuts? When I look at com.apple.mail, using the defaults read command, there is stuff in there I don’t think I ever set up, and some of it just does not work.


@Allen You can use “defaults read” and clean up the results in a text editor before pasting back into Terminal. For example, on my Mac this would mean removing the control characters (e.g. “\033”) and restoring the “>” that was deleted to be sure that the menu titles match.


[…] let you Option-Spacebar to page up. I’m seeing intermittent problems with account keyboard shortcuts no longer working, […]

Leave a Comment