aboutsummaryrefslogtreecommitdiff
path: root/scripts/audio_status.sh
blob: 84a6a0116afe20dac2a8c8f7da2e9cfd93e1f8c9 (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
#!/bin/sh

function print_mute {
   echo -n "M " 
}

function print_unmute {
   echo -n "U " 
}

if type pamixer &>/dev/null
then
    if pamixer --get-mute &> /dev/null
    then
        print_mute
    else
       print_unmute
   fi

   echo -n $(pacmd info | grep 'Default sink' | grep -o '[^.]*$')

   echo " [$(pamixer --get-volume)%]"

elif type amixer &>/dev/null
then
    if [[ "$(amixer sget Master | grep '\[on\]')" == "" ]]
    then
        print_mute
    else
        print_unmute
    fi

    echo -n "Volume: "

    echo "[$(amixer sget Master | grep Mono: | sed -e 's/[ \t]*Mono: Playback [0-9]* \[\([0-9]*%\)\].*/\1/')]"
else
    echo "please install either pamixer or amixer"
fi