Button Bindings



next up previous contents index
Next: Your Workspace: xterm Up: Personalizing X Windows Previous: Customizing Motif

Button Bindings

The .mwmrc file can also be used to define which buttons do what in various places. This is useful because you can create separate menus for each mouse button and you can also use it to change the behavior of mouse clicks on windows and icons. For example, let's say you always use the left mouse button to do things such as drag windows. To change this to the right mouse button, go to your .mwmrc file in your home directory and locate Button Bindings which look something like these: 


Buttons DefaultButtonBindings { <Btn1Down> frame|icon f.raise <Btn3Down> frame|icon f.post_wmenu <Btn1Down> root f.menu RootMenu <Btn3Down> root f.menu RootMenu Meta<Btn1Down> icon|window f.lower Meta<Btn2Down> window|icon f.resize Meta<Btn3Down> window f.move }

There may also be other button listings in the .mwmrc file with labels such as Explicit Button Bindings or Pointer Button Bindings. The specific set of bindings mwm uses is controlled by the line in .Xdefaults:


Mwm*buttonBindings: DefaultButtonBindings Choose button binds.

Changing the label from Default Button Bindings to one of the other bindings or perhaps to the name for your own set of bindings forces mwm to use the new button bindings. Once again, the change will not take place until after you restart mwm.

It is rare in our experience for a user to change the way the basic button bindings work in mwm. The sample .mwmrc file shows some examples of additional key button bindings you may find useful. In the example below, we add the Tools menu created previously to the right mouse button, button number 2, by adding the following line to the DefaultButtonBindings:


<Btn2Down> root f.menu Tools

The <Btn2Down> part of this line says that when the middle button is clicked on the screen background or on root, the function f.menu is executed to bring up the Tools menu. (The f.menu Tools command is the same one used in the Tools Menu to bring up the menu.)

Deciphering the other lines in the button bindings is pretty straightforward. For example, the sixth line, Meta<Btn1Down> icon|window f.lower, says that if button 1 is pressed down with the meta key (usually labeled [ALT]) while the mouse pointer is on an icon or in a window, then the function f.lower is executed. This in turn sends the icon or window behind other objects on the screen.



next up previous contents index
Next: Your Workspace: xterm Up: Personalizing X Windows Previous: Customizing Motif