Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Sound output switcher using PulseAudio,libnotify
- #
- # by Mickaël Quirin <eephyne[guess what put here]gmail.com
- # inspired by script done by Anton Veretenenko <anton[email sign]veretenenko.ru>
- #
- # Modified by alienjon <holy.smoking.floorboards.batman[ ]gmail.com>
- notify_show=1
- notify_delay=2000
- headset_card_num=1
- stereo_card_num=2
- active_device=`pacmd list-sinks | grep -i -E '\* index' | sed -r "s/^.*\* index: //"`
- if [ "$active_device" == "$headset_card_num" ]
- then
- pacmd "set-default-sink ${stereo_card_num}"
- test=`pacmd list-sink-inputs | grep -i -E 'index:'`
- while read -r line;
- do
- sink=(`echo $line | sed -r s/^.*index:\ //`)
- pacmd move-sink-input $sink ${stereo_card_num};
- done <<< $test
- if [ $notify_show -eq 1 ]
- then
- notify-send -u normal -t $notify_delay -i gnome-sound-properties "Speakers Enabled" "Sound output switched to speakers"
- fi
- else
- pacmd "set-default-sink ${headset_card_num}"
- test=`pacmd list-sink-inputs | grep -i -E 'index:'`
- while read -r line;
- do
- sink=(`echo $line | sed -r s/^.*index:\ //`)
- pacmd move-sink-input $sink ${headset_card_num};
- done <<< $test
- if [ $notify_show -eq 1 ]
- then
- notify-send -u normal -t $notify_delay -i gnome-sound-properties "Headset Enabled" "Sound output switched to headsets"
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement