summaryrefslogtreecommitdiffstats
path: root/oss_mute.sh
blob: cdb2e8493335e57473e569a918f98bfc150e1b22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/dash
#----------------------------------------------------
# Version:      0.1.0
# Author:       Florian "Bluewind" Pritz <f-p@gmx.at>
#
# Copyright (C) 2008-2009 Florian Pritz
#
# Licensed under GNU General Public License v3
#   (see COPYING for full license text)
#    
#----------------------------------------------------
# script to (un)mute oss devices
#----------------------------------------------------
MODE=1
CONTROL="jack.black.mute"

if [ $MODE = 1 ]; then
  MUTE=$(ossmix | grep "^$CONTROL\ " | awk '{print $4}' | awk -F')' '{print $1}')
  if [ "$MUTE" = 'ON' ]; then
	  ossmix "$CONTROL" OFF
  else
    ossmix "$CONTROL" ON
  fi
elif [ $MODE = 2 ]; then
 VOLUME=$(cat $HOME/.volume)
 if [ -z "$VOLUME" ]; then
       VOLUME=$(ossmix | grep "^$CONTROL " | awk '{print $4}' | awk -F : '{print $1}')
       ossmix $CONTROL 0
       echo $VOLUME > $HOME/.volume
 else
       ossmix $CONTROL $VOLUME 
       echo "" > $HOME/.volume
 fi
fi