1

Summary

I switched to i3wm and I'm trying to set up my environment. I am using an Apple keyboard (circa 2007). It has three volume keys and I can't find their keycodes for mapping.

Analysis

I read some other online guides for how to determine the keycode. I tried using xev to find out what keys these are, but it doesn't return me a keycode… only an output that doesn't seem to make sense.

FocusOut event, serial 33, synthetic NO, window 0x2200001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 33, synthetic NO, window 0x2200001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 33, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

FocusOut event, serial 33, synthetic NO, window 0x2200001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 33, synthetic NO, window 0x2200001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 33, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

The first three "blocks" are from one press of the "volume up" key, and the last three are from the "volume down" key. From this info, I'm unable to figure out what the keycode is so that I can make a mapping for volume in my system.

Before this, I was using GNOME (Fedora 25) and GNOME was able to use the volume keys correctly. So I don't think this is an issue of the kernel not being able to detect the keys, because somehow, GNOME was able to do it.

Expected behavior

  1. Press "volume down" key in xev
  2. Get key code
  3. Add to bindings to i3wm config
    • bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% # Increase sound volume
    • bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% # Decrease sound volume
    • bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # Mute sound
  4. Adjust system volume with volume keys

Actual behavior

  1. Press "volume down" key in xev
  2. Receive different output that doesn't seem to have a key code
1
  • The FocusOut/FocusIn events mean some other application is stealing the volume key event(s), probably to process them. You won't see the events in xev unless you stop this application or configure it to ignore those keys. Close everything uncessary, then use xlsclients to see which X applications are still running. i3wm itself may steal the events if you already have configured it to do so.
    – dirkt
    Commented Dec 5, 2016 at 15:35

1 Answer 1

0

I assume you are using a keyboard which is connected via usb. That means you have to use evtest via evtest /dev/input/eventX. To figure out which number is "X" use ls -l /dev/input/by-id. In my case it looks like:

sudo evtest /dev/input/event6
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x5ac product 0x205 version 0x110
Input device name: "Mitsumi Electric Apple Extended USB Keyboard"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 113 (KEY_MUTE)
    Event code 114 (KEY_VOLUMEDOWN)
    Event code 115 (KEY_VOLUMEUP)
    Event code 142 (KEY_SLEEP)
    Event code 143 (KEY_WAKEUP)
    Event code 150 (KEY_WWW)
    Event code 155 (KEY_MAIL)
    Event code 161 (KEY_EJECTCD)
    Event code 163 (KEY_NEXTSONG)
    Event code 164 (KEY_PLAYPAUSE)
    Event code 165 (KEY_PREVIOUSSONG)
    Event code 166 (KEY_STOPCD)
    Event code 168 (KEY_REWIND)
    Event code 208 (KEY_FASTFORWARD)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1484112801.351497, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00ea
Event: time 1484112801.351497, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 1
Event: time 1484112801.351497, -------------- SYN_REPORT ------------
Event: time 1484112801.479485, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00ea
Event: time 1484112801.479485, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 0
Event: time 1484112801.479485, -------------- SYN_REPORT ------------
1
  • Thanks for the answer, but will have to wait some time before I can test this again, at least until August… will come back to this once I'm back at the computer where this was an issue.
    – J.W.F.
    Commented Jun 28, 2017 at 22:57

You must log in to answer this question.

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