twm
twm, also known as the Tab Window Manager or Tom's Window Manager, is a lightweight, stacking window manager for the X Window System, providing titlebars, shaped windows, icon management, user-defined macro functions, click-to-type and pointer-driven keyboard focus, placement hints, and customizable key and button bindings.[1] Developed by Tom LaStrange at Solbourne Computer Inc., twm was initially released in April 1988 as a simple reparenting window manager and quickly evolved with contributions from the X community to enhance usability while maintaining a small code footprint.[2] It became the standard window manager included in the X11 distribution starting with Release 4 in 1989, serving as the default for many early Unix-like systems and remaining part of modern X.Org releases.[3][4] Highly configurable through a user-defined startup file such as$HOME/.twmrc, twm supports features like popup menus, accelerated window movement, and virtual desktop-like icon managers, though it lacks built-in support for true virtual desktops or advanced compositing.[1] Despite the rise of more feature-rich alternatives, twm continues to be maintained for its simplicity and compatibility, often used in minimalistic or historical X11 environments.[5]
Introduction
Overview
twm, or Tab Window Manager, is a stacking window manager for the X Window System designed to manage window placement, decoration, and user interactions, including title bars, shaped windows, and icon management.[6] It operates by stacking windows in a traditional overlapping manner, allowing users to focus on one window at a time while keeping others accessible behind it. As a core component of X11, twm provides essential functionality for desktop environments without relying on heavier graphical toolkits.[7] Developed starting in 1987 by Tom LaStrange at Evans & Sutherland as a replacement for the earlier uwm window manager, twm quickly became integral to the X ecosystem.[6] It was adopted as the standard window manager for X11R4 by the X Consortium in 1989, marking its role as the default choice for many early X installations.[6] twm is characterized by its lightweight design, built directly against the Xlib library rather than modern widget toolkits, ensuring minimal resource usage and broad compatibility.[6] It allows customization through configuration files.[4] The software is distributed under permissive licenses including the MIT/Open Group License, the Evans & Sutherland License, and the XFree86 1.0 License, as specified in its source distribution.[8] Its most recent stable release, version 1.0.13.1, was issued on May 6, 2025, and it remains bundled with the X.Org Server for legacy and minimal X11 support.[9] Derivatives such as vtwm and CTWM have extended its features for virtual desktops and enhanced theming.[10]Key features
Twm provides windows with decorative frames featuring title bars that display the window name and indicate the current keyboard focus through highlighting. These title bars include buttons for common operations: the left button typically iconifies the window, while the right button initiates resizing, though a close button is not included by default and must be configured manually.[11] The window manager supports shaped windows via the X SHAPE extension, allowing non-rectangular window outlines and efficient space usage, such as squeezing title bars to reduce their height. Icon management is handled through dedicated icon managers, which organize minimized windows into groups for easy navigation, sorting, and manipulation, including options to place or reposition icons on the desktop.[11] Twm employs a pointer-driven focus model, where windows gain keyboard focus automatically as the mouse pointer moves over them, enabling click-to-type input without requiring explicit selection. When new windows appear, they support interactive placement: if no geometry is specified, an outline of the default size appears with a title bar and a 3×3 grid of lines that follow the pointer, allowing users to position the window by clicking in one of the nine regions.[11] High configurability is a core aspect, achieved through user-defined bindings in configuration files like .twmrc, which map mouse buttons, keyboard keys, and pointer motions to custom functions for actions such as moving, resizing, or warping the pointer. This extends to menus and macros for complex behaviors.[11] Due to its direct use of Xlib, twm maintains lightweight resource usage, with a binary size under 200 KiB, making it suitable for resource-constrained environments in contrast to modern window managers that employ heavier toolkits.[12][13]Development history
Origins
Development of twm began in 1987 as a personal project by Tom LaStrange at Solbourne Computer Inc. Intended to address the limitations of early window management in the X Window System, it aimed to provide superior decoration and handling for windows in the developing X11 ecosystem. The project focused on creating a lightweight tool that could enhance user interaction without the complexities of heavier toolkits.[14] Originally titled Tom's Window Manager after its creator, the software was soon renamed the Tab Window Manager to highlight its distinctive title bar design, which featured shaped elements resembling tabs on file folders. This change emphasized the innovative visual approach to window identification and manipulation. twm served as a direct replacement for the earlier Unix Window Manager (uwm), introducing improved title bar operations and more effective icon management to streamline desktop organization.[15][14] The initial codebase was implemented in the C programming language, relying on direct integration with the Xlib library for core functionality. This minimalist architecture ensured low resource usage and tight coupling with X11 protocols, making twm suitable for the resource-constrained hardware of the late 1980s. The first public release occurred in April 1988. A version compatible with X11R1 was distributed via the Usenet newsgroup comp.unix.sources on June 13, 1988, allowing early adopters to experiment with its features.[2]Standardization and releases
Twm was officially adopted as the standard window manager for the X Window System with the release of X11R4 on December 22, 1989, by the X Consortium, transitioning from its earlier experimental status to a core component of the X ecosystem.[16][10] Following its integration into X11R4, twm continued to receive updates as part of the evolving X Window System, with maintenance shifting to the X.Org Foundation after the dissolution of the X Consortium in 1996. Key releases during this period focused on ensuring compatibility with successive X server versions, including enhancements for stability and integration with X extensions. The latest stable version, 1.0.13.1, was released on May 6, 2025, primarily addressing build issues and minor code refinements from the preceding 1.0.13 announcement.[17][18] Over the years, twm's releases have emphasized bug fixes, autoconf improvements, and better alignment with modern X11 features, such as support for the XRandR extension to enable multi-monitor configurations without requiring server restarts. These updates have maintained twm's lightweight footprint while ensuring compatibility with contemporary X.Org servers, including fixes for constification and miscellaneous code issues in versions like 1.0.10.[19][20] Within the X11 ecosystem, twm functioned as the default window manager in many Unix-like distributions, including early Linux variants, through the 1990s and into the 2000s, often serving as a fallback option for minimal installations.[6][21] Its primary use declined with the emergence of full desktop environments like GNOME in 1997 and KDE in 1998, which offered more integrated user experiences and supplanted basic window managers in mainstream setups.[22] Despite this, twm remains available in minimal X.Org packages for testing and legacy support.[23]Configuration and usage
Configuration files and syntax
TWM's configuration is managed through plain text files that allow users to customize appearance, behavior, and interactions. The system-wide default configuration is typically provided in/usr/share/X11/twm/system.twmrc or /etc/X11/twm/system.twmrc, depending on the distribution, which can be overridden by a user-specific file at ~/.twmrc.[24] TWM searches for these files in the following order at startup: ~/.twmrc.<screennumber> (where <screennumber> matches the display screen, e.g., .twmrc.0), ~/.twmrc, and finally the system-wide file; if none exist, it falls back to built-in defaults.[25] The command-line option -f filename enables loading a custom configuration file, overriding the standard search process.[26]
The syntax of these files is declarative and straightforward, using case-insensitive keywords, double-quoted strings for values (e.g., "blue"), and # to denote comments. Configurations are divided into sections for variables (defining colors, fonts, and behaviors), bindings (for keys and mouse events), menus (for popup interactions), and user-defined functions (macros combining built-in actions). Lists of items, such as window names or colors, are enclosed in braces, e.g., { "[emacs](/page/Emacs)" "[xterm](/page/Xterm)" }.[25] All settings must appear before bindings and menus in the file.[26]
Key configuration elements include menu definitions, which follow the format Menu "menuname" [ ("foreground":"background") ] { "label" function ... }, where functions invoke actions like window movement or resizing. For example, a root menu might be defined as:
This creates a menu accessible via mouse or key, with optional per-menu color schemes specified in aMenu "root" { "XTerm" f.spawn "xterm" "Move" f.move "Resize" f.resize "Quit" f.quit }Menu "root" { "XTerm" f.spawn "xterm" "Move" f.move "Resize" f.resize "Quit" f.quit }
Color block, e.g., Color { MenuBackground "gray80" MenuForeground "black" }.[25] Window behaviors are controlled via variables like NoTitle { "xclock" "xbiff" }, which removes titlebars from specified applications for an undecorated appearance, or AutoRaise { "emacs" } to automatically raise certain windows on focus.[26]
Key and mouse bindings use formats such as "keyname" = modifiers : context : function or ButtonN = modifiers : context : function, where Button1 denotes the left mouse button, modifiers include Ctrl, Alt, or Shift, and contexts specify interaction areas like root, title, window, or all. For instance, binding the left-click on a titlebar to raise a window: Button1 = : title : f.raise. A key binding example is "Alt F1" = : root : f.spawn "xterm", launching a terminal. Qualifiers like * (for all windows) or implicit current window selection enable broader actions, such as f.iconify * to iconify all windows, which can simulate basic virtual desktop management by grouping or hiding sets of windows.[25]
TWM integrates with X resources via the xrdb utility, particularly for the bitmapFilePath resource, which defines directories for loading icons and pixmaps used in configurations (e.g., for window icons or menu bitmaps). Some older options, like certain deprecated color models in pre-X11R6 setups, may not function in modern X11 environments, requiring updates to use RGB values or named colors instead. Common pitfalls include syntax errors from unquoted strings or mismatched braces, which can cause TWM to revert to defaults, and conflicts between unmapping iconified windows (IconifyByUnmapping) and icon manager visibility without a dedicated menu binding like Button3 = : root : f.menu "TwmWindows".[26]