Created
January 20, 2014 16:56
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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