From 6ea7f3a91f069917a03c28d5d006cbed15e0b03f Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sun, 22 Sep 2024 09:33:25 +0200 Subject: update panic script --- .local/share/bin/panic | 39 ++++++++++++++++++++++++++++----------- 1 file 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 -- cgit v1.2.3