#
# File: .twmrc
# Authors: ??
#          K.R. Sloan
# Last Modified: 21 April 1991
# Purpose:
# This is an .twmrc file for X.V11R4 that attempts to provide
# a pleasant, non-complex user interface.  
#
# This file may be used as a model for writing your own .twmrc file.
#
# Be sure to read UW CS Tech Note 157, available in 114 Sieg.

#-------------------------------------------------------------------------
# VARIABLES -- some grouped by related functions, others alphabetically.


#--- Dealing with Icons ---------
#
# There are several ways of organizing the icon mess (we use #2).
# 1) IconRegion (you see the real icons)
# 2) Icon Managers  (you see generic icons)
# 3) the TwmWindows menu (there are no icons)

# ShowIconManager means that you will be using an Icon Manager window.
ShowIconManager

# Here are windows that we do not want to appear in the Icon Manager.
# This is done for the following reasons.
# 1) to keep the Icon Manager small, or
# 2) if you want to see the icon
#IconManagerDontShow { "xclock" "xbiff" "Xmh" }
IconManagerDontShow { "Xmh" }

# The geometry "800x50+2+2" 8 makes a horizontal icon manager
# at the top of the screen.
# IconManagerGeometry "800x50+2+2" 8
#
# The geometry "100x600-2+2" 1 makes a vertical icon manager
# at the right of the screen (a la the NeXT "Dock").


# and I moved it down to just under my clock and made it a bit wider
IconManagerGeometry "130x600-10+160" 1

# And setting IconifyByUnmapping means that icons will only show up
# in an Icon Manager window, and never have their own real estate.
# You'll almost certainly want this on if you have ShowIconManager on.
IconifyByUnmapping

# DontIconifyByUnmapping lists windows whose icons we want to see anyway.
DontIconifyByUnmapping {
        "Xmh"
}

# SortIconManager means icons will be displayed in alphabetical order.
SortIconManager

# NoCaseSensitive makes XJaiAlai sort between Xhockey and Xkarate
# in the Icon Manager (if you have SortIconManager turned on).
NoCaseSensitive

#-----------------------------

# AutoRaise is a matter of taste.  If you have the UW CSE enhancements
# to twm, the semantics are as follows:
# 1) AutoRaise -- apply autoraise to all windows
# 2) RaiseDelay -- redefine autoraise to wait this number of milliseconds
# 3) AutoRaise {"xterm" "xmh"} -- apply autoraise only to the named windows
# If you don't have the UW CSE enhancements, 1) and 2) are unavailable.
#AutoRaise
#RaiseDelay 100
AutoRaise {}

# AutoRelativeResize is also a matter of taste.
#AutoRelativeResize

# Setting a wide BorderWidth, such as 4, makes sense if you
# don't let twm handle events in the ``window'' context.
# It gives you a wider ``frame'' context at which to aim your mouse.
BorderWidth 4

# A ButtonIndent of 0 gives you a bigger button area to aim for.
# If your twm chokes here, it is pre-R4.  This .twmrc file
# is for use with R4 twm.
ButtonIndent 0

#
# Monochrome has not been used in awhile - see "Color" below for more details
#  then - fix up Monchrome below
#
#Monochrome{
# DefaultBackground   "white"
# DefaultBackground   "black"
# MenuBackground      "black"
# MenuForeground      "white"
# MenuTitleBackground "white"
# MenuTitleForeground "black"
# MenuShadowColor     "black" 
# BorderColor "black"
# {
#  "XTerm" "black"
#  "xclock" "black"
# }
# BorderTileBackground "white"
# {
#  "XTerm" "white"
#  "xclock" "white"
# }
# BorderTileForeground "black"
# {
#  "XTerm" "black"
#  "xclock" "black"
# }
#}

# Without ConstrainedMoveTime 0, double clicking when invoking
# f.move would result in a constrained move.
# If you wanted to click twice in the scrollbar and not the border,
# the warp of the cursor caused by the constrained move could be confusing.
# I disable constrained moves here to avoid that confusion.
ConstrainedMoveTime 0

# DontMoveOff says that windows may not move off the screen.
#DontMoveOff

# MoveDelta must be nonzero for f.deltastop to have any significance.
MoveDelta 6

# Experiment to find out if backing store is worth it on your hardware.
NoBackingStore

# NoDefaults is very important.  Without it, you are adding onto to
# somebody else's user interface.  With it, you are writing one from scratch.
NoDefaults

# If every picosecond counts, set NoMenuShadows for faster drawing.
NoMenuShadows

# Experiment to find out if save unders are worth it on your hardware.
NoSaveUnders

# There are some windows (clients) that you probably don't want to
# have title bars.

NoTitle { "oclock" "xclock" "xbiff" "xterm" }

# Since we are not trying to implement a mouse-less user interface,
# set NoTitleFocus to avoid input lag.
NoTitleFocus

# A big, constant width font.
#ResizeFont "*-b&h-lucidatypewriter-medium-r-normal-sans-34-*"
# A medium sized, constant width font.
ResizeFont "*-b&h-lucidatypewriter-medium-r-normal-sans-20-*"

# When you change your .twmrc file, you'll want to restart twm;
# RestartPreviousState is nice in this case.
RestartPreviousState

# A TitleButtonBorderWidth of 0 gives you a bigger button area to aim for.
# However, I think that the border is a necessary visual clue.
#TitleButtonBorderWidth 1
TitleButtonBorderWidth 0

# The following variables must appear after the fonts (if any)
# have been assigned.
# DefaultFunction is assigned to all key and button events
# that you don't assign anything else to.
DefaultFunction f.nop
# WindowFunction is invoked from the items of the TwmWindows menu.
WindowFunction f.iconify

#-------------------------------------------------------------------------
#  BINDINGS (which mouse button does what)
# General guidelines for changing bindings:
# For the real estate that the application does not own
# (frame, icon, iconmgr, root, title) let twm decide what to do.
# For the real estate that the application does own
# (window) let the application decide what to do.
#

# Like the Mac, etc.
LeftTitleButton ":iconify" = f.iconify

# Titlebuttons with the same handedness (e.g. Left) are
# placed in left to right order, so this will go second from the left.
LeftTitleButton ":question" = f.menu "Ops For THIS Window"

# Like the Mac, etc.
RightTitleButton ":resize" = f.resize

#Button = KEYS : CONTEXT : FUNCTION
# If you drag with the left button, the thing will move.
# If you click with the left button, the thing will be raised.
# Whatever action is bound to the left button in the frame,
# it should be harmless, because the frame is close to the scrollbar.
Button1 =      : frame   : f.function "delta_move_else_raiselower"

# If you drag with the left button, the thing will move.
# If you click with the left button, the thing will be raised or lowered.
Button1 =      : title   : f.function "delta_move_else_raiselower"

# If you drag with the left button, the thing will move.
# If you click with the left button, the thing will be deiconified.
Button1 =      : icon    : f.function "delta_move_else_deiconify"

# If you click with the left button, the thing will be deiconified.
Button1 =      : iconmgr : f.iconify

# The following line, Button1 = : root : f.beep, is a good place to customize.
Button1 =      : root    : f.beep

#Button1 =      : window   : Don't let twm have these events!

# CAREFUL: remember that Button2 over an xterm pastes the selection.
# This has nothing to do with window managers.
# To prevent folks from pasting when they wanted to do something else,
# I give them a window manager in which Button2 does nothing.
Button2 =      : frame   : f.beep
Button2 =      : icon    : f.beep
Button2 =      : iconmgr : f.beep
Button2 =      : root    : f.beep
Button2 =      : title   : f.beep

# To make this user interface easy to learn, I have put all menus
# and only menus on the third button.
# Whatever action is bound to the right button in the frame,
# it should be harmless, because the frame is close to the scrollbar.
Button3 =      : frame   : f.menu "Ops For THIS Window"
Button3 =      : icon    : f.menu "Ops For THIS Window"
Button3 =      : iconmgr : f.menu "Ops For THIS Window"
Button3 =      : root    : f.menu "WINDOWS"
Button3 =      : title   : f.menu "Ops For THIS Window"

# The following section implements three reminders.
Button1 = m    : all    : f.menu "Meta Menu 1"
Button2 = m    : all    : f.menu "Meta Menu 2"
Button3 = m    : all    : f.menu "Meta Menu 3"

# Some no-ops.
Button1 = c|m  : all    : f.beep
Button2 = c|m  : all    : f.beep
Button3 = c|m  : all    : f.beep

Button1 = m|s  : all    : f.beep
Button2 = m|s  : all    : f.beep
Button3 = m|s  : all    : f.beep

# If you want to make it easier to raise hidden windows, try this.
# If you hold down meta and click with the left button,
# the window will be raised or lowered.
#Button1 = m   : window : f.raiselower

#-------------------------------------------------------------------------
#  FUNCTIONS
# If the window is actually moved, then return from the function.
# Else execute f.deiconify.
function "delta_move_else_deiconify" {
f.move f.deltastop f.deiconify
}
# If the window is actually moved, then return from the function.
# Else execute f.raise.
function "delta_move_else_raise" {
f.move f.deltastop f.raise
}
# If the window is actually moved, then return from the function.
# Else execute f.raiselower.
function "delta_move_else_raiselower" {
f.move f.deltastop f.raiselower
}

#-------------------------------------------------------------------------
#  MENUS

menu "WINDOWS"
 {
"WINDOWS" f.title
# NOTE: The ``-n'' flag, which sets the icon name, may not be supported
# in the next release.  You should use the ``*iconName'' resource.
"xterm" !"/usr/bin/X11/xterm -j -ls -n `hostname|sed 's/\\..*//'` -rw -title `hostname` -wf &"
# If you want a customized xterm, you define the characteristics of
# ``customxterm'' in your .Xresources file.
#"Custom xterm" !"/usr/bin/X11/xterm -j -ls -n custom -name customxterm -rw -title custom -wf &"
#
# For remote programs, there are two basic approaches: non-X networking
# software inside a local xterm, or invocation of remote software
# on an rsh platform.
#
# %%%%% Local xterm %%%%%
# These remote terminal emulators do not require a .rhosts file.
#
"Willis"     !"/usr/bin/X11/xterm -j -ls -n Willis -rw -s -title Willis -wf -e rlogin Willis &"
"Dave"     !"/usr/bin/X11/xterm -j -ls -n Dave -rw -s -title Dave -wf -e rlogin Dave &"
"Bill"     !"/usr/bin/X11/xterm -j -ls -n Bill -rw -s -title Bill -wf -e rlogin Bill &"
"Walt"     !"/usr/bin/X11/xterm -j -ls -n Walt -rw -s -title Walt -wf -e rlogin Walt &"
"Earl"     !"/usr/bin/X11/xterm -j -ls -n Earl -rw -s -title Earl -wf -e rlogin Earl &"
"cisa"      !"/usr/bin/X11/xterm -j -ls -n cisa -rw -s -title cisa -wf -e rlogin cisa &"
"Zeus"      !"/usr/bin/X11/xterm -j -ls -n Zeus -rw -s -title Zeus -wf -e rlogin Zeus &"
"June"      !"/usr/bin/X11/xterm -j -ls -n June -rw -s -title June -wf -e telnet june.cs.washington.edu &"
"Marr"      !"/usr/bin/X11/xterm -j -ls -n Marr -rw -s -title Marr -wf -e telnet marr.cs.washington.edu &"
"XOthello"  !"/usr/bin/X11/xterm -j -ls -n XOTHELLO -rw -s -title XOTHELLO -wf -geometry =80x50+0-0 -e /wf/ks/scripts/XOthello &"
"MAIL"     !"/usr/bin/X11/xterm -iconic -n Mail -title Mail -geometry =80x68+300+0 &"
#
# %%%%% Rsh platform %%%%%
# To make an rsh platform work, you will have to place a ``.rhosts''
# file on the remote machine.  On many UW CSE machines,
# the line below can be simplified using ``xrsh''.
# INETDISPLAY comes in handy with X Terminals.
# See the sample .xsession file for its definition.
#
#"June via rsh"     !"rsh june -n /usr/bin/X11/xterm -display $INETDISPLAY -j -ls -n june -rw -s -title june -wf &"
#
#	"" f.title
	"Other Applications" f.menu "APPLICATIONS"
	"Window Manager" f.title
	"TWM Operations" f.menu "TWM Operations"
 }
menu "APPLICATIONS"
 {
"APPLICATIONS" f.title
"cs-info" !"/usr/local/gemacs -q -l cs-info -f info &"
"xman" !"/usr/bin/X11/xman &"
"GNU emacs" !"/usr/local/gemacs &"
#"rn" !"/usr/local/rn &"
 }

menu "TWM Operations"
 {
	"TWM Operations" f.title
	"Refresh All" f.refresh
	"Restart Twm" f.restart
	"Show IconMgr" f.showiconmgr
        "Exit TWM" f.quit
# Twm defines a menu called TwmWindows.  Choosing an item on TwmWindows
# invokes the function WindowFunction.  Here is an example use:
# 1) Have WindowFunction make icons become windows (f.deiconify)
# 2) Have icons be unmapped (IconifyByUnmapping)
# 3) Attach the TwmWindows menu to a mouse button.
#	"TwmWindows" f.menu "TwmWindows"
 }

menu "Ops For THIS Window"
 {
	"Ops For THIS Window" f.title
	"(Un)Zoom" f.zoom
	"Win Refresh" f.winrefresh
	"(De)Iconify" f.iconify
	"Raise" f.raise
	"Lower" f.lower
	"Move" f.move
	"Resize" f.resize
	"Destroy" f.destroy
 }

menu "Meta Menu 1"
{
	"With this user interface," f.title
	"you never need the meta key." f.title
	"Left button without meta" f.title
	"gives direct actions." f.title
}

menu "Meta Menu 2"
{
	"With this user interface," f.title
	"you never need the meta key." f.title
	"Middle button is for" f.title
	"pasting in xterms, etc." f.title
}

menu "Meta Menu 3"
{
	"With this user interface," f.title
	"you never need the meta key." f.title
	"Right button without meta" f.title
	"gives a menu." f.title
}

# Several variables may only be set inside the Color or Monochrome variable
Color {
 DefaultBackground   "light grey"
 DefaultForeground   "black"
 MenuBackground      "navy"
 MenuForeground      "yellow"
 MenuTitleBackground "gray50"
 MenuTitleForeground "black"
 BorderColor "navy"
 {
  "xterm" "red"
  "xclock" "orange"
 }
 IconManagerHighlight "black"
  {
   "xterm" "red"
   "xclock" "orange"
   "xbiff" "black"
  }
 BorderTileBackground "light grey"
 {
  "xterm" "red"
  "xclock" "orange"
  "xbiff" "black"
 }
 BorderTileForeground "light grey"
 {
  "xterm" "red"
  "xclock" "orange"
  "xbiff" "white"
 }
 TitleBackground "light grey"
  {
   "xterm" "light grey"
   "xclock" "light grey"
  }
 TitleForeground "black"
  {
   "xterm" "red"
   "xclock" "orange"
  }
 IconBackground "light grey"
  {
   "xterm" "light grey"
   "xclock" "light grey"
  }
 IconForeground "black"
  {
   "xterm" "black"
   "xclock" "orange"
  }
 IconBorderColor "light grey"
  {
   "xterm" "red"
   "xclock" "orange"
  }
 IconManagerBackground "light grey"
  {
   "xterm" "light grey"
   "xclock" "light grey"
  }
 IconManagerForeground "black"
  {
   "xterm" "black"
   "xclock" "black"
  }
}
