Example of creating a new button set
This section provides a comprehensive example that ties together
some of the concepts and procedures discussed in this chapter.
The following example assumes that you are using the
default pmwm mode of the window manager,
that you want to create
a new button binding set for your local environment,
and you want to name the
set ``MyButtonBindings''.
MyButtonBindings consists of five new button binding definitions
that produce the following results:
-
Pressing mouse button 1 when the pointer is on the Root menu
posts the menu named ``MyRootMenu''. (See line six of
the following sample file.)
-
Pressing mouse button 1 when the pointer is on a window frame
raises the window. (See line seven of the following sample file.)
-
Pressing mouse button 2 or 3 when the
pointer is on either the window frame or on a window
manager icon posts
the menu specified by the PmmwmwindowMenu
resource. (See lines eight and nine of the following sample file.)
-
Pressing the Meta key and mouse button 1 simultaneously,
with the pointer on either an icon or a window,
raises the icon or the window to the top of the window stack if it is
partially obscured by another icon or window; otherwise,
it lowers the icon or window to the bottom of the window stack.
(See line ten of the following sample file.)
-
Pressing the Meta key and mouse button 2 simultaneously,
with the pointer on a window, sets the
colormap focus to the window.
(See line eleven of the following sample file.)
To create this new set:
-
Open the .pmwmrc file in your $HOME directory
for editing.
(If .pmwmrc does not already exist,
create it by copying /usr/lib/X11/system.pmwmrc
to .mwmrc in your $HOME directory).
-
Locate the ``DefaultButtonBindings'' section in
the .pmwmrc file and place a copy of the
section underneath the default definitions.
You can use this copy as a template for your new button binding set.
-
In the copy of the default definitions,
rename ``DefaultButtonBindings'' to ``MyButtonBindings.''
-
Edit the template so that it looks like this:
1 #
2 # button binding descriptions
3 #
4 Buttons MyButtonBindings
5 {
6 <Btn1Down> root f.menu MyRootMenu
7 <Btn1Down> frame f.raise
8 <Btn2Down> frame|icon f.post_wmenu
9 <Btn3Down> frame|icon f.post_wmenu
10 Meta<Btn1Down> icon|window f.raise_lower
11 Meta<Btn2Down> window f.focus_color
}
Note that for the f.focus_color function
to have an effect, the pmwm colormapFocusPolicy
resource must be set to ``explicit''.
See
``Customizing the window manager''
and
``OSF/Motif window manager resources''
for more information.
-
Define the buttonBindings resource to announce
the new button binding set to the window manager.
Specify the resource in the
$HOME/.Xdefaults-hostname file,
where hostname is the name
of the host, or machine, where the window manager is running.
The resource specification should look like this:
PmwmbuttonBindings: MyButtonBindings
-
Restart the window manager
so that the new button binding
information is implemented.
Previous topic:
Step 5: Restarting the window manager
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 26 May 2005