Skip to content

Commit

Permalink
volume-pulseaudio: use correct mixer and scontrol
Browse files Browse the repository at this point in the history
  • Loading branch information
kb100 committed Jan 13, 2018
1 parent 67dba4f commit ee9986f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions volume-pulseaudio/volume-pulseaudio
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ Options:
esac
done

MIXER="default"
if [[ "$(amixer info | head -1 | cut -d ' ' -f 2)" == "pulse" ]] ; then
MIXER="pulse"
fi

SCONTROL=$(amixer -D "$MIXER" scontrols | sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" | head -n1)
CAPABILITY=$(amixer -D $MIXER get $SCONTROL | sed -n "s/ Capabilities:.*cvolume.*/Capture/p")


function move_sinks_to_new_default {
DEFAULT_SINK=$1
pacmd list-sink-inputs | grep index: | grep -o '[0-9]\+' | while read SINK
Expand All @@ -89,10 +98,10 @@ function set_default_playback_device_next {

case "$BLOCK_BUTTON" in
1) set_default_playback_device_next ;;
2) amixer -q -D pulse sset Master toggle ;;
2) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY toggle ;;
3) set_default_playback_device_next -1 ;;
4) amixer -q -D pulse sset Master $AUDIO_INTERVAL%+ ;;
5) amixer -q -D pulse sset Master $AUDIO_INTERVAL%- ;;
4) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_INTERVAL%+ ;;
5) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_INTERVAL%- ;;
esac

function print_format {
Expand Down

2 comments on commit ee9986f

@dikiaap
Copy link

@dikiaap dikiaap commented on ee9986f Jan 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kb100
Copy link
Collaborator Author

@kb100 kb100 commented on ee9986f Jan 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dikiaap Can you copy paste this comment into an issue please?

Please sign in to comment.