Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a keyboard that is just a generic Gateway one that I got with my PC. I was wondering if it was possible to use the volume keys on it. I have the output from xev after pressing both the volume up and volume down keys.

KeyPress event, serial 35, synthetic NO, window 0x2000001,
root 0x162, subw 0x0, time 3904956, (-45,-188), root:(378,348),
state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
XLookupString gives 0 bytes: 
XmbLookupString gives 0 bytes: 
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x2000001,
root 0x162, subw 0x0, time 3905056, (-45,-188), root:(378,348),
state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
XLookupString gives 0 bytes: 
XFilterEvent returns: False

KeyPress event, serial 38, synthetic NO, window 0x2000001,
root 0x162, subw 0x0, time 3906475, (-45,-188), root:(378,348),
state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
XLookupString gives 0 bytes: 
XmbLookupString gives 0 bytes: 
XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x2000001,
root 0x162, subw 0x0, time 3906574, (-45,-188), root:(378,348),
state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
XLookupString gives 0 bytes: 
XFilterEvent returns: False

So, what can I do to get these to change my volume under Crunchbang Linux?

Thanks in advance!

share|improve this question

In a similar situation on a laptop, I let the window manager (Fluxbox) handle the events via the following keyboard shortcuts in ~/.fluxbox/keys:

XF86AudioLowerVolume    :ExecCommand amixer sset -q Master,0 5%- 
XF86AudioRaiseVolume    :ExecCommand amixer sset -q Master,0 5%+ 
XF86AudioMute           :ExecCommand amixer sset -q Master,0 toggle

Crunchbang uses OpenBox as default as I understand, so maybe the solution is similar to my Fluxbox one.

share|improve this answer
    
Thank you so much! I'm on my laptop with Arch using Fluxbox, and I was trying to figure out what to insert into ~/.fluxbox/keys! I couldn't figure out the keycodes or the alsa command.. Thank you again, this just made my day. :) – JamesTheAwesomeDude Sep 27 '13 at 18:01

Under Ubuntu, an easy (usually) way is to install KeyTouch. If your keyboard is not supported out of the box, you need both the keytouch and keytouch-editor packages. Run the keytouch editor, and configure your keyboard.

Other relevant Ubuntu wiki pages are Hotkeys/Troubleshooting (but try KeyTouch first) and Hotkeys/Architecture (explaining this is not as simple a it should be under the hood).

I don't know how relevant this information is for Crunchbang, which is based on Ubuntu but might have changed things related to keyboard configuration.

share|improve this answer
    
I tried KeyTouch and the Ubuntu Wiki pages without success. Thanks though! – Wuffers Nov 13 '10 at 16:10

You need to configure a hal policy.

share|improve this answer

Heres what I chucked in my rc.xml

    <keybind key="XF86AudioRaiseVolume">
  <action name="Execute">
    <execute>amixer sset -q Master,0 5%+</execute>
  </action>
</keybind> 
<keybind key="XF86AudioLowerVolume">
  <action name="Execute">
    <execute>amixer sset -q Master,0 5%-</execute>
  </action>
</keybind>
<keybind key="XF86AudioMute">
  <action name="Execute">
    <execute>ExecCommand amixer sset -q Master,0 toggle</execute>
  </action>
</keybind>
share|improve this answer

You must log in to answer this question.

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