[Konsole-devel] [Bug 47684] wish - session names = current dir

Richard Neill kde at richardneill.org
Thu Jun 23 06:23:07 UTC 2005


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=47684         




------- Additional Comments From kde richardneill org  2005-06-23 08:23 -------
Re: #3 and the tab caption, it was pointed out to me that changing PS1 is better than using PROMPT_COMMAND (and has the same effect). Here is the relevant bit of my .bashrc:

---------------BEGIN-------
#Set up a useful session name in Konsole. 
#Include hostname for remote logins (where $DISPLAY != :0).
#The first part:  \[\e]30;XXXX\a\] sets the session name to XXXX; the 
#second part:   \[\e]0;\a\]"    sets the window title to "" (to which 
#the session name is then appended anyway).

if test "$DISPLAY"; then
        if [ "$DISPLAY" == ":0"  -o "$DISPLAY" == ":0.0" ];then
                 export PS1=$PS1"\[\e]30;\W/ \a\]\[\e]0;\a\]"
        else
                export PS1=$PS1"\[\e]30;\h:\W/ \a\]\[\e]0;\a\]"
        fi
fi
------END---------

In root's .bashrc, I have the following:

----BEGIN----------
#Bash prompt: (the word 'root' is in red)
export PS1="[\[\033[0;31m\]\u\[\033[0m\] \h \W]# "

#Set up a useful shell name in Konsole. Use * for root, and include hostname for remote logins (where $DISPLAY != :0)
if test "$DISPLAY"; then
        if [ "$DISPLAY" == ":0" -o "$DISPLAY" == ":0.0" ];then
                export PS1=$PS1"\[\e]30;*\W/ \a\]\[\e]0;\a\]"
        else
                export PS1=$PS1"\[\e]30;*\h:\W/ \a\]\[\e]0;\a\]"
        fi
fi
------END--------


Explanation: there are three things going on here.

1)The regular prompt that you see (as provided in the default PS1)

2)An escape sequence which tells konsole to change the TAB text

3)Another escape sequence which tells konsole to change the WINDOW TITLE.


These ARE compatible with xterm, (and will be ignored by rxvt), but will appear as junk characters in gnome-terminal. 


These things are documented somewhere (in the tips of the day, but nowhere else), but I do agree, it would be really nice to have a GUI option for them.



More information about the konsole-devel mailing list