37 lines
979 B
Bash
Executable file
37 lines
979 B
Bash
Executable file
#! /bin/sh
|
|
|
|
internal() {
|
|
SPEAKER=$(pactl list sinks | grep "Name" | grep "alsa" | awk -F ': ' '{ print $2 }')
|
|
if [ "$SPEAKER" != "" ]; then
|
|
pactl set-default-sink "$SPEAKER"
|
|
pactl set-sink-mute "$SPEAKER" false
|
|
DEVICE=$( echo "$SPEAKER" | awk -F '.' ' { print $4 } ')
|
|
notify-send "changed audio to "$DEVICE" "
|
|
else
|
|
notify-send "failed, not available!"
|
|
fi
|
|
}
|
|
|
|
bluetooth() {
|
|
SPEAKER=$(pactl list sinks | grep "Name" | grep "blue" | awk -F ': ' '{ print $2 }')
|
|
if [ "$SPEAKER" != "" ]; then
|
|
pactl set-default-sink "$SPEAKER"
|
|
pactl set-sink-mute "$SPEAKER" false
|
|
DEVICE=$(echo "$SPEAKER" | awk -F '.' ' { print $4 } ')
|
|
notify-send "changed audio to "$DEVICE" "
|
|
else
|
|
notify-send "failed, not available!"
|
|
fi
|
|
}
|
|
|
|
|
|
if [ "$1" == "internal" ]; then
|
|
internal
|
|
elif [ "$1" == "bluetooth" ]; then
|
|
bluetooth
|
|
else
|
|
SPEAKER=$(pactl info | grep "Default Sink" | awk -F ': ' ' { print $2 } ')
|
|
pactl set-sink-mute "$SPEAKER" false
|
|
fi
|
|
|
|
|