If you're using zsh
you can also override your title bar's content by adding a precmd()
function like the following to your ~/.zshrc
.
precmd()
{
echo -ne "\e]1;$(dirs -p | head -1) - $COLUMNS\x78$LINES\a"
}
Resulting window title e.g.: ~/Projects - 80x24
Segment |
Effect |
precmd() |
Always called just before a new prompt is shown. |
echo -n |
Omits the default newline (necessary). |
echo -e |
Ensures escape sequences are processed. |
\e]1;TEXT\a |
[ESCAPE] ]1; TEXT [AUDIBLE-BELL] - the necessary escape sequence to change the window title. |
$(dirs -p | head -1) |
Current working directory using ~ ; e.g. ~/Projects |
$COLUMNS\x78$LINES |
COLUMNS and LINES are shell variables. \x78 is the hexadecimal code for x - if we wrote $COLUMNSx$LINES then the shell would be looking for COLUMNSx as a variable. |
Caveat: altered dimensions only change in the window title after you run a command.