summaryrefslogtreecommitdiffstats
path: root/.zfunc/set-title
blob: ae46b5a65448da34b1ba0542f79a8d701439ab1d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!zsh
emulate -L zsh

if tput hs
then
	tsl="$(tput tsl)"
	fsl="$(tput fsl)"
	hs=1
else
	case ${TERM} in
		xterm*|rxvt*)
			tsl="$(printf "\x1b]0;")"
			fsl="$(printf "\a")"
			hs=1
			;;
		screen*)
			tsl="$(printf "\x1b_")"
			fsl="$(printf "\x1b\\")"
			hs=1
			;;
	esac
fi

if test "$hs" = 1
then
	printf "%s" "$tsl"
	printf "%s" "$@"
	printf "%s" "$fsl"
fi