view_name=
-function in_git_repo {
- pwd=$PWD
-
- while [ "$pwd" != "/" ]; do
- if [ -d "$pwd/.git" ]; then
- true;
- return;
- fi
-
- pwd=$(dirname "$pwd")
- done
-
- false
-} # in_git_repo
-
# Function to set the title bar. Works on the terminal emulators listed.
function title_bar {
+ if [ $# -gt 1 ]; then
+ ROOT=shift
+ ROOT="${NORMAL}\($ROOT\)"
+ fi
+
prefix="$@"
+
# Change $HOME -> ~
if [ "${PWD#$HOME*}" != "$PWD" ]; then
current_dir="~${PWD#$HOME*}"
string=$(echo "${SYSNAME##*:}:$@")
echo -n "${ESC}]2;$string\007"
elif [ "$TERM" = "cygwin" -o "$TERM" = "vt100" -o "$TERM" = "xterm" ]; then
- PS1="\[\e]0;$prefix$current_dir\a\e[01;33m\]$SYSNAME:\[\e[0m\]"
+ PS1="\[\e]0;$prefix$current_dir\a$ROOT\e[01;33m\]$SYSNAME:\[\e[0m\]"
fi
} # title_bar
view_name=""
title_bar "$ROOT"
else
- title_bar "${ROOT}View: $view_name: "
+ title_bar "$ROOT" "View: $view_name: "
fi
icon_name "${SYSNAME##*:}"