summaryrefslogtreecommitdiffstats
path: root/oss-mute-proc.sh
blob: dbd10b3e2b5e769b545369cf2f9e28f52a336f0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
#----------------------------------------------------
# Version:      0.1.1
# Author:       Florian "Bluewind" Pritz <f-p@gmx.at>
#
# Licensed under WTFPL v2
#   (see COPYING for full license text)
#    
#----------------------------------------------------
# script to (un)mute processes using oss
#----------------------------------------------------
PROC="$1"
VOLFILE="/tmp/${USER}_volume_${PROC}"

VOLUME=$(cat "$VOLFILE" 2> /dev/null)
if [ -z "$VOLUME" ]; then
	VOLUME=$(ossmix | grep "\"$PROC\"" | awk '{print $4}' | awk -F : '{print $1}')
	ossmix $PROC 0
	echo $VOLUME > "$VOLFILE"
else
	ossmix $PROC $VOLUME 
	rm "$VOLFILE"
fi