# FVWM-Crystal: Bindings
# Written by: Maciej Delmanowski <harnir@linux.net.pl>

# Overview:
# Here are set keybindings and root window mouse bindings in the FVWM-Crystal.


# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Root window (mouse bindings)
Mouse 1 R $[Mod0] Nop
Mouse 2 RI $[Mod0] EWMH-Toggle Mouse 2 RI $[Mod0]
Mouse 3 RI $[Mod] AA

# Uncomment these to enable page-switching using your mouse wheel while mouse
# pointer is on the root window and the thumbnailed windows.
#Mouse 4 RI $[Mod0] GotoPage-Right
#Mouse 5 RI $[Mod0] GotoPage-Left

# Icon bindings
# Uncomment line below if you want to bring back iconified windows with
# a single click instead of double click (and comment out the next line).
#Mouse 1 I $[Mod] RemoveThumbnail
Mouse 1 I $[Mod] DeThumbnail
Mouse 2 I $[Mod1] CloseThumbnail

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Basic window bindings
Mouse 1 T       $[Mod] Window-Raise-RaiseMove
#Mouse 1 T       $[Mod] Window-Raise-MoveRaise

Mouse 2 T       $[Mod] Window-Shade-Resize

Mouse 3 T       $[Mod] Window-Lower-Move

Mouse 1 WT      $[Mod1] Window-Raise-RaiseMove
#Mouse 1 WT      $[Mod1] Window-Raise-MoveRaise

Mouse 2 WT      $[Mod1] Window-Resize-Opaque
#Mouse 2 WT      $[Mod1] Window-Resize

Mouse 3 WT      $[Mod1] Window-Lower-Move

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Keyboard bindings

Key grave A	$[Mod1] QuakeConsole
Key grave A	$[Mod2] AA
Key semicolon A $[Mod1] FvwmMiniConsole
Key Print A	$[Mod] Screenshot
Key Super_R A	$[Mod1] Menu /Applications root c c
Key Menu A	$[Mod1] Menu /RootMenu root c c

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Here are the bindings for focus-switching using the numpad
# This version only switches the focus
Key KP_Home             A $[Mod0] Window-FocusInDirection NorthWest
Key KP_Left             A $[Mod0] Window-FocusInDirection West
Key KP_End              A $[Mod0] Window-FocusInDirection SouthWest
Key KP_Up               A $[Mod0] Window-FocusInDirection North
Key KP_Down             A $[Mod0] Window-FocusInDirection South
Key KP_Page_Up          A $[Mod0] Window-FocusInDirection NorthEast
Key KP_Page_Down        A $[Mod0] Window-FocusInDirection SouthEast
Key KP_Right            A $[Mod0] Window-FocusInDirection East
Key KP_Begin            A $[Mod0] Window-FocusInDirection Center

# This version raises window after switch
#Key KP_Home             A $[Mod0] Window-FocusAndRaiseInDirection NorthWest
#Key KP_Left             A $[Mod0] Window-FocusAndRaiseInDirection West
#Key KP_End              A $[Mod0] Window-FocusAndRaiseInDirection SouthWest
#Key KP_Up               A $[Mod0] Window-FocusAndRaiseInDirection North
#Key KP_Down             A $[Mod0] Window-FocusAndRaiseInDirection South
#Key KP_Page_Up          A $[Mod0] Window-FocusAndRaiseInDirection NorthEast
#Key KP_Page_Down        A $[Mod0] Window-FocusAndRaiseInDirection SouthEast
#Key KP_Right            A $[Mod0] Window-FocusAndRaiseInDirection East
#Key KP_Begin            A $[Mod0] Window-FocusAndRaiseInDirection Center

# This version jumps the mouse cursor to the window after switching and
# automatically raises it
#Key KP_Home             A $[Mod0] Window-MPFocusInDirection NorthWest
#Key KP_Left             A $[Mod0] Window-MPFocusInDirection West
#Key KP_End              A $[Mod0] Window-MPFocusInDirection SouthWest
#Key KP_Up               A $[Mod0] Window-MPFocusInDirection North
#Key KP_Down             A $[Mod0] Window-MPFocusInDirection South
#Key KP_Page_Up          A $[Mod0] Window-MPFocusInDirection NorthEast
#Key KP_Page_Down        A $[Mod0] Window-MPFocusInDirection SouthEast
#Key KP_Right            A $[Mod0] Window-MPFocusInDirection East
#Key KP_Begin            A $[Mod0] Window-MPFocusInDirection Center

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Other numpad bindings
Key KP_Home             A $[Mod1] Window-Warp-LeftTop
Key KP_Up               A $[Mod1] Window-Warp-CenterTop
Key KP_Page_Up          A $[Mod1] Window-Warp-RightTop
Key KP_Left             A $[Mod1] Window-Warp-LeftCenter
Key KP_Begin            A $[Mod1] Window-Warp-CenterCenter
Key KP_Right            A $[Mod1] Window-Warp-RightCenter
Key KP_End              A $[Mod1] Window-Warp-LeftBottom
Key KP_Down             A $[Mod1] Window-Warp-CenterBottom
Key KP_Page_Down        A $[Mod1] Window-Warp-RightBottom

Key KP_Home             A $[Mod2] Window-MPAnimatedMove w-$[Window-MPAnimatedMove-Length]p w-$[Window-MPAnimatedMove-Length]p
Key KP_Up               A $[Mod2] Window-MPAnimatedMove w0p w-$[Window-MPAnimatedMove-Length]p
Key KP_Page_Up          A $[Mod2] Window-MPAnimatedMove w$[Window-MPAnimatedMove-Length]p w-$[Window-MPAnimatedMove-Length]p
Key KP_Left             A $[Mod2] Window-MPAnimatedMove w-$[Window-MPAnimatedMove-Length]p w0p
Key KP_Begin            A $[Mod2] -
Key KP_Right            A $[Mod2] Window-MPAnimatedMove w$[Window-MPAnimatedMove-Length]p w0p
Key KP_End              A $[Mod2] Window-MPAnimatedMove w-$[Window-MPAnimatedMove-Length]p w$[Window-MPAnimatedMove-Length]p
Key KP_Down             A $[Mod2] Window-MPAnimatedMove w0p w$[Window-MPAnimatedMove-Length]p
Key KP_Page_Down        A $[Mod2] Window-MPAnimatedMove w$[Window-MPAnimatedMove-Length]p w$[Window-MPAnimatedMove-Length]p

Key KP_Insert           WT $[Mod0] Raise
Key KP_Delete           WT $[Mod0] Lower
Key KP_Divide           WT $[Mod0] Window-Shade toggle
Key KP_Divide           WT $[Mod1] Stick toggle
Key KP_Multiply         WT $[Mod0] Maximize
Key KP_Multiply         WT $[Mod1] Fullscreen
Key KP_Subtract         A  $[Mod1] Thumbnail
Key KP_Subtract         A  $[Mod2] Close
Key KP_Add              A  $[Mod0] Layer 0 4
Key KP_Add              A  $[Mod1] Layer 0 5
Key KP_Add              A  $[Mod2] Layer 0 3

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Desktop switching using Function keys
Key F1	A $[Mod1] GotoPage 0 0
Key F2  A $[Mod1] GotoPage 1 0
Key F3  A $[Mod1] GotoPage 2 0
Key F4  A $[Mod1] GotoPage 3 0
Key F5  A $[Mod1] GotoPage 4 0
Key F6  A $[Mod1] GotoPage 5 0
Key F7  A $[Mod1] GotoPage 6 0
Key F8  A $[Mod1] GotoPage 7 0
#Key F9	A $[Mod1] GotoPage 8 0
#Key F10	A $[Mod1] GotoPage 9 0
#Key F11	A $[Mod1] GotoPage 10 0
#Key F12	A $[Mod1] GotoPage 11 0

Key F1  A $[Mod2] MoveToPage-Focus 0 0
Key F2  A $[Mod2] MoveToPage-Focus 1 0
Key F3  A $[Mod2] MoveToPage-Focus 2 0
Key F4  A $[Mod2] MoveToPage-Focus 3 0
Key F5  A $[Mod2] MoveToPage-Focus 4 0
Key F6  A $[Mod2] MoveToPage-Focus 5 0
Key F7  A $[Mod2] MoveToPage-Focus 6 0
Key F8  A $[Mod2] MoveToPage-Focus 7 0
#Key F9	A $[Mod2] MoveToPage-Focus 8 0
#Key F10	A $[Mod2] MoveToPage-Focus 9 0
#Key F11	A $[Mod2] MoveToPage-Focus 10 0
#Key F12	A $[Mod2] MoveToPage-Focus 11 0

Key Escape A $[Mod1] GotoPage prev

Key bracketleft	 A $[Mod1] GotoPage-Left
Key bracketright A $[Mod1] GotoPage-Right
Key bracketleft	 A $[Mod2] WarpToPage-Left
Key bracketright A $[Mod2] WarpToPage-Right


# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Window/icon lists
#Key Tab A $[Mod1]	Window-Next
Key Tab A $[Mod1]	Window-List-Page "root c c"
#Key Tab A $[Mod1]	Window-List "root c c"
Key Tab	A $[Mod2]	ThumbnailList "root c c"


# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Window resizer
PipeRead 'echo Key 5 A $[Mod2] Window-Resize-Context $(($[vp.width]-($[vp.width]/4))) $(($[vp.height]-($[vp.height]/4)))'
PipeRead 'echo Key 6 A $[Mod2] Window-Resize-Context $(($[vp.width]-10)) $((($[vp.height]/2)-45))'
PipeRead 'echo Key 7 A $[Mod2] Window-Resize-Context $(($[vp.width]-10)) $(($[vp.height]-($[vp.height]/4)))'
PipeRead 'echo Key 8 A $[Mod2] Window-Resize-Context $((($[vp.width]/2)-10)) $(($[vp.height]-80))'
PipeRead 'echo Key 9 A $[Mod2] Window-Resize-Context $(($[vp.width]-($[vp.width]/4))) $(($[vp.height]-80))'
PipeRead 'echo Key 0 A $[Mod2] Window-Resize-Context $(($[vp.width]-10)) $(($[vp.height]-80))'


# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# XMMS and audio bindings
Test (x xmms) Key Z A $[Mod1] Exec exec xmms --rew
Test (x xmms) Key X A $[Mod1] Exec exec xmms --play
Test (x xmms) Key C A $[Mod1] Exec exec xmms --pause
Test (x xmms) Key V A $[Mod1] Exec exec xmms --stop
Test (x xmms) Key B A $[Mod1] Exec exec xmms --fwd

Test (x xmms-shell) Key N A $[Mod1] Exec exec xmms-shell -e "backward"
Test (x xmms-shell) Key M A $[Mod1] Exec exec xmms-shell -e "forward"
Test (x xmms) Key J A $[Mod1] XMMS-Find

Test (x aumix) Key comma	A $[Mod1] Exec exec aumix -v -10
Test (x aumix) Key period	A $[Mod1] Exec exec aumix -v +10
Test (x aumix) Key comma	A $[Mod2] Exec exec aumix -v -5
Test (x aumix) Key period	A $[Mod2] Exec exec aumix -v +5


# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Bindings for multimedia keyboards
# Some default bindings, commented by default. Use them at will
#Key XF86VendorHome	A $[Mod0] X rox ~
#Key XF86Mail		A $[Mod0] A mutt
#Key XF86Shop		A $[Mod0] X firefox
#Key XF86Search		A $[Mod0] X firefox http://www.google.com
#Key XF86HomePage	A $[Mod0] AA

# Some XMMS bindings
#Key XF86AudioPlay		A $[Mod0] X xmms --play-pause
#Key XF86AudioStop		A $[Mod0] X xmms --stop
#Key XF86AudioNext		A $[Mod0] X xmms --fwd
#Key XF86AudioPrev		A $[Mod0] X xmms --rew
#Key XF86AudioMedia		A $[Mod0] XMMS-Find
#Key XF86AudioLowerVolume	A $[Mod0] Exec exec aumix -v -10
#Key XF86AudioRaiseVolume	A $[Mod0] Exec exec aumix -v +10

# Additional song changing using Alt+audio raise/lower keys
#Key XF86AudioLowerVolume	A $[Mod1] X xmms --rew
#Key XF86AudioRaiseVolume	A $[Mod1] X xmms --fwd


# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These binds are here because there may be some errors when they are used
# directly in related function files from 'functions/' directory

# Resize FvwmMiniConsole
Mouse (FvwmMiniConsoleNeedsUniqueName) 2 W $[Mod1] FvwmMiniConsole-Resize

# Resize QuakeConsole
Mouse (QuakeConsoleNeedsUniqueName) 2 W $[Mod1] QuakeConsole-Resize

