aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.local/share/bin/panic39
1 files changed, 28 insertions, 11 deletions
diff --git a/.local/share/bin/panic b/.local/share/bin/panic
index 1fa978b..7455786 100755
--- a/.local/share/bin/panic
+++ b/.local/share/bin/panic
@@ -3,17 +3,34 @@ silent() {
"$@" 1>/dev/null 2> /dev/null &
}
-# clear desktop
-silent i3-msg focus output primary
-silent i3-msg workspace 'panic1'
-silent i3-msg focus output right
-silent i3-msg workspace 'panic2'
+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
+ # 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
+ # 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