summaryrefslogtreecommitdiffstats
path: root/.local/bin/set-title
blob: 34caa8a9c94ca3093e384fb24f6494c1d2c6b70c (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
#!/bin/sh

exec < /dev/tty

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