Customizing Tab Titles in Oh My Zsh (terminal-profile)
Abenezer Belachew · January 02, 2024
2 min read
- I recently switched to Oh My Zsh, an open-source framework for managing Zsh configurations, along with terminal-profile.
- At first, it was pretty fun, but then I started facing a bit of a snag. As I opened more tabs, it became tricky to navigate to the specific tab I wanted because the titles were kind of obscure.
- Before this, I had added a
set-title
function to my~/.bashrc
file (with the snippet of code below commented out), which let me set the tab title by simply runningset-title “Title Name”
.
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
function set-title {
echo -ne "\033]0;$1\007"
}
- However, after the switch, this method stopped working.
- To fix this, I tried adding the same function to
~/.zshrc
, then sourced it and attempted to set a new title. - Unfortunately, that didn't work either.
- While skimming through the rest of the modified
~/.zshrc
config/code, I stumbled upon this line:
# DISABLE_AUTO_TITLE="true"
- So, I uncommented it and sourced
~/.zshrc
again.
source ~/.zshrc
-
And voilà! That did the trick. I can now add custom titles to my tabs with ease. 👍