There is a documentation about setting window title: https://www.gnu.org/software/screen/manual/html_node/Naming-Windows.html
I don't want to change .bashrc on all machines to make dynamic screen. However it will be good set hotkey in my .screenrc to set title using :title (C-a A) command with proper argument.
Maybe there is a solution to provide an output from uname -n
to :titile command. Or something similar which automatically or semi-automatically sets window title to hostname.
Questions are:
uname -n
to :title command?There are two approaches to solve it:
ESC k my-titile ESC \
. Screen will extract my-title
. It can be done via:printf '\ek%s\e\\' $(uname -n);
screen -X title my-titile
to set a titile of current window.Since I want to do it for all hosts which I sshed into, there is a trick to wrap actual ssh command into ssh() function using one of aforementioned approaches.
E.g.:
ssh() { printf '\ek%s\e\\' "$1"; command ssh "$@"; }
Thanks to #screen on freenode : )
ref.: https://www.gnu.org/software/screen/manual/html_node/Dynamic-Titles.html#Dynamic-Titles