Fix VolumeUp|VolumeDown|Mute/Unmute keyboard keys in Lubuntu

Mostly for my own reference; to get the Volume Up/Volume Down/{Mute|Unmute} keys to work on my Microsoft Natural Ergonomic Keyboard 4000 in Lubuntu (Ubuntu with LXDE/Openbox), I had to modify the lubuntu-rc.xml file to indicate the correct commands to execute when those keys were pressed.

Initially, I thought that the system wasn’t identifying the keys correctly, so I was using the xev tool to see what keycode was being sent to the system, but I found that the system already understood the keys properly. (They were identified as XF86AudioRaiseVolume, XF86AudioLowerVolume, and XF86AudioMute.)

The problem was that I am using the pulse audio daemon and the incorrect commands were being executed to adjust volume/mute/etc.

So, I edited ~/.config/openbox/lubuntu-rc.xml, looking for “volume” and commenting out the old command, substituting in the correct command as follows:

    <!-- Keybinding for Volume management -->
    <keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
        <!-- <command>amixer -q sset Master 3%+ unmute</command> -->
        <command>amixer -D pulse set Master 3%+ unmute</command>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
        <!-- <command>amixer -q sset Master 3%- unmute</command> -->
        <command>amixer -D pulse set Master 3%- unmute</command>
      </action>
    </keybind>
    <keybind key="XF86AudioMute">
      <action name="Execute">
        <!-- <command>amixer -q sset Master toggle</command> -->
        <command>amixer -D pulse set Master toggle</command>
      </action>
    </keybind>

Then I ran the command openbox --reconfigure to reload the configuration file.

Success!

3 thoughts on “Fix VolumeUp|VolumeDown|Mute/Unmute keyboard keys in Lubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.