5

When i press mute button on keyboard, it works. But when i press it second times, sound not unmute. How to repair it ?

This key on xubuntu 14.04 works good. Hardware is samsung 550p5c.

3

2 Answers 2

9

I also had the same problem. Author has provided a link in the comments with a forum post where it has been solved, but for completeness, if somebody else runs into this post, here is a solution.

The problem with unmuting is that pressing the button unmutes only the master channel but not Pulsaudio channels. To correct this one has to modify the keybinding for XF86AudioMute button which on Lubuntu is defined in file ~/.config/openbox/lubuntu-rc.xml. Open the file with a text editor and find <keybind key="XF86AudioMute">, and in <command> section put the following command: amixer -D pulse set Master Playback Switch toggle.

This question has been discussed at askubuntu as well, but that one is actually difficult to find if you do not know that Alsa is the problem, which can easily happen to an Ubuntu newbie.

At the end run openbox --reconfigure to set the configuration.

2
  • 1
    After changing the lubuntu-rc.xml file, of course make OpenBox read its new configuration to let the changes take effect. Just execute openbox --reconfigure, no restart required. [source]
    – tanius
    Feb 17, 2016 at 0:51
  • 1
    And according to this new comment over at the other askubuntu discussion, technically the correct command is amixer -D pulse set Master toggle. The one you have also works though.
    – tanius
    Feb 17, 2016 at 1:10
0

The trick is to make the speaker or headphone state follow the state of the master channel depending on if you have the headphones plugged in or not. This script does it for me on my ancient Dell Latitude laptop:

#!/bin/bash

amixer -q sset Master toggle

MASTER_STATE=`amixer get Master | awk -F"dB] " 'NR == 5 {print $2;}'`
HEADPHONES_PLUGGED=`amixer contents | grep -A 2 Headphone\ Jack | awk -F"=" 'NR == 3 {print $2;}'`

if [[ $HEADPHONES_PLUGGED == 'on' ]]; then
    SLAVE="Headphone"
else
    SLAVE="Speaker+LO"
fi

if [[ $MASTER_STATE == '[on]' ]]; then
    amixer -q sset $SLAVE unmute
else
    amixer -q sset $SLAVE mute
fi

You may need to check your channels with amixer on your computer and change the SLAVE definitions accordingly. Also the "Headphone\ Jack" grep string in the HEADPHONES_PLUGGED definition might need to be something else.

To hook into the toggle button you should make the above script available through your ~/.config/openbox/lubuntu-rc.xml configuration file.

<keybind key="XF86AudioMute">
    <action name="Execute">
        <!--command>amixer -q sset Master toggle</command-->
        <command>/usr/local/bin/amixer-toggle.sh</command>
    </action>
</keybind>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .