diff options
Diffstat (limited to 'bashrc/common/screen.sh')
-rw-r--r-- | bashrc/common/screen.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/bashrc/common/screen.sh b/bashrc/common/screen.sh new file mode 100644 index 0000000..734ccfb --- /dev/null +++ b/bashrc/common/screen.sh @@ -0,0 +1,19 @@ +# screen shelltitle magic + +set_screen_title() { + # prevent reset_screen_title from calling set_screen_title + if [[ $BASH_COMMAND != "reset_screen_title" ]]; then + echo -ne "\ek$(id -un)@$(hostname):${BASH_COMMAND/ *}\e\\" + fi +} + +reset_screen_title() { + echo -ne "\ek$(id -un)@$(hostname)\e\\" +} + +init_preexec_hack() { + if [[ $TERM == "screen" ]]; then + export PROMPT_COMMAND=reset_screen_title + trap set_screen_title DEBUG + fi +} |