Getting additional mouse buttons to be useful in linux
Quick follow up to the previous post. I have a Microsoft Laser Mouse 6000, which happens to have two side buttons, which in Windows correspond to the Back and Forward actions in things like web browsers and Explorer. In linux, these buttons don’t do anything by default, but I finally got them working.
All I had to do was install xbindkeys, which for OpenSuSE 10.3 can be found via the OpenSuSE Build Service. After that is installed, you create the file $HOME/.xbindkeysrc and put something like the following into it:
"xvkbd -text "\[Alt]\[Left]""
m:0x0 + b:8
"xvkbd -text "\[Alt]\[Right]""
m:0x0 + b:9
The b:8 and b:9 parts are the mouse buttons you want to listen for, which can be found by using xev.
After that file is set up, you just need to make sure that xbindkeys is started when you start X, which can be done in a script in $HOME/.kde/Autostart, maybe just added to the script I mentioned in the previous post about how to get multimedia keys working in linux. For the time being, you can just run xbindkeys from a commandline in your current session.
Once all this is done, xbindkeys will listen for the mouse buttons you set up and send the specified keyboard commands, in this case Alt+Left and Alt+Right, which should get you Back and Forward actions in your browsers.
Configuring the Logitech diNovo Edge in Linux 9
I love my Logitech diNovo Edge keyboard, and I only recently got some of it’s special keys mapped and working in Linux. Doing this required using xev to gather the keycodes for the various special keys and functions on they keyboard and then setting up an Xmodmap file mapping these keycodes to various XF86 actions.
The keys that I couldn’t get codes for are:
- “Phone” Key (Fn + F1)
- Magnifying glass keys (along the left edge)
- A B C D keys (Fn + F9-F12)
Otherwise, here’s the contents of my $HOME/.Xmodmap file:
keycode 160 = XF86AudioMute
keycode 176 = XF86AudioRaiseVolume
keycode 174 = XF86AudioLowerVolume
keycode 122 = XF86Search
keycode 144 = XF86AudioPrev
keycode 164 = XF86AudioStop
keycode 162 = XF86AudioPlay
keycode 153 = XF86AudioNext
keycode 236 = XF86Mail
keycode 130 = XF86HomePage
keycode 129 = XF86MenuPB
keycode 115 = XF86MenuKB
Then, if you’re using KDE, you can the KDE Control Center -> Regional & Accessibility menu’s Keyboard Shortcuts or the Input Actions sections to map these new keys to events.
One important part is to make sure your .Xmodmap file is loaded when you log in, you can do this via a bash script in $HOME/.kde/Autostart that looks something like this:
#!/bin/bash
xmodmap ~/.Xmodmap
Also, I followed some instructions found here for general XModmap usage and help: Multimediakeys with .Xmodmap HOWTO