Change konsole session name

Various KDE 1.-4. Improvements

Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

4
Become a Fan
4.8

Available as/for:
Description:
This little script on your ~/.bashrc will change the konsole session name on the fly. Also will put the remote host name if you connect it with ssh wraper kssh.

This can serve you to make more interesting things.

The screenshot is the original 5 minutes script.
Last changelog:

0.21:
-Bug fix: now "really" works for root

0.2:
-No magic in konsole detection: use of KONSOLE_DCOP_SESSION enviroment variable
-Only change konsole name only when needed
-Implemented the wintermte's idea as a internal function. Called kssh

0.1:
-Initial release.


Ratings & Comments

11 Comments

marycstewart

4 4 soso

bk12
Traktopel

When I su.. I get "bash: touch_konsole: command not found" upon running _any_ command with root. Any ideas?

mrthc

you must put the code in root's bashrc.

romvinot

I like this little script and it has already been added to my bashrc. Could it be possible to get only the last 3 directories instead of the whole path (from $HOME) ?

mrthc

Can you explain better? write here or mail me thc{at}wanadoo{dot}es. Thanks

pdreker

I am not the original poster, but I think what he means is that only the last 3 components of the path should be used to rename the konsole session. I have a rather deep directory structure here and using your script would sometimes rename my konsole session to e.g. "~/Desktop/Development/Debian/Packages/somepackage-1.2.3/debian" which is a little bit too long to be really useful (the tabs become really wide)... Using only the last 2 or 3 components the session would be renamed to "Packages/somepackage-1.2.3/debian" or "somepackage-1.2.3/debian". Still rather long but better than the aforementioned name ;-) One usually knwos where approximately one is in one's own dir structure, so one only needs a short reminder which session is where. The complete path is uneccessary IMO...

wintermte

I have a possible enhancement for this that can rename the Konsole session when you ssh to another host to the remote host name. Try this in the .bashrc (mostly the same): # Look if the parent is konsole dcop konsole-$PPID &> /dev/null if [ $? -eq 0 ]; then #OK we are on konsole PROMPT_COMMAND=touch_konsole export INKONSOLE=$PPID else export INKONSOLE=0 fi#!/bin/sh # Look if the parent is konsole echo $INKONSOLE if [ $INKONSOLE -gt 0 ]; then #OK we are on konsole CURRENT_SESSION=`dcop konsole-$INKONSOLE konsole currentSession` dcop konsole-$INKONSOLE $CURRENT_SESSION renameSession "$1" fi /usr/bin/ssh -X $1 # the -X is optional alias ssh="~/bin/ssh" Create a script in ~/bin/ called ssh which contains: #!/bin/sh # Look if the parent is konsole echo $INKONSOLE if [ $INKONSOLE -gt 0 ]; then #OK we are on konsole CURRENT_SESSION=`dcop konsole-$INKONSOLE konsole currentSession` dcop konsole-$INKONSOLE $CURRENT_SESSION renameSession "$1" fi /usr/bin/ssh -X $1

aplsin

Very nice script, really like it! Btw, do you know if theres any way to make this work when you su to root too?

mrthc

use "su -m" or put an alias in your .bashrc alias su="su -m" like I have

aplsin

thaht didn't work.. :/

Pling
0 Affiliates
Details
license
version
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 0

Other Various KDE 1.-4. Improvements:

Slicker Debian Package for Woody
cirrusgr
last update date: 22 years ago

Score 5.0

Konqueror/kdesktop suggestion
PovMan
last update date: 22 years ago

Score 5.0

Biiig buttons
dbojan
last update date: 20 years ago

Score 5.0

Yet Another KControl
Frans
last update date: 20 years ago

Score 5.0

Next window and next/previos window
dbojan
last update date: 20 years ago

Score 5.0

Fantasie Toolbar
katoe
last update date: 19 years ago

Score 5.0