]> git.phdru.name Git - dotfiles.git/blob - bin/xtitle
Feat(recode-filenames-recursive): Allow to omit parameters
[dotfiles.git] / bin / xtitle
1 #! /bin/sh
2
3 case "$TERM" in
4    *rxvt*|screen*|*term*|vt100)
5       if [ -z "$1" ]; then
6          TITLE="${USER}@`hostname`:$(echo ${PWD} | sed -e "s|^${HOME}|~|")"
7       else
8          TITLE="$@"
9       fi
10       XTITLE="\033]0;${TITLE}\007" # Set xterm title/icon
11       case "$TERM" in
12          screen*)
13             XTITLE="\033P${XTITLE}\033\\\\" # Set xterm title/icon under screen/tmux 
14             XTITLE="${XTITLE}\033k${TITLE}\033\\\\" # Set screen/tmux caption
15          ;;
16       esac
17       echo -n "$XTITLE"
18    ;;
19 esac