3 # Change konsole tab to current path
4 konsole-rename-path () {
5 if [ -n "$KONSOLE_DCOP_SESSION" -o -n "$KONSOLE_DBUS_SESSION" ]
10 if [[ "$SDIR" != "$DIR" ]]
12 SDIR="...${DIR[-25,-1]}"
16 if [ -n "$KONSOLE_DCOP_SESSION" ]
18 dcop ${KONSOLE_DCOP_SESSION} renameSession "$SDIR"
19 elif [ -n "$KONSOLE_DBUS_SESSION" ]
21 qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 0 "$SDIR" > /dev/null 2>&1
22 qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 1 "$SDIR" > /dev/null 2>&1
27 # Change konsole tab to current command
28 konsole-rename-cmd () {
29 if [ -n "$KONSOLE_DCOP_SESSION" -o -n "$KONSOLE_DBUS_SESSION" ]
31 # We don't need to change tab to "cd xyz" or precmd redefinition
32 # Yes, this is a dirty hack
33 if [[ "$1" != \ cd\ \"* && "$1" != \ precmd* ]]
37 if [[ "$1" != "$TXT" ]]
43 if [ -n "$KONSOLE_DCOP_SESSION" ]
45 dcop ${KONSOLE_DCOP_SESSION} renameSession "$TXT"
46 elif [ -n "$KONSOLE_DBUS_SESSION" ]
48 qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 0 "$TXT" > /dev/null 2>&1
49 qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 1 "$TXT" > /dev/null 2>&1
55 precmd_functions+='konsole-rename-path'
56 preexec_functions+='konsole-rename-cmd'
58 # On changing directory, when in mc (automatically called).