I thought it would be a great idea to aggregate brilliant info found on the internet for easy set up.
1) Create bash script to control PulseAudio volume and mute:-
#!/bin/bash
#### Create ~/.pulse/mute if not exists
ls ~/.pulse/mute &> /dev/null
if [[ $? != 0 ]]
then
echo "false" > ~/.pulse/mute
fi
####Create ~/.pulse/volume if not exists
ls ~/.pulse/volume &> /dev/null
if [[ $? != 0 ]]
then
echo "65536" > ~/.pulse/volume
fi
CURVOL=`cat ~/.pulse/volume` #Reads in the current volume
MUTE=`cat ~/.pulse/mute` #Reads mute state
if [[ $1 == "vol+" ]]
then
CURVOL=$(($CURVOL + 3277)) #3277 is 5% of the total volume, you can change this to suit your needs.
if [[ $CURVOL -ge 65536 ]]
then
CURVOL=65536
fi
elif [[ $1 == "vol-" ]]
then
CURVOL=$(($CURVOL - 3277))
if [[ $CURVOL -le 0 ]]
then
CURVOL=0
fi
elif [[ $1 == "mute" ]]
then
if [[ $MUTE == "false" ]]
then
pactl set-sink-mute 0 1
echo "true" > ~/.pulse/mute
exit
else
pactl set-sink-mute 0 0
echo "false" > ~/.pulse/mute
exit
fi
fi
pactl set-sink-volume 0 $CURVOL
echo $CURVOL > ~/.pulse/volume # Write the new volume to disk to be read the next time the script is run.
#############################################################################
I added the above script as /usr/local/bin/pulseaudio-mmkey using mousepad (be sure to set permissions to executable!!).
2) Map the appropriate keys to the above script.
I used Xfce Settings Manager --> Keyboard --> Application Shortcuts --> +Add (enter the COMMAND and press the required MM key - See below).
COMMAND......................... MMkey
pulseaudio-mmkey vol+ ----> XF86AudioRaiseVolume
pulseaudio-mmkey vol- ----> XF86AudioLowerVolume
pulseaudio-mmkey mute ---> XF86AudioMute
The above is neccessary due to xfce4-volumed not being compatible with PulseAudio.
For Banshee media player control map the keys as follows:-
COMMAND.........................MMkey
banshee --toggle-playing ----> XF86AudioPlay
banshee --next ---------------> XF86AudioNext
banshee --previous -----------> XF86AudioPrev
This solution works beautifully on my Debian Sid Xfce 4.8 desktop. Enjoy!