summary refs log tree commit diff
path: root/bin/hibiki/soundswitch
blob: 9ba73c9216ef4ea8276b345030964cfcbbe14973 (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
32
33
34
35
36
37
38
39
40
41
#!/bin/sh
set -ex

global=
focused=
profile=

while getopts fgp: name; do
	case $name in
		g) global=1 ;;
		f) focused=1 ;;
		p) profile=1 ;;
		?) printf "usage: %s [-gf]\n" "$0" >&2; exit 2 ;;
	esac
done

if [ "$#" -lt 1 ]; then
	printf "global\nfocused\nprofile\n" | menu | {
		read -r line
		case "${line}" in
			global) exec "$0" -g ;;
			focused) exec "$0" -f ;;
			profile) exec "$0" -p ;;
		esac
	}
fi

if [ -n "${global}" ]; then
	pactl list short sinks | awk '{print $2}' | menu | xargs pactl set-default-sink
	exit 0
fi

if [ -n "${focused}" ]; then
	printf "not implemented\n" >&2
	exit 1
fi

if [ -n "${profile}" ]; then
	printf "not implemented\n" >&2
	exit 1
fi