Bug 47684

Summary: wish - session names = current dir
Product: [Applications] konsole Reporter: static55
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: wishlist CC: ehamberg
Priority: NOR    
Version: 1.1.3   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description Bugzilla Maintainers 2002-09-10 07:04:21 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           konsole
Version:           1.1.3 (using KDE 3.0.3 )
Severity:          wishlist
Installed from:    Gentoo Packages
Compiler:          Not Specified
OS:                Linux
OS/Compiler notes: Not Specified

i think it would be helpful if konsole could use the directory names (or full paths) that each konsole session had open as the name for that session. 

a lot of times i have 5 or more konsole sessions open in one konsole window.. sometimes i have sessions open that are telnetted into other computers.. or sometimes i know that one session is in a certain directory and i want to get into that directory without cd-ing to it. most of the time i'm too lazy to name my sessions so i wind up clicking on two or three (or four or five) to find the session i want. 

if i could tell what directory each session was currently in at a glance i could probably find the session i want on the first click.

i saw another cool feature in another console app a while ago.. (i think it was the gnomes consol app.. not sure) if i remember correctly the console app had this cool feature that underlined URLs when i moved the cursor over them. I'm not sure if it actually opened the urls in a browser when i clicked on them though. 

it would be exceedingly cool if konsole could recognize links and open them in konqueror (or mozilla) when they are clicked on. :-)

(Submitted via bugs.kde.org)
Comment 1 Unknown 2002-09-16 13:12:01 UTC
The first is already implemented for KDE 3.1 via escape sequences.  
The second is a duplicate of bug 29712. 
Comment 2 Richard Neill 2004-01-16 07:58:59 UTC
I have the following in my bashrc:

if test "$DISPLAY"; then
        export PROMPT_COMMAND='echo -ne "\033]30;`basename $PWD`/ \007\033]31;\007"'
fi

This means that the session name will be  
    rjn/   
when I am in /home/rjn. I also have different things in root's .bashrc
so as to prepend a * i.e.
   *rjn/
and on remote systems:
   machine-name:dir/
or
   *machine-name:dir/


1)I think it would be nice to have this option in the GUI. It's really useful, and I think it should be an option for settings->configure konsole.

2)If it could use colour (eg a red *), that would be even better.
Comment 3 Erlend Hamberg 2005-06-22 22:13:43 UTC
It would be really nice to have this option in the GUI in some way.
I had no idea I could change the tab caption with a PROMPT_COMMAND, and I have used KDE and Konsole for years. :)
Comment 4 Richard Neill 2005-06-23 08:23:05 UTC
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.