]> git.alrj.org Git - zsh.d.git/commitdiff
Use zsh truncation functions for tabs labels
authorAmand Tihon <amand.tihon@iba-group.com>
Fri, 6 May 2011 09:39:06 +0000 (11:39 +0200)
committerAmand Tihon <amand.tihon@iba-group.com>
Fri, 6 May 2011 09:39:06 +0000 (11:39 +0200)
S61_konsoletabs

index 340eb1644f396eb30627a0ca998c0e0e03ece2b3..710d703d09d712f605133397971b3fdf5e51451f 100644 (file)
@@ -5,21 +5,14 @@ konsole-rename-path () {
     if [ -n "$KONSOLE_DCOP_SESSION" -o -n "$KONSOLE_DBUS_SESSION" ]
     then
         local DIR
     if [ -n "$KONSOLE_DCOP_SESSION" -o -n "$KONSOLE_DBUS_SESSION" ]
     then
         local DIR
-        DIR=${PWD/#${HOME}/\~}
-        SDIR="${DIR[-28,-1]}"
-        if [[ "$SDIR" != "$DIR" ]]
-        then
-           SDIR="...${DIR[-25,-1]}"
-        else
-           SDIR="$DIR"
-        fi
+        DIR=`print -P "%28<...<%~"`
         if [ -n "$KONSOLE_DCOP_SESSION" ]
         then
         if [ -n "$KONSOLE_DCOP_SESSION" ]
         then
-          dcop ${KONSOLE_DCOP_SESSION} renameSession "$SDIR"
+          dcop ${KONSOLE_DCOP_SESSION} renameSession "$DIR"
         elif [ -n "$KONSOLE_DBUS_SESSION" ]
         then
         elif [ -n "$KONSOLE_DBUS_SESSION" ]
         then
-          qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 0 "$SDIR" > /dev/null 2>&1
-          qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 1 "$SDIR" > /dev/null 2>&1
+          qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 0 "$DIR" > /dev/null 2>&1
+          qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 1 "$DIR" > /dev/null 2>&1
         fi
     fi
 }
         fi
     fi
 }
@@ -32,21 +25,16 @@ konsole-rename-cmd () {
         # Yes, this is a dirty hack
         if [[ "$1" != \ cd\ \"* && "$1" != \ precmd* ]]
         then
         # Yes, this is a dirty hack
         if [[ "$1" != \ cd\ \"* && "$1" != \ precmd* ]]
         then
-            local TXT
-            TXT="${1[0,33]}"
-            if [[ "$1" != "$TXT" ]]
-            then
-                TXT="${1[0,30]}..."
-            else
-                TXT="$1"
-            fi
+            local CMD
+            CMD=`print -P "%30>...>$1>"`
+
             if [ -n "$KONSOLE_DCOP_SESSION" ]
             then
             if [ -n "$KONSOLE_DCOP_SESSION" ]
             then
-              dcop ${KONSOLE_DCOP_SESSION} renameSession "$TXT"
+              dcop ${KONSOLE_DCOP_SESSION} renameSession "$CMD"
             elif [ -n "$KONSOLE_DBUS_SESSION" ]
             then
             elif [ -n "$KONSOLE_DBUS_SESSION" ]
             then
-              qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 0 "$TXT" > /dev/null 2>&1
-              qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 1 "$TXT" > /dev/null 2>&1
+              qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 0 "$CMD" > /dev/null 2>&1
+              qdbus ${KONSOLE_DBUS_SERVICE} ${KONSOLE_DBUS_SESSION} setTitle 1 "$CMD" > /dev/null 2>&1
             fi
         fi
     fi
             fi
         fi
     fi