# Unfortunately, order does matter in this file
# The correct order for inserting configurations is:
# 1. Colors
# 2. Assorted configuration paramters such as ClickToFocus, or MWMBorders
# 3. Path setup (ModulePath, PixmapPath, IconPath)
# 4. Style settings, including the default style Style "*" ...
# 5. InitFunction and ResetFunction definitions.
# 6. Other Functions. Functions cannot be forward referenced from
#	other functions, but they can be backward referenced.
# 7. Menus definitions. Same caveats about forward referencing
# 8. Key and Mouse Bindings.
# 9. Module options.

# The order of steps 5, 6, and 7 is not critical, as long as there are
# no forward references to functions or menus.

# If you get it wrong, the most common problem is that color or font settings
# are ignored
###########################################################################
# This sample is set up to try to conserve memory. A few techniques are
# used:
# 1. Only "fixed" font is used.
# 2. The internal pager is used instead of the module.
# 3. The FvwmWinList is used instead of the internal one.
# 4. rxvt is used instead of xterm.
# 5. Color icons are avoided.
###########################################################################
# set up the colors

# this is used for the selected window
HiForeColor 		Black
HiBackColor 		#c06077

PagerBackColor		#5c54c0
PagerForeColor		orchid

StickyForeColor		Black
StickyBackColor		#60c0a0

# Menu colors
MenuForeColor           Black
MenuBackColor           grey
MenuStippleColor        SlateGrey

# Fonts

Font		7x14
WindowFont	7x14

###########################################################################
# 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 1 1 +70 -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

# 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
########################      MISCELLANEOUS STUFF     #######################
# If you don't like the default 150 msec click delay for the complex functions
# change this and uncomment it.
ClickTime 100

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

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

# 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 25 5


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

# SmartPlacement makes new  windows pop-up in blank regions of screen if possible,
# otherwise 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

##########################################################################
# Setup paths for icons and modules
#
# ModulePath is a colon-separated list, just like regular unix PATH
ModulePath /usr/bin/X11/fvwm.modules:/usr/lib/X11/fvwm:/usr/bin/X11

# Icon paths
IconPath	    /usr/include/X11/bitmaps/:/users/sam/misc/bitmaps

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

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

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


# Use the Fvwm Pager
Pager -5 -5

#############################################################################
# Initialization Functions

Function "InitFunction"
#	Exec	"I"	exec rxvt &
#	Exec	"I"	exec rclock -ic &
EndFunction

############################################################################
# list the windows that don't want a title bar
Style "*" BorderWidth 3, HandleWidth 4, Color Black/#60a0c0,Icon xlogo32
Style "Fvwm*" NoTitle, NoHandles,Sticky,StaysOnTop,WindowListSkip
Style "GoodStuff" NoTitle, NoHandles,Sticky,WindowListSkip
Style "*lock" NoTitle,NoHandles,Sticky,WindowListSkip
Style "xbiff" NoTitle,NoHandles,Sticky
Style "GoodStuff" NoTitle
Style "?ppeed*" NoTitle
Style "xvt" Icon terminal, Color Black/#60a0b0

############################################################################
# Now define some handy complex functions
Function "Delete-and-talk"
#	Exec		"Click" exec play \\usr\\lib\\X11\\sounds\\deadjim.snd 11000 -q -ste &
	Delete		"Click" 
EndFunction

# 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"
#	Exec		"Click" exec play \\usr\\lib\\X11\\sounds\\woohoo.220 22050 -z -q -ste &
#	Exec		"Motion" exec play \\usr\\lib\\X11\\sounds\\hal2.snd 11000 -q -ste &
	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 92
	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"
#	Exec		"Click" exec play \\usr\\lib\\X11\\sounds\\meepmeep.080 8000 -z -q -ste &
#	Exec		"Motion" exec play \\usr\\lib\\X11\\sounds\\doh.220 22050 -z -q -ste &
	RaiseLower	"DoubleClick"
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	"Really Quit Fvwm?"
	Quit	"Yes, Really Quit"
	Restart "Restart Fvwm"	fvwm
	Restart "Start twm" 	twm
	Nop	""
	Nop	"No, Don't Quit"
EndPopup

# Provides a list of modules to fire off
Popup "Module-Popup"
	Title	"Modules"
	Module	"GoodStuff"	GoodStuff
	Module	"FvwmWinList"	FvwmWinList
	Module	"NoClutter"	FvwmClean
	Module	"Identify"	FvwmIdent
	Move	"Move"
	Module  "SaveDesktop"   FvwmSave
	Module	"Debug"		FvwmDebug
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" 
	Maximize 	"(Un)Maximize"
	Maximize 	"(Un)Maximize Vertical"	0 100
	Nop     	""
#	Delete  	"Delete"
	Function	"Delete" Delete-and-talk
	Nop	""
	Refresh	"Refresh Screen"
#	Nop	""
#	Desk	"Next Desk"	1 0
#	Desk	"Previous Desk" -1 0
	Nop 	""
	Popup	"Exit Fvwm"	Quit-Verify
	Popup	"Modules"	Module-Popup
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     	""
	Delete  	"Delete"
	Nop		""
	Module		"ScrollBar" 	FvwmScroll
EndPopup

#====================================
Popup "Tools"
	Title	"Unix Tools"
	Exec	"Top"		exec xvt -geometry 80x35 -font 6x9 -n 'System Processes' -e /bin/top &
	Exec	"Xev"		exec xvt -sb -n 'Xev-events' -font '5x7' -e /usr/bin/X11/xev &
	Popup	"Modules"	Module-Popup
EndPopup

Popup "Terminals"
	Title	"Shell Terminals"
	Exec	"Tiny Xvt [tcsh]" exec xvt -font 6x9 -sb -n 'Xvt [tcsh]' -font '5x7' -e /bin/tcsh &
	Exec	"Xvt [sh]"	exec xvt -font 7x14 -sb -n 'Xvt [sh]' -e /bin/sh &
	Exec	"Xvt [bash]"	exec xvt -font 7x14 -sb -n 'Xvt [bash]' -e /bin/bash &
	Exec	"Xterm [tcsh]"	exec xterm -font 7x14 -sb -n 'Xterm [tcsh]' -e /bin/tcsh &
	Nop	""
EndPopup

# INTERNET Connection Tools
#=====================================================================
# Atari ftp archives
Popup "FTParchives"
	Title	"FTP Archive Sites"
	Exec	"nic.switch.ch"		exec xvt -font 7x14 -sb -n 'FTP:nic.switch.ch' -e /usr/ucb/ftp nic.switch.ch
	Exec	"phlem.ph.kcl.ac.uk"	exec xvt -font 7x14 -sb -n 'FTP:phlem.ph.kcl.ac.uk' -e /usr/ucb/ftp phlem.ph.kcl.ac.uk
	Exec	"micros.hensa.ac.uk"	exec xvt -font 7x14 -sb -n 'FTP:micros.hensa.ac.uk' -e /usr/ucb/ftp micros.hensa.ac.uk &
	Exec	"ftp.uni-paderborn.de"	exec xvt -font 7x14 -sb -n 'FTP:ftp.uni-paderborn.de' -e /usr/ucb/ftp ftp.uni-paderborn.de &
	Exec	"ftp.uni-muenster.de"	exec xvt -font 7x14 -sb -n 'FTP:ftp.uni-muenster.de' -e /usr/ucb/ftp ftp.uni-muenster.de &
	Exec	"ftp.uni-kl.de"		exec xvt -font 7x14 -sb -n 'FTP:ftp.uni-kl.de' -e /usr/ucb/ftp ftp.uni-kl.de &
	Exec	"ftp.cs.tu-berlin.de"	exec xvt -font 7x14 -sb -n 'FTP:ftp.cs.tu-berlin.de' -e /usr/ucb/ftp ftp.cs.tu-berlin.de &
	Exec	"ftp.cnam.fr"		exec xvt -font 7x14 -sb -n 'FTP:ftp.cnam.fr' -e /usr/ucb/ftp ftp.cnam.fr &
	Exec	"ftp.std.com"		exec xvt -font 7x14 -sb -n 'FTP:ftp.std.com' -e /usr/ucb/ftp ftp.std.com &
	Exec	"cs-ftp.bu.edu"		exec xvt -font 7x14 -sb -n 'FTP:cs-ftp.bu.edu' -e /usr/ucb/ftp cs-ftp.bu.edu &
	Exec	"atari.archive.umich.edu" exec xvt -font 7x14 -sb -n 'FTP:atari.archive.umich.edu' -e /usr/ucb/ftp atari.archive.umich.edu &
	Exec	"atari.archive [back door]" exec xvt -font 7x14 -sb -n 'FTP:atari.archive [back door]' -e /usr/ucb/ftp 141.211.128.22 &
EndPopup

# Remote hosts at Newcastle Uni.
Popup "Rhosts"
	Title	"Remote Hosts"
	Exec	"kingcong"	exec xvt -font 7x14 -sb -n 'TELNET:kingcong' -e /usr/ucb/telnet 129.97.86.20 &
	Exec	"bode"		exec xvt -font 7x14 -sb -n 'TELNET:bode' -e /usr/ucb/telnet bode.uwaterloo.ca &
	Exec	"garfield"	exec xvt -font 7x14 -sb -n 'TELNET:garfield' -e /usr/ucb/telnet garfield.cs.mun.ca &
EndPopup

Popup "Apps"
	Title	"Applications"
	Exec	"Xv"		 	exec xv &
	Exec	"Xfig"		 	exec xfig 2> /dev/null &
	Exec	"GnuPlot"		exec xvt -font 7x14 -sb -n 'GNUPLOT 3.5' -e /usr/local/bin/gnuplot -font 7x14 &
	Exec	"WEB Browser"	 	exec chimera -n 'Chimera WEB Browser' &
EndPopup

Popup "InternetTools"
	Title	"Internet Tools"
	Exec	"Telnet Kingcong"	exec xvt -font 7x14 -sb -geometry 80x50 -n 'TELNET:kingcong' -e /usr/ucb/telnet 129.97.86.20 &
	Exec	"Ftp Kingcong"		exec xvt -font 7x14 -sb -n 'FTP:kingcong' -e /usr/ucb/ftp 129.97.86.20 &
	Popup	"Remote Hosts"		Rhosts
	Popup	"FTP Archives"		FTParchives
	Exec	"Telnet"		exec xvt -font 7x14 -sb -n Telnet -e /usr/ucb/telnet &
	Exec	"FTP"			exec xvt -font 7x14 -sb -n FTP -e /usr/ucb/ftp &
	Nop	""
	Exec	"WEB Browser"	 	exec chimera -n 'Chimera WEB Browser' &
	Nop	""
	Exec	"Connect"		exec /bin/sh /usr/ucb/ppp144 &
	Exec	"Disconnect"		exec /bin/sh kill 'cat \\etc\\ppp\\ppp0.pid'
EndPopup

# My LHS Button menu
Popup "Craig"
	Title	"Xwindows Menu"
	Exec	"Xvt [tcsh]"		exec xvt -font 7x14 -sb -n 'Xvt [tcsh]' -e /bin/tcsh &
	Nop	""
	Exec	"WEB Browser"	 	exec chimera -n 'Chimera WEB Browser' &
	Nop	""
	Popup	"FTP Archives"		FTParchives
	Exec	"Telnet"		exec xvt -font 7x14 -sb -n Telnet -e /usr/ucb/telnet &
	Exec	"FTP"			exec xvt -font 7x14 -sb -n FTP -e /usr/ucb/ftp &
	Nop	""
	Exec	"Connect"		exec /bin/sh /usr/ucb/ppp144 &
	Exec	"Disconnect"		exec /bin/sh kill 'cat \\etc\\ppp\\ppp0.pid'
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 "Craig"
Mouse 2		R    	A      	PopUp "Window Ops"



# 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		FS	A	Function "Resize-or-Raise"
# Button 1 in the title, sides, or icon, w/ any modifiers, gives move or raise
Mouse 1		T	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"

Mouse 3         R	A	Module "t" FvwmWinList transient
############################################################################
# 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 "Craig"
Key F2		A	M	Popup "Window Ops"
Key F3		A	M	Module "t" 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
Key F9		R	A	Exec exec "rxvt" rxvt &

#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
*GoodStuffBack White
*GoodStuffFore Black

*GoodStuffFont -*-times-medium-r-normal--*-100-75-75-p-54-*-*

# Geometry - really likes to pick its own size, but giving a position is OK
*GoodStuffGeometry +0-1

# Layout: specify rows or columns, not both
*GoodStuffColumns 5
*GoodStuffRows 2

# Define the buttons to use.....
*GoodStuff(1x2) Xvt prog.icon Exec "Xvt"	exec xvt -sb -n Xvt &

#Buttons for some other desktops.
*GoodStuff Desk-0  Term    Desk 0 0
*GoodStuff Desk-1  Term    Desk 0 1
*GoodStuff Desk-2  Term    Desk 0 2
*GoodStuff Desk-3  Term    Desk 0 3

#Buttons for useful Internet stuff
*GoodStuff newton star		Exec	""	exec xvt -n 'TELNET (newton)' -e /usr/ucb/telnet newton.ncl.ac.uk &
*GoodStuff Internet Up 		Exec	""	exec xvt -geometry 80x13+0+0 -n Connect -e /usr/ucb/dip /etc/slip.dip &
*GoodStuff Internet Down	Exec	""	exec /usr/ucb/dip -k > /dev/null &

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

*FvwmPagerGeometry -1-1
*FvwmPagerColumns 1

########################## Window-Lister ###############################
*FvwmWinListBack DarkOliveGreen
*FvwmWinListFore PaleGoldenRod
*FvwmWinListFont -*-times-medium-r-normal--*-100-75-75-p-54-*-*
*FvwmWinListAction Click1 Iconify -1
*FvwmWinListAction Click2 Iconify
*FvwmWinListAction Click3 Module "FvwmIdent" FvwmIdent
*FvwmWinListUseSkipList
*FvwmWinListUseIconNames
*FvwmWinListGeometry -50+10
# I like it achored
#*FvwmWinListNoAnchor

############################################################################
#Startup with some default modules active - I like the GoodStuff button bar
# and the Window List

#module GoodStuff
#module FvwmWinList

