How can I programmically set the gnome-terminal title? I've tried
gnome-terminal --title="bla"
but this opens a new terminal window while outputting
Xlib: extension "RANDR" missing on display ":0.0".
How can I programmically set the gnome-terminal title? I've tried
gnome-terminal --title="bla"
but this opens a new terminal window while outputting
Xlib: extension "RANDR" missing on display ":0.0".
Got this to work
PROMPT_COMMAND='echo -ne "\033]0;g0\007"'
If this did not change your terminal title you will first have to open ~/.bashrc
. Find the line that says:
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
Comment out this line, by putting a #
character in front of it:
# PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
Now add this line (you may want to put it just after the commented-out line):
PROMPT_COMMAND='echo -ne "\033]0;Terminal title name change here\007"'
Replace Terminal title name change here
with whatever you want to change the Terminal title to be, if anything.
gksu gedit /usr/share/applications/gnome-terminal.desktop
find Name=Terminal
change to Name=whatever you want
save restart
name changed
IS that what you wanted ?
Or another way without leaving the terminal
cd /usr/share/applications
sudo sed -i 's/Terminal/Your new name here/' gnome-terminal.desktop
to see the name change appear on the icon in launcher you must also restart unity
unity &> /dev/null & disown
for more info about unity restart read https://askubuntu.com/a/38597/71679
`
The gnome-terminal option --title is often overridden by your .bashrc file which updates your terminal (or tab) title as the prompt changes.
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
Other posts have recommended commenting out this logic in the .bashrc, but this disables all terminals from tracking the prompt, which is sometimes useful.
To add an optional control modify your .bashrc to add an environment variable which when set, skips tying your terminal (tab) title to the prompt:
if [ -z "$BASHRC_SKIPPS1" ]
then
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
fi
Now, to invoke a terminal with a static title use:
$ BASHRC_SKIPPS1=true gnome-terminal --title="static title"
and to open a new tab in an existing terminal with a static title use:
$ BASHRC_SKIPPS1=true gnome-terminal --title="static title" --tab
To open a terminal with the title tracking the prompt use:
$ gnome-terminal
or a terminal tab with the title tracking the prompt use:
$ gnome-terminal --tab