From d7bf026c46373b80698fa4a4be8105b85ae0d85d Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 21 Jul 2014 14:40:10 -0300 Subject: Setting window title inside screen --- terminal.dot.link | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'terminal.dot.link') diff --git a/terminal.dot.link b/terminal.dot.link index ada0ceb..bda0e57 100644 --- a/terminal.dot.link +++ b/terminal.dot.link @@ -12,6 +12,18 @@ source $HOME/.profile # Default window title TITLE="terminal" +# Set terminal title +function terminal_title { + # Set window title + xtitle $* + + # Set window title inside screen + # http://stackoverflow.com/questions/899609/gnu-screen-run-script-that-sends-commands-to-the-screen-session-it-is-being-run + if [ -n "$STY" ]; then + screen -X title $* + fi +} + # Set window title, standard version #trap 'echo -ne "\e]0;terminal: ${TITLE:-$BASH_COMMAND}\007"' DEBUG #trap 'xtitle ${TITLE:-$BASH_COMMAND}' DEBUG @@ -24,7 +36,8 @@ TITLE="terminal" # #trap 'last="$_" ; echo -ne "\e]0;terminal: ${TITLE:-$BASH_COMMAND}\007"; true $last' DEBUG #trap 'last="$_" ; xtitle ${TITLE:-$BASH_COMMAND}; true $last' DEBUG -trap '_last="$_" ; _command=${BASH_COMMAND#command_prompt} ; xtitle ${_command:-$TITLE}; true $_last' DEBUG +#trap '_last="$_" ; _command=${BASH_COMMAND#command_prompt} ; xtitle ${_command:-$TITLE}; true $_last' DEBUG +trap '_last="$_" ; _command=${BASH_COMMAND#command_prompt} ; terminal_title ${_command:-$TITLE}; true $_last' DEBUG # Fortune :) #fortune -- cgit v1.2.3