aboutsummaryrefslogtreecommitdiff
path: root/.local/share/bin/panic
blob: 745578614c764c7edd8b43232aad0951023dd6c7 (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
#!/bin/sh
silent() {
	"$@" 1>/dev/null 2> /dev/null &
}

on() {
	# clear desktop
	silent i3-msg focus output primary
	silent i3-msg workspace 'panic1'
	silent i3-msg focus output right
	silent i3-msg workspace 'panic2'

	# stop playing media (if any)
	silent mpc pause
	silent playerctl -a pause

	# mute mic/headphones
	silent pactl set-sink-mute @DEFAULT_SINK@ true
	silent pactl set-source-mute @DEFAULT_SOURCE@ true
}

off() {
	# unmute mic/headphones
	silent pactl set-sink-mute @DEFAULT_SINK@ false
	silent pactl set-source-mute @DEFAULT_SOURCE@ false
}

panicfile="$XDG_CACHE_HOME/panic"
if [ -e "$panicfile" ] ; then
	rm "$panicfile"
	off
else
	touch "$panicfile"
	on
fi