blob: 0a23aedc8abba52ed52bba9516ad9102fbe9e9ab (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#!/bin/sh
# Aumix mute toggle
# Version: 1.1.0
# Date: 2005/03/21
#
# Copyright: 2004 Jeremy Brand <jeremy@nirvani.net>
# http://www.nirvani.net/software/
# Licenced under the GNU Public License Version 2.
#
# Purpose:
# To have a single script toggle between current sound levels
# and mute with the aumix program while maintaining
# and not deleting current mixer saved settings.
#
# Notes:
# I bind this program to a single key in my window manager's
# configuration file. It then serves the purpose of having a
# audio mute key. If you have a fancy keyboard with a mute
# key, try binding this program to that scancode.
#
# Usage:
#
# Toggle between mute and unmute based on last state:
# aumix-toggle-mute.sh
#
# Force mute:
# aumix-toggle-mute.sh --force-mute
#
# Force unmute:
# aumix-toggle-mute.sh --force-unmute
#
MUTERC="$HOME/.aumixrc.mute"
function __mute() {
if [ -e "$MUTERC" ]; then
aumix -v 0; aumix -w 0
else
aumix -f "$MUTERC" -S
aumix -v 0; aumix -w 0
fi
}
function __unmute () {
if [ -e "$MUTERC" ]; then
aumix -f "$MUTERC" -L > /dev/null
rm -f "$MUTERC"
else
aumix -L > /dev/null
fi
}
if [ "$1" = "--force-mute" ]; then
__mute;
elif [ "$1" = "--force-unmute" ]; then
__unmute;
elif [ -e "$MUTERC" ]; then
__unmute;
else
__mute;
fi
|