I have a multi-button mouse (the Trust MI-2950R) with left and right wheel tilt, back and forward thumb buttons and a couple zoom buttons. I want to use them efficiently, and in my case, since I rarely use the horizontal scrolling, I wanted to map on the left-right wheel tilt another function that I use often: changing the volume of the audio.
Since I’m using Debian with XFCE, the audio is managed by amixer
. It is possible to change the volume from the command line, first of all I got a list of possible “controls” to adjust:
$ amixer scontrols Simple mixer control 'Master',0 Simple mixer control 'Headphone',0 Simple mixer control 'PCM',0 Simple mixer control 'Front',0 ...
Then I run “amixer set Master 10%+
” and noticed that the volume was raised, and a notification pop-up was flashed by the desktop environment. In order to map this command to a mouse button I used xbindkeys
. First I needed to know what identifier is mapped on the left-right tilt buttons. For this, the “xev
” command is very useful: it shows a small window that captures mouse and keyboard events, and dumps the debug output on the console. By tilting the wheel on the left, this output is shown among many lines:
... ButtonPress event, serial 34, synthetic NO, window 0x2a00001, root 0x164, subw 0x2a00002, time 9499114, (46,17), root:(597,433), state 0x10, button 6, same_screen YES ...
It means that the left tilt button is mapped as button 6. In the same way I discovered that the right tilt button is mapped as button 7. I then installed xbindkeys
, created a “~/.xbindkeysrc
” file and added the following configuration:
... #Mouse Volume Up "/usr/bin/amixer set Master 10%+" m:0x0 + b:7 #Mouse Volume Down "/usr/bin/amixer set Master 10%-" m:0x0 + b:6
xbindkeys
runs when the graphical environment shows up, and it reads my configuration files. Now when the button 6 or 7 is pressed, the event is captured by xbindkeys
which runs the commands to raise and lower volume.
Rehasher Supreme
2011/08/27
Thanks! Solved my problem! Cheers!
Fogas
2012/01/15
Hy
I wanted to change the zoom+ button in my mouse. I use autohotkey and this isn’t working whit zoomin command. After a little thinking and trying i found the solution. If i push the zoom+ button the mouse send a ctrl+wheelup command.
^wheelup::
Send {rbutton}+{down}+{enter}
So whit this skript in AHK i can save the picture in google chrome with zoom+ button whith a single click.
I hope this comment will be helpful to someone.