summaryrefslogtreecommitdiffstats
path: root/oss-mute-proc.sh
blob: 3fbd3475b99df0935ba6a93414d013b8aa0d7760 (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 <flo@xssn.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