Added desktop notifications via notify-send

This commit is contained in:
crt0mega 2022-02-16 16:05:33 +01:00
parent 94e094b53b
commit 684f24de7a
Signed by: crt0mega
GPG Key ID: DCAA09100B14F420
1 changed files with 17 additions and 5 deletions

View File

@ -1,23 +1,35 @@
#!/bin/bash
CARD=$(grep /proc/asound/cards -e "DGX" | cut -d' ' -f2 -)
declare CARD=$(grep /proc/asound/cards -e "DGX" | cut -d' ' -f2 -)
declare NTFY=$(command -v notify-send)
declare NTFY_ARGS="--icon=sound DGX-Switcher "
output() {
echo $TEXT
if [ $NTFY ]; then
$NTFY $NTFY_ARGS "$TEXT"
fi
}
if [ "$CARD" = "" ]; then
echo "Keine Xonar DGX gefunden, beende."
TEXT="Keine Xonar DGX gefunden, beende."
output
exit
fi
AOUT=$(amixer -c $CARD sget 'Analog Output' | grep -e "Item0:" | cut -d"'" -f2 -)
echo "Analog Output momentan geschaltet auf: $AOUT"
TEXT="Analog Output momentan geschaltet auf: $AOUT"
if [ "$AOUT" = "Multichannel" ]; then
echo "Schalte um auf Kopfhörer (Front Panel)"
TEXT="$TEXT\nSchalte um auf Kopfhörer (Front Panel)"
output
amixer -c $CARD sset 'Analog Output' 'Stereo Headphones FP' > /dev/null
else
echo "Schalte um auf Mehrkanalausgabe"
TEXT="$TEXT\nSchalte um auf Mehrkanalausgabe"
output
amixer -c $CARD sset 'Analog Output' 'Multichannel' > /dev/null
fi