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


Click here to return to the 'Creating keyboard shortcuts on the command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Creating keyboard shortcuts on the command line
Authored by: Lri on Apr 07, '14 04:37:01PM

I use a shell script like this to configure the keyboard shortcuts:

defaults write -g NSUserKeyEquivalents '{
"Minimize"="\u200b";
"Minimize All"="\u200b";
}'

defaults write com.apple.finder NSUserKeyEquivalents '{
"Show Package Contents"="@\r";
"Tags..."="@t";
}'

defaults write -app Safari NSUserKeyEquivalents '{
"Show Previous Tab"="@j";
"Show Next Tab"="@k";
"Mail Contents of This Page"="\u200b";
}'

defaults write -app Mail NSUserKeyEquivalents '{
"\033Format\033Indentation\033Decrease"="^\Uf702";
"\033Format\033Indentation\033Increase"="^\Uf703";
}'

The shortcut strings use the same format as in DefaultKeyBinding.dict. For example \Uf702 is the left arrow key.

-app doesn't work with some applications like Finder or Notes.

You can disable a shortcut by assigning the menu item to for example \u200b (ZERO WIDTH SPACE). nil would be triggered by n in some applications like Audacity, \0 would be triggered by any key in Safari in 10.9, and \1 would be triggered by the home key.

If you specify a menu item as Format->Indentation->Increase in System Preferences, it is stored as \033Format\033Indentation\033Increase.



[ Reply to This | # ]