TWM(1)
๐ TWM(1) โ Tab Window Manager for the X Window System ๐
(General Commands Manual)
๐ NAME ๐
twm โ Tab Window Manager for the X Window System. That's the whole name, bestie. โจ
๐ฆ SYNOPSIS ๐ฆ
twm [ options ]
๐ DESCRIPTION ๐
Okay so twm is a window manager for the X Window System. It provides titlebars, shaped windows, several forms of icon management, user-defined macro functions, click-to-type and pointer-driven keyboard focus, and user-specified key and pointer button bindings. It's giving "classic X, but make it customizable." ๐
This program is usually started by the user's session manager or startup script. When used from xdm(1) or xinit(1) without a session manager, twm is frequently executed in the foreground as the last client. When run this way, exiting twm causes the session to be terminated (i.e., logged out). So yeah โ that exit is a whole logout, no cap.
๐จ Careful, bestie: iftwmis the last client in anxdm(1)/xinit(1)setup with no session manager, exiting it terminates the session โ i.e., logs you out.
By default, application windows are surrounded by a โframeโ with a titlebar at the top and a special border around the window. The titlebar contains the window's name, a rectangle that is lit when the window is receiving keyboard input, and function boxes known as โtitlebuttonsโ at the left and right edges of the titlebar.
Pressing pointer Button1 (usually the left-most button unless it has been changed with xmodmap) on a titlebutton will invoke the function associated with the button. In the default interface, windows are iconified by clicking (pressing and then immediately releasing) the left titlebutton (which looks like a Dot). Conversely, windows are deiconified by clicking in the associated icon or entry in the icon manager (see description of the variable ShowIconManager and of the function f.showiconmgr). Click, don't hold โ that's the iconify vibe check. ๐
Windows are resized by pressing the right titlebutton (which resembles a group of nested squares), dragging the pointer over the edge that is to be moved, and releasing the pointer when the outline of the window is the desired size. Similarly, windows are moved by pressing in the title or highlight region, dragging a window outline to the new location, and then releasing when the outline is in the desired position. Just clicking in the title or highlight region raises the window without moving it. Lowkey the cleanest drag-to-resize flow. ๐ฆ
When new windows are created, twm will honor any size and location information requested by the user (usually through -geometry command line argument or resources for the individual applications). Otherwise, an outline of the window's default size, its titlebar, and lines dividing the window into a 3x3 grid that track the pointer are displayed. Clicking pointer Button1 will position the window at the current position and give it the default size. Pressing pointer Button2 (usually the middle pointer button) and dragging the outline will give the window its current position but allow the sides to be resized as described above. Clicking pointer Button3 (usually the right pointer button) will give the window its current position but attempt to make it long enough to touch the bottom of the screen. Three buttons, three whole placement moods. โจ
๐ OPTIONS ๐
twm accepts several command line options, which may be abbreviated, e.g., -d for -display (but upper/lower-case are different):
-clientId IDโ Each timetwmstarts, it callsSmcOpenConnectionto establish a new session. It can be told to restart from a previous session by giving the previous session's client-identifier.-display dpyโ Specify the X server to use.-file filenameโ Specify the name of the startup file to use. By default,twmwill look in the user's home directory for files named.twmrc.num(wherenumis a screen number) or.twmrc.-quietโ Tellstwmthat it should not print error messages when it receives unexpected X Error events. Besides X Error events,twmalso reports its own warnings. The-quietoption suppresses those.-restore filenameโ Whentwm's session is stopped, it attempts to save the current window configuration. Use this option to telltwmto read this file for that information when starting (or restarting) a session.-singleโ Tellstwmthat only the default screen (as specified by-displayor by theDISPLAYenvironment variable) should be managed. By default,twmwill attempt to manage all screens on the display.-verboseโ Tellstwmthat it should print error messages whenever it receives an unexpected X Error event. This can be useful when debugging applications but can be distracting in regular use. The-verboseand-quietoptions increment and decrement the message level, cancelling each other.-Vโ Telltwmto print its version to the standard output, and exit.
๐ง CUSTOMIZATION ๐ง
Much of twm's appearance and behavior can be controlled by providing a startup file in one of the following locations (searched in order for each screen being managed when twm begins):
$HOME/.twmrc.screennumberโ Thescreennumberis a small positive number (e.g.,0,1, etc.) representing the screen number (e.g., the last number in theDISPLAYenvironment variablehost:displaynum.screennum) that would be used to contact that screen of the display. This is intended for displays with multiple screens of differing visual types.$HOME/.twmrcโ This is the usual name for an individual user's startup file./usr/share/X11/twm/system.twmrcโ If neither of the preceding files are found,twmwill look in this file for a default configuration. This is often tailored by the site administrator to provide convenient menus or familiar bindings for novice users.
If no startup files are found, twm will use the built-in defaults described above. The only resource used by twm is bitmapFilePath for a colon-separated list of directories to search when looking for bitmap files (for more information, see the Athena Widgets manual and xrdb(1)).
twm startup files are logically broken up into three types of specifications: Variables, Bindings, Menus. The Variables section must come first and is used to describe the fonts, colors, cursors, border widths, icon and window placement, highlighting, autoraising, layout of titles, warping, use of the icon manager. The Bindings section usually comes second and is used to specify the functions that should be invoked when keyboard and pointer buttons are pressed in windows, icons, titles, and frames. The Menus section gives any user-defined menus (containing functions to be invoked or commands to be executed). Variables first, bindings next, menus last โ the order is iconic. ๐ซถ
Variable names and keywords are case-insensitive. Strings must be surrounded by double quote characters (e.g., "blue") and are case-sensitive. A pound sign (#) outside of a string causes the remainder of the line in which the character appears to be treated as a comment.
๐ธ VARIABLES ๐ธ
Many of the aspects of twm's user interface are controlled by variables that may be set in the user's startup file. Some of the options are enabled or disabled simply by the presence of a particular keyword. Other options require keywords, numbers, strings, or lists of all these.
Lists are surrounded by braces and are usually separated by whitespace or a newline. For example:
AutoRaise { "emacs" "XTerm" "Xmh" }
or
AutoRaise
{
"emacs"
"XTerm"
"Xmh"
}
When a variable containing a list of strings representing windows is searched (e.g., to determine whether or not to enable autoraise as shown above), a string must be an exact, case-sensitive match to the window's name (given by the WM_NAME window property), resource name or class name (both given by the WM_CLASS window property). The preceding example would enable autoraise on windows named โemacsโ as well as any xterm (since they are of class โXTermโ) or xmh windows (which are of class โXmhโ). Case matters, bestie โ exact match energy only. โจ
String arguments that are interpreted as filenames (see the Pixmaps, Cursors, and IconDirectory below) will prepend the user's directory (specified by the HOME environment variable) if the first character is a tilde (~). If, instead, the first character is a colon (:), the name is assumed to refer to one of the internal bitmaps that are used to create the default titlebars symbols: :xlogo or :delete (both refer to the X logo), :dot or :iconify (both refer to the dot), :resize (the nested squares used by the resize button), :menu (a page with lines), and :question (the question mark used for non-existent bitmap files). Colon-prefixed names are the built-in bitmap girlies. ๐
The following variables may be specified at the top of a twm startup file. Lists of Window name prefix strings are indicated by win-list. Optional arguments are shown in square brackets:
AutoRaise { win-list }โ This variable specifies a list of windows that should automatically be raised whenever the pointer enters the window. This action can be interactively enabled or disabled on individual windows using the functionf.autoraise.AutoRelativeResizeโ This variable indicates that dragging out a window size (either when initially sizing the window with pointer Button2 or when resizing it) should not wait until the pointer has crossed the window edges. Instead, moving the pointer automatically causes the nearest edge or edges to move by the same amount. This allows the resizing of windows that extend off the edge of the screen. If the pointer is in the center of the window, or if the resize is begun by pressing a titlebutton,twmwill still wait for the pointer to cross a window edge (to prevent accidents). This option is particularly useful for people who like the press-drag-release method of sweeping out window sizes.BorderColor string [{ wincolorlist }]โ This variable specifies the default color of the border to be placed around all non-iconified windows, and may only be given within aColor,GrayscaleorMonochromelist. The optionalwincolorlistspecifies a list of window and color name pairs for specifying particular border colors for different types of windows. For example:
BorderColor "gray50"
{
"XTerm" "red"
"xmh" "green"
}
The default is "black".
BorderTileBackground string [{ wincolorlist }]โ This variable specifies the default background color in the gray pattern used in unhighlighted borders (only ifNoHighlighthasn't been set), and may only be given within aColor,GrayscaleorMonochromelist. The optionalwincolorlistallows per-window colors to be specified. The default is"white".
okay bestie, we're still in the variables section and it's giving customization buffet ๐ โจ. Every knob below is real, and the defaults are not vibes โ they're literal, so keep an eye on the code bits.
BorderTileForeground string [{ wincolorlist }]โ this one sets the default foreground color in the gray pattern used in unhighlighted borders (only ifNoHighlighthasn't been set, iykyk). It may only be given inside aColor,Grayscale, orMonochromelist. The optionalwincolorlistlets you specify per-window colors ๐. Default:"black".BorderWidth pixelsโ sets the width in pixels of the border surrounding all client window frames, but only ifClientBorderWidthhas not been specified. This value is also used to set the border size of windows created by twm (such as the icon manager). Default:2.ButtonIndent pixelsโ the amount by which titlebuttons should be indented on all sides. Positive values cause the buttons to be smaller than the window text and highlight area so that they stand out. Setting this and theTitleButtonBorderWidthvariables to0makes titlebuttons be as tall and wide as possible. Default:1.ClientBorderWidthโ this variable indicates that the border width of a window's frame should be set to the initial border width of the window, rather than to the value ofBorderWidth. no args, just a whole mood ๐ .Color { colors-list }โ this slays a whole list of color assignments to be made if the default display is capable of displaying more than simple black and white ๐. Thecolors-listis made up of these color variables and their values:DefaultBackground,DefaultForeground,MenuBackground,MenuForeground,MenuTitleBackground,MenuTitleForeground,MenuShadowColor,MenuBorderColor,PointerForeground, andPointerBackground. These color variables may also be given a list of window and color name pairs to allow per-window colors to be specified (seeBorderColorfor details):BorderColor,IconManagerHighlight,BorderTitleBackground,BorderTitleForeground,TitleBackground,TitleForeground,IconBackground,IconForeground,IconBorderColor,IconManagerBackground, andIconManagerForeground. For example:
Color
{
MenuBackground "gray50"
MenuForeground "blue"
BorderColor "red" { "XTerm" "yellow" }
TitleForeground "yellow"
TitleBackground "blue"
}
All of these color variables may also be specified for the Monochrome variable, allowing the same initialization file to be used on both color and monochrome displays. periodt.
ConstrainedMoveTime millisecondsโ the length of time between button clicks needed to begin a constrained move operation. Double clicking within this amount of time when invokingf.movewill cause the window to be moved only in a horizontal or vertical direction. Setting this value to0will disable constrained moves. Default:400 milliseconds.Cursors { cursor-list }โ specifies the glyphs twm should use for various pointer cursors ๐ฆ. Each cursor may be defined either from the cursor font or from two bitmap files. Shapes from the cursor font may be specified directly as:
cursorname "string"
where cursorname is one of the cursor names listed below, and string is the name of a glyph as found in the file /usr/include/X11/cursorfont.h (without the โXC_โ prefix). If the cursor is to be defined from bitmap files, the following syntax is used instead:
cursorname "image" "mask"
The image and mask strings specify the names of files containing the glyph image and mask in bitmap(1) form. The bitmap files are located in the same manner as icon bitmap files. The following example shows the default cursor definitions:
Cursors
{
Frame "top_left_arrow"
Title "top_left_arrow"
Icon "top_left_arrow"
IconMgr "top_left_arrow"
Move "fleur"
Resize "fleur"
Menu "sb_left_arrow"
Button "hand2"
Wait "watch"
Select "dot"
Destroy "pirate"
}
DecorateTransientsโ this variable indicates that transient windows (those containing aWM_TRANSIENT_FORproperty) should have titlebars ๐. By default, transients are not reparented.DefaultBackground stringโ the background color to be used for sizing and information windows. Default:"white".DefaultForeground stringโ the foreground color to be used for sizing and information windows. Default:"black".DontIconifyByUnmapping { win-list }โ a list of windows that should not be iconified by simply unmapping the window (as would be the case ifIconifyByUnmappinghad been set). This is frequently used to force some windows to be treated as icons while other windows are handled by the icon manager. fr fr, it's a whole sorting hack.DontMoveOffโ windows should not be allowed to be moved off the screen. It can be overridden by thef.forcemovefunction.DontSqueezeTitle [{ win-list }]โ titlebars should not be squeezed to their minimum size as described underSqueezeTitlebelow. If the optional window list is supplied, only those windows will be prevented from being squeezed.ForceIconsโ icon pixmaps specified in theIconsvariable should override any client-supplied pixmaps. main character energy for your icons ๐.FramePadding pixelsโ the distance between the titlebar decorations (the button and text) and the window frame. Default:2 pixels.Grayscale { colors }โ a list of color assignments that should be made if the screen has aGrayScaledefault visual. See the description ofColors.IconBackground string [{ win-list }]โ the background color of icons, and may only be specified inside of aColor,GrayscaleorMonochromelist. The optionalwin-listis a list of window names and colors so that per-window colors may be specified. See theBorderColorvariable for a complete description of thewin-list. Default:"white".IconBorderColor string [{ win-list }]โ the color of the border used for icon windows, and may only be specified inside of aColor,GrayscaleorMonochromelist. The optionalwin-listis a list of window names and colors so that per-window colors may be specified. See theBorderColorvariable for a complete description of thewin-list. Default:"black".IconBorderWidth pixelsโ the width in pixels of the border surrounding icon windows. Default:2.IconDirectory stringโ the directory that should be searched if a bitmap file cannot be found in any of the directories in thebitmapFilePathresource. literally the lost-and-found for bitmaps ๐.IconFont stringโ the font to be used to display icon names within icons. Default:"variable".IconForeground string [{ win-list }]โ the foreground color to be used when displaying icons, and may only be specified inside of aColor,GrayscaleorMonochromelist. The optionalwin-listis a list of window names and colors so that per-window colors may be specified. See theBorderColorvariable for a complete description of thewin-list. Default:"black".IconifyByUnmapping [{ win-list }]โ windows should be iconified by being unmapped without trying to map any icons. This assumes that the user will remap the window through the icon manager, thef.warptofunction, or theTwmWindowsmenu. If the optionalwin-listis provided, only those windows will be iconified by simply unmapping.
๐จ Heads up: Windows that have both this and theIconManagerDontShowoptions set may not be accessible if no binding to theTwmWindowsmenu is set in the user's startup file.
IconManagerBackground string [{ win-list }]โ the background color to use for icon manager entries, and may only be specified inside of aColor,GrayscaleorMonochromelist. The optionalwin-listis a list of window names and colors so that per-window colors may be specified. See theBorderColorvariable for a complete description of thewin-list. Default:"white".IconManagerDontShow [{ win-list }]โ the icon manager should not display any windows. If the optionalwin-listis given, only those windows will not be displayed. This variable is used to prevent windows that are rarely iconified (such asxclockorxload) from taking up space in the icon manager. iconic space-saving behavior, honestly ๐ธ.IconManagerFont stringโ the font to be used when displaying icon manager entries. Default:"variable".IconManagerForeground string [{ win-list }]โ the foreground color to be used when displaying icon manager entries, and may only be specified inside of aColor,GrayscaleorMonochromelist. The optionalwin-listis a list of window names and colors so that per-window colors may be specified. See theBorderColorvariable for a complete description of thewin-list. Default:"black".IconManagerGeometrystring [ columns ] โ this one's the vibe-setter for your icon manager window's geometry โจ The string is a standard geometry spec that says how big the icon manager starts out, full size. Then the window gets chopped into columns pieces and scaled to however many entries are in the icon manager ๐ Extra entries get wrapped around to make more rows. Default for columns is1.IconManagerHighlightstring [{ win-list }] โ sets the border color used when you're highlighting the icon manager entry that currently has the focus ๐ And heads up: this can only be specified inside aColor,GrayscaleorMonochromelist. The optional win-list is a list of window names and colors so you can do per-window colors โ see theBorderColorvariable for the whole rundown on win-list. Default is"black".IconManagers{ iconmgr-list } โ drops a whole list of icon managers to create ๐ซถ Every item in the iconmgr-list looks like this:
"winname" ["iconname"] "geometry" columns
where winname is the name of the windows that should get put into this icon manager, iconname is the name of that icon manager window's icon, geometry is a standard geometry spec, and columns is the number of columns in this icon manager โ same deal as described in IconManagerGeometry. Obsessed with an example, so:
IconManagers
{
"XTerm" "=300x5+800+5" 5
"myhost" "=400x5+100+5" 2
}
So clients whose name or class is โXTermโ get an entry created in the โXTermโ icon manager ๐ and clients whose name was โmyhostโ get put into the โmyhostโ icon manager. Slay.
IconManagerShow{ win-list } โ lists windows that should appear in the icon manager. Team it up with theIconManagerDontShowvariable and only the windows on this list get shown in the icon manager ๐IconRegiongeomstring vgrav hgrav gridwidth gridheight โ marks out an area on the root window where icons get placed when the client didn't hand you a specific icon location ๐ฆ geomstring is a quoted string holding a standard geometry spec. Give it more than oneIconRegionline and icons flow into the next icon region once the first one's full. vgrav should be eitherNorthorSouthand controls whether icons fill in from the top or the bottom of the region. Same energy for hgrav โ eitherEastorWest, controlling whether icons fill in from the left or the right. Icons get laid out inside the region in a grid, with cells gridwidth pixels wide and gridheight pixels high โจIcons{ win-list } โ a list of window names plus the bitmap filenames to use as their icons ๐ธ Like:
Icons
{
"XTerm" "xterm.icon"
"xfd" "xfd_icon"
}
Windows that match โXTermโ and would not be iconified by unmapping would try to use the icon bitmap in the file xterm.icon. And if ForceIcons is set, that bitmap gets used even when the client asked for its own icon pixmap ๐
InterpolateMenuColorsโ says menu entry colors should be interpolated between the colors you specified on entries ๐ In this example:
Menu "mymenu"
{
"Title" ("black":"red") f.title
"entry1" f.nop
"entry2" f.nop
"entry3" ("white":"green") f.nop
"entry4" f.nop
"entry5" ("red":"white") f.nop
}
the foreground colors for โentry1โ and โentry2โ get interpolated between black and white, and the background colors between red and green ๐ Similarly, the foreground for โentry4โ lands half-way between white and red, and its background half-way between green and white. It's giving gradient, honestly.
MakeTitle{ win-list } โ names windows that should get a titlebar ๐ It's how you request titles on specific windows whenNoTitlehas been set.MaxWindowSizestring โ a geometry where the width and height are the max size for a given window. Usually used to keep windows inside the size of the screen. Default width is32767 - screen width. Default height is32767 - screen height๐MenuBackgroundstring โ the background color for menus, and it can only be specified inside aColororMonochromelist. Default is"white".MenuBorderColorstring โ color of the menu border, and it can only be specified inside aColor,GrayscaleorMonochromelist. Default is"black".MenuBorderWidthpixels โ width in pixels of the border around menu windows. Default is2.MenuFontstring โ the font used when displaying menus. Default is"variable".MenuForegroundstring โ foreground color used for menus, and it can only be specified inside aColor,GrayscaleorMonochromelist. Default is"black".MenuShadowColorstring โ color of the shadow behind pull-down menus, and it can only be specified inside aColor,GrayscaleorMonochromelist. Default is"black".MenuTitleBackgroundstring โ background color forf.titleentries in menus, and it can only be specified inside aColor,GrayscaleorMonochromelist. Default is"white".MenuTitleForegroundstring โ foreground color forf.titleentries in menus, and it can only be specified inside aColororMonochromelist. Default is"black".Monochrome{ colors } โ a list of color assignments to make when the screen has a depth of1. Go read the description ofColorsfor the details ๐MoveDeltapixels โ how many pixels the pointer has to move before thef.movefunction even starts working. Also peep thef.deltastopfunction. Default is zero pixels.NoBackingStoreโ says twm's menus should not request backing store, which minimizes repainting of menus. Typically used with servers that can repaint faster than they can handle backing store ๐ซถNoCaseSensitiveโ says case gets ignored when sorting icon names in an icon manager. Typically used with applications that capitalize the first letter of their icon name โจNoDefaultsโ says twm should not supply the default titlebuttons and bindings. Only use this if your startup file has a completely new set of bindings and definitions โ fr fr, otherwise you're gonna have a bad time ๐ญNoGrabServerโ says twm should not grab the server when popping up menus and moving opaque windows.NoHighlight[{ win-list }] โ says borders should not be highlighted to track where the pointer is ๐ Give the optional win-list and highlighting only gets disabled for those windows. When the border is highlighted it's drawn in the currentBorderColor; when it's not, it gets stippled with a gray pattern using the currentBorderTileForegroundandBorderTileBackgroundcolors ๐NoIconManagersโ says no icon manager should be created. Periodt.NoMenuShadowsโ says menus should not have drop shadows drawn behind them. Typically used with slower servers, since it speeds up menu drawing at the cost of making the menu a lil harder to read ๐NoRaiseOnDeiconifyโ says windows that get deiconified should not be raised.NoRaiseOnMoveโ says windows should not be raised when they're moved. Typically used so windows can slide underneath each other ๐NoRaiseOnResizeโ says windows should not be raised when they're resized. Typically used so windows can be resized underneath each other.NoRaiseOnWarpโ says windows should not be raised when the pointer is warped into them via thef.warptofunction. > Heads up bestie: if this is set, warping to an occluded window may leave the pointer sitting in the occluding window instead of the one you wanted โ which causes unexpected behavior withf.warpring๐NoSaveUndersโ says menus should not request save-unders, which minimizes window repainting after you pick something from a menu. Typically used with displays that can repaint faster than they can handle save-unders โจNoStackMode[{ win-list }] โ says client window requests to change stacking order should be ignored. With the optional win-list, only requests on those windows get ignored. Typically used to stop applications from relentlessly popping themselves to the front of the window stack ๐ main character energy, but make it rude.NoTitle [{ win-list }]โ says no titlebars for windows, periodt ๐ . If you pass the optional win-list, only those windows lose their titlebars. And bestie, you can pair this withMakeTitleto force titlebars back onto specific windows โ icon behavior, but make it fashion.NoTitleFocusโ tellstwmnot to set keyboard input focus to every window as you enter it. Normallytwmsets focus so focus and key events from the titlebar and icon managers get delivered to the application. But if the pointer moves quickly andtwmis slow to respond, input can go to the old window instead of the new one ๐ญ. This option is typically used to prevent that โinput lagโ and to work around bugs in older applications that have problems with focus events. Very โwe fixed it in postโ energy.NoTitleHighlight [{ win-list }]โ hides the highlight area of the titlebar, the bit that shows which window currently has the input focus โจ. If you give the optional win-list, only those windows skip the highlight area. This and theSqueezeTitleoptions can be set to substantially reduce the amount of screen space required by titlebars. Tiny titlebar, big main character energy ๐.OpaqueMoveโ makes thef.movefunction actually move the window instead of just drawing an outline, so you immediately see what the window will look like in the new position ๐. This option is typically used on fast displays (particularly ifNoGrabServeris set). Real-time slay, no ghosting.Pixmaps { pixmaps }โ gives you a list of pixmaps that define the appearance of various images ๐ผ๏ธ. Each entry is a keyword indicating the pixmap to set, followed by a string giving the name of the bitmap file. The following pixmaps may be specified:
Pixmaps
{
TitleHighlight "gray1"
}
The default for TitleHighlight is to use an even stipple pattern. Cute, consistent, lowkey iconic.
Priority priorityโ setstwm's priority. priority should be an unquoted, signed number (e.g.,999). This variable has an effect only if the server supports theSYNCextension. Prioritize yourself, bestie ๐.RandomPlacementโ windows with no specified geometry get placed in a pseudo-random location instead of making the user drag out an outline ๐ฒ. Chaos? A little. Convenient? Absolutely.ResizeFont stringโ sets the font used in the dimensions window when resizing windows. The default is"fixed". Numbers, but make them legible ๐.RestartPreviousStateโ tellstwmto attempt to use theWM_STATEproperty on client windows to tell which windows should be iconified and which should be left visible ๐. This is typically used to try to regenerate the state that the screen was in before the previous window manager was shutdown. Itโs giving โrestore my tabsโ but for your whole desktop.SaveColor { colors-list }โ a list of color assignments to be stored as pixel values in the root window property_MIT_PRIORITY_COLORS๐จ. Clients may elect to preserve these values when installing their own colormap. Note that use of this mechanism is a way for an application to avoid the "technicolor" problem, whereby useful screen objects such as window borders and titlebars disappear when a programโs custom colors are installed by the window manager. For example:
SaveColor
{
BorderColor
TitleBackground
TitleForeground
"red"
"green"
"blue"
}
This would place on the root window 3 pixel values for borders and titlebars, as well as the three color strings, all taken from the default colormap. Color coordination: protected ๐
.
ShowIconManagerโ says the icon manager window should be displayed whentwmis started ๐. It can always be brought up using thef.showiconmgrfunction. No need to hunt for it, bestie.SortIconManagerโ entries in the icon manager get sorted alphabetically instead of just appending new windows to the end ๐ค. Organized queen behavior.SqueezeTitle [{ squeeze-list }]โ tellstwmto attempt to use theSHAPEextension to make titlebars occupy only as much screen space as they need, rather than extending all the way across the top of the window ๐ซถ. The optional squeeze-list controls where the squeezed titlebar sits along the top. It contains entries of the form:
"name" justification num denom
Here name is a window name, justification is either left, center, or right, and num and denom are numbers specifying a ratio giving the relative position about which the titlebar is justified. The ratio is measured left to right if the numerator is positive, and right to left if negative. A denominator of 0 indicates that the numerator should be measured in pixels. For convenience, the ratio 0/0 is the same as 1/2 for center and -1/1 for right. For example:
SqueezeTitle
{
"XTerm" left 0 0
"xterm1" left 1 3
"xterm2" left 2 3
"oclock" center 0 0
"emacs" right 0 0
}
The DontSqueezeTitle list can be used to turn off squeezing on certain titles. Selective squeezing, we love to see it โจ.
StartIconified [{ win-list }]โ client windows start out as icons until the user explicitly deiconifies them ๐ด. If you pass the optional win-list, only those windows start iconic. This is useful for programs that do not support an-iconiccommand line option or resource. Introvert windows, respectfully.TitleBackground string [{ win-list }]โ the background color used in titlebars, and it may only be specified inside of aColor,GrayscaleorMonochromelist ๐จ. The optional win-list is a list of window names and colors so per-window colors may be specified. The default is"white". Crisp, clean, classic.TitleButtonBorderWidth pixelsโ the width in pixels of the border surrounding titlebuttons ๐ฒ. This is typically set to0to allow titlebuttons to take up as much space as possible and to not have a border. The default is1. Minimal border, maximal button.TitleFont stringโ the font used for displaying window names in titlebars. The default is"variable". Your window names deserve a cute little outfit too ๐.TitleForeground string [{ win-list }]โ the foreground color used in titlebars, and it may only be specified inside of aColor,GrayscaleorMonochromelist โจ. The optional win-list is a list of window names and colors so per-window colors may be specified. The default is"black". Contrast queen.TitlePadding pixelsโ the distance between the various buttons, text, and highlight areas in the titlebar. The default is8 pixels. Personal space, but make it aesthetic ๐.UnknownIcon stringโ the filename of a bitmap file to be used as the default icon ๐ผ๏ธ. This bitmap will be used as the icon of all clients which do not provide an icon bitmap and are not listed in theIconslist. The default default, basically.UsePPosition stringโ whether or nottwmshould honor program-requested locations (given by thePPositionflag in theWM_NORMAL_HINTSproperty) in the absence of a user-specified position ๐. The argument string may have one of three values:"off"(the default) indicating thattwmshould ignore the program-supplied position,"on"indicating that the position should be used, and"non-zero"indicating that the position should be used if it is other than(0,0). The latter option is for working around a bug in older toolkits. Respect the appโs wishesโฆ selectively.WarpCursor [{ win-list }]โ the pointer should be warped into windows when they are deiconified ๐. If you pass the optional win-list, the pointer will only be warped when those windows are deiconified. Teleporting cursor, but consensually.WindowRing { win-list }โ a list of windows along which thef.warpringfunction cycles ๐. Your own little window carousel.WarpUnmappedโ says thef.warptofunction should deiconify any iconified windows it encounters ๐. This is typically used to make a key binding that will pop a particular window (such asxmh), no matter where it is. The default is forf.warptoto ignore iconified windows. Pop-up powers: unlocked.XorValue numberโ the value to use when drawing window outlines for moving and resizing ๐จ. This should be set to a value that will result in a variety of distinguishable colors when exclusive-or'ed with the contents of the user's typical screen. Setting this variable to1often gives nice results if adjacent colors in the default colormap are distinct. By default,twmwill attempt to cause temporary lines to appear at the opposite end of the colormap from the graphics. Outline glow-up, no cap โจ.Zoom [ count ]โ outlines suggesting movement of a window to and from its iconified state should be displayed whenever a window is iconified or deiconified ๐ฆ. The optional count argument specifies the number of outlines to be drawn. The default count is8. Itโs giving cinematic transition.
๐จ Real talk, bestie: the following variables must be set after the fonts have been assigned, so it is usually best to put them at the end of the variables or beginning of the bindings sections:
DefaultFunction functionโ specifies the function to be executed when a key or button event is received for which no binding is provided ๐ซถ. This is typically bound tof.nop,f.beep, or a menu containing window operations. The fallback function, but make it intentional.WindowFunctionfunction โ this one's the vibe check for what happens when you pick a window out of theTwmWindowsmenu. Set it to whatever function you want to run on that window. Ngl, if you don't set it at all, the window just gets deiconified and raised. Simple. Chill. Default behavior slay ๐
๐ซถ BINDINGS ๐ซถ
Okay so once you've got all your variables set up (iconic of you, truly), that's when you attach functions to titlebuttons and to key and pointer buttons. Titlebuttons you can add from the left or from the right, and they show up in the titlebar left-to-right in exactly the order you specified them in. Key and pointer button bindings? Those can go in literally any order you want. No rules. Main character energy โจ
Titlebutton specs must include the name of the pixmap to use in the button box, plus the function to invoke when a pointer button gets pressed inside it:
LeftTitleButton "bitmapname" = function
or
RightTitleButton "bitmapname" = function
The bitmapname can totally just point to one of the built-in bitmaps (and those get scaled to match TitleFont, cute right?) by using the appropriate colon-prefixed name described above. ๐
Key and pointer button specs, meanwhile, have to give the modifiers that must be pressed, over which parts of the screen the pointer has to be, and what function gets invoked. Keys are written as strings containing the appropriate keysym name; buttons are given as the keywords Button1-Button5:
"FP1" = modlist : context : function
Button1 = modlist : context : function
So the modlist is any combo of the modifier names shift, control, lock, meta, mod1, mod2, mod3, mod4, or mod5 โ and yes bestie you can abbreviate them as s, c, l, m, m1, m2, m3, m4, m5 respectively โ all separated by a vertical bar (|). Same deal with the context: any combination of window, title, icon, root, frame, iconmgr, their first letters (heads up, the iconmgr abbreviation is m, not i, iykyk), or all, separated by a vertical bar. And the function is any of those f. keywords described down below. ๐
For example, the default startup file has these bindings in it:
Button1 = : root : f.menu "TwmWindows"
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"
Button2 = : title : f.raiselower
Button1 = : icon : f.function "move-or-iconify"
Button2 = : icon : f.iconify
Button1 = : iconmgr : f.iconify
Button2 = : iconmgr : f.iconify
And a user who wanted to manipulate windows straight from the keyboard could use these bindings โ genuinely such a flex:
"F1" = : all : f.iconify
"F2" = : all : f.raiselower
"F3" = : all : f.warpring "next"
"F4" = : all : f.warpto "xmh"
"F5" = : all : f.warpto "emacs"
"F6" = : all : f.colormap "next"
"F7" = : all : f.colormap "default"
"F20" = : all : f.warptoscreen "next"
"Left" = m : all : f.backiconmgr
"Right" = m | s : all : f.forwiconmgr
"Up" = m : all : f.upiconmgr
"Down" = m | s : all : f.downiconmgr
Ngl, twm provides so many more window manipulation primitives than could ever be conveniently stored in a titlebar, a menu, or a set of key bindings. Like, a ridiculous amount. And even though a small set of defaults is supplied (unless you specify NoDefaults, obvs), most users are gonna want their most common operations bound to key and button strokes. So to make that happen, twm associates names with each of the primitives and gives you user-defined functions for building higher-level primitives โ plus menus for interactively picking among groups of functions. Chef's kiss architecture fr fr ๐ง
User-defined functions contain the name by which they're referenced in calls to f.function, plus a list of other functions to execute. Like so:
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 }
Function "restore-colormap" { f.colormap "default" f.lower }
The function name must be used in f.function exactly as it appears in the function specification. No nicknames. No vibes-based paraphrasing. Exactly. ๐
In the descriptions below, if a function is said to operate on the selected window, but it's invoked from a root menu, then the cursor gets changed to the Select cursor and the next window to receive a button press will be the chosen one. The chosen one!! ๐
!string โ this is literally just an abbreviation forf.execstring.f.autoraiseโ toggles whether or not the selected window gets raised whenever the pointer enters it. Peep the description of theAutoRaisevariable for the full tea. ๐ฆf.backiconmgrโ warps the pointer to the previous column in the current icon manager, wrapping back to the previous row if necessary.f.beepโ sounds the keyboard bell. That's it. That's the function. ๐f.bottomzoomโ similar to thef.fullzoomfunction, except it resizes the window to fill only the bottom half of the screen.f.circledownโ lowers the top-most window that occludes another window.f.circleupโ raises the bottom-most window that is occluded by another window.f.colormapstring โ rotates the colormaps (which it gets from theWM_COLORMAP_WINDOWSproperty on the window) thattwmwill display when the pointer is in this window. The argument string can be one of the following values:"next","prev", and"default". Okay important caveat here bestie, so listen up: in general, the installed colormap is determined by keyboard focus. A pointer-driven keyboard focus will install a private colormap upon entry of the window owning the colormap. But if you're using the click-to-type model, private colormaps won't get installed until the user presses a mouse button on the target window. Not me warning you twice ๐f.deiconifyโ deiconifies the selected window. If the window isn't an icon, this function does absolutely nothing. Zero. Zilch. ๐f.deleteโ sends theWM_DELETE_WINDOWmessage to the selected window if the client application has requested it through theWM_PROTOCOLSwindow property. The application is supposed to respond to the message by removing the indicated window. If the window hasn't requestedWM_DELETE_WINDOWmessages, the keyboard bell gets rung, which is basically twm going "girl, pick a different method" โ indicating the user should choose an alternative method. Note that this is very different fromf.destroy. The intent here is to delete a single window, not necessarily the entire application. Big distinction, don't mix them up ๐ฅf.deltastopโ lets a user-defined function be aborted if the pointer has been moved more thanMoveDeltapixels. See the example definition given forFunction "move-or-raise"at the beginning of the section. ๐
โ ๏ธf.destroyโ instructs the X server to close the display connection of the client that created the selected window. This should only be used as a last resort for shutting down runaway clients. Like, actual last resort. See alsof.delete. ๐ญ
f.downiconmgrโ warps the pointer to the next row in the current icon manager, wrapping to the beginning of the next column if necessary.f.execstring โ passes the argument string to/bin/shfor execution. In multiscreen mode, if string starts a new X client without giving a display argument, the client will appear on the screen from which this function was invoked. Neat, right? โจf.focusโ toggles the keyboard focus of the server to the selected window, changing the focus rule from pointer-driven if necessary. And if the selected window was already focused? It just executes anf.unfocus. Uno reverse ๐f.forcemoveโ likef.move, except it ignores theDontMoveOffvariable. Rules were made to be broken, lowkey.f.forwiconmgrโ warps the pointer to the next column in the current icon manager, wrapping to the beginning of the next row if necessary.f.fullzoomโ resizes the selected window to the full size of the display, or restores the original size if the window was already zoomed.
In some cases f.fullzoom may maximize to full size of display after a single mouse click, but require two mouse clicks instead of a single mouse click to restore the original window size. Okay so when single mouse clicks are desired for both maximizing and restoring, an alternative is to define a function
Function "FullZoom" { f.fullzoom f.winrefresh }
and invoke that by using f.function "FullZoom" instead of invoking f.fullzoom. Iconic workaround, honestly ๐
f.functionstring โ executes the user-defined function whose name is specified by the argument string.f.hbzoomโ this one's a synonym forf.bottomzoom.f.hideiconmgrโ unmaps the current icon manager. Poof, gone ๐ซฅf.horizoomโ this variable is similar to thef.zoomfunction, except the selected window is resized to the full width of the display.f.htzoomโ a synonym forf.topzoom.f.hzoomโ a synonym forf.horizoom.f.iconifyโ iconifies or deiconifies the selected window or icon, respectively.f.identifyโ displays a summary of the name and geometry of the selected window. If the server supports theSYNCextension, the priority of the client owning the window is also displayed. Clicking the pointer or pressing a key in the window dismisses it. Cute lil info card ๐ฆf.lefticonmgrโ similar tof.backiconmgr, except that wrapping does not change rows.f.leftzoomโ this variable is similar to thef.bottomzoomfunction, but it causes the selected window to be resized to only the left half of the display.f.lowerโ lowers the selected window.f.menustring โ invokes the menu specified by the argument string. And yes bestie, cascaded menus can be built by nesting calls tof.menu. Menus within menus within menus, it's giving inception ๐ธf.moveโ okay so this function drags an outline of the selected window (or the window itself if theOpaqueMovevariable is set) until the invoking pointer button is released. Double clicking within the number of milliseconds given byConstrainedMoveTimewarps the pointer to the center of the window and constrains the move to be either horizontal or vertical depending on which grid line is crossed. To abort a move, press another button before releasing the first button. ๐f.nexticonmgrโ warps the pointer to the next icon manager containing any windows on the current or any succeeding screen. โจf.nopโ does absolutely nothing, and it's typically used with theDefaultFunctionorWindowFunctionvariables or to introduce blank lines in menus. Iconic lazy-girl behavior, no cap.f.previconmgrโ warps the pointer to the previous icon manager containing any windows on the current or preceding screens. ๐ฆf.prioritystring โ sets the priority of the client owning the selected window to the numeric value of the argument string, which should be a signed integer in double quotes (e.g.,"999"). This function has an effect only if the server supports theSYNCextension. ๐ฅf.quitโ causestwmto restore the window's borders and exit. Iftwmis the first client invoked fromxdm, this will result in a server reset. Bestie, that's a whole exit, so use it with main character intention. ๐ญf.raiseโ raises the selected window. ๐f.raiselowerโ raises the selected window to the top of the stacking order if it is occluded by any windows, otherwise the window will be lowered. Vibe check energy fr fr.f.refreshโ causes all windows to be refreshed. โจf.resizeโ displays an outline of the selected window. Crossing a border (or settingAutoRelativeResize) will cause the outline to begin to rubber band until the invoking button is released. To abort a resize, press another button before releasing the first button. ๐f.restartโ kills and restartstwm. Glow-up via reboot, lowkey.f.startwmstring โ killstwmand starts another window manager, as specified by string.f.righticonmgrโ similar tof.nexticonmgrexcept that wrapping does not change rows.f.rightzoomโ okay the original literally calls this a โvariableโ here, but it's a function: similar to thef.bottomzoomfunction except that the selected window is only resized to the right half of the display. ๐f.saveyourselfโ sends aWM_SAVEYOURSELFmessage to the selected window if it has requested the message in itsWM_PROTOCOLSwindow property. Clients that accept this message are supposed to checkpoint all state associated with the window and update theWM_COMMANDproperty as specified in theICCCM. If the selected window has not selected for this message, the keyboard bell will be rung. ๐f.showiconmgrโ maps the current icon manager.f.sorticonmgrโ sorts the entries in the current icon manager alphabetically. See the variableSortIconManager. ๐f.titleโ provides a centered, unselectable item in a menu definition. It should not be used in any other context. Not me using it elsewhere ๐.f.topzoomโ same โvariableโ situation as above, but it's the function: similar to thef.bottomzoomfunction except that the selected window is only resized to the top half of the display.f.unfocusโ resets the focus back to pointer-driven. This should be used when a focused window is no longer desired.f.upiconmgrโ warps the pointer to the previous row in the current icon manager, wrapping to the last row in the same column if necessary.f.vlzoomโ synonym forf.leftzoom.f.vrzoomโ synonym forf.rightzoom.f.warpringstring โ warps the pointer to the next or previous window (as indicated by the argument string, which may be"next"or"prev") specified in theWindowRingvariable.f.warptostring โ warps the pointer to the window which has a name or class that matches string. If the window is iconified, it will be deiconified if the variableWarpUnmappedis set or else ignored. ๐งf.warptoiconmgrstring โ warps the pointer to the icon manager entry associated with the window containing the pointer in the icon manager specified by the argument string. If string is empty (i.e.,""), the current icon manager is chosen.f.warptoscreenstring โ warps the pointer to the screen specified by the argument string. String may be a number (e.g.,"0"or"1"), the word"next"(indicating the current screen plus 1, skipping over any unmanaged screens), the word"back"(indicating the current screen minus 1, skipping over any unmanaged screens), or the word"prev"(indicating the last screen visited โ and yes the original leaves that paren open, we respect the chaos). ๐f.winrefreshโ similar to thef.refreshfunction except that only the selected window is refreshed.f.zoomโ similar to thef.fullzoomfunction, except that only the height of the selected window is changed.
๐ MENUS ๐
Functions may be grouped and interactively selected using pop-up (when bound to a pointer button) or pull-down (when associated with a titlebutton) menus. Each menu specification contains the name of the menu as it will be referred to by f.menu, optional default foreground and background colors, the list of item names and the functions they should invoke, and optional foreground and background colors for individual items:
Menu "menuname" [ ("deffore":"defback") ]
{
string1 [ ("fore1":"backn")] function1
string2 [ ("fore2":"backn")] function2
.
.
.
stringN [ ("foreN":"backN")] functionN
}
The menuname is case-sensitive. The optional deffore and defback arguments specify the foreground and background colors used on a color display to highlight menu entries. The string portion of each menu entry will be the text which will appear in the menu. The optional fore and back arguments specify the foreground and background colors of the menu entry when the pointer is not in the entry. These colors will only be used on a color display. The default is to use the colors specified by the MenuForeground and MenuBackground variables. The function portion of the menu entry is one of the functions, including any user-defined functions, or additional menus. ๐
There is a special menu named TwmWindows which contains the names of all of the client and twm-supplied windows. Selecting an entry will cause the WindowFunction to be executed on that window. If WindowFunction hasn't been set, the window will be deiconified and raised. ๐ช
๐ฆ ICONS ๐ฆ
Twm supports several different ways of manipulating iconified windows. The common pixmap-and-text style may be laid out by hand or automatically arranged as described by the IconRegion variable. In addition, a terse grid of icon names, called an icon manager, provides a more efficient use of screen space as well as the ability to navigate among windows from the keyboard. โจ
An icon manager is a window that contains names of selected or all windows currently on the display. In addition to the window name, a small button using the default iconify symbol will be displayed to the left of the name when the window is iconified. By default, clicking on an entry in the icon manager performs f.iconify. To change the actions taken in the icon manager, use the iconmgr context when specifying button and keyboard bindings. ๐
Moving the pointer into the icon manager also directs keyboard focus to the indicated window (setting the focus explicitly or else sending synthetic events NoTitleFocus is set). Using the f.upiconmgr, f.downiconmgr, f.lefticonmgr, and f.righticonmgr functions, the input focus can be changed between windows directly from the keyboard. โจ๏ธ
๐ ENVIRONMENT ๐
DISPLAYโ this variable is used to determine which X server to use. It is also set duringf.execso that programs come up on the proper screen. ๐ฅ๏ธHOMEโ this variable is used as the prefix for files that begin with a tilde and for locating thetwmstartup file. ๐
๐ FILES ๐
$HOME/.twmrc.<screen number>$HOME/.twmrc/usr/share/X11/twm/system.twmrc
๐ BUGS ๐
- The resource manager should have been used instead of all of the window lists. ๐ญ
- The
IconRegionvariable should take a list. - Double clicking very fast to get the constrained move function will sometimes cause the window to move, even though the pointer is not moved. Not the pointer gaslighting us ๐.
- If
IconifyByUnmappingis on and windows are listed inIconManagerDontShowbut not inDontIconifyByUnmapping, they may be lost if they are iconified and no bindings tof.menu "TwmWindows"orf.warptoare setup. ๐
๐ AUTHORS ๐
- Tom LaStrange, Solbourne Computer
- Jim Fulton, MIT X Consortium
- Steve Pitschke, Stardent Computer
- Keith Packard, MIT X Consortium
- Dave Sternlicht, MIT X Consortium
- Dave Payne, Apple Computer
๐ฅ SEE ALSO ๐ฅ
source/version: X Version 11, twm 1.0.13.1, TWM(1) โ and the date? the footer didn't print one, so we're not inventing one, bestie ๐
โจ
๐ฆ where this page comes from
- alpine 3.24: twm-doc 1.0.13.1-r0 ยท MIT
- arch rolling: xorg-twm 1.0.13.1-1 ยท LicenseRef-twm
- Copyright 1993, 1994, 1998 The Open Group
- copyright 1988 Evans & Sutherland Computer Corporation
- copyright 1989 Hewlett-Packard Company
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms