1

I have three simple bash script to handle the volume with the corresponding sink (bluetooth-adapter or laptop-speakers):

example 1:

#!/bin/bash

sink=`pactl list short sinks | grep "RUNNING" | cut -c 1`
pactl set-sink-mute $sink false
pactl set-sink-volume $sink -1%

The script detects the sink and put the volume up (or down). Next I did bind this script to a button and it worked fine. However if I bind it to the corresponding multimedia-key (like volume-down "XF86AudioLowerVolume") nothing will happen.

Can someone give me an advice how to bind a media-key to a bash script?

Running latest Manjaro on a Thinkpad x220 with Xfce

Thanks in advance!

example 2:

#!/bin/bash

sink=`pactl list short sinks | grep "RUNNING" | cut -c 1`
pactl set-sink-mute $sink false
pactl set-sink-volume $sink +1%

example 3:

#!/bin/bash

sink=`pactl list short sinks | grep "RUNNING" | cut -c 1`
pactl set-sink-mute $sink toggle

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.