Skip to content

Commit

Permalink
Merge pull request #916 from Mic92/joerg-ci
Browse files Browse the repository at this point in the history
add audio-chooser for desktop
  • Loading branch information
mergify[bot] authored Sep 24, 2023
2 parents a741338 + 1c932e7 commit 8f1409f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions home/bin/audio-chooser
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

choices=("Headphones" "Speakers" "Headphones (Output-Only)")
choices=("headphones" "speakers" "headphones (output-only)")
selected=$(for c in "${choices[@]}"; do echo "$c"; done | rofi -dmenu -p "Select Audio Setup: ")

echo You Picked: " $selected"
Expand All @@ -10,29 +10,33 @@ headset=alsa_card.usb-0b0e_Jabra_Link_380_08C8C2E6DA47-00
speakers=alsa_card.pci-0000_00_1f.3

case $selected in
Headphones)
headphones)
echo "Setting up Headphones"
pactl set-card-profile "$headset" output:analog-stereo+input:mono-fallback
pactl set-card-profile "$speakers" off
;;
Speakers)
speakers)
echo "Setting up Speakers"
pactl set-card-profile "$speakers" output:analog-stereo+input:analog-stereo
pactl set-card-profile "$headset" off
;;
"Headphones (Output-Only)")
"headphones (output-only)")
echo "Setting up Headphones (Output-Only)"
pactl set-card-profile "$headset" output:analog-stereo
pactl set-card-profile "$speakers" off
;;
*)
echo "Invalid Option $selected"
exit 1
;;
esac

pactl list short sinks | while read -r sink; do
sink_idx=$(echo "$sink" | cut -f1)
pamixer --unmute --sink "$sink_idx"
pamixer --unmute --sink "$sink_idx" || true
done

pactl list short sources | while read -r source; do
source_idx=$(echo "$source" | cut -f1)
pamixer --unmute --source "$source_idx"
pamixer --unmute --source "$source_idx" || true
done

0 comments on commit 8f1409f

Please sign in to comment.