blob: 1b30ad67144dcdf65b9528c47820a9db61a83d1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#!/usr/bin/env zsh
lockFile=~/.mute.flock
case $1 in
mute)
(
flock -n 9 || exit 1
sleep 0.2
pacmd set-source-mute @DEFAULT_SOURCE@ 1
) 9<>${lockFile} &
;;
unmute)
set -o pipefail
while fuser ${lockFile} 2>/dev/null | cut -d ':' -f 2- | xargs -r -- kill; do sleep 0.001; done
pacmd set-source-mute @DEFAULT_SOURCE@ 0
;;
esac
|