summaryrefslogtreecommitdiffstats
path: root/.zfunc/set-title
blob: cba1aebd63b1869e30ab7cacbf52e20002f54eb5 (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
30
31
#!zsh
emulate -L zsh

zmodload zsh/terminfo

if [[ $teminfo[hs] == "yes" ]]
then
	tsl="$terminfo[tsl]"
	fsl="$terminfo[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 [[ "$hs" == 1 ]]
then
	printf "%s" "$tsl"
	printf "%s" "$@"
	printf "%s" "$fsl"
fi