dotfiles/zsh/.config/zsh/window-title-bar.sh

20 lines
580 B
Bash
Raw Normal View History

2021-08-31 14:18:45 +02:00
#!/bin/zsh
if [[ "${TERM}" != "" && "${TERM}" == "alacritty" ]]
then
precmd()
{
# output on which level (%L) this shell is running on.
# append the current directory (%~), substitute home directories with a tilde.
# "\a" bell (man 1 echo)
# "print" must be used here; echo cannot handle prompt expansions (%L)
print -Pn "\e]0;$(id --user --name)@$(hostname): zsh[%L] %~\a"
}
preexec()
{
# output current executed command with parameters
echo -en "\e]0;$(id --user --name)@$(hostname): ${1}\a"
}
fi