INCLUDE = "vars"

Global {
# - - ----------------------------------------------- - -
# Simple bindings to most frequently used actions.
#
# Adding your own frequently used actions is easy -
# just copy it over from CHAINS and edit the keypress!
        # Moving in frames
        KeyPress = "Mod1 Tab" { Actions = "NextFrameMRU TempRaise" }
        KeyPress = "Mod1 Shift Tab" { Actions = "PrevFrameMRU TempRaise" }
        KeyPress = "Mod1 Ctrl Tab" { Actions = "NextFrame EndRaise" }
        KeyPress = "Mod1 Ctrl Shift Tab" { Actions = "PrevFrame EndRaise" }
        KeyPress = "Mod4 Tab" { Actions = "ActivateClientRel 1" }
        KeyPress = "Mod4 Shift Tab" { Actions = "ActivateClientRel -1" }
        KeyPress = "Mod4 Ctrl Right" { Actions = "MoveClientRel 1" }
        KeyPress = "Mod4 Ctrl Left" { Actions = "MoveClientRel -1" }
        KeyPress = "Mod4 Left" { Actions = "FocusDirectional Left" }
        KeyPress = "Mod4 Right" { Actions = "FocusDirectional Right" }
        KeyPress = "Mod4 Up" { Actions = "FocusDirectional Up" }
        KeyPress = "Mod4 Down" { Actions = "FocusDirectional Down" }
        # Moving in workspaces
        KeyPress = "Ctrl Mod1 Left" { Actions = "GotoWorkspace Left" }
        KeyPress = "Ctrl Mod1 Right" { Actions = "GotoWorkspace Right" }
        KeyPress = "Ctrl Mod1 Up" { Actions = "GotoWorkspace Up" }
        KeyPress = "Ctrl Mod1 Down" { Actions = "GotoWorkspace Down" }
        KeyPress = "Ctrl Mod4 Shift Left" { Actions = "GotoWorkspace LeftN" }
        KeyPress = "Ctrl Mod4 Shift Right" { Actions = "GotoWorkspace RightN" }
        KeyPress = "Mod4 1" { Actions = "GotoWorkspace 1" }
        KeyPress = "Mod4 2" { Actions = "GotoWorkspace 2" }
        KeyPress = "Mod4 3" { Actions = "GotoWorkspace 3" }
        KeyPress = "Mod4 4" { Actions = "GotoWorkspace 4" }
        KeyPress = "Mod4 5" { Actions = "GotoWorkspace 5" }
        KeyPress = "Mod4 6" { Actions = "GotoWorkspace 6" }
        KeyPress = "Mod4 7" { Actions = "GotoWorkspace 7" }
        KeyPress = "Mod4 8" { Actions = "GotoWorkspace 8" }
        KeyPress = "Mod4 9" { Actions = "GotoWorkspace 9" }
        KeyPress = "Ctrl Mod1 Shift Left" { Actions = "SendToWorkspace Next KeepFocus; GoToWorkspace Next" }
        KeyPress = "Ctrl Mod1 Shift Right" { Actions = "SendToWorkspace Prev KeepFocus; GoToWorkspace Prev" }
        KeyPress = "Ctrl Mod1 Shift Up" { Actions = "SendToWorkspace NextV KeepFocus; GoToWorkspace NextV" }
        KeyPress = "Ctrl Mod1 Shift Down" { Actions = "SendToWorkspace PrevV KeepFocus; GoToWorkspace PrevV" }
        KeyPress = "Mod4 Shift 1" { Actions = "SendToWorkspace 1" }
        KeyPress = "Mod4 Shift 2" { Actions = "SendToWorkspace 2" }
        KeyPress = "Mod4 Shift 3" { Actions = "SendToWorkspace 3" }
        KeyPress = "Mod4 Shift 4" { Actions = "SendToWorkspace 4" }
        KeyPress = "Mod4 Shift 5" { Actions = "SendToWorkspace 5" }
        KeyPress = "Mod4 Shift 6" { Actions = "SendToWorkspace 6" }
        KeyPress = "Mod4 Shift 7" { Actions = "SendToWorkspace 7" }
        KeyPress = "Mod4 Shift 8" { Actions = "SendToWorkspace 8" }
        KeyPress = "Mod4 Shift 9" { Actions = "SendToWorkspace 9" }
        # Simple window management
        KeyPress = "Mod4 Shift V" { Actions = "Toggle Maximized False True" }
        KeyPress = "Mod4 M" { Actions = "Toggle Maximized True True" }
        KeyPress = "Mod4 Shift U" { Actions = "SetGeometry 50%x50% current HonourStrut" }
        KeyPress = "Mod4 Shift Z" { Actions = "SetGeometry 50%x100% current HonourStrut" }
        KeyPress = "Mod4 Shift H" { Actions = "SetGeometry 100%x50% current HonourStrut" }
        KeyPress = "Mod4 G" { Actions = "Maxfill True True" }
        KeyPress = "Mod4 F" { Actions = "Toggle FullScreen" }
        KeyPress = "Mod4 Return" { Actions = "MoveResize" }
        KeyPress = "Mod4 Shift Left" { Actions = "MoveToEdge LeftEdge" }
        KeyPress = "Mod4 Shift Right" { Actions = "MoveToEdge RightEdge" }
        KeyPress = "Mod4 Shift Up" { Actions = "MoveToEdge TopEdge" }
        KeyPress = "Mod4 Shift Down" { Actions = "MoveToEdge BottomEdge" }
        KeyPress = "Mod4 Q" { Actions = "Close" }
        KeyPress = "Mod4 S" { Actions = "Toggle Shaded" }
        KeyPress = "Mod4 I" { Actions = "Toggle Iconified" }
        # Marking
        KeyPress = "Mod4 Z" { Actions = "Toggle Marked" }
        KeyPress = "Mod4 A" { Actions = "AttachMarked" }
        # Tagging
        KeyPress = "Mod4 T" { Actions = "Toggle Tagged False" }
        # Menus
        KeyPress = "Mod4 R" { Actions = "ShowMenu Root" }
        KeyPress = "Mod4 W" { Actions = "ShowMenu Window" }
        KeyPress = "Mod4 L" { Actions = "ShowMenu Goto" }
        KeyPress = "Mod4 C" { Actions = "ShowMenu GotoClient" }
        KeyPress = "Mod4 Shift I" { Actions = "ShowMenu Icon" }
        KeyPress = "Mod4 X" { Actions = "HideAllMenus" }
        # External Commands
        KeyPress = "Mod1 Print" { Actions = "Exec pekwm_screenshot" }
        KeyPress = "Mod4 E" { Actions = "Exec $TERM" }
        # Pekwm control
        KeyPress = "Ctrl Mod1 Delete" { Actions = "Reload" }
        KeyPress = "Mod4 D" { Actions = "ShowCmdDialog" }
        KeyPress = "Mod4 V" { Actions = "ShowSearchDialog" }
        KeyPress = "Mod4 H" { Actions = "Toggle HarbourHidden" }

# - - ----------------------------------------------- - -
# CHAINS. These give you access to just about everything.
        # Move to Corner
        Chain = "Ctrl Mod4 C" {
                KeyPress = "Q" { Actions = "MoveToEdge TopLeft" }
                KeyPress = "Y" { Actions = "MoveToEdge TopCenterEdge" }
                KeyPress = "W" { Actions = "MoveToEdge TopCenterEdge" }
                KeyPress = "Shift Y" { Actions = "MoveToEdge TopEdge" }
                KeyPress = "Shift W" { Actions = "MoveToEdge TopEdge" }
                KeyPress = "P" { Actions = "MoveToEdge TopRight" }
                KeyPress = "E" { Actions = "MoveToEdge TopRight" }
                KeyPress = "A" { Actions = "MoveToEdge LeftCenterEdge" }
                KeyPress = "Shift A" { Actions = "MoveToEdge LeftEdge" }
                KeyPress = "L" { Actions = "MoveToEdge RightCenterEdge" }
                KeyPress = "D" { Actions = "MoveToEdge RightCenterEdge" }
                KeyPress = "Shift L" { Actions = "MoveToEdge RightEdge" }
                KeyPress = "Shift D" { Actions = "MoveToEdge RightEdge" }
                KeyPress = "Z" { Actions = "MoveToEdge BottomLeft" }
                KeyPress = "B" { Actions = "MoveToEdge BottomCenterEdge" }
                KeyPress = "X" { Actions = "MoveToEdge BottomCenterEdge" }
                KeyPress = "Shift B" { Actions = "MoveToEdge BottomEdge" }
                KeyPress = "Shift X" { Actions = "MoveToEdge BottomEdge" }
                KeyPress = "M" { Actions = "MoveToEdge BottomRight" }
                KeyPress = "C" { Actions = "MoveToEdge BottomRight" }
                KeyPress = "H" { Actions = "MoveToEdge Center" }
                KeyPress = "S" { Actions = "MoveToEdge Center" }
        }
        # Menus
        Chain = "Ctrl Mod4 M" {
                KeyPress = "R" { Actions = "ShowMenu Root" }
                KeyPress = "W" { Actions = "ShowMenu Window" }
                KeyPress = "I" { Actions = "ShowMenu Icon" }
                KeyPress = "G" { Actions = "ShowMenu Goto" }
                KeyPress = "C" { Actions = "ShowMenu GotoClient" }
                KeyPress = "D" { Actions = "ShowMenu Decor" }
                KeyPress = "A" { Actions = "ShowMenu AttachClientInFrame" }
                KeyPress = "F" { Actions = "ShowMenu AttachFrameInFrame" }
                Keypress = "Shift A" { Actions = "ShowMenu AttachClient" }
                Keypress = "Shift F" { Actions = "ShowMenu AttachFrame" }
                KeyPress = "X" { Actions = "HideAllMenus" }
        }
        # Grouping
        Chain = "Ctrl Mod4 T" {
                KeyPress = "T" { Actions = "Toggle Tagged False" }
                KeyPress = "B" { Actions = "Toggle Tagged True" }
                KeyPress = "C" { Actions = "Unset Tagged" }
                KeyPress = "G" { Actions = "Toggle GlobalGrouping" }
                KeyPress = "M" { Actions = "Toggle Marked" }
                KeyPress = "A" { Actions = "AttachMarked" }
                KeyPress = "D" { Actions = "Detach" }
                Keypress = "P" { Actions = "AttachClientInNextFrame" }
                KeyPress = "O" { Actions = "AttachClientInPrevFrame" }
                Keypress = "I" { Actions = "AttachFrameInNextFrame" }
                KeyPress = "U" { Actions = "AttachFrameInPrevFrame" }
        }
        # Decor Toggles
        Chain = "Ctrl Mod4 D" {
                KeyPress = "B" { Actions = "Toggle DecorBorder" }
                KeyPress = "T" { Actions = "Toggle DecorTitlebar" }
                KeyPress = "D" { Actions = "Toggle DecorBorder; Toggle DecorTitlebar" }
        }
        # Window Actions
        Chain = "Ctrl Mod4 A" {
                Chain = "G" {
                        KeyPress = "G" { Actions = "MaxFill True True" }
                        KeyPress = "V" { Actions = "MaxFill False True" }
                        KeyPress = "H" { Actions = "MaxFill True False" }
                }
                Chain = "M" {
                        KeyPress = "M" { Actions = "Toggle Maximized True True" }
                        KeyPress = "V" { Actions = "Toggle Maximized False True" }
                        KeyPress = "H" { Actions = "Toggle Maximized True False" }
                }
                Chain = "Q" {
                        KeyPress = "Q" { Actions = "Close" }
                        KeyPress = "F" { Actions = "CloseFrame" }
                        KeyPress = "K" { Actions = "Kill" }
                }
                KeyPress = "S" { Actions = "Toggle Shaded" }
                KeyPress = "A" { Actions = "Toggle Sticky" }
                KeyPress = "O" { Actions = "Toggle AlwaysOnTop" }
                KeyPress = "B" { Actions = "Toggle AlwaysBelow" }
                KeyPress = "I" { Actions = "Set Iconified" }
                KeyPress = "R" { Actions = "Raise" }
                KeyPress = "Shift R" { Actions = "Raise True" }
                KeyPress = "L" { Actions = "Lower" }
                KeyPress = "Shift L" { Actions = "Lower True" }
                KeyPress = "X" { Actions = "ActivateOrRaise" }
                KeyPress = "Return" { Actions = "MoveResize" }
                KeyPress = "F" { Actions = "Toggle Fullscreen" }
                KeyPress = "Left" { Actions = "GrowDirection Left" }
                KeyPress = "Right" { Actions = "GrowDirection Right" }
                KeyPress = "Up" { Actions = "GrowDirection Up" }
                KeyPress = "Down" { Actions = "GrowDirection Down" }
        }
        # Moving in Frames
        Chain = "Ctrl Mod4 F" {
                KeyPress = "P" { Actions = "NextFrame AlwaysRaise" }
                KeyPress = "O" { Actions = "PrevFrame AlwaysRaise" }
                KeyPress = "Shift P" { Actions = "NextFrameMRU EndRaise" }
                KeyPress = "Shift O" { Actions = "PrevFrameMRU EndRaise" }
                KeyPress = "I" { Actions = "ActivateClientRel 1" }
                KeyPress = "U" { Actions = "ActivateClientRel -1" }
                KeyPress = "Shift I" { Actions = "MoveClientRel 1" }
                KeyPress = "Shift U" { Actions = "MoveClientRel -1" }
                KeyPress = "Up" { Actions = "FocusDirectional Up" }
                KeyPress = "Down" { Actions = "FocusDirectional Down" }
                KeyPress = "Left" { Actions = "FocusDirectional Left" }
                Keypress = "Right" { Actions = "FocusDirectional Right" }
                KeyPress = "1" { Actions = "ActivateClientNum 1" }
                KeyPress = "2" { Actions = "ActivateClientNum 2" }
                KeyPress = "3" { Actions = "ActivateClientNum 3" }
                KeyPress = "4" { Actions = "ActivateClientNum 4" }
                KeyPress = "5" { Actions = "ActivateClientNum 5" }
                KeyPress = "6" { Actions = "ActivateClientNum 6" }
                KeyPress = "7" { Actions = "ActivateClientNum 7" }
                KeyPress = "8" { Actions = "ActivateClientNum 8" }
                KeyPress = "9" { Actions = "ActivateClientNum 9" }
                KeyPress = "0" { Actions = "ActivateClientNum 10" }
                KeyPress = "C" { Actions = "ShowCmdDialog GotoClientID " }
        }
        # Workspaces
        Chain = "Ctrl Mod4 W" {
                KeyPress = "Right" { Actions = "GoToWorkspace Right" }
                KeyPress = "Left" { Actions = "GoToWorkspace Left" }
                KeyPress = "N" { Actions = "GoToWorkspace Next" }
                KeyPress = "P" { Actions = "GoToWorkspace Prev" }
                KeyPress = "1" { Actions = "GoToWorkspace 1" }
                KeyPress = "2" { Actions = "GoToWorkspace 2" }
                KeyPress = "3" { Actions = "GoToWorkspace 3" }
                KeyPress = "4" { Actions = "GoToWorkspace 4" }
                KeyPress = "5" { Actions = "GoToWorkspace 5" }
                KeyPress = "6" { Actions = "GoToWorkspace 6" }
                KeyPress = "7" { Actions = "GoToWorkspace 7" }
                KeyPress = "8" { Actions = "GoToWorkspace 8" }
                KeyPress = "9" { Actions = "GoToWorkspace 9" }
                KeyPress = "Up" { Actions = "SendToWorkspace Next KeepFocus; GoToWorkspace Next" }
                KeyPress = "Down" { Actions = "SendToWorkspace Prev KeepFocus; GoToWorkspace Prev" }
                KeyPress = "F1" { Actions = "SendToWorkspace 1" }
                KeyPress = "F2" { Actions = "SendToWorkspace 2" }
                KeyPress = "F3" { Actions = "SendToWorkspace 3" }
                KeyPress = "F4" { Actions = "SendToWorkspace 4" }
                KeyPress = "F5" { Actions = "SendToWorkspace 5" }
                KeyPress = "F6" { Actions = "SendToWorkspace 6" }
                KeyPress = "F7" { Actions = "SendToWorkspace 7" }
                KeyPress = "F8" { Actions = "SendToWorkspace 8" }
                KeyPress = "F9" { Actions = "SendToWorkspace 9" }
        }
        # External commands
        Chain = "Ctrl Mod4 E" {
                KeyPress = "E" { Actions = "Exec $TERM" }
                KeyPress = "L" { Actions = "Exec xlock -mode blank" }
                KeyPress = "S" { Actions = "Exec pekwm_screenshot" }
                KeyPress = "C" { Actions = "ShowCmdDialog" }
        }
        # Wm actions
        Chain = "Ctrl Mod4 P" {
                KeyPress = "Delete" { Actions = "Reload" }
                KeyPress = "Next" { Actions = "Restart" }
                KeyPress = "End" { Actions = "Exit" }
                KeyPress = "Prior" { Actions = "RestartOther twm" }
                KeyPress = "D" { Actions = "ShowCmdDialog" }
                KeyPress = "H" { Actions = "Toggle HarbourHidden" }
        }
        # Skipping
        Chain = "Ctrl Mod4 S" {
                Keypress = "M" { Actions = "Toggle Skip Menus" }
                Keypress = "F" { Actions = "Toggle Skip FocusToggle" }
                Keypress = "S" { Actions = "Toggle Skip Snap" }
        }
}

# Keys when MoveResize is active
MoveResize {
        KeyPress = "Left" { Actions = "MoveHorizontal -10" }
        KeyPress = "Right" { Actions = "MoveHorizontal 10" }
        KeyPress = "Up" { Actions = "MoveVertical -10" }
        KeyPress = "Down" { Actions = "MoveVertical 10" }
        Keypress = "Shift Left" { Actions = "MoveHorizontal -1" }
        Keypress = "Shift Right" { Actions = "MoveHorizontal 1" }
        Keypress = "Shift Up" { Actions = "MoveVertical -1" }
        Keypress = "Shift Down" { Actions = "MoveVertical 1" }
        Keypress = "Mod4 Left" { Actions = "ResizeHorizontal -10" }
        Keypress = "Mod4 Right" { Actions = "ResizeHorizontal 10" }
        Keypress = "Mod4 Up" { Actions = "ResizeVertical -10" }
        Keypress = "Mod4 Down" { Actions = "ResizeVertical 10" }
        Keypress = "Mod1 Left" { Actions = "ResizeHorizontal -10" }
        Keypress = "Mod1 Right" { Actions = "ResizeHorizontal 10" }
        Keypress = "Mod1 Up" { Actions = "ResizeVertical -10" }
        Keypress = "Mod1 Down" { Actions = "ResizeVertical 10" }
        Keypress = "Shift Mod4 Left" { Actions = "ResizeHorizontal -1" }
        Keypress = "Shift Mod4 Right" { Actions = "ResizeHorizontal 1" }
        Keypress = "Shift Mod4 Up" { Actions = "ResizeVertical -1" }
        Keypress = "Shift Mod4 Down" { Actions = "ResizeVertical 1" }
        Keypress = "Shift Mod1 Left" { Actions = "ResizeHorizontal -1" }
        Keypress = "Shift Mod1 Right" { Actions = "ResizeHorizontal 1" }
        Keypress = "Shift Mod1 Up" { Actions = "ResizeVertical -1" }
        Keypress = "Shift Mod1 Down" { Actions = "ResizeVertical 1" }
        Keypress = "s" { Actions = "MoveSnap" }
        Keypress = "Escape" { Actions = "Cancel" }
        Keypress = "q" { Actions = "Cancel" }
        Keypress = "Return" { Actions = "End" }
}

# Keys for CmdDialog editing
InputDialog {
        KeyPress = "Left" { Actions = "CursPrev" }
        KeyPress = "Right" { Actions = "CursNext" }
        KeyPress = "Ctrl A" { Actions = "CursBegin" }
        KeyPress = "Ctrl E" { Actions = "CursEnd" }
        KeyPress = "BackSpace" { Actions = "Erase;CompleteAbort" }
        KeyPress = "Ctrl K" { Actions = "ClearFromCursor" }
        KeyPress = "Ctrl C" { Actions = "Clear" }
        KeyPress = "Return" { Actions = "Exec" }
        KeyPress = "Escape" { Actions = "Close" }
        KeyPress = "Up" { Actions = "HistPrev" }
        KeyPress = "Down" { Actions = "HistNext" }
        KeyPress = "Ctrl P" { Actions = "HistPrev" }
        KeyPress = "Ctrl N" { Actions = "HistNext" }
        KeyPress = "Ctrl B" { Actions = "CursPrev" }
        KeyPress = "Ctrl F" { Actions = "CursNext" }
        KeyPress = "Tab" { Actions = "Complete" }
        KeyPress = "Any Any" { Actions = "Insert" }
}

# Keys working in menus
Menu {
        KeyPress = "Down" { Actions = "NextItem" }
        KeyPress = "Up" { Actions = "PrevItem" }
        KeyPress = "Ctrl N" { Actions = "NextItem" }
        KeyPress = "Ctrl P" { Actions = "PrevItem" }

        KeyPress = "1" { Actions = "GotoItem 1" }
        KeyPress = "2" { Actions = "GotoItem 2" }
        KeyPress = "3" { Actions = "GotoItem 3" }
        KeyPress = "4" { Actions = "GotoItem 4" }
        KeyPress = "5" { Actions = "GotoItem 5" }
        KeyPress = "6" { Actions = "GotoItem 6" }
        KeyPress = "7" { Actions = "GotoItem 7" }
        KeyPress = "8" { Actions = "GotoItem 8" }
        KeyPress = "9" { Actions = "GotoItem 9" }

        KeyPress = "Left" { Actions = "LeaveSubmenu" }
        KeyPress = "Right" { Actions = "EnterSubmenu" }
        KeyPress = "Return" { Actions = "Select" }
        KeyPress = "space" { Actions = "Select" }
        KeyPress = "Escape" { Actions = "Close" }
        KeyPress = "Q" { Actions = "Close" }
}

