###########################################################################
# set up the colors
#
# OK some people like bright clear colors on their window decorations.
# These people, I guess would mostly be from nice sunny/good weather places
# line California.
#
# StdForeColor 		Black
# StdBackColor		LightSkyBlue
# HiForeColor 		yellow
# HiBackColor		PeachPuff1
# PagerBackColor	BlanchedAlmond

# Me, I'm from Upstate New York, and live in New Hampshire, so I prefer
# these dark muddy colors...

# this is used for non-selected windows, menus, and the panner
StdForeColor 		Black
StdBackColor 		#60a0c0

# this is used for the selected window
HiForeColor 		Black
HiBackColor 		#3ca1c60fb9ef

#PagerBackColor		#5c54c0
#PagerForeColor		orchid

StickyForeColor		Black
StickyBackColor		#60c0a0

# Menu colors
MenuForeColor           Black
MenuBackColor           grey
MenuStippleColor        SlateGrey

############################################################################
# Now the fonts - one for menus, another for window titles, another for icons
#Font			-adobe-helvetica-medium-r-*-*-*-120-*-*-*-*-*-*
Font			-*-times-medium-i-*-*-*-120-*-*-*-*-*-*
WindowFont		-adobe-helvetica-bold-r-*-*-*-120-*-*-*-*-*-*
#IconFont		-adobe-helvetica-medium-r-*-*-11-*-*-*-*-*-*-*
IconFont		fixed

###########################################################################
# Set up the major operating modes
#
########################      FOCUS STUFF     ##############################
# Set windows to auto-raise after 750 milliseconds if you like it.
# Autoraise can sometimes obscure pop-up windows. Performance is now
# similar to olvwm's auto-raise feature.
#AutoRaise 750

# Normally, we'll be in focus-follows mouse mode, but uncomment this 
# for mwm-style click-to-focus
ClickToFocus

########################      ICON STUFF     ##############################
# Auto Place Icons is a nice feature....
# This creates two icon boxes, one on the left side, then one on the
# bottom. Leaves room in the upper left for my clock and xbiff,
# room on the bottom for the Pager.
#IconBox -150 90 -5 -140
#IconBox 5 -140 -140 -5
IconBox -32 1 -1 -140

# If you uncomment this, and make sure that the WindowList is bound to
# something, it works pretty much like an icon manager.
#SuppressIcons

# StubbornIcons makes icons de-iconify into their original position on the
# desktop, instead of on the current page.
#StubbornIcons

# With AutoPlacement, icons will normally place themselves underneath active
# windows. This option changes that.
#StubbornIconPlacement

# If you want ALL you icons to follow you around the desktop (Sticky), try
# this
#StickyIcons

########################      MWM EMULATION     #######################
#
# My feeling is that everyone should use MWMDecorHints and MWMFunctionHints,
# since some applications depend on having the window manager respect them

# MWMFunction hints parses the function information in the MOTIF_WM_HINTS
# property, and prohibits use of these functions on the window. Appropriate
# portions of the window decorations are removed.
MWMFunctionHints

# MWM is kinda picky about what can be done to transients, and it was keeping
# me from iconifying some windows that I like to iconify, so here's an
# over-ride that will allow me to do the operation, even tough the menu
# item is shaded out.
MWMHintOverride

# MWMDecor hints parses the decoration information in the MOTIF_WM_HINTS
# property, and removes these decoratons from the window. This does not affect
# the functions that can be performed via the menus.
MWMDecorHints

# These are affect minor aspects for the look-and-feel.
# Sub-menus placement mwm-style?
MWMMenus
# mwm-style border reliefs (less deep than default fvwm) ?
MWMBorders
# Maximize button does mwm-inversion thingy
MWMButtons
# Some SGI-sh Motif Style
MWMButtons
MWMFunctionHints
MWMMenus
BoundaryWidth   2
NoBoundaryWidth 0
ButtonStyle 1 50x22
ButtonStyle 2 50x50
ButtonStyle 4 22x22
DecorateTransients

########################      MISCELLANEOUS STUFF     #######################
# If you don't like the default 150 msec click delay for the complex functions
# change this and uncomment it.
#ClickTime 150

# OpaqueMove has a number (N) attached to it (default 5).
# if the window occupies less than N% of the screen, 
# then opaque move is used. 0 <= N <= 100
# OpaqueMove 100

# flip by whole pages on the edge of the screen.
EdgeScroll 100 100

# A modest delay before flipping pages seems to be nice...
# I thresh in a 50 pixel Move-resistance too, just so people
# can try it out.
EdgeResistance 250 50


########################      WINDOW PLACEMENT     #######################
# RandomPlacement prevents user interaction while placing windows:
#RandomPlacement

# SmartPlacement makes new windows pop-up in blank regions of screen 
# if possible, or falls back to random or interactive placement.
SmartPlacement

# With SmartPlacement, windows will normally place themselves over icons. 
# Uncomment this to change that.
#StubbornPlacement

# NoPPosition instructs fvwm to ignore the PPosition field in window 
# geometry hints. Emacs annoyingly sets PPosition to (0,0)!
#NoPPosition


########################      DECORATIONS     #######################
# If you want decorated transient windows, uncomment this:
DecorateTransients


###########################################################################
# Set up the virtual desktop and pager

#set the desk top size in units of physical screen size
#DeskTopSize 2x2
DeskTopSize 1x1

# and the reduction scale used for the panner/pager
#DeskTopScale 32
DeskTopScale 16

##########################################################################
# Module path and paths to the icons
#
# ModulePath is a colon-separated list, just like regular unix PATH
ModulePath /usr/lib/X11/fvwm
PixmapPath /cds001/usr/users/chen/dskicons
IconPath   /cds001/usr/users/chen/dskicons

############################################################################
# Set the decoration styles and window options
# Order is important!!!!
# If compatible styles are set for a single window in multiple Style
# commands, then the styles are ORed together. If conflicting styles
# are set, the last one specified is used.

# These commands should command before any menus or functions are defined,
# and before the internal pager is started.

# change the default width.
Style "*" BorderWidth 5, HandleWidth 5, Color Black/#60a0c0,Icon unknown1.xpm

Style "Fvwm*"      NoTitle, NoHandles, Sticky, WindowListSkip,BorderWidth 0
Style "Fvwm Pager" StaysOnTop
Style "FvwmBanner" StaysOnTop
Style "FvwmFileMgr" Title, Handles, Icon folder2.xpm
# Make sure that these windows get icons.
Style "FvwmFileManagerWindow" NoTitle, NoHandles, Icon
Style "Garbage"    Title, Handles, Icon
Style "GoodStuff"  NoTitle, NoHandles, Sticky, WindowListSkip,BorderWidth 2
Style "*lock"      NoTitle, NoHandles, Sticky, WindowListSkip
Style "xpbiff"     NoTitle,            Sticky, WindowListSkip
Style "xconsole"   Sticky, WindowListSkip
Style "*Mail"      Sticky, WindowListSkip
Style "dxsession"  Sticky, WindowListSkip
Style "xterm"      Icon terminl.xpm
Style "dxterm"     Icon terminl.xpm
#Style "Appointment" Icon datebook.xpm
Style "xcalc"      Icon xcalc.xpm
#Style "xbiff"     Icon mail1.xpm
Style "xman"	   Icon manual.xpm
#Style "xvgr"	   Icon graphs.xpm
Style "GoodStuff"  Icon toolbox.xpm
Style "xconsole"   Icon clamp.xpm
Style "*Mail"      Icon mail.xpm
Style "Emacs"      Icon editor.xpm
Style "xfontsel"   Icon fonts.xpm

#############################################################################

# Stuff to do at start-up
#	Exec	"I"	xpmroot /cds001/usr/users/chen/dskicons/fvwm.xpm &


Function "InitFunction"
	Module	"I"	FvwmBanner
	Exec    "I"	xpmroot /cds001/usr/users/chen/dskicons/Pebbles.xpm
	Module	"I"	GoodStuff
	Module	"I"	FvwmPager 0 4
EndFunction

Function "RestartFunction"
	Exec    "I"	xpmroot /cds001/usr/users/chen/dskicons/Pebbles.xpm
	Module	"I"	GoodStuff
	Module	"I"	FvwmPager 0 4
EndFunction


############################################################################
# Now define some handy complex functions

# This one moves and then raises the window if you drag the mouse,
# only raises the window if you click,  or does a RaiseLower if you double 
# click
Function "Move-or-Raise"
	Move 		"Motion"
	Raise		"Motion"
	Raise		"Click"
	RaiseLower	"DoubleClick" 
EndFunction

# This one maximizes vertically if you click (leaving room for the GoodStuff bar at the
# bottom, or does a full maximization if you double click, or a true full vertical 
# maximization if you just hold the mouse button down.
Function "maximize_func"
	Maximize	"Motion" 0 100
	Maximize	"Click" 0 80
	Maximize	"DoubleClick" 100 100
EndFunction


# This one moves and then lowers the window if you drag the mouse,
# only lowers the window if you click,  or does a RaiseLower if you double 
# click
Function "Move-or-Lower"
	Move 		"Motion"
	Lower		"Motion"
	Lower		"Click"
	RaiseLower	"DoubleClick"
EndFunction

# This one moves or (de)iconifies:
Function "Move-or-Iconify"
	Move 		"Motion"
	Iconify		"DoubleClick"
EndFunction

# This one resizes and then raises the window if you drag the mouse,
# only raises the window if you click,  or does a RaiseLower if you double 
# click
Function "Resize-or-Raise"
	Resize 		"Motion"
	Raise		"Motion"
	Raise		"Click"
	RaiseLower	"DoubleClick"
EndFunction


# This is provided as a hint only.
# Move to a known page on the desktop, then start an application in a 
# known location. Could also switch to a known desktop, I guess
#Function "abs_coord"
#	GoToPage "Immediate"	1,1
#	Exec	"Immediate"	exec xcalc -geometry +100+100&
#EndFunction


##############################################################################
#now define the menus - defer bindings until later

# This menu is invoked as a sub-menu - it allows you to quit,
# restart, or switch to another WM.
Popup "Quit-Verify"
	Title	"Window Manager Options?"
#	Quit	"Yes, Really Quit"
	Restart "Restart Fvwm"	fvwm
	Restart "Start mwm" 	mwm
	Nop	""
#	Nop	"No, Don't Quit"
EndPopup

# Provides a list of modules to fire off
Popup "Module-Popup"
	Title	"Modules"
#	Module	"GoodStuff"	GoodStuff
	Module	"Clean-Up"	FvwmClean
	Module	"Identify"	FvwmIdent
	Module  "SaveDesktop"   FvwmSave
	Module	"Debug"		FvwmDebug
#	Module  "Pager"         FvwmPager 0 4
	Module  "FvwmWinList"   FvwmWinList
#	Module  "FileManager"   FvwmFileMgr
EndPopup

Popup "Background-Popup"
	Title	"Background"
	Exec    "Pebbles" xpmroot /cds001/usr/users/chen/dskicons/Pebbles.xpm
	Exec    "Arena" xpmroot /cds001/usr/users/chen/dskicons/arena.xpm
        Exec    "background5"  xpmroot /cds001/usr/users/chen/dskicons/background5.xpm
        Exec    "background8"  xpmroot /cds001/usr/users/chen/dskicons/background8.xpm
       Exec     "bg_blu"       xpmroot /cds001/usr/users/chen/dskicons/bg_blu.xpm
       Exec     "circle_weave" xpmroot /cds001/usr/users/chen/dskicons/circle_weave.xpm
       Exec     "cloth"        xpmroot /cds001/usr/users/chen/dskicons/cloth.xpm
       Exec     "concrete"     xpmroot /cds001/usr/users/chen/dskicons/concrete.xpm
       Exec     "flames"       xpmroot /cds001/usr/users/chen/dskicons/flames.xpm
       Exec     "funkyblue_weave"      xpmroot /cds001/usr/users/chen/dskicons/funkyblue_weave.xpm
       Exec     "gradient"     xpmroot /cds001/usr/users/chen/dskicons/gradient.xpm
       Exec     "gray_stucco"  xpmroot /cds001/usr/users/chen/dskicons/gray_stucco.xpm
       Exec     "green_stucco" xpmroot /cds001/usr/users/chen/dskicons/green_stucco.xpm
       Exec     "greysea"      xpmroot /cds001/usr/users/chen/dskicons/greysea.xpm
       Exec     "honey"        xpmroot /cds001/usr/users/chen/dskicons/honey.xpm
       Exec     "marbled"      xpmroot /cds001/usr/users/chen/dskicons/marbled.xpm
       Exec     "marbled2"     xpmroot /cds001/usr/users/chen/dskicons/marbled2.xpm
       Exec     "maze3"        xpmroot /cds001/usr/users/chen/dskicons/maze3.xpm
       Exec     "multicolor1_rock"     xpmroot /cds001/usr/users/chen/dskicons/multicolor1_rock.xpm
       Exec     "multicolor3_rock"     xpmroot /cds001/usr/users/chen/dskicons/multicolor3_rock.xpm
       Exec     "plasma_maze"  xpmroot /cds001/usr/users/chen/dskicons/plasma_maze.xpm
       Exec     "pool"         xpmroot /cds001/usr/users/chen/dskicons/pool.xpm
       Exec     "raindrops_dark" xpmroot /cds001/usr/users/chen/dskicons/raindrops_dark.xpm
       Exec     "red_rock"     xpmroot /cds001/usr/users/chen/dskicons/red_rock.xpm
       Exec     "red_stucco"   xpmroot /cds001/usr/users/chen/dskicons/red_stucco.xpm
       Exec     "rough"        xpmroot /cds001/usr/users/chen/dskicons/rough.xpm
       Exec     "slate"        xpmroot /cds001/usr/users/chen/dskicons/slate.xpm
       Exec     "slate_green"  xpmroot /cds001/usr/users/chen/dskicons/slate_green.xpm
       Exec     "space"        xpmroot /cds001/usr/users/chen/dskicons/space.xpm
       Exec     "space2"       xpmroot /cds001/usr/users/chen/dskicons/space2.xpm
       Exec     "tan_paper"    xpmroot /cds001/usr/users/chen/dskicons/tan_paper.xpm
       Exec     "tiles"        xpmroot /cds001/usr/users/chen/dskicons/tiles.xpm
       Exec     "wax"          xpmroot /cds001/usr/users/chen/dskicons/wax.xpm
       Exec     "weave-red"    xpmroot /cds001/usr/users/chen/dskicons/weave-red.xpm
       Exec     "wood"         xpmroot /cds001/usr/users/chen/dskicons/wood.xpm
       Exec     "wood2"        xpmroot /cds001/usr/users/chen/dskicons/wood2.xpm
       Exec     "xenon"        xpmroot /cds001/usr/users/chen/dskicons/xenon.xpm
EndPopup

# This menu will fire up some very common utilities
Popup "Utilities"
	Title 	"Utilities"
	Exec    "Xterm"		exec xterm -ls -sb -sl 500 &
	Exec    "Dxterm"        exec dxterm -ls &
	Exec    "notepad"       exec dxnotepad &
	Popup   "Background"    Background-Popup
	Nop	""
	Popup	"Modules"	Module-Popup
	Nop	""
	Popup	"WM Options"	Quit-Verify
EndPopup

# This defines the most common window operations
Popup "Window Ops"
	Title		"Window Ops"
	Function	"Move" 		Move-or-Raise
	Function 	"Resize" 	Resize-or-Raise
	Raise   	"Raise"
	Lower   	"Lower"
	Iconify 	"(De)Iconify" 
	Stick		"(Un)Stick"
	Function 	"(Un)Maximize"	maximize_func
	Nop     	""
	Destroy 	"Destroy"
	Delete  	"Delete"
	Nop		""
	Refresh		"Refresh Screen"
EndPopup

#this defines all network connection
Popup "Network Ops"
	Title           "Network"
	Exec  "codahp"  exec donetwork -auto -node codahp&
	Exec  "dahp1"   exec donetwork -auto -node dahp1 &
	Exec  "cebafb"  exec donetwork -auto -node cebafb&
	Exec  "cebafh"  exec donetwork -auto -node cebafh&
	Exec  "cebaf9"  exec donetwork -auto -node cebaf9&
	Exec  "cds002"  exec donetwork -auto -node cds002&
EndPopup

# A trimmed down version of "Window Ops", good for binding to decorations
Popup "Window Ops2"
	Function 	"Move"		Move-or-Raise
	Function  	"Resize" 	Resize-or-Raise
	Raise   	"Raise"
	Lower   	"Lower"
	Iconify 	"Iconify"
	Stick		"(Un)Stick"
	Nop     	""
	Destroy 	"Destroy"
	Delete  	"Delete"
	Nop 		""
#	Module		"ScrollBar" 	FvwmScroll 2 2
EndPopup

#############################################################################
# One more complex function - couldn't be defined earlier because it used 
# pop-up menus
#
# This creates a motif-ish sticky menu for the title-bar window-ops
# pop-up
# Menu acts like normal twm menu if you just hold the button down,
# but if you click instead, the menu stays up, motif style
Function "window_ops_func"
	PopUp 	"Click"		Window Ops2
	PopUp	"Motion"	Window Ops2
# Motif would add
#       Delete  "DoubleClick"  
EndFunction


##############################################################################
# This defines the mouse bindings

# First, for the mouse in the root window
# Button 1 gives the Utilities menu
# Button 2 gives the Window Ops menu
# Button 3 gives the WindowList (like TwmWindows)
# I use the AnyModifier (A) option for the modifier field, so you can hold down
# any shift-control-whatever combination you want!

#     Button	Context Modifi 	Function
Mouse 1		R   	A       PopUp "Utilities"
Mouse 2         R       A       PopUp "Network Ops"
Mouse 3		R    	A      	PopUp "Window Ops"
#Mouse 3		R    	A      	Module "winlist" FvwmWinList transient



# Now the title bar buttons
# Any button in the left title-bar button gives the window ops menu
# Any button in the right title-bar button Iconifies the window
# Any button in the rightmost title-bar button maximizes
# Note the use of "Mouse 0" for AnyButton.

#     Button	Context Modifi 	Function
Mouse 0		1    	A      	Function "window_ops_func"
Mouse 0		2    	A     	Function "maximize_func"
Mouse 0		4    	A     	Iconify

# Now the rest of the frame
# Here I invoke my complex functions for Move-or-lower, Move-or-raise,
# and Resize-or-Raise. 
# Button 1 in the corner pieces, with any modifiers, gives resize or raise
Mouse 1		F	A	Function "Resize-or-Raise"
# Button 1 in the title, sides, or icon, w/ any modifiers, gives move or raise
Mouse 1		TS	A	Function "Move-or-Raise"

# Button 1 in an icons gives move for a drag, de-iconify for a double-click,
# nothing for a single click
# Button 2 in an icon, w/ any modifiers, gives de-iconify

Mouse 1		I	A	Function "Move-or-Iconify"
Mouse 2		I	A	Iconify

# Button 2 in the corners, sides, or title-bar gives the window ops menu
Mouse 2		FST	A	Function "window_ops_func"
# Button 3 anywhere in the decoration (except the title-bar buttons)
# does a raise-lower
Mouse 3		TSIF	A	RaiseLower

# Button 3 in the window, with the Modifier-1 key (usually alt or diamond)
# gives Raise-Lower. Used to use control here, but that interferes with xterm
Mouse 3         W       M       RaiseLower

############################################################################
# Now some keyboard shortcuts.

# Arrow Keys
# press arrow + control anywhere, and scroll by 1 page
Key Left	A	C	Scroll -100 0
Key Right	A	C	Scroll +100 +0
Key Up		A	C	Scroll +0   -100
Key Down	A	C	Scroll +0   +100

# press arrow + meta key, and scroll by 1/10 of a page
Key Left	A	M	Scroll -10 +0
Key Right	A	M	Scroll +10 +0
Key Up		A	M	Scroll +0   -10
Key Down	A	M	Scroll +0   +10

# press shift arrow + control anywhere, and move the pointer by 1% of a page
Key Left	A	SC	CursorMove -1 0
Key Right	A	SC	CursorMove +1 +0
Key Up		A	SC	CursorMove +0   -1
Key Down	A	SC	CursorMove +0   +1

# press shift arrow + meta key, and move the pointer by 1/10 of a page
Key Left	A	SM	CursorMove -10 +0
Key Right	A	SM	CursorMove +10 +0
Key Up		A	SM	CursorMove +0   -10
Key Down	A	SM	CursorMove +0   +10

# Keyboard accelerators
Key F1		A	M	Popup "Utilities"
Key F1		A	M	Popup "Utilities"
Key F2		A	M	Popup "Window Ops"
Key F3		A	M	Module "WindowList" FvwmWinList 
Key F4		A	M	Iconify
Key F5		A	M	Move
Key F6		A	M	Resize
Key F7		A	M	CirculateUp
Key F8		A	M	CirculateDown

#Page Up/Dapge Down keys are used to scroll by one desktop page
# in any context, press page up/down + control
# in root context, just pressing page up/down is OK
# 
# I prefer the non-wrapping scroll. These are for example purposes only
#Key Next	A       C       Scroll 100000 0
#Key Next	R       N       Scroll 100000 0  
#Key Prior	A       C       Scroll -100000 0
#Key Prior	R       N       Scroll -100000 0


############################################################################
############################################################################
#Definitions used by the modules

###################### GoodStuff button-bar ################################
# Colors
*GoodStuffFore Black
*GoodStuffBack #129999

# Font
*GoodStuffFont -adobe-helvetica-bold-r-*-*-*-100-*-*-*-*-*-*
# Geometry - really likes to pick its own size, but giving a position is OK
*GoodStuffGeometry +0-1

# Layout: specify rows or columns, not both
*GoodStuffRows 1

# Define the buttons to use.....
*GoodStuff Kill    rbomb.xpm    Destroy

# xterm or rxvts on remote machines can be done like this
# Output re-direction is csh style, not sh style
# You will want to substitute your own hosts here!

#*GoodStuff Grumpy  rterm.xpm   Exec "cebaf9" rsh cebaf9 "exec xterm -T cebaf9 -display $HOSTDISPLAY </dev/null >&/dev/null & "&
#*GoodStuff Snoopy  rterm.xpm   Exec "snoopy" rsh snoopy "exec xterm -T snoopy -display $HOSTDISPLAY </dev/null >&/dev/null & "&
#*GoodStuff xclock  clock.xpm   Swallow "xclock" xclock -bg \#908090 -geometry -1500-1500 -padding 0 &
*GoodStuff  Mail    mail1.xpm   Exec "Mail" exec dxmail -geometry +50+100 &
*GoodStuff  News    desk.xpm    Exec "ReadNews" exec /usr/local/gnu/bin/xrn&
*GoodStuff  Addr    map.xpm     Exec "Address"  exec dxcardfiler&
*GoodStuff  Cal     xcalc.xpm   Exec "Calculator" exec dxcalc&
*GoodStuff  XV      graphs.xpm  Exec "X view"   exec xv&
*GoodStuff  XPaint  draw.xpm    Exec "Xpaint"   exec xpaint&
*GoodStuff  Xman    xman.xpm    Exec "Xman"     exec xman&
*GoodStuff  fonts   fonts.xpm   Exec "xfont"    exec xfontsel&

######################### No Clutter ########################################
# I only wrote NoClutter as a simple test case, but maybe some big sites like
# universities really have usage problems (too many open windows)....
# Time delays are in seconds.
*FvwmNoClutter 3600 Iconify 1
*FvwmNoClutter 86400 Delete
*FvwmNoCLutter 172800 Destroy

########################## Window-Identifier ###############################
# Just choose colors and a fonts
*FvwmIdentBack MidnightBlue
*FvwmIdentFore Yellow
*FvwmIdentFont -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*

########################### Pager #########################################
*FvwmPagerBack #908090
*FvwmPagerFore #484048
*FvwmPagerFont -adobe-times-bold-i-*-*-*-120-*-*-*-*-*-*
*FvwmPagerHilight #cab3ca
*FvwmPagerGeometry -1-1
*FvwmPagerLabel 0 CODA
*FvwmPagerLabel 1 Remote
*FvwmPagerLabel 2 Misc
*FvwmPagerLabel 3 OOD
*FvwmPagerLabel 4 HP
*FvwmPagerSmallFont 5x8


##########################FvwmWinList##################################
*FvwmWinListBack #908090
*FvwmWinListFore Black
*FvwmWinListFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
*FvwmWinListAction Click1 Iconify -1,Focus
*FvwmWinListAction Click2 Iconify
*FvwmWinListAction Click3 Module "FvwmIdent" FvwmIdent
*FvwmWinListUseSkipList
*FvwmWinListGeometry +0-1
                                      