Last active
March 9, 2017 22:24
-
-
Save locriani/a11204e6d934f340da06 to your computer and use it in GitHub Desktop.
SSH Terminal Color Hack
This file contains hidden or 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
alias ssh="~/.bash/ssh.sh" |
This file contains hidden or 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
www.example.com | |
list your safe servers on each newline | |
This file lives in your home directory (not in ~/.bash) | |
You need at least one "safe" server in order for the script to function properly |
This file contains hidden or 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
function onExit { | |
osascript ~/.bash/terminal_color.scpt "Pro" | |
} | |
trap onExit EXIT | |
safe_server=`echo "$@" | grep -i --max-count=1 -f ~/.safe_servers | wc -l` | |
if [ $safe_server -gt 0 ]; then | |
osascript ~/.bash/terminal_color.scpt "SafeRemote" | |
else | |
osascript ~/.bash/terminal_color.scpt "Remote" | |
fi | |
/usr/bin/ssh "$@" |
This file contains hidden or 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
on run argv | |
tell application "Terminal" to set current settings of selected tab of window 1 to (first settings set whose name is (item 1 of argv)) | |
end run | |
-- iTerm2 User? | |
-- change the ssh.sh script to use colors instead of theme names and use this AppleScript instead: | |
-- | |
-- on run argv | |
-- tell application "iTerm" to set background color of current session of current terminal to (item 1 of argv) | |
-- end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Such star. Much Bright.