You are not logged in.

#1 2008-05-09 03:41:17

bladdo
Member
From: Blacksburg, VA
Registered: 2008-05-05
Posts: 111
Website

urxvt terminal title set -- dynamic possibly?[solved]

Does anyone know how I could set urxvt's title set to say my $PS1, I tried declaring it in my .XDefaults but it literally says echo $PS1 in the title when I do that....

Or also I remember when I used xfce4-terminal I think it showed dynamically what was going on in the term title, is this achievable somehow?

I'm bash btw.

Thanks,
bladdo

Last edited by bladdo (2008-05-11 00:42:27)


bladdo / mil / Miles
userbound.com - blog and projects

Offline

#2 2008-05-09 04:25:36

iBertus
Member
From: Greenville, NC
Registered: 2004-11-04
Posts: 2,228

Re: urxvt terminal title set -- dynamic possibly?[solved]

Try putting echo -ne "\033]0;${USER}@${HOST}\007" somewhere it might get executed when the terminal is started.

Offline

#3 2008-05-09 07:16:22

tami
Member
From: Norway, Oslo
Registered: 2007-11-10
Posts: 58
Website

Re: urxvt terminal title set -- dynamic possibly?[solved]

I have in my .bashrc:

# Change the window title of X terminals 
    if [[ $TERM =~ "xterm|*rxvt*" ]]; then
    # set -o functrace
    trap 'set_title' DEBUG
    fi

I 'm sorry - I do not remember from where I grabbed it... Anyway - my urxvt window titles are changing dynamically. Don't forget to source your .bashrc after editing it though... wink
I hope it will help you,
tami


"Possession means worries and luggage bags one has to drag along." Little My wink

Offline

#4 2008-05-09 07:56:20

klixon
Member
From: Nederland
Registered: 2007-01-17
Posts: 525

Re: urxvt terminal title set -- dynamic possibly?[solved]

Maybe this section from the bash-prompt howto helps. You should also read the next page if u use screen in you urxvt.

I haven't tried it myself, but i think it should work if you change

case $TERM in
    xterm*)

into

case $TERM in
    xterm*|*rxvt*)

Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!

Offline

#5 2008-05-09 08:16:51

paralax
Member
From: Czech Republic
Registered: 2007-05-26
Posts: 51

Re: urxvt terminal title set -- dynamic possibly?[solved]

Hi! I have this is my .bashrc and it works great.

PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$ \[\e[m\]\[\e[1;37m\] '
# X Terminal titles
case "$TERM" in
xterm*|rxvt*)
        PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
        ;;
*)
        ;;
esac

shotsz1.th.png

Look at my dotfiles.org folder for more configs: http://dotfiles.org/~paralaX/

Last edited by paralax (2008-05-09 08:22:21)

Offline

#6 2008-05-09 15:45:18

dolby
Member
From: 1992
Registered: 2006-08-08
Posts: 1,581

Re: urxvt terminal title set -- dynamic possibly?[solved]

its already in /etc/profile.bash

Last edited by dolby (2008-05-09 15:45:37)


There shouldn't be any reason to learn more editor types than emacs or vi -- mg (1)
[You learn that sarcasm does not often work well in international forums.  That is why we avoid it. -- ewaller (arch linux forum moderator)

Offline

#7 2008-05-09 18:53:28

bladdo
Member
From: Blacksburg, VA
Registered: 2008-05-05
Posts: 111
Website

Re: urxvt terminal title set -- dynamic possibly?[solved]

Thanks smile I got it working but I wanna add in another feature.

I'm trying to make it so I can see the tty in the title too, but its not quite working sad I don't know bash that well so bare with me.

PS1='[\[\033[1;31m\]\u@\h \[\033[1;34m\]$(/usr/bin/tty | /bin/sed -e '\''s:/dev/::'\'')\[\033[0m\]] \[\033[0m\]'
TTY='$(/usr/bin/tty | /bin/sed -e '\''s:/dev/::'\'')\';
export BROWSER='firefox'
export EDITOR=vim
export PS1 
export TTY

# urxvt title
case "$TERM" in
xterm*|rxvt-256color)
        PROMPT_COMMAND='echo -ne "${TTY}\\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
        ;;
*)
        ;;
esac

And it errors out and the title is set to default again.

Thanks,
bladdo


bladdo / mil / Miles
userbound.com - blog and projects

Offline

#8 2008-05-11 00:41:29

bladdo
Member
From: Blacksburg, VA
Registered: 2008-05-05
Posts: 111
Website

Re: urxvt terminal title set -- dynamic possibly?[solved]

tami wrote:

I have in my .bashrc:

# Change the window title of X terminals 
    if [[ $TERM =~ "xterm|*rxvt*" ]]; then
    # set -o functrace
    trap 'set_title' DEBUG
    fi

I 'm sorry - I do not remember from where I grabbed it... Anyway - my urxvt window titles are changing dynamically. Don't forget to source your .bashrc after editing it though... wink
I hope it will help you,
tami

At first I settled for it just showing my username/host/pwd in the titlebar. Then I really wanted dynamic, I looked and everywhere I saw online it said it was only achievable through zsh. Tami, your code error'd my term for some reason.

Eventually I found out how to do it smile

# urxvt title
case $TERM in
        rxvt-256color)
            trap 'echo -ne "\e]0;$USER@$HOSTNAME: $BASH_COMMAND\007"' DEBUG
         ;;
    esac

Will display as :

user@host: command

PWD and TTY can be added in but it looks to stuffed then in my opinion. Just change the rxvt-256color to any term and it should work for you too smile

-bladdo


bladdo / mil / Miles
userbound.com - blog and projects

Offline

#9 2008-05-11 07:09:50

tami
Member
From: Norway, Oslo
Registered: 2007-11-10
Posts: 58
Website

Re: urxvt terminal title set -- dynamic possibly?[solved]

bladdo wrote:

At first I settled for it just showing my username/host/pwd in the titlebar. Then I really wanted dynamic, I looked and everywhere I saw online it said it was only achievable through zsh. Tami, your code error'd my term for some reason.

After posting and reading the tread I found out that actually, as others pointed out, the function to show dynamically working directory is set system-wide in Arch. Posted by me function from .bashrc ("heritage" from previous installations of other distro) doesn't "spit out" any errors here. (The reason perhaps is that I'm not running rxvt-unicode-256color from AUR - only simple rxvt-unicode from extra - but: this is just a guess! I really did not want to confuse you or your system! wink ). So - sorry if it errors at your place. I also probably misunderstood what you really needed...

Anyway - I'm glad you found out yourself how to achieve the effect you wanted. smile

Have a nice day,

tami


"Possession means worries and luggage bags one has to drag along." Little My wink

Offline

#10 2009-05-06 18:52:36

robmaloy
Member
From: Germany
Registered: 2008-05-14
Posts: 263

Re: urxvt terminal title set -- dynamic possibly?[solved]

 
PROMPT_COMMAND='DEFTITLE="${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}"; echo -ne "\033]0;${TITLE:-$DEFTITLE}\007"'

this way i just have to set $TITLE and if i unset it, it goes back to whatever DEFTITLE is


☃ Snowman ☃

Offline

#11 2011-10-22 10:52:47

bloom
Member
Registered: 2010-08-18
Posts: 749
Website

Re: urxvt terminal title set -- dynamic possibly?[solved]

True dynamic titles can be achieved through tmux with the following setting:

set -g set-titles on

gh · da · ds

Offline

#12 2011-10-22 15:30:48

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: urxvt terminal title set -- dynamic possibly?[solved]

bloom,
thanks for the info, but this thread is fairly old and thus should not be necrobumped: https://wiki.archlinux.org/index.php/Fo … Bumping.27

Closing


To know or not to know ...
... the questions remain forever.

Offline

Board footer

Powered by FluxBB