aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/signal
blob: 8653bde4ad6f1250de91998259593a914bbace18 (plain)
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
#! /usr/bin/env sh

main()
{
	# Handle opts
	opts "$@"
	shift "$OPTS"
	unset OPTS

	# Show help
	[ "$OPT_HELP_ONLY" ] && usage && exit 0

	export TMPDIR=${XDG_CACHE_HOME:-$HOME/.local/tmp}

	exec signal-desktop
}

opts()
{
	OPTS=0

	while getopts ":h" opt
	do
		case "$opt" in
			h) OPT_HELP_ONLY=1 ;;
			*)
				printf "Invalid option passed: %s\n" "$OPTARG" >&2
				;;
		esac
	done

	unset opt
}

usage()
{
	cat <<EOF
Usage:
	$(basename "$0") -h

Wrapper for signal[-desktop]. This starts the Signal desktop client, but
applying some fixes here and there to make it actually start. Daily reminder
that Electron is a cancer on our society, and people using it should be
receiving electro-shock therapy.

Options:
	-h  Show this help text and exit.
EOF
}

main "$@"