Topic: Changing Pulseaudio's sinks with a fingertip!

Hi all!!

Well, I had some spare time, and the inhability to change sound output is something that kept me frustrated with the sound under linux... until now!!! big_smile

This is a quite simple script, wich should change your audio output if you only have 2 sinks...if not...well, you can just finish this script off wink

#!/bin/bash

currentindex=`pacmd list-sinks | grep index | grep -v '\*' | awk '{print $3}'`
currentinput=`pacmd list-sink-inputs | grep index | awk '{print $2}' | head -c 2`

#echo "index = ${index}"                        #debug
#echo "currentinput = ${currentinput}" #debug

pacmd move-sink-input ${currentinput} ${index}    #set input
pacmd set-default-sink $index             #set pa index

One of the problem I'm having just now, is I'm trying to bind this (in scrotwm), with the following code:

program[ChangeSink]    = ~/bin/changesound.sh
bind[ChangeSink]    = MOD+Shift+s

I'm trying to get this to work...any ideas?

Last edited by Athos (2012-01-24 13:09:56)

Re: Changing Pulseaudio's sinks with a fingertip!

Try replacing ~ by /home/<yourusername>
The ~ thingy is a bashism.

If you poke the bear it is going to come after you.

Re: Changing Pulseaudio's sinks with a fingertip!

xaos52 wrote:

Try replacing ~ by /home/<yourusername>
The ~ thingy is a bashism.


I did it, but it isn't working :-/

Any ideas?

Re: Changing Pulseaudio's sinks with a fingertip!

Did you make the script executable?
Did you restart the xserver after modifying the config file?

Last edited by xaos52 (2012-01-24 15:31:00)

If you poke the bear it is going to come after you.

Re: Changing Pulseaudio's sinks with a fingertip!

xaos52 wrote:

Did you make the script executable?
Did you restart the xserver after modifying the config file?


Oh sh*t!

Thank you! I even looked for some privileges problems, but I forgot the executable flag...

Damn, that was a noobish error.
Thanks