#-----------------------------------------------------------------------------#
#
# 9. Mouse, frame buttons and keyboard bindings
#
#-----------------------------------------------------------------------------#


#------------------------------------------------------------------------------
# First, for the mouse in the root window (Context=R)
# 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-Ctrl-whatever combination you want!
# Moreover on a window the same bindings are defined with the Alt modifier
#------------------------------------------------------------------------------


#     Button	Context Modifi 	Function

Mouse 1		R   	A       Menu Utilities mouse -1p -1p
Mouse 2		R    	A       Menu Window mouse -1p -1p
Mouse 3         R       A       WindowList mouse -1p -1p
Mouse 3         R       C       WindowList mouse -1p -1p OnlyListSkip

Mouse 1		W   	M       Menu Utilities mouse -1p -1p
Mouse 2		W    	M       Menu Window mouse -1p -1p
Mouse 3         W       M       WindowList mouse -1p -1p
Mouse 3         W       CM      WindowList mouse -1p -1p OnlyListSkip


#G_SESSION 3 bind Shift Mouse * to gnomebutton
#Mouse 1		R	S	GnomeButton
#Mouse 2		R	S	GnomeButton
#Mouse 3		R	S	GnomeButton

#------------------------------------------------------------------------------
# Now the rest of the frame
# Here I invoke my complex functions for Move-or-lower, Move-or-Raise-Shade,
# and Resize-or-Raise.
#------------------------------------------------------------------------------

# Button 1 in the corners or sides, with any modifiers, gives resize or raise
Mouse 1		FS	A	Function "Resize-or-Raise-or-Shade"

# Button 1 in the title, sides, w/ any modifiers, gives move or raise or shade
Mouse 1		T	A	Function "Move-or-Raise-or-Shade"
Mouse 1		FS	C	Function "Move-or-Raise-or-Shade"

# Button 1 in an icons gives move for a drag, de-iconify for a double-click,
# raiselower for a single click
Mouse 1		I	A	Function "Move-or-Iconify-or-Raise"
# Alt Button 1 on an icons raise all icons
Mouse 1		I	M	All (CurrentPage Iconic) Raise

# Button 2 in an icon, w/ any modifiers, gives de-iconify
Mouse 2		I	A	Iconify

# Button 2 in the corners, sides, or title-bar gives the window ops menu
Mouse 2		FST	A	Menu Window-Ops2

# Button 3 anywhere in the decoration (except the title-bar buttons)
# does a raise-lower
Mouse 3		TSF	A	RaiseLower

# Button 3 on a icon:
Mouse 3		I	A	Menu Window-Ops3 c+0 -101m

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


#-----------------------------------------------------------------------------
# Mouse windows buttons binding
# buttons: 1 3 5 7 9              8 6 4 2
#------------------------------------------------------------------------------


#     Button	Context Modif 	Function
Mouse 1		1    	A      	Function "window_ops_func"
Mouse 2         1	A	Menu WindowGroupOps
Mouse 3         1       A       Menu Move-Window
Mouse 1         2       A       Close
Mouse 2		2	A	All ($c) Close
Mouse 3         2       A       Destroy
Mouse 1		4    	A     	Maximize 100 100
Mouse 2         4       A       Maximize 0 100
Mouse 3         4       A       Maximize 100 0
Mouse 1		6    	A     	Iconify
Mouse 2		6    	A     	All ($c) Iconify On
Mouse 3         6       A       All ($c) WindowShade On

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

#------------------------------------------------------------------------------
# press arrow + Shift anywhere, and scroll by 1 page
#------------------------------------------------------------------------------

Key Left	A	S	Scroll -100 0
Key Right	A	S	Scroll +100 +0
Key Up		A	S	Scroll +0   -100
Key Down	A	S	Scroll +0   +100

#------------------------------------------------------------------------------
# press arrow + Alt 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 arrow + control-meta anywhere, and move the pointer by 1% of a page
#------------------------------------------------------------------------------

Key Left	A	MC	CursorMove -1 0
Key Right	A	MC	CursorMove +1 +0
Key Up		A	MC	CursorMove +0   -1
Key Down	A	MC	CursorMove +0   +1

#------------------------------------------------------------------------------
# press arrow + Shift-Alt 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

#------------------------------------------------------------------------------
# Page Up/Page Down keys are used to scroll by one desktop page
# in any context, press page up/down + control + alt
# in root context, just pressing page up/down is OK
#------------------------------------------------------------------------------

Key Next	A       CM      Desk  -1 0 0 3
Key Next	R       M       Desk  -1 0 0 3
Key Prior	A       CM      Desk  +1 0 0 3
Key Prior	R       M       Desk  +1 0 0 3

#------------------------------------------------------------------------------
# Alt-Shift-Fx window operations
#------------------------------------------------------------------------------
Key F4		A	MS	Close
Key F5		A	MS	RaiseLower
Key F6		A	MS	All (Iconic) Raise  # originally Restore
Key F7		A	MS	Move
Key F8		A	MS	Resize
Key F9		A	MS	Iconify
Key F10		A	MS	Maximize 100 100
Key F11		A	MS	FvwmIdent
Key F12		A	MS	FvwmConsole

#------------------------------------------------------------------------------
# The menus via Alt-Shift-Fx
#------------------------------------------------------------------------------
Key F1		A	MS	Menu Utilities mouse -1p -1p
Key F2		A	MS	Menu Window mouse -1p -1p
Key F3		A	MS	WindowList mouse -1p -1p


#------------------------------------------------------------------------------
# The famous Alt-tab binding
#------------------------------------------------------------------------------

DestroyFunc my_dbltab2
AddToFunc   my_dbltab2
+ I WindowListFunc
DestroyFunc my_dbltab_prev
AddToFunc   my_dbltab_prev
+ I Prev my_dbltab2

Key Tab A M	WindowList Root c c CurrentAtEnd, IconifiedAtEnd, NoGeometry, NoDeskSort, SelectOnRelease Alt_L my_dbltab_prev
Key Tab	A CM	WindowList Root c c CurrentAtEnd, IconifiedAtEnd, NoGeometry, OnlyListSkip, SelectOnRelease


#------------------------------------------------------------------------------
# Stroke Bindings
#------------------------------------------------------------------------------
#
# You need fvwm compiled with stroke support and libstroke installed
# See the Stroke and StrokeFunc entries in the fvwm man page
# We use mostly simple stroke motion. For complex stroke motions we need
# to consider many sloppy stroke motions for each action.

#STROKE 2
Mouse	3	R	N	StrokeFunc FeedBack DrawMotion
Mouse	3 	W 	M 	StrokeFunc FeedBack DrawMotion

#STROKE 2 We need to redefine the default bindings
Stroke	0		0 	R 	N 	WindowList mouse -1p -1p
Stroke	0		0	W	M	WindowList mouse -1p -1p

#PREF 11
#STROKE 2 A | from the top to the bottom
Stroke	N852		0	R	N	Exec exec xterm
Stroke	N852		0	W	M       Exec exec xterm

#STROKE 2 A | from the bottom to the top
Stroke	N258		0	R	N	Exec exec emacs
Stroke	N258		0	W	M	Exec exec emacs

#STROKE 2 A / from the bottom to the top
Stroke	N159		0	R	N	Exec exec pcmanfm
Stroke	N159		0	W	M	Exec exec pcmanfm

#STROKE 2 A C from the top
Stroke	N9874123	0	R	N	Exec exec xcalc
Stroke	N9874123	0	W	M	Exec exec xcalc

#STROKE 11 A N (from the bottom)
Stroke	7415963		0	R	N	Exec exec mozilla
Stroke	74148963	0	R	N	Exec exec mozilla
Stroke	74158963	0	R	N	Exec exec mozilla
Stroke	7418963		0	R	N	Exec exec mozilla
Stroke	415963		0	R	N	Exec exec mozilla

Stroke	7415963		0	W	M	Exec exec mozilla
Stroke	74148963	0	W	M	Exec exec mozilla
Stroke	74158963	0	W	M	Exec exec mozilla
Stroke	7418963		0	W	M	Exec exec mozilla
Stroke	415963		0	W	M	Exec exec mozilla

#STROKE 4 A clockwise box from the top left
Stroke	N78963214	0	R	N	FvwmForm FvwmForm-QuitVerify
Stroke	N789632147	0	R	N	FvwmForm FvwmForm-QuitVerify
Stroke	N78963214	0	W	M	FvwmForm FvwmForm-QuitVerify
Stroke	N789632147	0	W	M	FvwmForm FvwmForm-QuitVerify

