-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvolumeControl.sh
executable file
·53 lines (48 loc) · 1.35 KB
/
volumeControl.sh
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
#!/bin/bash
# Author: Nate Levesque <[email protected]>
# Language: Shell
# Filename: volumeControl.sh
#
# Description:
# Simple script to change the volume, useful to bind to keys in
# desktops/WMs that don't have their own control for it.
#
# Arguments:
# (none): displays the current volume to the terminal and pops up
# a notification with libnotify with the same info
# up: raises the volume 5%
# down: lowers the volume 5%
# mute: mutes/unmutes the volume, prints it the console and shows a
# libnotify notification
#
# Example:
# ./volumeControl.sh mute - toggles mute
# ./volumeControl.sh - shows current playback status
# ./volumeControl.sh up - raise volume 5%
#
MIXER_COMMAND_VOLUME_UP=true
MIXER_COMMAND_TOGGLE_MUTE=true
MIXER_COMMAND_VOLUME_DOWN=true
if which amixer &> /dev/null; then
MIXER_COMMAND_VOLUME_UP="amixer set Master 5%+"
MIXER_COMMAND_VOLUME_DOWN="amixer set Master 5%-"
MIXER_COMMAND_TOGGLE_MUTE="amixer set Master toggle"
fi
if which pamixer &> /dev/null; then
MIXER_COMMAND_VOLUME_UP="pamixer -i 5"
MIXER_COMMAND_VOLUME_DOWN="pamixer -d 5"
MIXER_COMMAND_TOGGLE_MUTE="pamixer -t"
fi
case "$1" in
"")
;;
up)
$MIXER_COMMAND_VOLUME_UP
;;
down)
$MIXER_COMMAND_VOLUME_DOWN
;;
mute)
$MIXER_COMMAND_TOGGLE_MUTE
;;
esac