fix: audio control and implement switch to bluettooth and internal

This commit is contained in:
Fabio Lenherr 2022-09-02 23:25:35 +02:00
parent 07b5b7dc15
commit db2c08d240
No known key found for this signature in database
GPG key ID: 868FFD689D878939
4 changed files with 71 additions and 14 deletions

37
eww/scripts/change-audio Executable file
View file

@ -0,0 +1,37 @@
#! /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

View file

@ -84,7 +84,6 @@ fi
hoverGet() {
NAME="$1"
EWW_BIN="$HOME/.local/bin/eww"
STORE="$HOME/.cache/cache.txt"
if [[ -f "$STORE" ]]; then
rm "$STORE"
${EWW_BIN} -c $HOME/.config/eww close "$NAME"
@ -92,14 +91,13 @@ fi
}
hoverCreate() {
STORE="$HOME/.cache/cache.txt"
if [[ ! -f "$STORE" ]]; then
touch "$STORE"
else
echo "failure!"
fi
}
STORE=true
if [ "$1" = "calendar" ]; then
calendar
elif [ "$1" = "system" ]; then