Change konsole session name
Source (link to git-repo or to original if based on someone elses unmodified work):
Available as/for:
Description:This can serve you to make more interesting things.
The screenshot is the original 5 minutes script.
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
4 4 soso
Looks similar to this one: http://kde-look.org/content/show.php?content=6976
When I su.. I get "bash: touch_konsole: command not found" upon running _any_ command with root. Any ideas?
you must put the code in root's bashrc.
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) ?
Can you explain better? write here or mail me thc{at}wanadoo{dot}es. Thanks
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...
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
Very nice script, really like it! Btw, do you know if theres any way to make this work when you su to root too?
use "su -m" or put an alias in your .bashrc alias su="su -m" like I have
thaht didn't work.. :/