Guide to X11/Window Managers/twm

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Tab Window Manager[edit | edit source]

The Tab Window Manager is a configurable re-parenting window manager that provides title bars, shaped windows and icon management.

History[edit | edit source]

The Tab Window Manager was developed by Tom LaStrange and is the traditional window manager for the X Window System. It was originally called Tom's Window Manager, but was later renamed as the Tab Window Manager by the X consortium, who took over its maintenance.

The Tab Window Manager has been largely superseded by other window managers and is no longer maintained. Despite being obsolete, it has made a strong impact on the development of X window managers and its source code is often used as a base for other window managers.

The Tab Window Manager is used as a reference implementation and many window managers, such as swm, vtwm, tvtwm, ctwm, and fvwm, and various derivatives, are built from the Tab Window Manager code.

Features of twm[edit | edit source]

  • A stacking window manager
  • Written in C
  • Uses xlib directly
  • opensource and freely available
  • No menubar: the application menu is accessible by clicking the window background and holding the mouse button down.
  • Lightweight - Has few dependencies

Small Footprint[edit | edit source]

Some users still use the Tab Window Manager because it is simple, customizable, and has a small footprint and has a lightweight load on system resources. The Tab Window Manager is written in C directly against xlib rather than using an X toolkit.

Using twm[edit | edit source]

When first starting twm, a user may only see an empty screen with a grayscale pattern. Some distributions launch an xshell or an actual terminal program in the background, which means that either of these run at the start of X and twm (or some other window manager).

Menus[edit | edit source]

Menus for programs and window manipulation work by clicking on the desktop with either the main or middle pointer button, holding the button down and then dragging through the menu and its submenus until a desired program or function is selected — the user then releases the pointer button off the item to select an action.

The Main Menu can be accessed with the primary pointer button (usually the left mouse button). This menu's first item is the operating system submenu, which lists all apps by their category submenus. The next two commands show and hide the Icon Manager, which is a UNIX-world taskbar precursor (twm was developed in 1987). The Icon Manager lists program windows in order they were run and allows raising or iconifying said windows.

The Window Ops menu can be invoked by clicking on the desktop with the middle pointer button. There, a user must choose a window manipulation function and then click on the desired window or its title.

Where and how to click the third pointer button

Wheel mice typically have a separately clickable wheel; If touchpads only feature two buttons, then the middle button can be right at where the two buttons meet in the middle. If there are only two buttons, then X allows "simulating" the middle pointer button by letting the left and right buttons be clicked simultaneously (depending on X configuration for the pointer). If the functionality of your pointing device is different enough, consult its documentation.

Launching applications[edit | edit source]

At invoking a program, twm will show skeleton crosshairs for the program's window. The crosshair grid follows pointer movement and the user must select a desirable position for the window with the pointer and click on the pointer button to have the window contents rendered. This is standard behaviour for twm.

To avoid having to move the pointer and click its button to set the location when launching some programs, a user can manually set window geometry for the program. This has been observed not to work with Mozilla Firefox and Wine.

Caveats[edit | edit source]

By default, classic implementations of twm omit window closing buttons in windows' title bars, which forces users new to twm to learn every which way how to close an application in there. This is in following the philosophy around X, whereby programs' visual toolkit choices are not set in stone by the underlying graphical framework.

To add a window closing button, see below.

Configuration[edit | edit source]

Much useful information about configuring twm can be found in twm's man page. This article section concentrates on some important practicalities.

.twmrc[edit | edit source]

twm's configuration file, depending on where it's at, is named or suffixed .twmrc and is located in two places.

The global configuration file is system.twmrc and twm may defer to it in case a local file is not present. system.twmrc can be at /etc/X11/twm (in case of XFree86), it can also be at /usr/share/X11/twm. The global file also contains menu hooks to applications and programs created by the system. In general, system.twmrc should not be edited.

The local configuration file is .twmrc and is located in the home directory of a user (at /home/username/). When first starting twm, the local configuration file might not be present. The local configuration file, once in the user's home directory, cannot be empty, because twm will only refer to that and will thus reflect the config file's emptiness by lacking a proper menu.

A half-solution is to copy the global file to the user's home directory and rename it to .twmrc — This will also provide application menu hooks, yet after installing new programs, the local menu file won't be updated and the user must add commands to access newly-installed applications on his/her own. Since the global menu file menudefs.hook is still updated by the system after installing a new package, a user can copy commands of new apps from there into their own .twmrc file.

Closing program windows in twm[edit | edit source]

By default, there are no window close buttons in twm. A user can choose to do some of the following:

Specify an unused mouse button to close the window by clicking on its title bar
Button3 = : title : f.delete

Mouse buttons are ordered thus: the left mouse button is Button1, the middle button is Button2 and the right one is Button3, which by default isn't assigned to anything when clicking the window's titlebar. The : title : specifies that a function be applied to when a titlebar is clicked. f.delete can close a program's secondary window or send a non-forceful exit signal to an application.

Add a close button to windows' titlebars
twm windows with a close button
RightTitleButton "xlogo11" = f.delete

This adds the X logo to the right of the title bar; an example of this can be seen in the screenshot.

xlogo11 is a pixmap file located in XFree86 at /usr/X11R6/include/X11/bitmaps — which is the default pixmap location twm seeks out. The above bitmaps directory contains tens of other pixmaps a user can use in configuring twm.

Where is twm on the hammer scale?[edit | edit source]

Dependencies[edit | edit source]

twm is dependent on the following xlib libraries:

  • libx11-6
  • libxext6

Resources used[edit | edit source]

VIRT   RES     SHR     %CPU    %MEM
3544   1808    1324    1.3     0.5