########################################################################
# .fvwm2rc -- a sample .fvwm2rc
#
# See also
#
#		 ModulePath/system.fvwm2rc
#
# and the fvwm home page at
#
#		http://www.hpc.uh.edu/fvwm/
#

############################ Paths #################################

# Be sure to customize these paths for your
# installation...
#
ModulePath /usr/local/lib/fvwm2
PixmapPath $HOME/FVWM2/icons:/usr/local/include/X11/pixmaps:/usr/X11R6/include/X11/pixmaps
IconPath   /usr/X11R6/include/X11/bitmaps

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

# Fvwm runs this function on startup -- you can
# start clients here or in .xinitrc (before starting
# fvwm2). Any fvwm2 modules you want at startup must
# be started here, however.
#
# One idea for InitFunction: you can start apps on
# different desktop pages with something like:
#
#	Scroll	100 0      # go one page to the right
#	Exec	netscape & # launch netscape
#	Wait	Netscape   # wait for netscape to appear
#	Scroll	-100 0     # go back to original position
#
# Invoke the FvwmIdent module (or run xwininfo) to
# determine the application name (for the Wait
# command).
#
# Below, the "I" means "Immediate" -- the subsequent
# fvwm command is invoked when the function is
# invoked.
#
# You should use an "&" with the fvwm Exec command
# to avoid problems on certain platforms.
#
AddToFunc InitFunction "I" Exec xsetroot -solid steelblue3
+		       "I" Module FvwmButtons
+		       "I" Exec xterm -geometry +0+64 &

# Modules have to be restarted when fvwm2 is
# restarted...
#
AddToFunc RestartFunction "I" FvwmButtons

######################### Font/color/misc Stuff #########################

# See the fvwm2 manpage for more details on these 5:
#
ClickTime 150
OpaqueMoveSize 10
EdgeResistance 10000 100
EdgeScroll 0 0
ColormapFocus FollowsMouse

# Fonts & colors -- run "xfontsel -print" to help
# choose fonts.  Look at /usr/lib/X11/rgb.txt to
# help choose colors.
#
WindowFont -adobe-helvetica-bold-r-*-*-12-*	# titlebar font
IconFont   -adobe-helvetica-bold-r-*-*-12-*	# icon font
HilightColor gold navy				# title fg/bg of win w/ focus

# Menu fg/bg/disabled colors, menu font, last field
# is "fvwm" or "mwm"
#
MenuStyle blick grey SlateGrey \
	-adobe-helvetica-bold-r-*-*-12-* fvwm

########################### Window Styles #################################
# Styles are searched in the reverse order of
# appearance,so put the most specific ones last!

# Default Style:
### window frame size
Style "*"           BorderWidth 5, HandleWidth 5
### icon stuff
Style "*"           Icon unknown1.xpm, StickyIcon
Style "*"           IconBox -640 -65 -1 -1
### misc
Style "*"           MWMFunctions, MWMDecor
Style "*"	    HintOverride, DecorateTransient
Style "*"           NoPPosition, MouseFocus
### make user place windows
Style "*"           DumbPlacement, ActivePlacement
### titlebar fg/bg for window w/o focus
Style "*"	    Color lightgrey/navy

# Styles for various Fvwm modules:
Style "Fvwm*"       NoTitle, NoHandles, Sticky
Style "Fvwm*"	    WindowListSkip, BorderWidth 0
Style "Fvwm*"       CirculateSkipIcon, CirculateSkip
Style "FvwmButtons" ClickToFocus

# Styles for various common programs:
Style "XTerm"       Icon xterm.xpm
Style "xbiff"       NoTitle, Sticky, WindowListSkip, ClickToFocus
Style "xcalc"       Icon xcalc.xpm, NoButton 2
Style "*xconsole"   Sticky, WindowListSkip
Style "xman"        ClickToFocus
Style "xmag"        ClickToFocus

#################### Keyboard and Mouse Bindings ###################

# Syntax:
#	Key   <key> <ctx> <mod> <cmd>
#	Mouse <btn> <ctx> <mod> <cmd>
#
# <key> is an X keysym in X11/keysymdef.h -- just
#	strip off the leading "XK_". You can also
#	run xev to get keysym names. I strongly
#	suggest avoiding the use of "funny" keys
#	like F18 since not all kbds have this key.
#
# <btn> is 1,2,3 for the LMB, MMB, or RMB. If
#	<btn> is 0 then any mouse button will
#	invoke the action.
#
# <ctx> is a context for the action. Valid
#	contexts are:
#	R    = root window
#	I    = icon
#	W    = application's window. Be careful!
#	T    = title bar
#	F    = window frame (handles on corners)
#	S    = window sides
#	1-10 = title bar button no. They appear in
#	       this order: 13579 08642. NOTE: a
#	       mouse binding causes the button to
#	       be created.
#
# <mod> is a list of keyboard modifiers. Valid
#	ones are:
#	N = None
#	A = Any
#	S = Shift
#	C = Control
#	M = Meta
#
# <cmd> is any fvwm command
#

# Some simple default mouse bindings:
#   for the root window:
Mouse 1 R       A       Menu RootMenu Nop
Mouse 3 R       A       WindowList
#   hotkey in case cmap gets goofed up:
Mouse 3 R	M	Restart fvwm2

#   for the title bar buttons:
Mouse 0 1       A       Window-Ops-Func
Mouse 0 2       A       Maximize 0 100
Mouse 0 4       A       Iconify

#   for other parts of the window/borders/icons:
Mouse 1 FS      A       Resize-or-Raise
Mouse 1 T       A       Move-or-Raise
Mouse 1 I       A       Move-or-Iconify
Mouse 1 A       CM      RaiseLower
Mouse 3 A       CM      Iconify
Mouse 2 I       A       Iconify
Mouse 2 FST     A       Menu Window-Ops Nop
Mouse 3 TSIF    A       RaiseLower

# Pop up window ops via Alt-F4:
Key F4  TFS	M	Menu Window-Ops Nop

############################ Menus ##############################

AddToMenu RootMenu "Menu"    Title
+                  "XTerm"   Exec xterm &
+                  "Apps"    Popup Apps
+                  "Utils"   Popup Utils
+                  ""        Nop
+                  "Restart" Restart fvwm2
+                  ""        Nop
+                  "Exit"    FvwmForm QuitVerify

AddToMenu Apps "Apps"     Title
+              "Emacs"    Exec emacs &
+              "Netscape" MailFunc Netscape netscape
+              "Xv"       Exec xv &

AddToMenu Utils "Utilities"       Title
+		"FvwmIdent"	  FvwmIdent
+		"FvwmTalk"	  FvwmForm MyFvwmTalk
+               "Xmag"            Exec xmag &
+               "Xman"            Exec xman &
+               ""                Nop
+               "Load X defaults" Exec xrdb -load $HOME/.Xdefaults 

######################## Window Op Menu #####################

AddToMenu Window-Ops "&Move"	     Move-or-Raise
+		     "&Resize"	     Resize-or-Raise
+		     "R&aise"	     Raise  	
+		     "&Lower"	     Lower  	
+		     "(De)&Iconify"  Iconify	
+		     "(Un)&Stick"    Stick	
+                    "(Un)Ma&ximize" Maximize 0 100
+		     ""		     Nop
+		     "&Close"	     Close
+		     "Destroy"	     Destroy	

######################## Window Op Funcs #####################

# Some handy function bound to events.
#
# "M" means "mouse motion"
# "C" means click (button press - button release)
# "D" means double click
#

AddToFunc Move-or-Raise	  "I" Raise
+			  "M" Move
+  			  "D" Iconify

AddToFunc Move-or-Iconify "I" Raise
+			  "M" Move
+			  "C" Iconify

AddToFunc Resize-or-Raise "I" Raise
+			  "M" Resize
+			  "C" Raise
+			  "D" Lower

AddToFunc Window-Ops-Func "M" PopUp Window-Ops
+			  "C" PopUp Window-Ops
+			  "D" Close

# This one is really cool -- you can use it for mail
# programs or things like netscape where only one
# instance of the app should ever be running.
# 
# In a function, $0 - $9 are the args to the
# function. $w is the window's XId -- you can pass
# this to certain programs.
# 
# What MailFunc does: If a window named $0 exists,
# deiconify it if it is iconified, raise it to the
# top of the stacking order, and give it the
# keyboard focus. If such a window does not exist,
# treat the remaining arguments as a command to
# launch the application. You should try this with
# and without StickyIcon set in the default
# Style. You might also want to look at the
# WarpToWindow command in the fvwm2 manpage.
# 
AddToFunc MailFunc "I" Next [$0] Iconify -1
+                  "I" Next [$0] Raise
+                  "I" Next [$0] Focus
+                  "I" None [$0] Exec $1 $2 $3 $4 $5 $6 $7 $8 $9 &

########################### Button Bar ################################

# Overall props:
*FvwmButtonsBack steelblue3
#*FvwmButtonsColumns 1
*FvwmButtonsFont -adobe-helvetica-bold-r-*-*-10-*
*FvwmButtonsFore blick
*FvwmButtonsFrame 2
*FvwmButtonsGeometry +0+0
*FvwmButtonsPadding 2 0
#*FvwmButtonsRows 1
*FvwmButtonsRows 2

# The buttons:
# Action takes a single arg, so you might need to
# quote it. The action can be any fvwm command.
#
*FvwmButtons(Title Exit, Icon bullwinkle_3d.xpm, \
             Action 'FvwmForm QuitVerify')

# The 1st arg to Swallow is the application
# name/window title. The 2nd arg to Swallow is
# the fvwm command to launch the program.
#
*FvwmButtons(Swallow xeyes 'Exec xeyes &')
*FvwmButtons(Swallow xclock 'Exec xclock &')

# Title <text> puts the text <text> under the
# button. FvwmButtons adds an extension to the
# Exec command: the Exec "xterm" ... means that
# the button should remain "pushed" until a
# window named "xterm" appears.
#
*FvwmButtons(Title XTerm, Icon xterm.xpm, \
	     Action 'Exec "xterm" xterm -ls &')

# Swallow the desktop pager -- 2 buttons wide, 1
# button high. The DeskTopSize (below) controls the
# layout within the 2x1 button.
#
*FvwmButtons(Swallow 'FvwmPager' 'FvwmPager 0 0')

# Here's how to get a button that starts up an xterm
# on ame2.
# 
# NOTES:
# 	1) The appearance of the xterm is governed
#          by $HOME/.Xdefaults on the remote
# 	   machine (ame2), not the local machine.
# 	2) For this to work, you'll need to edit
# 	   $HOME/.rhosts on ame2.
# 
# ABOUT .rhosts:
# 
#   The .rhosts file allows you to log in/run
# commands on remote machines *without* giving your
# UNIX password. This is both handy and frightening.
# 
# Use the following form for your .rhosts file:
# 
# 	<remote machine> <remote username>
# 
# For example, if you want to log into ame2 from
# acoma without giving a password, add:
# 
# 	acoma.math.arizona.edu	fred
# 
# This means that fred@acoma can log in as you@ame2
# without giving a password.
# 
# THOU SHALT NOT USE THE FOLLOWING FORMS IN .RHOSTS:
# 
# 	<remote machine>
# 	<remote machine> +
# 	+ <remote username>
# 	+ +
# 
# The first two are bad: they let anyone on <remote
# machine> become *you* on the local machine. The
# next one is worse: it lets any user with username
# <remote username> *anywhere* become you on the
# local machine. The last one is the worst: it lets
# *anyone* *anywhere* become you. It's worse than
# posting your password to Usenet.
# 
# Let me reiterate: whoever gets in via .rhosts
# REALLY IS YOU as far as the local machine is
# concerned!!  Thus you should take steps to ensure
# that only you can get in via .rhosts. Hackers can
# do things like:
# 
# Ouch: /bin/rm -rf $HOME
# Ugh:  echo "<someone> is an *$#!@@!!" >> diss.tex
# Oof:  mail -s "<someone> is a ..." <(ex)friends>
# Eek:  emacs $HOME/public_html/index.html
# Zow:  xpaint $HOME/public_html/picture_of_you.gif
# 
# ALWAYS DO THIS:
# 
# 	chmod 600 $HOME/.rhosts
# 
# NEVER DO THIS:
# 
# 	- add .rhosts entries for dynamic IP
# 	  addresses (ie, PPP from an ISP).
# 
# 	- leave .rhosts entries for machines on
# 	  which you no longer have accounts.
# 
# 	- make .rhosts entries for buddies so that
# 	  they can use your account.
# 
# To test your .rhosts: "rsh ame2 /bin/ls" -- you
# should see a listing of the files in your home dir
# on ame2.
# 
# This function runs xhost and starts up a program
# using rsh. The redirection from/to /dev/null keeps
# the process table clean on both ends. Fvwm sets
# $HOSTDISPLAY to the display of the machine at
# which you are sitting -- this is used to
# initialize the DISPLAY variable for the remote
# process...
# 
# Args: $0	 remote username
# 	$1	 remote hostname
# 	$2 - $9	 program to run
# 
AddToFunc RemoteXFunc "I"	Exec xhost + $1 >/dev/null; rsh $1 -l $0 "/bin/sh -c 'DISPLAY=$HOSTDISPLAY; export DISPLAY; $2 $3 $4 $5 $6 $7 $8 $9 </dev/null >/dev/null 2>&1 &'" &

# This calls RemoteXFunc to start an xterm on a
# remote machine -- any extra args (2-9) are passed
# on to the xterm (see MathFunc below). If there are
# no extra args, you just get a regular old xterm.
#
# Args: $0	 remote username
#	$1	 remote hostname
#	$2 - $7	 additional args for "xterm -ls"
#
AddToFunc XTermFunc "I" RemoteXFunc $0 $1 /usr/bin/X11/xterm -ls $2 $3 $4 $5 $6 $7

# This starts up mathematica in an xterm on ame2
#
# Args: $0	remote username
#
AddToFunc MathFunc "I" XTermFunc $0 ame2 -e math

# These buttons call XTermFunc and MathFunc:
#
*FvwmButtons(Title Ame2, Icon xterm-sun.xpm, \
	     Action 'XTermFunc hays ame2')
*FvwmButtons(Title Wolfram, Icon afraid_3d.xpm, \
	     Action 'MathFunc hays')

# Here's a menu with mini-icons in it. The
# %filename% syntax says to place the icons
# to the left of the menu label.
#
AddToMenu Apps2	"Applications"		      Title
+		"Emacs%mini.letter.xpm%"      Exec emacs &
+		"Netscape%mini.netscape.xpm%" MailFunc Netscape netscape
+		"XCalc%jcalc.xpm%"	      Exec xcalc &
+		"XTerm%jx.xpm%"		      Exec xterm &
+		"Xv%jpaint.xpm%"	      Exec xv &

# Here's a menu with big icons in it -- it looks
# kind of like a drop-down toolbar. The
# *filename* syntax tells fvwm to put the label
# under the icon.
#
AddToMenu Apps3	"Applications"	   Title
+		"*gnu-animal.xpm*" Exec emacs &
+		"*netscape.xpm*"   MailFunc Netscape netscape
+		"*xcalc.xpm*"	   Exec xcalc &
+		"*xterm.xpm*"	   Exec xterm &
+		"*xv.xpm*"	   Exec xv &

# This pops up Apps3 after temporarily redefining 
# the menu bg color to be the same as the toolbar
# bg color...
#
AddToFunc PDTB "I" MenuStyle blick steelblue3 SlateGrey -adobe-helvetica-bold-r-*-*-12-* fvwm
+	       "I" Popup Apps3
+	       "I" MenuStyle blick grey SlateGrey -adobe-helvetica-bold-r-*-*-12-* fvwm

# Here's how to invoke it as a popup menu from the
# button bar...  You can specify a different action
# for each mouse button. You MUST specify a default
# action, though, or FvwmButtons will crash.
#
*FvwmButtons(Title Apps, Icon dilbert_3d.xpm, \
	Action 'Popup Apps2', \
	Action(Mouse 2) 'Popup Apps3', \
	Action(Mouse 3) PDTB)

# You can even make tables in buttons! This one is
# 2 buttons wide and 1 button high. The Container
# has 2 rows, so this is a 2x2 array of small
# buttons.
#
*FvwmButtons(2x1, Container(NoSize, Rows 2, Frame 2))
*FvwmButtons(Title(Side,Left) Emacs, \
	     Icon mini.letter.xpm, \
	     Action 'Exec "emacs" emacs &')
*FvwmButtons(Title(Side,Left) XTerm, \
	     Icon jx.xpm, \
	     Action 'Exec "xterm" xterm -ls &')
*FvwmButtons(Title(Side,Left) XPaint, \
	     Icon jpaint.xpm, \
	     Action 'Exec "xpaint" xpaint &')
*FvwmButtons(Title(Side,Left) Netscape, \
	     Icon mini.netscape.xpm, \
	     Action 'MailFunc Netscape netscape')
*FvwmButtons(End)

############################# Pager ###################################

# We go 4x2 pages since we made it 2 buttons wide...
#
DeskTopSize 3x3

*FvwmPagerBack steelblue3
*FvwmPagerFore snow
*FvwmPagerFont -adobe-helvetica-bold-r-*-*-8-*
*FvwmPagerDeskTopScale 64
*FvwmPagerHilight steelblue2
*FvwmPagerGeometry +0+0
*FvwmPagerLabel 0 Desktop
*FvwmPagerSmallFont 5x8

########################## Window-Identifier ###############################

*FvwmIdentBack MidnightBlue
*FvwmIdentFore Yellow
*FvwmIdentFont -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*

############################# FvwmTalk Form ###############################

# The FvwmForm module processes these. You can do all sorts of
# stuff with FvwmForm -- see system.fvwm2rc for examples.

*MyFvwmTalkFont		*helvetica*m*r*n*14*
*MyFvwmTalkButtonFont	*helvetica*m*o*n*14*
*MyFvwmTalkInputFont	*cour*m*r*n*14*
*MyFvwmTalkFore		Red
*MyFvwmTalkBack		Gray
*MyFvwmTalkItemFore	Blue
*MyFvwmTalkItemBack	Gray
*MyFvwmTalkLine		center
*MyFvwmTalkText		"Fvwm Function"
*MyFvwmTalkInput	Func 40 ""
*MyFvwmTalkLine 	expand
*MyFvwmTalkButton	restart "Run" ^M
*MyFvwmTalkCommand	$(Func)
*MyFvwmTalkButton	restart "Clear" ^R
*MyFvwmTalkCommand	Nop
*MyFvwmTalkButton	restart "Iconify" ^Z
*MyFvwmTalkCommand	Next [MyFvwmTalk] Iconify
*MyFvwmTalkButton	quit "Quit" ^C
*MyFvwmTalkCommand	Nop

############################ Quit-Verify Dialog ############################

# FvwmForm alias - query exit ala mwm
*QuitVerifyGrabServer
*QuitVerifyWarpPointer
*QuitVerifyFont         *helvetica*m*r*n*14*
*QuitVerifyButtonFont   7x13bold
*QuitVerifyFore         Black
*QuitVerifyBack         Light Gray
*QuitVerifyItemFore	Wheat
*QuitVerifyItemBack	Gray50
*QuitVerifyLine         center
*QuitVerifyText         "Do you really want to exit FVWM2?"
*QuitVerifyLine         expand
*QuitVerifyButton  	quit      " Exit "
*QuitVerifyCommand 	Quit
*QuitVerifyButton  	quit      "Cancel"
*QuitVerifyCommand 	Nop

# EOF .fvwm2rc