# -*-sh-*-
#
# $HOME/.twmrc -- Configuration file for the Zen Window Manager TWM
#
# The  canonical TWM configuration  file that  uses TWM  to implement  a simple
# point-and-click environment:
#
# - ALT-TAB cycles windows Clicking anywhere in the window to focus and
#   activate it.
#
# - Auto-raising is disabled.
#
# - Windows won't stay activate although the focus was yanked from under them.
#
# - When windows are dragged they're no longer overlapped by other windows.
#
# Note that Much of the comment text for configuration keys has been copied
# from the TWM man-page.  This file is free software.
#
########
# $Companion: ~/.Xsession$
# $Maintained at: <http://www.visualco.de>$

# This variable specifies a geometry in which the width and height give the
# maximum size for a given window. This is typically used to restrict windows
# to the size of the screen. The default width is 32767 screen width. The
# default height is 32767 screen height.

#MaxWindowSize "1280x1024"

# This variable indicates that TWM should not grab the server when popping up
# menus and moving opaque windows.

NoGrabServer

# This variable indicates that TWM's menus should not request backing store to
# minimize repainting of menus. This is typically used with servers that can
# repaint faster than they can handle backing store.

NoBackingStore

# This variable indicates that menu entry colors should be interpolated between
# entry specified colors. In the 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" will be interpolated between
# black and white, and the background colors between red and green. Similarly,
# the foreground for "entry4" will be half-way between white and red, and the
# background will be half-way between green and white.

#InterpolateMenuColors

# This variable specifies the background color used for menus, and can only be
# specified inside of a Color or Monochrome list. The default is "white".

#MenuBackground string

# Number of pixels for menu border

#MenuBorderWidth 1

# This variable specifies the font to use when displaying menus. The default is
# "variable".

#MenuFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"
MenuFont "-*-lucidatypewriter-medium-r-normal-*-18-*-*-*-*-*-*-*"

# This variable indicates that menus should not have drop shadows drawn behind
# them. This is typically used with slower servers since it speeds up menu
# drawing at the expense of making the menu slightly harder to read.

#NoMenuShadows

# This variable indicates that menus should not request save-unders to minimize
# window repainting following menu selection. It is typically used with
# displays that can repaint faster than they can handle save-unders.

#NoSaveUnders

# This variable sets TWM's priority. priority should be an unquoted, signed
# number (e.g. 999).  This variable has an effect only if the server supports
# the SYNC extension.

#Priority priority

# This variable indicates that windows with no specified geometry should be
# placed in a pseudo-random location instead of having the user drag out an
# outline.

RandomPlacement

# This variable specifies the font to be used for in the dimensions window when
# resizing windows. The default is "fixed".

#ResizeFont "-adobe-helvetica-bold-r-normal--*-240-*-*-*-*-*-*"
#ResizeFont "-*-lucidatypewriter-medium-r-normal-*-20-*-*-*-*-*-*-*"

# This variable indicates that TWM should attempt to use the WM_STATE property
# 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.

RestartPreviousState

# This variable specifies whether or not TWM should honor program-requested
# locations (given by the PPosition flag in the WM_NORMAL_HINTS property) in
# the absence of a user-specified position. The argument string may have one of
# three values: "off" (the default) indicating that TWM should ignore the
# program-supplied position, "on" indicating that the position should be used,
# and "nonzero" indicating that the position should used if it is other than
# (0,0). The latter option is for working around a bug in older toolkits.

UsePPosition "on"

# This variable indicates 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 an for application to avoid the "technicolor"
# problem, whereby useful screen objects such as window borders and titlebars
# disappear when a programs 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.

#SaveColor { colors-list }

#XorValue 1

# This variable indicates that 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 is 8.

#Zoom 50 # [ count ]

# This variable indicates that client window requests to change stacking order
# should be ignored. If the optional win-list is given, only requests on those
# windows will be ignored. This is typically used to prevent applications from
# relentlessly popping themselves to the front of the window stack.

#NoStackMode [{ win-list }]

# This variable specifies 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.

#Pixmaps { TitleHighlight "s-bsd.xbm" }

##############################################################################
# Icons and the icon manager.
#

# This variable indicates that client windows should initially be left as icons
# until explicitly deiconified by the user. If the optional win-list is given,
# only those windows will be started iconic. This is useful for programs that
# do not support an -iconic command line option or resource.

#StartIconified [{ win-list }]

# This variable indicates that the icon manager window should be displayed when
# TWM is started. It can always be brought up using the f.showiconmgr function.

#ShowIconManager

# This variable indicates that entries in the icon manager should be sorted
# alphabetically rather than by simply appending new windows to the end.

#SortIconManager

# This variable indicates that case should be ignored when sorting icon names
# in an icon manager. This option is typically used with applications that
# capitalize the first letter of their icon name.

NoCaseSensitive

# This variable indicates that no icon manager should be created.

#NoIconManagers

# This variable specifies a list of icon managers to create. Each item in the
# iconmgr-list has the following format: "winname" ["iconname"] "geometry"
# columns where winname is the name of the windows that should be put into this
# icon manager, iconname is the name of that icon manager window's icon,
# geometry is a standard geometry specification, and columns is the number of
# columns in this icon manager as described in IconManagerGeometry.

#IconManagers { iconmgr-list }

# This variable specifies the font to be used when displaying icon manager
# entries. The default is "variable".

IconManagerFont "-*-lucida-bold-r-normal-*-14-*-*-*-*-*-*-*"

# This variable specifies the geometry of the icon manager window. The string
# argument is standard geometry specification that indicates the initial full
# size of the icon manager. The icon manager window is then broken into columns
# pieces and scaled according to the number of entries in the icon
# manager. Extra entries are wrapped to form additional rows. The default
# number of columns is 1.

#IconManagerGeometry "=843x120+125-0" 2

# This variable indicates that the icon manager should not display any
# windows. If the optional win-list is given, only those windows will not be
# displayed. This variable is used to prevent windows that are rarely iconified
# (such as xclock or xload) from taking up space in the icon manager.

IconManagerDontShow {
    "xclock" "xeyes" "xlogo" "xosview" "xload" "xconsole"
    "GV"
}

# This variable indicates that windows should be iconified by being unmapped
# (minimized) without trying to map any icons (render a placeholder icon on the
# desktop). This assumes that the user will remap the window through the icon
# manager, the f.warpto function, or the TwmWindows menu. If the optional
# win-list is provided, only those windows will be iconified by simply
# unmapping. Windows that have both this and the IconManagerDontShow options
# set may not be accessible if no binding to the TwmWindows menu is set in the
# user's startup file.

IconifyByUnmapping {
    "xclock" "xeyes" "xlogo" "xosview" "xload" "xconsole"
    "GV"
}

# This variable specifies a list of windows that should not be iconified by
# simply unmapping the window (as would be the case if IconifyByUnmapping had
# been set). This is frequently used to force some windows to be treated as
# icons while other windows are handled by the icon manager.

#DontIconifyByUnmapping { "Emacs" "XTerm" }

# This variable indicates that icon pixmaps specified in the Icons variable
# should override any client-supplied pixmaps.

#ForceIcons

# This variable specifies the width in pixels of the border surrounding icon
# windows. The default is 2.

IconBorderWidth 3

# This variable specifies the directory that should be searched if if a bitmap
# file cannot be found in any of the directories in the bitmapFilePath
# resource.

#IconDirectory "/usr/X11R6/lib/X11/xfm/bitmaps/"

# This variable specifies the font to be used to display icon names within
# icons. The default is "variable".

IconFont "-*-lucida-bold-r-normal-*-14-*-*-*-*-*-*-*"

# This variable specifies an area on the root window in which icons are placed
# if no specific icon location is provided by the client. The geomstring is a
# quoted string containing a standard geometry specification. If more than one
# IconRegion lines are given, icons will be put into the succeeding icon
# regions when the first is full.  The vgrav argument should be either North or
# South and control and is used to control whether icons are first filled in
# from the top or bottom of the icon region. Similarly, the hgrav argument
# should be either East or West and is used to control whether icons should be
# filled in from left from the right. Icons are laid out within the region in a
# grid with cells gridwidth pixels wide and gridheight pixels high.

#IconRegion geomstring vgrav hgrav gridwidth gridheight

#IconRegion "800x500+125-0" South West 16 12 # grows icons from bottom to top

# This variable specifies a list of window names and the bitmap filenames that
# should be used as their icons. For example:
#   Icons { "XTerm" "xterm.icon"
#           "xfd" "xfd_icon" }
# Windows that match "XTerm" and would not be iconified by unmapping, and
# would try to use the icon bitmap in the file "xterm.icon". If ForceIcons is
# specified, this bitmap will be used even if the client has requested its own
# icon pixmap.

#Icons { }

# This variable specifies 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 the Icons list.

#UnknownIcon "ghost.xbm"

##############################################################################
# Frames and main windows.
#

# This variable indicates that borders should not be highlighted to track the
# location of the pointer.  If the optional win-list is given, highlighting
# will only be disabled for those windows. When the border is highlighted, it
# will be drawn in the current BorderColor. When the border is not highlighted,
# it will be stippled with a gray pattern using the current
# BorderTileForeground and BorderTileBackground colors.

NoHighlight { "xeyes" "xlogo" }

# This variable specifies the default background color in the gray pattern used
# in unhighlighted borders (only if NoHighlight hasn't been set), and may only
# be given within a Color, Grayscale or Monochrome list. The optional
# wincolorlist allows per-window colors to be specified. The default is
# "white".

#BorderTileBackground string [{ wincolorlist }]

# This variable specifies the default foreground color in the gray pattern used
# in unhighlighted borders (only if NoHighlight hasn't been set), and may only
# be given within a Color, Grayscale or Monochrome list. The optional
# wincolorlist allows per-window colors to be specified. The default is
# "black".

#BorderTileForeground string [{ wincolorlist }]

# This variable specifies the width in pixels of the border surrounding all
# client window frames if ClientBorderWidth has not been specified. This value
# is also used to set the border size of windows created by TWM (such as the
# icon manager).  The default is 2.

BorderWidth 3

# This variable indicates that border width of a window's frame should be set
# to the initial border width of the window, rather than to the value of
# BorderWidth.

#ClientBorderWidth

# This variable specifies a list of color assignments to be made if the default
# display is capable of displaying more than simple black and white.  The
# colors-list is made up of the following color variables and their values:
#   - DefaultBackground, DefaultForeground, 
#   - MenuBackground, MenuForeground, MenuTitleBackground, MenuTitleForeground, MenuShadowColor, 
#   - PointerForeground, PointerBackground. 
# The following color variables may also be given a list of window and color
# name pairs to allow per-window colors to be specified (see BorderColor for
# details): 
#   - BorderColor, BorderTitleForeground, BorderTitleBackground,
#   - IconManagerHighlight, IconManagerBackground, IconManagerForeground,
#   - TitleBackground, TitleForeground, IconBackground,
#   - IconForeground, IconBorderColor.  
# 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.  Example:
#   IconBackground string [{ win-list }]
# Use the UNIX command `xfontsel' to preview and compose X fontnames.  From
# within GNU/Emacs you may use the function `list-colors-display' for color
# names.

# Note: the maroon/gray colors below are TWMs default colors.

Color {
    # Menus
    MenuTitleBackground "Brown"
    MenuTitleForeground "White"
    #MenuTitleBackground "gray70"
    #MenuTitleForeground "maroon"
    MenuBackground "white"
    MenuForeground "black"
    MenuBorderColor "gray50"

    # Icons
    IconBorderColor "Brown"
    IconBackground "Black"
    IconForeground "White"

    # Icon Manager
    IconManagerBackground "black"
    IconManagerForeground "white" # font color
    IconManagerHighlight "Brown"
    #IconManagerBackground "maroon"
    #IconManagerForeground "gray85"
    #IconBackground "maroon"
    #IconForeground "gray85"
    #IconBorderColor "gray85"

    # Windows
    BorderColor "Brown"
    #BorderColor "medium violet red"
    DefaultBackground "White"
    DefaultForeground "Black"
    #DefaultBackground "maroon"
    #DefaultForeground "gray85"
    #TitleBackground "OrangeRed2"
    #TitleBackground "Maroon"
    TitleBackground "Black"
    TitleForeground "Snow"
    #TitleBackground "maroon"
    #TitleForeground "gray85"
}

# This variable specifies a list of color assignments that should be made if
# the screen has a GrayScale default visual. See the description of Colors.

#Grayscale { colors }

# This variable specifies a list of color assignments that should be made if
# the screen has a depth of 1. See the description of Colors.

#Monochrome { colors }

# This variable specifies the glyphs that 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
# <.../include/X11/cursorfont.h> (without the "XC_" prefix; <...> is the X root
# directory).
#
# <xfd -fn cursor> will show all possible cursors and their names can be found
# in </usr/include/X11/cursorfont.h>. 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.

#Cursors { Frame "spider" }

##############################################################################
# Title bars.
#

# This variable indicates that windows should not have titlebars. If the
# optional win-list is given, only those windows will not have titlebars.
# MakeTitle may be used with this option to force titlebars to be put on
# specific windows.

NoTitle {
    "TWM Icon Manager"
     "Login"
    "xlogo" "xclock" "xeyes" "xosview" "xcalc" "xterm" "rxvt" "xconsole"
}

# This variable indicates that TWM should attempt to use the SHAPE extension 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
# may be used to control the location of the squeezed titlebar along the top of
# the window. It contains entries of the form: "name" justification num denom
# where 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 from 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.  The DontSqueezeTitle list can be used to turn off squeezing on
# certain titles.

#SqueezeTitle
#SqueezeTitle [{ squeeze-list }]

# This variable specifies the font to be used for displaying window names in
# titlebars. The default is "variable".

TitleFont "-adobe-helvetica-medium-r-normal-*-18-*-*-*-*-*-*-*"
#TitleFont "-adobe-helvetica-medium-r-normal-*-17-*-*-*-*-*-*-*"
#TitleFont "-adobe-new century schoolbook-medium-r-normal-*-17-*-*-*-*-*-*-*"

# This variable specifies the width in pixels of the border surrounding
# titlebuttons. This is typically set to 0 to allow titlebuttons to take up as
# much space as possible and to not have a border.  The default is 1.

TitleButtonBorderWidth 0 # pixels

# This variable specifies the distance between the various buttons, text, and
# highlight areas in the titlebar. The default is 8 pixels.

TitlePadding 8

# This variable indicates that TWM should NOT set keyboard input focus to each
# window as it is entered. Normally, TWM sets the focus so that focus and key
# events from the titlebar and icon managers are delivered to the
# application. If the pointer is moved quickly and TWM is slow to respond,
# input can be directed to the old window instead of the new. This option is
# typically used to prevent this "input lag" and to work around bugs in older
# applications that have problems with focus events.

#NoTitleFocus

# This variable indicates that the highlight area of the titlebar, which is
# used to indicate the window that currently has the input focus, should not be
# displayed. If the optional win-list is given, only those windows will not
# have highlight areas.  This and the SqueezeTitle options can be set to
# substantially reduce the amount of screen space required by titlebars.

#NoTitleHighlight [{ win-list }]

# This variable specifies a list of windows on which a titlebar should be
# placed and is used to request titles on specific windows when NoTitle has
# been set.

#MakeTitle { win-list }

# This variable specifies the distance between the titlebar decorations (the
# button and text) and the window frame. The default is 2 pixels.

#FramePadding pixel

# This variable specifies 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 the
# TitleButtonBorderWidth variables to 0 makes titlebuttons be as tall and wide
# as possible. The default is 1.

ButtonIndent 0 # pixels

# This variable indicates that titlebars should not be squeezed to their
# minimum size as described under SqueezeTitle below. If the optional window
# list is supplied, only those windows will be prevented from being squeezed.

#DontSqueezeTitle [{ win-list }]

# This variable indicates that transient windows (those containing a
# WM_TRANSIENT_FOR property) should have titlebars. By default, transients are
# not reparented.

#DecorateTransients

# This variable specifies the background color to be used for sizing and
# information windows. The default is "white".

#DefaultBackground string

# This variable specifies the foreground color to be used for sizing and
# information windows. The default is "black".

#DefaultForeground string

# This variable indicates that TWM should not supply the default titlebuttons
# and bindings. This option should only be used if the startup file contains a
# completely new set of bindings and definitions.

NoDefaults

# After the desired variables have been set, titlebuttons may be added from the
# left or right side and appear in the titlebar from left-to-right according to
# the order in which they are specified. Key and pointer button bindings may be
# given in any order.
#
# Titlebuttons specifications must include the name of the pixmap to use in the
# button box and the function to be invoked when a pointer button is pressed
# within them: LeftTitleButton "bitmapname" = function or RightTitleButton
# "bitmapname" = function The bitmapname may refer to one of the built-in
# bitmaps (which are scaled to match TitleFont) by using the appropriate
# colon-prefixed name described above.

LeftTitleButton ":iconify"  = f.iconify
#LeftTitleButton ":dot"     = f.focus
RightTitleButton ":menu"    = f.menu "ApplicationMenu"
RightTitleButton ":xlogo"   = f.menu "TwmWindows"
RightTitleButton ":resize"  = f.menu "WindowMenu"

#RightTitleButton    "8x8-minimize.xbm"  = f.iconify
#RightTitleButton    "8x8-resize.xbm"    = f.resize
#RightTitleButton    "8x8-maximize.xbm"  = f.fullzoom
#RightTitleButton    "8x8-close.xbm"     = f.delete

########################################################################
# Bindings for keyboard and mouse events.
#
# Establish a simple point and click environment.
#   Button 1: raise windows
#   Button 2: lower/iconify windows
#
# 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.
#
# Warnings:
#
# - If "window" is used the "title" function isn't called. Why?
#
# - Assumes NoTitleFocus has not been set, and the focus will automatically
#   follow the mouse pointer.  So we don't have to call f.focus explicitly.

# This variable specifies the function to be executed when a key or button
# event is received for which no binding is provided. This is typically bound
# to f.nop, f.beep, or a menu containing window operations.

DefaultFunction f.menu "RootMenu" # if all else fails bring up the default menu

# This variable specifies the function to execute when a window is selected
# from the "TwmWindows" menu. If this variable is not set, the window will be
# deiconified and raised.

WindowFunction f.function "bring-up"

# 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 function f.autoraise.

#AutoRaise { "Emacs" "XTerm" }

# This variable indicates that windows should not be raised when moved. This is
# typically used to allow windows to slide underneath each other.

#NoRaiseOnMove

# This variable indicates that windows should not be raised when resized. This
# is typically used to allow windows to be resized underneath each other.

#NoRaiseOnResize

# This variable indicates that windows should not be raised when the pointer is
# warped into them with the f.warpto function. If this option is set, warping
# to an occluded window may result in the pointer ending up in the occluding
# window instead the desired window (which causes unexpected behavior with
# f.warpring).

#NoRaiseOnWarp

# This variable indicates that the f.move function should actually move the
# window instead of just an outline so that the user can immediately see what
# the window will look like in the new position.  This option is typically used
# on fast displays (particularly if NoGrabServer is set).

OpaqueMove

# This variable specifies the number of pixels the pointer must move before the
# f.move function starts working. Also see the f.deltastop function. The
# default is zero pixels.

MoveDelta 1 # pixels

# This variable indicates that windows should not be allowed to be moved off
# the screen. It can be overridden by the f.forcemove function.

#DontMoveOff

# 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, TWM will still wait for the pointer to cross
# a window edge (to prevent accidents). This option is particularly useful for
# people who like the pressdrag-release method of sweeping out window sizes.

AutoRelativeResize

# This variable specifies the length of time between button clicks needed to
# begin a constrained move operation. Double clicking within this amount of
# time when invoking f.move will cause the window to be moved only in a
# horizontal or vertical direction. Setting this value to 0 will disable
# constrained moves (turn off horizontal/vertical only moving). The default is
# 400 milliseconds.

ConstrainedMoveTime 0

########
# Cycle Windows. Use ALT-TAB to select the next window from TWM, SHIFT-ALT-TAB
# to select the previous window.
#
# But, actually, this not possible. TWM's prehistoric focus management makes
# circleup/down not working like expected. Both functions are simply not smart
# enough. For example, the pointer is outside the window being circled to, the
# focus can remain in the previous window, which may now be invisible.
#

# After using TWM a long time and having inspected also its C sources, I'm
# convinced there's no workarround.  Placing f.focus, f.unfocus etc. into
# "next-window" won't help.  The pointer-driven focus management is not
# actually customizable - and not controllable using the keyboard, in general.
# Therefore I found it most practical to use the "warp functionality." I simply
# had to define the WindowRing and WarpCursor variables.  ALT-TAB warps to the
# next, predefined window; SHIFT-ALT-TAB to the previous one. Additionally,
# ALT-CTRL-TAB quickly warps to xterm.
#
# Also let the user nuke the window frame with C-F4 and the X-client program
# with M-F4.
#
# Not that I'm a Windows enthusiast, but since these functions are really
# useful in any windowing environment, and the keys commonly known, binding the
# functionality to other keys seems odd to me.

Function "previous-window"  { f.circleup }
Function "next-window"      { f.circledown }

#"Tab"   =   M : all : f.function "next-window"
#"Tab"   = S M : all : f.function "previous-window"

"Tab" =   M : all : f.warpring "next"
"Tab" = S M : all : f.warpring "prev"
"Tab" = C M : all : f.warpto "XTerm"

"F4"  = C   : window : f.delete   
"F4"  = M   : window : f.destroy 

# ALT+Digit keys warp to windows. I don't know any applicaton (incl. my heavily
# customized Emacs) that makes any use of ALT+1, ALT+2 etc.  Because there're
# only 10 of them they can be easily remembered.  Another advantage is their
# relationship to ALT+TAB to cycle windows.

"0" = M : all : f.warpto "XTerm"
"1" = M : all : f.warpto "Emacs"
"2" = M : all : f.warpto "Gecko"
"3" = M : all : f.warpto "thunar"
"4" = M : all : f.warpto "gqview"

# This variable specifies a list of windows along which the f.warpring function
# cycles.  I simply set this to my favorite applications: XTerm, Emacs,
# Firefox.

WindowRing {
    "Emacs" "XTerm" "Gecko" "Konqueror" "thunar"
    "gqview" "gthumb" "gFTP"
    "frame" # FileZilla
    "xfontsel"
}

# This variable indicates that the pointer should be warped into windows when
# they are deiconified. If the optional win-list is given, the pointer will
# only be warped when those windows are deiconified.

#WarpCursor [{ win-list }]
WarpCursor

# This variable indicates that the f.warpto function should deiconify any
# iconified windows it encounters. This is typically used to make a key binding
# that will pop a particular window (such as xmh), no matter where it is. The
# default is for f.warpto to ignore iconified windows.

WarpUnmapped

# This variable specifies 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 of distinguishable colors when exclusive-or'ed with the contents
# of the user's typical screen. Setting this variable to 1 often gives nice
# results if adjacent colors in the default colormap are distinct. By default,
# TWM will attempt to cause temporary lines to appear at the opposite end of
# the colormap from the graphics.


########
# Button 1 
#

# The left mouse button brings windows up. It raise the window and sets the
# input focus.  Raising means to bring the window to the front. If an icon is
# clicked raising means to deiconify the icon. Raising always means to also set
# the input focus into the raised window.
#
# When the button is clicked in the title bar, and the mouse is moved more than
# MoveDelta pixels, it moves the whole window over the screen.
#
# Note that we don't bind "move-or-raise" or "window"; we bind it just to
# "title" and "frame". The meaning of the left button is usually defined to the
# client program that runs the window. For example, Emacs allows the selection
# of text using the left button.

Function "move-raise"       { f.move f.deltastop f.raise }
Function "move-iconify"     { f.move f.deltastop f.iconify }
Function "bring-up"         { f.iconify f.deiconify }

Button1 = : root            : f.menu "ApplicationMenu"
Button1 = : title|frame     : f.function "move-raise"
Button1 = : icon            : f.function "move-iconify"
Button1 = : iconmgr         : f.deiconify

########
# Button 2
#
# Middle button. It does the opposite by lowering or iconifying the window.
# This button does not move it arround.  If pressed in the title bar it shall
# iconify the window, in the client area it lowers it, and it deiconifies
# icons.
#
# The move-xxx macros are actually a trick - otherwise one has to some click
# twice.
#

Function "move-fullzoom"        { f.move f.deltastop           f.fullzoom }
Function "move-fullzoom-icon"   { f.move f.deltastop f.iconify f.fullzoom }
Function "move-topzoom"         { f.move f.deltastop           f.topzoom }
Function "move-bottomzoom"      { f.move f.deltastop           f.bottomzoom }

Button2 =     : root                : f.menu "EmacsDesktopsMenu"
Button2 =     : title|frame         : f.menu "TwmWindows"
Button2 =     : window              : f.function "move-fullzoom"
Button2 =     : icon                : f.function "move-fullzoom-icon"
Button2 =  S  : title|frame|window  : f.function "move-topzoom"
Button2 =   C : title|frame|window  : f.function "move-bottomzoom"
Button2 = M   : title|frame|window  : f.iconify
Button2 = M C : window              : f.menu "WindowMenu"

########
# Button 3
#
# Right button. Opens a context-sensitive menu - but not in the client window
# area!  On the root window the context is all TWM windows.

Button3 =     : root|title|frame    : f.menu "RootMenu"

##############################################################################
# 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.

Function "restart-twm"      { f.exec "xrdb -load $HOME/.Xresources" f.restart }

menu "RootMenu"
{
    "Root Menu"             f.title
    # Shells are run as login-shells, not ordinary sub-shells.  Reason: xterms
    # directly run from <.Xsession> or TWM are principally login shells;
    # there's no default shell after the display manager.
    "> login shell"         f.exec "xterm -name Login -g 100x40 -ls &"
    "> login shell (root)"  f.exec "xterm -bg gray95 -fg darkred -g 100x25 -fn 10x20 -e su -&"
    "- - - - - - - - - -"   f.nop
    "> aptitude"            f.exec "sudo aptitude &"
    "> pstree"              f.exec "pstree -alnpu|xmessage -file -&"
    "> top"                 f.exec "nice -10 rxvt -fn 9x15 -g 80x25 -e top &" # 7x14 6x10 6x13 8x13 9x15
    ">!/var/log/messages"   f.exec "nice -10 rxvt -fn 9x15 -T messages -g 100x25-0-0 -e sudo less -n +F /var/log/messages &"
    "- - - - - - - - - -"   f.nop
    "  Reload X"            f.function "restart-twm"
    " !Restart system"      f.exec "/usr/bin/sudo /sbin/shutdown -r now"
    " !Halt system"         f.exec "/usr/bin/sudo /sbin/shutdown -h now"
    "  Quit twm"            f.quit
}

Menu "WindowMenu"
{
    "Window"                f.title
    "  Iconify"             f.iconify
    "  Resize"              f.resize
    "  Maximize"            f.fullzoom
    "  Zoom -> left"        f.leftzoom
    "  Zoom -> right"       f.rightzoom
    "  Zoom -> top"         f.topzoom
    "  Zoom -> bottom"      f.bottomzoom
    "  Zoom -> horiz."      f.horizoom
    "  Zoom -> vert."       f.zoom
    "- - - - - - - - - -"   f.nop
    "  System..."           f.menu "RootMenu"
    "  Icons..."            f.showiconmgr
    "  Identify..."         f.identify
    "  Kill window"         f.delete
    "  Kill X client"       f.destroy
}

menu "ApplicationMenu"
{
    "Applications"          f.title
    "> thunar"              f.exec "thunar &"
    "> mc"                  f.exec "xterm -name Login -geometry 100x40 -font '-misc-*-medium-*-*-*-20-*-*-*-*-*-*-*' -ls -e mc&"
    "> gFTP"                f.exec "gftp &"
    "> filezilla"           f.exec "filezilla &"
    "- - - - - - - - - -"   f.nop
    "> opera"               f.exec "opera &"
    "> firefox"             f.exec "firefox -geometry 800x600+0+0 &"
    "> konqueror"           f.exec "konqueror &"
    "> GQview"              f.exec "gqview &"
    "> gThumb"              f.exec "gthumb &"
    "> xine"                f.exec "xine &"
    ">!stella"              f.exec "sudo nice -n 20 stella &"
    "- - - - - - - - - -"   f.nop
    "> xcalc"               f.exec "xcalc &"
    "> xfontsel"            f.exec "xfontsel &"
}

menu "EmacsDesktopsMenu"
{
    "Emacs Desktops"        f.title
    "  .../cstor"               f.exec "cd ~/prj/cstor; emacs &"
    "  .../photon"              f.exec "cd ~/prj/photon/mk/gnu; emacs &"
    "  .../rlist"               f.exec "cd ~/prj/rlist/mk/gnu; emacs &"
    "- - - - - - - - - -"   f.nop
    "  Windows..."          f.menu "TwmWindows"
}

# Local Variables:
# coding: iso-latin-1-unix
# fill-column: 79
# End:

# end of file .twmrc