Window Managers

Window Manager Similarities

Window Manager Differences

The main difference between window managers is APPEARANCE

uwm

twm

mwm

Overview of uwm

 

Uwm Configuration Files

When uwm is executed, it looks for these files to set up its behavior.
 
/usr/X11R6/lib/X11/uwm/system.uwmrc
$HOME/.uwmrc

Resources

Uwm has no resource name or class associated with it.  Thus, there are no entries in ".Xdefaults" that can be used to change the behavior of uwm.
 

The .uwmrc file

There is a sample .uwmrc file in /usr/X11R6/lib/X11/rcfiles/uwmrc. You can copy this to $HOME/.uwmrc, and modify it as you like.

The following sample .uwmrc illustrates 1) setting uwm variables, 2) binding a uwm function to a key/mouse button sequence, and 3) setting up popup menus. For a complete description of actions that are available through uwm, see the uwm man page.

# UWM startup file for Sun 3/50 ordinary  resolution monochrome display
bordercolor=red         # Set border color for all uwm windows (menus, dialogs)
delta=15                # Cursor must move 15 pixels before movement is seen
iconfont=fixed          # Font to be used inside icons
menufont=fixed          # Font to be used in menus

#
# Mouse button/key maps
#
# FUNCTION      KEYS    CONTEXT         BUTTON          MENU(if any)
f.lower =       meta    :               :left up
f.raise =       meta    :               :right down
f.newiconify =  meta    :               :left delta
f.move =        meta    :               :right delta
f.resize =      meta    :               :middle delta
f.menu =                : root          :left down      :"Window Ops"
f.circledown =          : root          :middle down
f.circleup =            : root          :right down



#
# MENU DEFINITIONS
#



menu = "Window Ops" {
Reshape:                f.resize
Move:                   f.move
Focus:                  f.focus
Iconify@New Position:   f.newiconify
"(De)Iconify":          f.iconify
New Window:             !"xterm &"
Top:                    f.raise
Bottom:                 f.lower
Circulate Up:           f.circleup
Circulate Down:         f.circledown
Refresh All Windows:    f.refresh
Exit:                   f.exit

}
 

Overview of twm

Twm Configuration Files

When twm is executed, it looks for these files to set up its behavior.
 
$HOME/.twmrc.<screennumber>
$HOME/.twmrc


If none of these files is found, twm will try to read the system default file /usr/X11R6/lib/X11/twm/system.twmrc.
 

Resources

Twm has no resource name or class associated with it.  Thus, there are no entries in ".Xdefaults" that can be used to change the behavior of twm.
 

The .twmrc file

The system default .twmrc file in /usr/X11R6/lib/X11/twm/system.twmrc. You can copy this to $HOME/.twmrc, and modify it as you like.

The following sample .twmrc illustrates 1) setting twm variables, 2) defining a custom function, 3) binding a function to a key/mouse button sequence, and 4) setting up popup menus. For a complete description of actions that are available through twm, see the twm man page.

#
# Sample .twmrc
#
ShowIconManager
TitleFont "fixed"
MenuFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"



Color
{
    DefaultForeground "white"
    DefaultBackground "blue"
    TitleBackground "maroon"
    TitleForeground "gray85"
    IconManagerBackground "maroon"
    IconManagerForeground "gray85"
}

#
# Define some useful functions for motion-based actions.

#
MoveDelta 3
Function "move-or-lower" { f.move f.deltastop f.lower }
Function "move-or-raise" { f.move f.deltastop f.raise }
Function "move-or-iconify" { f.move f.deltastop f.iconify }

#
# Set some useful bindings.  Sort of uwm-ish.
#
Button1 = : root : f.menu "small_menu"

Button1 = m : window|icon : f.function "move-or-lower"
Button2 = m : window|icon : f.iconify
Button3 = m : window|icon : f.function "move-or-raise"

Button1 = : title : f.function "move-or-raise"
Button1 = : icon : f.function "move-or-iconify"

#
# And a menu with a few things
#
menu "small_menu"
{
"Twm"           f.title
"xterm"         ! "/usr/bin/X11/xterm &"
""              f.nop
"Show Iconmgr"  f.showiconmgr
"Hide Iconmgr"  f.hideiconmgr
""              f.nop
"Kill"          f.destroy
"Delete"        f.delete
""              f.nop
"Restart"       f.restart
"Exit"          f.quit
}

 

Introduction to mwm

Mwm Resource Setup Files

Unlike twm and uwm, mwm has a rich set of resources that can be changed to customize its appearance and behavior. The default resource class for mwm is "Mwm", and the resource name is "mwm". When mwm is executed, it reads the following files, in the order listed, to find resources in order set up its behavior and appearance.

        /usr/lib/X11/app-defaults/Mwm
        $HOME/Mwm
        $HOME/.Xdefaults
        $HOME/.Xdefaults-<hostname>

 

Mwm Configuration File"

In addition to the resource files described above, mwm also makes use of a Configuration File. The Configuration File contains descriptions of Keyboard Bindings, Mouse Button Bindings, and Menus. The default Configuration File is \fI$HOME/.mwmrc\fP, but this can be changed by setting the "configFile" resource.
 

mwm - Resources

Types of Resources

There are a large number of resources (approximately 115) that can be specified in any of the Resource Setup Files (.Xdefaults, Mwm).  These resources can be broken down into three categories:
 
  1. Component Appearance Resources:  These resources change the appearance or behavior of one or more of the the mwm components - Menus, Icons, Client Frames, and Feedback Dialogs.
  2. Specific Appearance and Behavior Resources:  These affect the appearance and behavior of mwm as a whole, not for individual components.
  3. Client Specific Resources: These are resources that can be applied to individual clients or client classes. They affect client-specific icon and window frame appearance and behavior.
Refer to the mwm man page for a complete listing and description of all mwm resources.
 

Component Appearance Resources

Component Appearance resources are specified in the Resource Setup files as follows:

        Mwm*[menu[*menu_name*] | icon | client[*title*] | feedback]*resource_id
 

The following are some examples illustrating how to use these resources.

        Mwm*client*title*foreground: darkblue
        Mwm*client*title*background: gray85
        (Sets the colors in the title area of each client frame.)

        Mwm*menu*fontList: -misc-fixed-medium-r-normal--10-*-iso8859-1
        (Sets the font to use in menus)

        Mwm*icon*activeForeground: red
        Mwm*client*activeForeground: red
        (Sets the color of the frame when the client or icon becomes active).

 

Specific Appearance and Behavior Resources"

Specific Appearance and Behavior resources are specified in the Resource Setup files as follows:

        Mwm*resource_id

There are approximately 53 Specific Appearance and Behavior resources.  The following examples illustrate how to use some of the most common ones:

        Mwm*keyboardFocusPolicy: pointer
        (To cause keyboard focus to move to the window which contains the mouse pointer)

        Mwm*useIconBox: True
        (To enable the Icon Box)

        Mwm*clientAutoPlace: False
        Mwm*interactivePlacement: True
        (Allow the user to choose placement for windows that do not have a location specified in their "geometry", rather than automatically placing the window in a certain location).

        Mwm*frameBorderWidth: 5
        Mwm*resizeBorderWidth: 5
        (Changes the width of the frame and resize handles around clients).

Client Specific Resources


Client Specific resources are specified in the Resource Setup files as follows:

        Mwm*client_name_or_class*resource_id

The following examples illustrate how to use a few of these resources:

        Mwm*xbiff*clientDecoration: title
        Mwm*XClock*clientDecoration: -maximize -minimize -menu
        (Legal clientDecorations are: all, border, maximize, minimize, none, resize, menu, and title).

        Mwm*XTerm*iconImage: /home/coskrey/bitmaps/tigerpaw
        Mwm*XTerm*iconImageForeground: orange
        Mwm*XTerm*iconImageBackground: white
        (When I iconify an xterm, it turns into an orange and white tiger paw).

        Mwm*xman*clientFunctions: -minimize -maximize
        Mwm*Xfig*clientFunctions: resize move minimize close
        (Legal clientFunctions are: all, none, resize, move, minimize, maximize, and close).

 
 

mwm - Configuration File

Setting up Function Bindings

There are 34 functions provided by mwm.  These range from f.beep, which causes the bell to sound, to f.normalize_and_raise, which "de-iconifies" an icon and maps the resulting window on top of any other windows that are in its space.  These functions can be bound to a key and/or mouse button sequence. They also can be included in a pop-up menu.
 

Mouse Button Bindings

To set up mouse button bindings, use the following syntax:

        Buttons bindings_set_name
        {
                Keyboard_Modifiers<button_event>        context function
                Keyboard_Modifiers<button_event>        context function
                ...
        }

The Keyboard Modifiers can be zero or more of the following: Ctrl, Alt, Shift, Lock, Meta, Alt1, Alt2, Alt3, Alt4, and Alt5.  If more than one modifier key is used, the keys should be separated with a "|".

Legal names for button_event are Btn1Down, Btn1Up, Btn1Click, Btn1Click2, Btn2Down, etc.  Mwm will recognize up to 5 mouse buttons; however, our
X servers only support three.

Legal names for context are root, icon, window, title, frame, border, and app. Some functions are only legal in certain contexts.  For example, the
"f.iconify" function is not legal in the "root" context, because you cannot iconify the root window.  See the mwm man page for a complete list of legal contexts for each function.

By default, mwm uses the button binding whose bindings_set_name is "DefaultButtonBinding".  The "Mwm*buttonBindings" resource can be used to change
the name of the binding set that is used.

Keyboard Bindings

To set up key bindings, use the following syntax:

        Keys bindings_set_name
        {
                Keyboard_Modifiers\fB<Key>\fPkey_name   context function
                Keyboard_Modifiers\fB<Key>\fPkey_name   context function
                ...
       }

The KeyboardModifiers and context are the same as they are for Button bindings.

The key_name entries are the names of the key which is pressed. Some examples: F7, !, Escape, Tab, Delete.

By default, mwm uses the key binding whose bindings_set_name is "DefaultKeyBinding". The "Mwm*keyBindings" resource can be used to change the name of the binding set that is used.

Menus

To create an mwm menu, use the following syntax:

        Menu Imenu_name
        {
                label   [mnemonic]      [accelerator]   function
                label   [mnemonic]      [accelerator]   function
                ...
        }

The label is the string that will appear in the menu.

The mnemonic is an optional, two-character field. The field looks like "_<char>", where <char> is a character that appears in the label. When
the menu comes up, the user can press the mnemonic <char> and execute the function, rather than clicking or dragging the mouse pointer to the menu

entry.

The accelerator syntax matches the key specification in the key binding specification. It looks like:

        Keyboard_Modifiers<Key>key_name

The accelerator allows the user to execute the function without even having to bring up the menu! When the user is in the correct context (root, window, etc.) and the accelerator key sequence is pressed, the function is executed. For example, the default window menu contains this entry:

        Move            _M      Alt<Key>F7      f.move

When the pointer focus is in a window, the user can press Alt-F7 to invoke the "f.move" function, which allows him to move the window.

mwm - Sample Config File

The following sample mwm config file illustrates how to set up key and button bindings, and how to set up a menu. There is a sample mwm config file in /usr/X11R6/lib/X11/rcfiles/system.mwmrc, which you can copy to $HOME/.mwmrc and change as you like.

#
#  Sample mwm config file.
#

#
# Root Menu Description (this menu must be explicitly posted via f.menu)
#
Menu RootMenu
{
        "Root Menu"             f.title
        "New Window"            f.exec "xterm &"
        "Shuffle Up"            f.circle_up
        "Shuffle Down"          f.circle_down
        "Refresh"               f.refresh
        "Toggle Behavior"       f.set_behavior
        no-label                f.separator
        "Restart..."            f.restart
        "Exit Mwm"              f.quit_mwm
}

#
# Default Window Menu Description
#
Menu DefaultWindowMenu
{
        Restore         _R      Alt<Key>F5      f.normalize
        Move            _M      Alt<Key>F7      f.move
        Size            _S      Alt<Key>F8      f.resize
        Minimize        _n      Alt<Key>F9      f.minimize
        Maximize        _x      Alt<Key>F10     f.maximize
        Lower           _L      Alt< Key>F3     f.lower
        no-label                                f.separator
        Close           _C      Alt<Key>F4      f.kill
}

menu "machines"
{
        "machines"              f.title
        "Big Window"            !"/usr/bin/X11/xterm -geometry 80x50-0-0 &"
        "Little Window"         !"/usr/bin/X11/xterm -geometry 80x24+0-0 &"
        "SMEARS"                !"/usr/bin/X11/xterm -e telnet smears &"
        "SEAMS"                 !"/usr/bin/X11/xterm -e telnet seams &"
        "sitpc5"                !"/usr/bin/X11/xterm -e telnet sitpc5 &"
        "churchill"             !"/usr/bin/X11/xterm -e telnet churchill &"
}

menu "tools"
{
        "tools"         f.title
        "xman"          !"MANPATH=/NFS/export/usr/catman /usr/bin/X11/xman &"
        "xcalc"         !"/usr/bin/X11/xcalc &"
        "hexcalc"       !"/usr/bin/X11/hexcalc &"
        "oclock"        !"/usr/bin/X11/oclock &"
        "xload"         !"/usr/bin/X11/xload &"
        no-label        f.separator
        "xsol"          !"/usr/bin/X11/xsol &"
        "xrobots"       !"/usr/bin/X11/xrobots &"
}

#
# Key Binding Description
#

Keys DefaultKeyBindings
{
        Shift<Key>Escape                window|icon             f.post_wmenu
        Meta<Key>space                  window|icon             f.post_wmenu
        Meta<Key>Tab                    root|icon|window        f.next_key
        Meta Shift<Key>Tab              root|icon|window        f.prev_key
        Meta<Key>Escape                 root|icon|window        f.next_key
        Meta Shift<Key>Escape           root|icon|window        f.prev_key
        Meta Shift Ctrl<Key>exclam      root|icon|window        f.set_behavior
        Meta<Key>F6                     window                  f.next_key transient
        Meta Shift<Key>F6               window                  f.prev_key transient
        <Key>F4                         icon                    f.post_wmenu

}

#
# Button Binding Description(s)
#

Buttons DefaultButtonBindings
{
        <Btn1Down>      icon|frame      f.raise
        <Btn2Down>      icon|frame      f.lower
        <Btn3Down>      icon|frame      f.post_wmenu
        <Btn1Down>      root            f.menu  RootMenu
        <Btn2Down>      root            f.menu  machines
        <Btn3Down>      root            f.menu  tools
    Ctrl<Btn3Down>      icon            f.iconify
}

#
#  END OF mwm RESOURCE DESCRIPTION FILE
#