-
Notifications
You must be signed in to change notification settings - Fork 213
Closed
Description
Currently the documentation recommends setting the shell title this way:
PS1=$
PROMPT_COMMAND=
echo -ne "\033]0;New Title\a"
This sucks, because it sets PS1 to $. It would be much better to do this:
export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
echo -ne '\033]0;New Title\a'
This way, the command prompt stays the way it is, but setting the title still works.
Even better, add this to the end of ~/.bashrc:
settitle () {
export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
echo -ne '\033]0;'"$1"'\a'
}
What this does is it adds the command settitle that can be used at any time to change the window title like so:
settitle 'New Title'
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 349883e2-58e8-1c35-1414-0440ffda64a3
- Version Independent ID: 46a673fd-9560-6c8d-5b0b-e1723c184b73
- Content: Windows Terminal Tab Title Setup
- Content Source: TerminalDocs/tutorials/tab-title.md
- Service: terminal
- GitHub Login: @cinnamon-msft
- Microsoft Alias: cinnamon
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels