File: xtitle.sh

package info (click to toggle)
xtitle 1.0.2-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 128 kB
  • ctags: 41
  • sloc: sh: 103; makefile: 58
file content (88 lines) | stat: -rwxr-xr-x 2,344 bytes parent folder | download
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh -
PATH=/bin:/usr/bin; export PATH

# xtitle - set window title and icon name for an X11 terminal window
# Steve Kinzler, kinzler@cs.indiana.edu, Nov 93/Nov 98/Mar 00/Dec 09
# see website http://www.cs.indiana.edu/~kinzler/xtitle/
# http://www.cs.indiana.edu/~kinzler/home.html#x11

# An older version of this script (not recommended for use in dtterm's)
# is packaged for Solaris and available at
#	http://metalab.unc.edu/pub/solaris/sparc/

#   Copyright
#
#	Copyright (C) 1993 Stephen B Kinzler <kinzler@cs.indiana.edu>
#
#   License
#
#	This program is free software; you can redistribute it and/or modify
#	it under the terms of the GNU General Public License as published by
#	the Free Software Foundation; either version 2 of the License, or
#	(at your option) any later version.
#
#	This program is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#	GNU General Public License for more details.
#
#	You should have received a copy of the GNU General Public License
#	along with this program. If not, see <http://www.gnu.org/licenses/>.

#version=1.0.0
version=1.0.1	# 2009-12-10: add copyright/GPL notice for debian pkg
version=1.0.2	# 2009-12-18: add -V option, long options

Help ()
{
    echo "\
usage: $0 [ -itvV ] string ...
	-i, --icon	set icon name
	-t, --title	set window title
	-v, --verbose	display informational messages
	-V, --version	only output program version
Without -i or -t options, both the window title and icon name are set.
Version $version"

    exit 0
}

default="-t-i"  # flags
target=

while :
do
	case $# in
	0)	break;;
	*)	case "$1" in
		-h|--help)      Help ;;
		-i|--icon)	target="${target}-i" ;;
		-t|--title)	target="${target}-t" ;;
		-v|--verbose)	target="${target}-v" ;;
		-V|--version)	echo $version ; exit 0 ;;
		-*)		echo "$0: unknown option ($1)" >&2 ;;
		--)		shift; break ;;
		*)		break ;;
		esac
		shift;;
	esac
done

[ ! "$arget" ] && target=$default

case "$target" in
*i*|*t*) something="something" ;;
esac

case "$target" in
*t*)	case "$target" in
	*-v*)	echo "]2;$*title = $*";;
	*)	echo "]2;$*" | tr -d '\012';;
	esac;;
esac
case "$target" in
*i*)	case "$target" in
	*-v*)	echo "]1;$*icon  = $*";;
	*)	echo "]1;$*" | tr -d '\012';;
	esac;;
esac