In this article I will show you how to get your Logitech Media Keyboard Elite's multimedia keys functional and configured for use within the Openbox window manager.
The Media Keyboard Elite has four keys which need to have their key codes manually setup in order to work. These are the side zoom keys and the messenger key.
Note: Some system file locations in this tutorial are Arch Linux centric. However, it can be easily adjusted for any GNU/Linux distribution.
Update: It has come to my attention that these keys are not detected when the keyboard is connected to your computer via USB.
1. Setting up your keycodes.
Before we can do anything we need to edit your local multi-user start-up script and configure the key codes for some keys.
This can be done by editing your /etc/rc.local
file as root and adding the following:
setkeycodes e004 132 # Messenger key
setkeycodes e05a 218 # Mode F button
# Zoom Keys
setkeycodes 6b 235 # 100% key
setkeycodes 6a 234 # - Zoom key
setkeycodes e011 145 # + Zoom key
# Function Keys with Mode F off
setkeycodes e03b 187 # F1
setkeycodes e03c 188 # F2 - Word
setkeycodes e03d 189 # F3 - Excel
setkeycodes e03e 190 # F4 - Finance
setkeycodes e03f 191 # F5 - Undo
setkeycodes e040 192 # F6 - Redo
setkeycodes e041 193 # F7 - Print
setkeycodes e042 194 # F8 - Save
setkeycodes e043 195 # F9 - "Programmable A"
setkeycodes e044 196 # F10 - "Programmable B"
setkeycodes e057 215 # F11 - "Programmable C"
setkeycodes e058 216 # F12 - "Programmable D"
Once this is done, save the file and either reboot or run
sh /etc/rc.local
from your terminal to activate your changes.
2. Setting up your multimedia keys.
To set up your multimedia keys, you will need to edit a line in your xorg.conf file as root.
Look for the InputDevice section of the file and update the XkbModel line so it looks exactly like the following:
Option "XkbModel"
"logiclx300"
After restarting X your media keys should now be detected.
Now that the multimedia keys are working, we will move onto creating a file that will map the messenger, zoom, and function key codes to their keysyms which identifies the symbolic name of each key on your keyboard.
This is done by creating or editing a file called .Xmodmap
in your home
directory and adding the following:
keycode 240 = XF86Go # This is the 100% Key.
keycode 140 = XF86ZoomOut
keycode 213 = XF86ZoomIn
keycode 199 = XF86Messenger
# Function keys
keycode 194 = XF86Launch0 # Mode F
keycode 131 = XF86Support
keycode 247 = XF86Word
keycode 132 = XF86Excel
keycode 170 = XF86Finance
keycode 219 = XF86Undo
keycode 249 = XF86Redo
keycode 205 = XF86Print
keycode 207 = XF86Save
keycode 149 = XF86LaunchA
keycode 150 = XF86LaunchB
keycode 120 = XF86LaunchC
keycode 121 = XF86LaunchD
Next edit your .xinitrc
or .xsession
file and
insert xmodmap ~/.Xmodmap &
towards the top of the file.
Configuration Variant:
If for some odd reason the keys were not detected and you have verified
your above changes, you can append the following to your
.Xmodmap
in order to get them working.
keycode 160 = XF86AudioMute
keycode 161 = XF86Calculator
keycode 162 = XF86AudioPlay
keycode 164 = XF86AudioStop
keycode 176 = XF86AudioRaiseVolume
keycode 174 = XF86AudioLowerVolume
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext
keycode 178 = XF86WWW
keycode 223 = XF86Sleep
keycode 230 = XF86Favorites
keycode 236 = XF86Mail
keycode 237 = XF86AudioMedia
3. Configure Openbox to use your media keys.
The final step is configuring Openbox to use your newly configured media
keys. This can be done by editing your ~/.config/openbox/rc.xml
file and adding the following. This is my personal configuration so
please change the applications to your preference.
This example has not set up the function keys.
<keybind key="XF86Calculator">
<action name="Execute"><execute>gcalctool</execute></action>
</keybind>
<keybind key="XF86WWW">
<action name="Execute"><execute>galeon</execute></action>
</keybind>
<keybind key="XF86Mail">
<action name="Execute"><execute>urxvt -g 100x44 -e mutt</execute></action>
</keybind>
<keybind key="XF86Messenger">
<action name="Execute"><execute>urxvt -g 100x44 -e centericq</execute></action>
</keybind>
<keybind key="XF86AudioMedia">
<action name="Execute"><execute>mpd</execute></action>
</keybind>
<keybind key="XF86AudioPlay">
<action name="Execute"><execute>mpc toggle</execute></action>
</keybind>
<keybind key="XF86AudioStop">
<action name="Execute"><execute>mpc stop</execute></action>
</keybind>
<keybind key="XF86AudioMute">
<action name="Execute"><execute>mpc toggle</execute></action>
</keybind>
<keybind key="XF86AudioRaiseVolume">
<action name="Execute"><execute>mpc volume +10</execute></action>
</keybind>
<keybind key="XF86AudioLowerVolume">
<action name="Execute"><execute>mpc volume -10</execute></action>
</keybind>
<keybind key="XF86AudioNext">
<action name="Execute"><execute>mpc next</execute></action>
</keybind>
<keybind key="XF86AudioPrev">
<action name="Execute"><execute>mpc prev</execute></action>
</keybind>
<!-- These are the Zoom keys on the left. I use them to launch rox and
switch between virtual desktops -->
<keybind key="XF86Go">
<action name="Execute"><execute>thunar</execute></action>
</keybind>
<keybind key="XF86ZoomIn">
<action name="DesktopNext"/>
</keybind>
<keybind key="XF86ZoomOut">
<action name="DesktopPrev"/>
</keybind>
Finally, save the file and reconfigure Openbox when you are done making your changes to activate your changes.
If you have any questions or comments, please feel free to email me.
Comments?