aboutsummaryrefslogtreecommitdiff
path: root/rxmenu-profile
blob: d30c96e664400c9569bd756c647416f25528b807 (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
42
43
44
45
46
47
48
49
50
#!/bin/sh

lf="$(printf '\n')"

t="$(promptmenu profile << EOF
mini
save
cons
norm
perf
EOF
)"

f() {
	if [ "$t" = "mini" ]; then
		telinit 2
		rfkill block 0
		rfkill block 1
		exit 0
	elif [ "$t" = "save" ]; then
		rfkill unblock 0
		rfkill unblock 1
		telinit 3
		setgov powersave
		exit 0
	elif [ "$t" = "cons" ]; then
		rfkill unblock 0
		rfkill unblock 1
		telinit 3
		setgov conservative
		exit 0
	elif [ "$t" = "norm" ]; then
		rfkill unblock 0
		rfkill unblock 1
		telinit 3
		setgov schedutil
		exit 0
	elif [ "$t" = "perf" ]; then
		rfkill unblock 0
		rfkill unblock 1
		telinit 3
		setgov performance
		exit 0
	else
		notify-send "profile $t" "not a valid profile"
		exit 1
	fi
}

log="$(f 2>&1)" && notify-send "profile $t" "$log"