3 # Change konsole tab to current path
4 konsole-rename-path () {
5 if [ -n "$KONSOLE_DCOP_SESSION" -o -n "$KONSOLE_DBUS_SESSION" ]
8 DIR=`print -P "%28<...<%~"`
9 if [ -n "$KONSOLE_DCOP_SESSION" ]
11 dcop ${KONSOLE_DCOP_SESSION} renameSession "$DIR"
12 elif [ -n "$KONSOLE_DBUS_SESSION" ]
14 qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 0 "$DIR" > /dev/null 2>&1
15 qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 1 "$DIR" > /dev/null 2>&1
20 # Change konsole tab to current command
21 konsole-rename-cmd () {
22 if [ -n "$KONSOLE_DCOP_SESSION" -o -n "$KONSOLE_DBUS_SESSION" ]
24 # We don't need to change tab to "cd xyz" or precmd redefinition
25 # Yes, this is a dirty hack
26 if [[ "$1" != \ cd\ \"* && "$1" != \ precmd* ]]
29 CMD=`print -P "%30>...>$1"`
31 if [ -n "$KONSOLE_DCOP_SESSION" ]
33 dcop ${KONSOLE_DCOP_SESSION} renameSession "$CMD"
34 elif [ -n "$KONSOLE_DBUS_SESSION" ]
36 qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 0 "$CMD" > /dev/null 2>&1
37 qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 1 "$CMD" > /dev/null 2>&1
43 precmd_functions+='konsole-rename-path'
44 preexec_functions+='konsole-rename-cmd'
46 # On changing directory, when in mc (automatically called).