# This file is in the public domain. Anyone is free to copy, modify, publish
# use, sell or distribute for any purpose, commercial or non-commercial, and by
# any means.

INCLUDE = "vars"

INCLUDE = "$_PEKWM_ETC_PATH/keys_inputdialog"
INCLUDE = "$_PEKWM_ETC_PATH/keys_menu"
INCLUDE = "$_PEKWM_ETC_PATH/keys_moveresize"

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!

	# Environment
	KeyPress = "Ctrl Mod1 Space" { Actions = "Exec $_PEKWM_SCRIPT_PATH/pekwm_toggle_kbd_layout.sh" }

        # 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 = "FillEdge LeftEdge 40" }
        KeyPress = "Mod4 Shift Right" { Actions = "FillEdge RightEdge 40" }
        KeyPress = "Mod4 Shift Up" { Actions = "FillEdge TopEdge 50" }
        KeyPress = "Mod4 Shift Down" { Actions = "FillEdge BottomEdge 50" }
        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 = "H" { Actions = "DetachSplitHorz 50" }
                KeyPress = "V" { Actions = "DetachSplitVert 50" }
                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 $_PEKWM_SCRIPT_PATH/pekwm_lock.sh" }
                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" }
        }
	# Audio/Playback control
	Keypress = "XF86AudioPrev" { Actions = "Exec $_PEKWM_SCRIPT_PATH/pekwm_audio_ctrl.sh prev" }
	Keypress = "XF86AudioPrev" { Actions = "Exec $_PEKWM_SCRIPT_PATH/pekwm_audio_ctrl.sh prev" }
	Keypress = "XF86AudioNext" { Actions = "Exec $_PEKWM_SCRIPT_PATH/pekwm_audio_ctrl.sh next" }
	Keypress = "XF86AudioPlay" { Actions = "Exec $_PEKWM_SCRIPT_PATH/pekwm_audio_ctrl.sh playpause" }
	Keypress = "XF86AudioMute" { Actions = "Exec $_PEKWM_SCRIPT_PATH/pekwm_audio_ctrl.sh vmute" }
	Keypress = "XF86AudioLowerVolume" { Actions = "Exec $_PEKWM_SCRIPT_PATH/pekwm_audio_ctrl.sh vdown" }
	Keypress = "XF86AudioRaiseVolume" { Actions = "Exec $_PEKWM_SCRIPT_PATH/pekwm_audio_ctrl.sh vup" }
}
