-
-
Save felag/4f1baca024db07700cbd262a6af82981 to your computer and use it in GitHub Desktop.
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
# This code can be used as an ssh alias in order to get | |
# target hostname in title as well as changin background color | |
# Usage example: sss r user@host.domain.org | |
sss() { | |
case "$1" in | |
r ) _REMOTE_BGCOLOR="#2F0100" ;; | |
v ) _REMOTE_BGCOLOR="#003611" ;; | |
n ) _REMOTE_BGCOLOR="#111111" ;; | |
b ) _REMOTE_BGCOLOR="#002E51" ;; | |
* ) _REMOTE_BGCOLOR="#2F0100" ;; | |
esac | |
_ORIG_BGCOLOR="#282A36" | |
_ORIG_TERMTITLE="Terminal" | |
echo -e "\033]11;$_REMOTE_BGCOLOR\a" | |
ssh -A -C $2 -t 'echo -ne "\033]0;$(echo $HOSTNAME | tr \[\:lower:] \[\:upper:])\007"; eval $SHELL' | |
echo -e "\033]11;$_ORIG_BGCOLOR\a" | |
echo -e "\033]2;$_ORIG_TERMTITLE\007" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment