I've just installed Ubuntu 16.04 on my ThinkPad T450s and for some reason the media keys for volume and screen brightness are not giving any keycodes or keysyms (ie. XF86AudioRaiseVolume). But all the other media keys give the correct values.
What's weird is that the media keys still work fine in unity and gnome, it's just a problem when I use i3 because I can't map the volume keys to change the volume.
This is what xev
returns for the volume down, volume up and volume mute keys:
Volume down:
FocusOut event, serial 33, synthetic NO, window 0x1a00001,
mode NotifyUngrab, detail NotifyPointer
FocusIn event, serial 33, synthetic NO, window 0x1a00001,
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
Volume Up:
FocusOut event, serial 33, synthetic NO, window 0x1a00001,
mode NotifyGrab, detail NotifyAncestor
FocusIn event, serial 33, synthetic NO, window 0x1a00001,
mode NotifyUngrab, detail NotifyAncestor
KeymapNotify event, serial 33, synthetic NO, window 0x0,
keys: 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 0
Volume mute:
FocusOut event, serial 33, synthetic NO, window 0x1a00001,
mode NotifyUngrab, detail NotifyPointer
FocusIn event, serial 33, synthetic NO, window 0x1a00001,
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
As you can see, they are all the same. So I have no idea how unity or gnome can tell them apart. Just for reference I'll show the output for the mic off and wifi off media keys from xev
:
KeyRelease event, serial 33, synthetic NO, window 0x1a00001,
root 0xf6, subw 0x0, time 3107820, (-19,759), root:(625,798),
state 0x0, keycode 198 (keysym 0x1008ffb2, XF86AudioMicMute), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 34, synthetic NO, window 0x1a00001,
root 0xf6, subw 0x0, time 3112189, (-19,759), root:(625,798),
state 0x0, keycode 246 (keysym 0x1008ff95, XF86WLAN), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
And I used to get similar results for the volume keys before installing ubuntu as well (I was using Arch).
The brightness keys don't work either, are these being overridden at some low level? Is there a way I can fix it so they return the correct value or is there some other way I can get the media keys working for ubuntu?
Update: This is what xev
gives for the volume up and down keys while I'm running unity.
FocusOut event, serial 47, synthetic NO, window 0x4800001,
mode NotifyGrab, detail NotifyAncestor
FocusIn event, serial 47, synthetic NO, window 0x4800001,
mode NotifyUngrab, detail NotifyAncestor
KeymapNotify event, serial 47, synthetic NO, window 0x0,
keys: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
KeyRelease event, serial 47, synthetic NO, window 0x4800001,
root 0xf7, subw 0x0, time 2182026, (-1217,972), root:(525,2104),
state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
FocusOut event, serial 47, synthetic NO, window 0x4800001,
mode NotifyGrab, detail NotifyAncestor
FocusIn event, serial 47, synthetic NO, window 0x4800001,
mode NotifyUngrab, detail NotifyAncestor
KeymapNotify event, serial 47, synthetic NO, window 0x0,
keys: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
KeyRelease event, serial 47, synthetic NO, window 0x4800001,
root 0xf7, subw 0x0, time 2185429, (-1217,972), root:(525,2104),
state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
When running unity, I also have unity-settings-daemon
, unity-panel-service
and unity-fallback-mount-helper
. Could one of these be catching the event and adding the XF86
keysyms? None of these are running in i3.
In response to @Adaephon I have this in my i3 config:
# volume controls
bindsym XF86AudioRaiseVolume exec amixer -q set Master playback 2%+ unmute
bindsym XF86AudioLowerVolume exec amixer -q set Master playback 2%- unmute
bindsym XF86AudioMute exec amixer -q set Master mute