summaryrefslogtreecommitdiff
path: root/home/wayland/pkgs/wayland-scripts/src/bin/ttyasrt
blob: 5148faf1608a19f09aed13f1fbf953ae054aba45 (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
#!/bin/sh

die()
{
	printf "\033[31;1merr: %b\033[0m\n" "$1"
	command -v notify-send > /dev/null &&
		notify-send "    ttyasrt" "$1"
	exit "${2:-1}"
}

########
# MAIN #
########

if [ -z "$TERMINAL" ]; then
	die "\$TERMIANL must be set"
fi

if tty --silent; then
	exec "$@"
else
	exec "$TERMINAL" -- "$@"
fi