Re: Mouse button binding

From: Dances With Crows (
Date: 07/01/03

Date: 1 Jul 2003 20:39:07 GMT

On Tue, 01 Jul 2003 12:39:53 -0700, Charles-Henri staggered into the
Black Sun and said:
> I have a mouse with many buttons, and they're recognized by xev. But
> they're pretty useless now. Is there a way to bind a mouse button to
> something, like a key ?

When someone puts together a FAQ for this group, this question should go
on it. It's reasonably easy to bind a mouse button to any arbitrary
command, you use xbindkeys to do that. If you want to press a mouse
button and have a sequence of keypresses (or mouse button presses)
output, you use xmacroplay in combination with xbindkeys.

xbindkeys and xmacroplay are available on Both are small
and easily compiled.

Put this in ~/.xbindkeysrc , and pressing mouse button 6 will launch an
xterm :

# in ~/.xbindkeysrc
"xterm &"

Put this in ~/.xbindkeysrc , and pressing mouse button 6 will echo the
Alt+Left key combination to the X server, which maps to "back" in
Konqueror and Mozilla :

# in ~/.xbindkeysrc
"echo -e 'KeyStrPress Alt_L\nKeyStrPress Left\nKeyStrRelease Left\n
KeyStrRelease Alt_L' | xmacroplay &"
  b:6 , this NG, keywords
"xbindkeys" and "xmacro". HTH,

Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin /     /  "He is a rhythmic movement of the
-----------------------------/    penguins, is Tux." --MegaHAL