Topic: [SOLVED]Volume keybind in OB

Is it possible to make a keybind in Openbox where I can control the volume with the Super key and the mouse wheel, without having to install an additional app for it?

Thanks.

Last edited by h8uthemost (2011-08-30 13:19:09)

Re: [SOLVED]Volume keybind in OB

I'm not sure exactly how to bind the mouse wheel in openbox but I'm sure it's possible. I had to bind my function+ arrow key on my Lenovo laptop. Here's what the code from rc.xml looks like:

    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Volume down</name>
        </startupnotify>
        <command>amixer set Master 8-</command>
      </action>
    </keybind>
    <keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Volume up</name>
        </startupnotify>
        <command>amixer set Master 8+</command>
      </action>
    </keybind>

You need to run xev from a terminal and move the mouse wheel over the window that pops up and see if the terminal responds.

Re: [SOLVED]Volume keybind in OB

Thanks mynis.

My code similar to yours with my volume key bindings. Expect I have mine set as W-Up and W-Down for up and down. The thing is, if I can just figure out what the key is for mousewheel up and mousewheel down, then I could just replace the Up and Down with those keys. But I'm having a hard time finding out what I would type for mousewheel up/down. I thought it was C-A-Right/Left for the mouse wheel, but I tried it and didn't work.

Re: [SOLVED]Volume keybind in OB

Isn't that the keybind for mousewheel:

 
<mousebind button="Up" action="Click">
        <action name="Shade"/>
      </mousebind>
      <mousebind button="Down" action="Click">
        <action name="Unshade"/>
        <action name="Raise"/>
      </mousebind>

Re: [SOLVED]Volume keybind in OB

Thanks, foolphil. I tried it though but still can't get it to work. Maybe I'm putting in the wrong mousebind though. I used W-Up/Down.

This is a pretty tricky one.

Re: [SOLVED]Volume keybind in OB

So does xev just not show output for the mouse wheel or something?

Re: [SOLVED]Volume keybind in OB

This works for me:

<mousebind button="W-Up" action="Click">
  <action name="Execute">
    <command>amixer -q set Master 5%+</command>
  </action>
</mousebind>
<mousebind button="W-Down" action="Click">
  <action name="Execute">
    <command>amixer -q set Master 5%-</command>
  </action>
</mousebind>

You should put these code two times into the <mouse> section of your rc.xml, if you want to use it everywhere on your screen:

  • In the context "Frame": For any position of a window.

  • In the context "Desktop": When you are outside of any window.

Re: [SOLVED]Volume keybind in OB

mynis01 wrote:

So does xev just not show output for the mouse wheel or something?

Nah, it sure didn't. It showed output for just about every other key, but nothing when I scrolled the wheel.

aiBo wrote:

This works for me:

I just knew that someone here has used this setup before. That code you posted works perfectly. smile But that's pretty much what I was trying before, but I was putting it into the wrong sections in my rc.xml. Thanks for letting me know the right places to put in.

And thanks everyone else for the help as well.