Having just spent some time getting the extra buttons (e.g. Mute, Mail, Web..) on my Microsoft Natural Multimedia Keyboard (1.0A) working in Ion via xmodmap [1], I thought I'd post the fruits of my labours here in the hope that they may be of use to other Ion newbies like myself with non-standard buttons on their keyboards :)
[1] http://www.xfree86.org/4.2.0/xmodmap.1.html
1. Map button KeyCodes to KeySyms using xev to discover the KeyCodes [2] and the file /usr/X11R6/lib/X11/XKeysymDB (Redhat 9 box) to discover the available KeySyms.
[2] See for example http://www.tillgerken.de/item/225
I defined these mappings in ~/.xmodmaprc (note that I couldnt find a suitable existing KeySym for Redo and Print - I could define my own if I wanted to use those keys):
~/.xmodmaprc
keycode 187 = osfHelp keycode 136 = osfUndo ! keycode 135 = # Redo keycode 119 = XF86New keycode 120 = XF86Open keycode 121 = XF86Close keycode 122 = XF86Reply keycode 194 = XF86MailForward keycode 195 = XF86Send keycode 163 = XF86Spell keycode 215 = XF86Save ! keycode 216 = # Print keycode 101 = XF86Documents keycode 228 = XF86Pictures keycode 188 = XF86Music keycode 160 = XF86AudioMute keycode 162 = XF86AudioPlay keycode 164 = XF86AudioStop keycode 176 = XF86AudioRaiseVolume keycode 174 = XF86AudioLowerVolume keycode 144 = XF86AudioPrev keycode 153 = XF86AudioNext keycode 237 = XF86AudioMedia keycode 236 = XF86Mail keycode 178 = XF86WWW keycode 133 = XF86Messenger keycode 161 = XF86Calculator keycode 150 = XF86LogOff keycode 223 = XF86Sleep
3. Load in mappings and check with xev:
xmodmap ~/.xmodmaprc
(I needed to add this line to my .xinitrc to load the mappings every time X starts)
3. Using the KeySyms, define additional bindings for Ion.
I created the config file ~/.ion2/msnatmmkb-bindings.lua (all buttons included for completeness, note that I don't use all of them!).
~/.ion2/msnatmmkb-bindings.lua
-- Ion bindings for Microsoft Natural Multimedia Keyboard
global_bindings{
-- kpress(SECOND_MOD.."osfHelp", make_exec_fn("")),
-- kpress(SECOND_MOD.."osfUndo", make_exec_fn("")),
-- kpress(SECOND_MOD.."XF86New", make_exec_fn("")),
-- kpress(SECOND_MOD.."XF86Open", make_exec_fn("")),
-- kpress(SECOND_MOD.."XF86Close", make_exec_fn("")),
-- kpress(SECOND_MOD.."XF86Reply", make_exec_fn("")),
-- kpress(SECOND_MOD.."XF86MailForward", make_exec_fn("")),
-- kpress(SECOND_MOD.."XF86Send", make_exec_fn("")),
-- kpress(SECOND_MOD.."XF86Spell", make_exec_fn("")),
-- kpress(SECOND_MOD.."XF86Save", make_exec_fn("")),
-- kpress(SECOND_MOD.."XF86Documents", make_exec_fn("")),
-- kpress(SECOND_MOD.."XF86Pictures", make_exec_fn("")),
kpress(SECOND_MOD.."XF86Music", make_exec_fn("")),
kpress(SECOND_MOD.."XF86AudioMute", make_exec_fn("aumix -v0")),
kpress(SECOND_MOD.."XF86AudioPlay", make_exec_fn("xmms --play-pause")),
kpress(SECOND_MOD.."XF86AudioStop", make_exec_fn("xmms --stop")),
kpress(SECOND_MOD.."XF86AudioRaiseVolume", make_exec_fn("aumix -w+5")),
kpress(SECOND_MOD.."XF86AudioLowerVolume", make_exec_fn("aumix -w-5")),
kpress(SECOND_MOD.."XF86AudioPrev", make_exec_fn("xmms --rew")),
kpress(SECOND_MOD.."XF86AudioNext", make_exec_fn("xmms --fwd")),
kpress(SECOND_MOD.."XF86AudioMedia", make_exec_fn("xmms")),
kpress(SECOND_MOD.."XF86Mail", make_exec_fn("/usr/local/thunderbird/thunderbird")),
kpress(SECOND_MOD.."XF86WWW", make_exec_fn("gnome-moz-remote --newwin 'javascript:home()'")),
-- kpress(SECOND_MOD.."XF86Messenger", make_exec_fn("")),
-- kpress(SECOND_MOD.."XF86Calculator", make_exec_fn("")),
kpress(SECOND_MOD.."XF86LogOff", make_exec_fn("xscreensaver-command -lock")),
-- kpress(SECOND_MOD.."XF86Sleep", make_exec_fn("")),
4. Load the additional bindings.
I added following line to my local ion.lua (~/.ion2/ion.lua):
include("msnatmmkb-bindings")
5. Restart Ion and test the new keys!
Hope this is useful to someone!
Tim.
-- Timothy Miles-Board Intelligence, Agents, Multimedia Group University of Southampton, UK http://www.milesboard.org/
