Skip to content

Instantly share code, notes, and snippets.

@ZevEisenberg
Created January 20, 2014 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZevEisenberg/8523931 to your computer and use it in GitHub Desktop.
Save ZevEisenberg/8523931 to your computer and use it in GitHub Desktop.
Function to set Control-Tab and Control-Shift-Tab for Select Next Tab and Select Previous Tab in Terminal.app
#!/bin/sh
# First, a function to safely add custom menu item entries to com.apple.universalaccess.plist,
# since duplicate entries in com.apple.custommenu.apps causes a crash when you open
# System Preferences and go to Keyboard -> Shortcusts
function addCustomMenuEntryIfNeeded
{
if [[ $# == 0 || $# > 1 ]]; then
echo "usage: addCustomMenuEntryIfNeeded com.company.appname"
return 1
else
contents=`defaults read com.apple.universalaccess "com.apple.custommenu.apps"`
grepResults=`echo $contents | grep $1`
if [[ -z $grepResults ]]; then
# does not contain app
defaults write com.apple.universalaccess "com.apple.custommenu.apps" -array-add $($1)
else
# contains app already, so do nothing
fi
fi
}
function fixTerminal
{
defaults write com.apple.Terminal NSUserKeyEquivalents '{ "Select Next Tab" = "^\U21e5"; "Select Previous Tab" = "^$\U21e5"; }'
addCustomMenuEntryIfNeeded "com.apple.Terminal"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment